ubwcp_ioctl.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __UBWCP_IOCTL_H_
  6. #define __UBWCP_IOCTL_H_
  7. #include <linux/ioctl.h>
  8. #include <linux/types.h>
  9. #define UBWCP_IOCTL_SET_BUF_ATTR _IOW('U', 1, struct ubwcp_ioctl_buffer_attrs)
  10. #define UBWCP_IOCTL_GET_HW_VER _IOR('U', 2, struct ubwcp_ioctl_hw_version)
  11. #define UBWCP_IOCTL_GET_STRIDE_ALIGN _IOWR('U', 3, struct ubwcp_ioctl_stride_align)
  12. #define UBWCP_IOCTL_VALIDATE_STRIDE _IOWR('U', 4, struct ubwcp_ioctl_validate_stride)
  13. enum ubwcp_image_format {
  14. UBWCP_LINEAR = 0,
  15. UBWCP_RGBA8888,
  16. UBWCP_NV12,
  17. UBWCP_NV12_Y,
  18. UBWCP_NV12_UV,
  19. UBWCP_NV124R,
  20. UBWCP_NV124R_Y,
  21. UBWCP_NV124R_UV,
  22. UBWCP_TP10,
  23. UBWCP_TP10_Y,
  24. UBWCP_TP10_UV,
  25. UBWCP_P010,
  26. UBWCP_P010_Y,
  27. UBWCP_P010_UV,
  28. UBWCP_P016,
  29. UBWCP_P016_Y,
  30. UBWCP_P016_UV,
  31. };
  32. enum ubwcp_compression_type {
  33. UBWCP_COMPRESSION_LOSSLESS = 0,
  34. };
  35. enum ubwcp_subsample {
  36. UBWCP_SUBSAMPLE_4_2_0 = 0,
  37. };
  38. #define UBWCP_SUBSYSTEM_TARGET_CPU (1 << 0)
  39. /**
  40. * @image_format: image format
  41. * @major_ubwc_ver: set to 0. This is not HW version.
  42. * @minor_ubwc_ver: set to 0. This is not HW version.
  43. * @compression_type: only lossless is supported.
  44. * @lossy_params: set to 0
  45. * @width: image width (pixels)
  46. * @height: image height (pixels)
  47. * @stride: image stride (bytes)
  48. * @scanlines: number of scanlines
  49. * @planar_padding: padding between Y and UV planes (bytes)
  50. * @subsample: only 4:2:0 is supported
  51. * @sub_system_target: only CPU is supported
  52. * @y_offset: set to 0
  53. * @batch_size: set to 1
  54. *
  55. * All pad[x] and unused[x] fields must be set to 0
  56. */
  57. struct ubwcp_buffer_attrs {
  58. __u16 image_format; /* enum ubwcp_image_format */
  59. __u16 major_ubwc_ver; /* per-buffer version: must be set to 0 */
  60. __u16 minor_ubwc_ver; /* per-buffer version: must be set to 0 */
  61. __u16 compression_type; /* enum ubwcp_compression_type */
  62. __u64 lossy_params; /* must be set to 0 */
  63. __u32 width;
  64. __u32 height;
  65. __u32 stride;
  66. __u32 scanlines;
  67. __u32 planar_padding;
  68. __u32 subsample; /* enum enum ubwcp_subsample */
  69. __u32 sub_system_target;/* bit mask: UBWCP_SUBSYSTEM_TARGET_XXX */
  70. __u32 y_offset; /* must be set to 0 */
  71. __u32 batch_size; /* only size supported: 1 */
  72. __u32 unused1;
  73. __u32 unused2;
  74. __u32 unused3;
  75. __u32 unused4;
  76. __u32 unused5;
  77. __u32 unused6;
  78. __u32 unused7;
  79. __u32 unused8;
  80. __u32 unused9;
  81. };
  82. /**
  83. * @fd: dma_buf file descriptor for the buffer whose
  84. * attributes are specified
  85. * @attr: ubwcp buffer attributes
  86. */
  87. struct ubwcp_ioctl_buffer_attrs {
  88. __u32 fd;
  89. __u32 pad;
  90. struct ubwcp_buffer_attrs attr;
  91. };
  92. /**
  93. * ubwcp hardware version
  94. * @major: major version
  95. * @minor: minor version
  96. */
  97. struct ubwcp_ioctl_hw_version {
  98. __u32 major;
  99. __u32 minor;
  100. };
  101. /**
  102. * Stride alignment for given format
  103. * @image_format: image format
  104. * @stride_align: stride alignment
  105. * @unused: must be set to 0
  106. * IOCTL will fail for linear image format
  107. */
  108. struct ubwcp_ioctl_stride_align {
  109. __u16 image_format;
  110. __u16 stride_align;
  111. __u32 unused;
  112. };
  113. /**
  114. * validate stride
  115. * @image_format: image format
  116. * @width: image width in pixels
  117. * @stride: image stride in bytes
  118. * @valid: returns 0 (not valid), 1 (valid)
  119. * @unusedX: must be set to 0
  120. * IOCTL will fail for linear image format
  121. */
  122. struct ubwcp_ioctl_validate_stride {
  123. __u16 image_format;
  124. __u32 width;
  125. __u32 stride;
  126. __u16 valid;
  127. __u16 unused1;
  128. __u16 unused2;
  129. };
  130. #endif /* __UBWCP_IOCTL_H_ */