ubwcp_ioctl.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2022 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. enum ubwcp_image_format {
  12. UBWCP_LINEAR = 0,
  13. UBWCP_RGBA8888,
  14. UBWCP_NV12,
  15. UBWCP_NV12_Y,
  16. UBWCP_NV12_UV,
  17. UBWCP_NV124R,
  18. UBWCP_NV124R_Y,
  19. UBWCP_NV124R_UV,
  20. UBWCP_TP10,
  21. UBWCP_TP10_Y,
  22. UBWCP_TP10_UV,
  23. UBWCP_P010,
  24. UBWCP_P010_Y,
  25. UBWCP_P010_UV,
  26. UBWCP_P016,
  27. UBWCP_P016_Y,
  28. UBWCP_P016_UV,
  29. };
  30. enum ubwcp_compression_type {
  31. UBWCP_COMPRESSION_LOSSLESS = 0,
  32. };
  33. enum ubwcp_subsample {
  34. UBWCP_SUBSAMPLE_4_2_0 = 0,
  35. };
  36. #define UBWCP_SUBSYSTEM_TARGET_CPU (1 << 0)
  37. /**
  38. * @image_format: image format
  39. * @major_ubwc_ver: set to 0. This is not HW version.
  40. * @minor_ubwc_ver: set to 0. This is not HW version.
  41. * @compression_type: only lossless is supported.
  42. * @lossy_params: set to 0
  43. * @width: image width (pixels)
  44. * @height: image height (pixels)
  45. * @stride: image stride (bytes)
  46. * @scanlines: number of scanlines
  47. * @planar_padding: padding between Y and UV planes (bytes)
  48. * @subsample: only 4:2:0 is supported
  49. * @sub_system_target: only CPU is supported
  50. * @y_offset: set to 0
  51. * @batch_size: set to 1
  52. *
  53. * All pad[x] and unused[x] fields must be set to 0
  54. */
  55. struct ubwcp_buffer_attrs {
  56. __u16 image_format; /* enum ubwcp_image_format */
  57. __u16 major_ubwc_ver; /* per-buffer version: must be set to 0 */
  58. __u16 minor_ubwc_ver; /* per-buffer version: must be set to 0 */
  59. __u16 compression_type; /* enum ubwcp_compression_type */
  60. __u64 lossy_params; /* must be set to 0 */
  61. __u32 width;
  62. __u32 height;
  63. __u32 stride;
  64. __u32 scanlines;
  65. __u32 planar_padding;
  66. __u32 subsample; /* enum enum ubwcp_subsample */
  67. __u32 sub_system_target;/* bit mask: UBWCP_SUBSYSTEM_TARGET_XXX */
  68. __u32 y_offset; /* must be set to 0 */
  69. __u32 batch_size; /* only size supported: 1 */
  70. __u32 unused1;
  71. __u32 unused2;
  72. __u32 unused3;
  73. __u32 unused4;
  74. __u32 unused5;
  75. __u32 unused6;
  76. __u32 unused7;
  77. __u32 unused8;
  78. __u32 unused9;
  79. };
  80. /**
  81. * @fd: dma_buf file descriptor for the buffer whose
  82. * attributes are specified
  83. * @attr: ubwcp buffer attributes
  84. */
  85. struct ubwcp_ioctl_buffer_attrs {
  86. __u32 fd;
  87. __u32 pad;
  88. struct ubwcp_buffer_attrs attr;
  89. };
  90. /**
  91. * ubwcp hardware version
  92. * @major: major version
  93. * @minor: minor version
  94. */
  95. struct ubwcp_ioctl_hw_version {
  96. __u32 major;
  97. __u32 minor;
  98. };
  99. #endif /* __UBWCP_IOCTL_H_ */