msm_drm_pp.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. #ifndef _MSM_DRM_PP_H_
  2. #define _MSM_DRM_PP_H_
  3. #include <linux/types.h>
  4. /**
  5. * struct drm_msm_pcc_coeff - PCC coefficient structure for each color
  6. * component.
  7. * @c: constant coefficient.
  8. * @r: red coefficient.
  9. * @g: green coefficient.
  10. * @b: blue coefficient.
  11. * @rg: red green coefficient.
  12. * @gb: green blue coefficient.
  13. * @rb: red blue coefficient.
  14. * @rgb: red blue green coefficient.
  15. */
  16. struct drm_msm_pcc_coeff {
  17. __u32 c;
  18. __u32 r;
  19. __u32 g;
  20. __u32 b;
  21. __u32 rg;
  22. __u32 gb;
  23. __u32 rb;
  24. __u32 rgb;
  25. };
  26. /**
  27. * struct drm_msm_pcc - pcc feature structure
  28. * @flags: for customizing operations
  29. * @r: red coefficients.
  30. * @g: green coefficients.
  31. * @b: blue coefficients.
  32. * @r_rr: second order coefficients
  33. * @r_gg: second order coefficients
  34. * @r_bb: second order coefficients
  35. * @g_rr: second order coefficients
  36. * @g_gg: second order coefficients
  37. * @g_bb: second order coefficients
  38. * @b_rr: second order coefficients
  39. * @b_gg: second order coefficients
  40. * @b_bb: second order coefficients
  41. */
  42. #define DRM_MSM_PCC3
  43. struct drm_msm_pcc {
  44. __u64 flags;
  45. struct drm_msm_pcc_coeff r;
  46. struct drm_msm_pcc_coeff g;
  47. struct drm_msm_pcc_coeff b;
  48. __u32 r_rr;
  49. __u32 r_gg;
  50. __u32 r_bb;
  51. __u32 g_rr;
  52. __u32 g_gg;
  53. __u32 g_bb;
  54. __u32 b_rr;
  55. __u32 b_gg;
  56. __u32 b_bb;
  57. };
  58. /* struct drm_msm_pa_vlut - picture adjustment vLUT structure
  59. * flags: for customizing vlut operation
  60. * val: vLUT values
  61. */
  62. #define PA_VLUT_SIZE 256
  63. struct drm_msm_pa_vlut {
  64. __u64 flags;
  65. __u32 val[PA_VLUT_SIZE];
  66. };
  67. #define PA_HSIC_HUE_ENABLE (1 << 0)
  68. #define PA_HSIC_SAT_ENABLE (1 << 1)
  69. #define PA_HSIC_VAL_ENABLE (1 << 2)
  70. #define PA_HSIC_CONT_ENABLE (1 << 3)
  71. /**
  72. * struct drm_msm_pa_hsic - pa hsic feature structure
  73. * @flags: flags for the feature customization, values can be:
  74. * - PA_HSIC_HUE_ENABLE: Enable hue adjustment
  75. * - PA_HSIC_SAT_ENABLE: Enable saturation adjustment
  76. * - PA_HSIC_VAL_ENABLE: Enable value adjustment
  77. * - PA_HSIC_CONT_ENABLE: Enable contrast adjustment
  78. *
  79. * @hue: hue setting
  80. * @saturation: saturation setting
  81. * @value: value setting
  82. * @contrast: contrast setting
  83. */
  84. #define DRM_MSM_PA_HSIC
  85. struct drm_msm_pa_hsic {
  86. __u64 flags;
  87. __u32 hue;
  88. __u32 saturation;
  89. __u32 value;
  90. __u32 contrast;
  91. };
  92. #define MEMCOL_PROT_HUE (1 << 0)
  93. #define MEMCOL_PROT_SAT (1 << 1)
  94. #define MEMCOL_PROT_VAL (1 << 2)
  95. #define MEMCOL_PROT_CONT (1 << 3)
  96. #define MEMCOL_PROT_SIXZONE (1 << 4)
  97. #define MEMCOL_PROT_BLEND (1 << 5)
  98. /* struct drm_msm_memcol - Memory color feature structure.
  99. * Skin, sky, foliage features are supported.
  100. * @prot_flags: Bit mask for enabling protection feature.
  101. * @color_adjust_p0: Adjustment curve.
  102. * @color_adjust_p1: Adjustment curve.
  103. * @color_adjust_p2: Adjustment curve.
  104. * @blend_gain: Blend gain weightage from othe PA features.
  105. * @sat_hold: Saturation hold value.
  106. * @val_hold: Value hold info.
  107. * @hue_region: Hue qualifier.
  108. * @sat_region: Saturation qualifier.
  109. * @val_region: Value qualifier.
  110. */
  111. #define DRM_MSM_MEMCOL
  112. struct drm_msm_memcol {
  113. __u64 prot_flags;
  114. __u32 color_adjust_p0;
  115. __u32 color_adjust_p1;
  116. __u32 color_adjust_p2;
  117. __u32 blend_gain;
  118. __u32 sat_hold;
  119. __u32 val_hold;
  120. __u32 hue_region;
  121. __u32 sat_region;
  122. __u32 val_region;
  123. };
  124. #define DRM_MSM_SIXZONE
  125. #define SIXZONE_LUT_SIZE 384
  126. #define SIXZONE_HUE_ENABLE (1 << 0)
  127. #define SIXZONE_SAT_ENABLE (1 << 1)
  128. #define SIXZONE_VAL_ENABLE (1 << 2)
  129. /* struct drm_msm_sixzone_curve - Sixzone HSV adjustment curve structure.
  130. * @p0: Hue adjustment.
  131. * @p1: Saturation/Value adjustment.
  132. */
  133. struct drm_msm_sixzone_curve {
  134. __u32 p1;
  135. __u32 p0;
  136. };
  137. /* struct drm_msm_sixzone - Sixzone feature structure.
  138. * @flags: for feature customization, values can be:
  139. * - SIXZONE_HUE_ENABLE: Enable hue adjustment
  140. * - SIXZONE_SAT_ENABLE: Enable saturation adjustment
  141. * - SIXZONE_VAL_ENABLE: Enable value adjustment
  142. * @threshold: threshold qualifier.
  143. * @adjust_p0: Adjustment curve.
  144. * @adjust_p1: Adjustment curve.
  145. * @sat_hold: Saturation hold info.
  146. * @val_hold: Value hold info.
  147. * @curve: HSV adjustment curve lut.
  148. */
  149. struct drm_msm_sixzone {
  150. __u64 flags;
  151. __u32 threshold;
  152. __u32 adjust_p0;
  153. __u32 adjust_p1;
  154. __u32 sat_hold;
  155. __u32 val_hold;
  156. struct drm_msm_sixzone_curve curve[SIXZONE_LUT_SIZE];
  157. };
  158. #define GAMUT_3D_MODE_17 1
  159. #define GAMUT_3D_MODE_5 2
  160. #define GAMUT_3D_MODE_13 3
  161. #define GAMUT_3D_MODE17_TBL_SZ 1229
  162. #define GAMUT_3D_MODE5_TBL_SZ 32
  163. #define GAMUT_3D_MODE13_TBL_SZ 550
  164. #define GAMUT_3D_SCALE_OFF_SZ 16
  165. #define GAMUT_3D_SCALEB_OFF_SZ 12
  166. #define GAMUT_3D_TBL_NUM 4
  167. #define GAMUT_3D_SCALE_OFF_TBL_NUM 3
  168. #define GAMUT_3D_MAP_EN (1 << 0)
  169. /**
  170. * struct drm_msm_3d_col - 3d gamut color component structure
  171. * @c0: Holds c0 value
  172. * @c2_c1: Holds c2/c1 values
  173. */
  174. struct drm_msm_3d_col {
  175. __u32 c2_c1;
  176. __u32 c0;
  177. };
  178. /**
  179. * struct drm_msm_3d_gamut - 3d gamut feature structure
  180. * @flags: flags for the feature values are:
  181. * 0 - no map
  182. * GAMUT_3D_MAP_EN - enable map
  183. * @mode: lut mode can take following values:
  184. * - GAMUT_3D_MODE_17
  185. * - GAMUT_3D_MODE_5
  186. * - GAMUT_3D_MODE_13
  187. * @scale_off: Scale offset table
  188. * @col: Color component tables
  189. */
  190. struct drm_msm_3d_gamut {
  191. __u64 flags;
  192. __u32 mode;
  193. __u32 scale_off[GAMUT_3D_SCALE_OFF_TBL_NUM][GAMUT_3D_SCALE_OFF_SZ];
  194. struct drm_msm_3d_col col[GAMUT_3D_TBL_NUM][GAMUT_3D_MODE17_TBL_SZ];
  195. };
  196. #define PGC_TBL_LEN 512
  197. #define PGC_8B_ROUND (1 << 0)
  198. /**
  199. * struct drm_msm_pgc_lut - pgc lut feature structure
  200. * @flags: flags for the featue values can be:
  201. * - PGC_8B_ROUND
  202. * @c0: color0 component lut
  203. * @c1: color1 component lut
  204. * @c2: color2 component lut
  205. */
  206. struct drm_msm_pgc_lut {
  207. __u64 flags;
  208. __u32 c0[PGC_TBL_LEN];
  209. __u32 c1[PGC_TBL_LEN];
  210. __u32 c2[PGC_TBL_LEN];
  211. };
  212. #define IGC_TBL_LEN 256
  213. #define IGC_DITHER_ENABLE (1 << 0)
  214. /**
  215. * struct drm_msm_igc_lut - igc lut feature structure
  216. * @flags: flags for the feature customization, values can be:
  217. * - IGC_DITHER_ENABLE: Enable dither functionality
  218. * @c0: color0 component lut
  219. * @c1: color1 component lut
  220. * @c2: color2 component lut
  221. * @strength: dither strength, considered valid when IGC_DITHER_ENABLE
  222. * is set in flags. Strength value based on source bit width.
  223. */
  224. struct drm_msm_igc_lut {
  225. __u64 flags;
  226. __u32 c0[IGC_TBL_LEN];
  227. __u32 c1[IGC_TBL_LEN];
  228. __u32 c2[IGC_TBL_LEN];
  229. __u32 strength;
  230. };
  231. #define HIST_V_SIZE 256
  232. /**
  233. * struct drm_msm_hist - histogram feature structure
  234. * @flags: for customizing operations
  235. * @data: histogram data
  236. */
  237. struct drm_msm_hist {
  238. __u64 flags;
  239. __u32 data[HIST_V_SIZE];
  240. };
  241. #define AD4_LUT_GRP0_SIZE 33
  242. #define AD4_LUT_GRP1_SIZE 32
  243. /*
  244. * struct drm_msm_ad4_init - ad4 init structure set by user-space client.
  245. * Init param values can change based on tuning
  246. * hence it is passed by user-space clients.
  247. */
  248. struct drm_msm_ad4_init {
  249. __u32 init_param_001[AD4_LUT_GRP0_SIZE];
  250. __u32 init_param_002[AD4_LUT_GRP0_SIZE];
  251. __u32 init_param_003[AD4_LUT_GRP0_SIZE];
  252. __u32 init_param_004[AD4_LUT_GRP0_SIZE];
  253. __u32 init_param_005[AD4_LUT_GRP1_SIZE];
  254. __u32 init_param_006[AD4_LUT_GRP1_SIZE];
  255. __u32 init_param_007[AD4_LUT_GRP0_SIZE];
  256. __u32 init_param_008[AD4_LUT_GRP0_SIZE];
  257. __u32 init_param_009;
  258. __u32 init_param_010;
  259. __u32 init_param_011;
  260. __u32 init_param_012;
  261. __u32 init_param_013;
  262. __u32 init_param_014;
  263. __u32 init_param_015;
  264. __u32 init_param_016;
  265. __u32 init_param_017;
  266. __u32 init_param_018;
  267. __u32 init_param_019;
  268. __u32 init_param_020;
  269. __u32 init_param_021;
  270. __u32 init_param_022;
  271. __u32 init_param_023;
  272. __u32 init_param_024;
  273. __u32 init_param_025;
  274. __u32 init_param_026;
  275. __u32 init_param_027;
  276. __u32 init_param_028;
  277. __u32 init_param_029;
  278. __u32 init_param_030;
  279. __u32 init_param_031;
  280. __u32 init_param_032;
  281. __u32 init_param_033;
  282. __u32 init_param_034;
  283. __u32 init_param_035;
  284. __u32 init_param_036;
  285. __u32 init_param_037;
  286. __u32 init_param_038;
  287. __u32 init_param_039;
  288. __u32 init_param_040;
  289. __u32 init_param_041;
  290. __u32 init_param_042;
  291. __u32 init_param_043;
  292. __u32 init_param_044;
  293. __u32 init_param_045;
  294. __u32 init_param_046;
  295. __u32 init_param_047;
  296. __u32 init_param_048;
  297. __u32 init_param_049;
  298. __u32 init_param_050;
  299. __u32 init_param_051;
  300. __u32 init_param_052;
  301. __u32 init_param_053;
  302. __u32 init_param_054;
  303. __u32 init_param_055;
  304. __u32 init_param_056;
  305. __u32 init_param_057;
  306. __u32 init_param_058;
  307. __u32 init_param_059;
  308. __u32 init_param_060;
  309. __u32 init_param_061;
  310. __u32 init_param_062;
  311. __u32 init_param_063;
  312. __u32 init_param_064;
  313. __u32 init_param_065;
  314. __u32 init_param_066;
  315. __u32 init_param_067;
  316. __u32 init_param_068;
  317. __u32 init_param_069;
  318. __u32 init_param_070;
  319. __u32 init_param_071;
  320. __u32 init_param_072;
  321. __u32 init_param_073;
  322. __u32 init_param_074;
  323. __u32 init_param_075;
  324. };
  325. /*
  326. * struct drm_msm_ad4_cfg - ad4 config structure set by user-space client.
  327. * Config param values can vary based on tuning,
  328. * hence it is passed by user-space clients.
  329. */
  330. struct drm_msm_ad4_cfg {
  331. __u32 cfg_param_001;
  332. __u32 cfg_param_002;
  333. __u32 cfg_param_003;
  334. __u32 cfg_param_004;
  335. __u32 cfg_param_005;
  336. __u32 cfg_param_006;
  337. __u32 cfg_param_007;
  338. __u32 cfg_param_008;
  339. __u32 cfg_param_009;
  340. __u32 cfg_param_010;
  341. __u32 cfg_param_011;
  342. __u32 cfg_param_012;
  343. __u32 cfg_param_013;
  344. __u32 cfg_param_014;
  345. __u32 cfg_param_015;
  346. __u32 cfg_param_016;
  347. __u32 cfg_param_017;
  348. __u32 cfg_param_018;
  349. __u32 cfg_param_019;
  350. __u32 cfg_param_020;
  351. __u32 cfg_param_021;
  352. __u32 cfg_param_022;
  353. __u32 cfg_param_023;
  354. __u32 cfg_param_024;
  355. __u32 cfg_param_025;
  356. __u32 cfg_param_026;
  357. __u32 cfg_param_027;
  358. __u32 cfg_param_028;
  359. __u32 cfg_param_029;
  360. __u32 cfg_param_030;
  361. __u32 cfg_param_031;
  362. __u32 cfg_param_032;
  363. __u32 cfg_param_033;
  364. __u32 cfg_param_034;
  365. __u32 cfg_param_035;
  366. __u32 cfg_param_036;
  367. __u32 cfg_param_037;
  368. __u32 cfg_param_038;
  369. __u32 cfg_param_039;
  370. __u32 cfg_param_040;
  371. __u32 cfg_param_041;
  372. __u32 cfg_param_042;
  373. __u32 cfg_param_043;
  374. __u32 cfg_param_044;
  375. __u32 cfg_param_045;
  376. __u32 cfg_param_046;
  377. __u32 cfg_param_047;
  378. __u32 cfg_param_048;
  379. __u32 cfg_param_049;
  380. __u32 cfg_param_050;
  381. __u32 cfg_param_051;
  382. __u32 cfg_param_052;
  383. __u32 cfg_param_053;
  384. };
  385. #define DITHER_MATRIX_SZ 16
  386. /**
  387. * struct drm_msm_dither - dither feature structure
  388. * @flags: for customizing operations
  389. * @temporal_en: temperal dither enable
  390. * @c0_bitdepth: c0 component bit depth
  391. * @c1_bitdepth: c1 component bit depth
  392. * @c2_bitdepth: c2 component bit depth
  393. * @c3_bitdepth: c2 component bit depth
  394. * @matrix: dither strength matrix
  395. */
  396. struct drm_msm_dither {
  397. __u64 flags;
  398. __u32 temporal_en;
  399. __u32 c0_bitdepth;
  400. __u32 c1_bitdepth;
  401. __u32 c2_bitdepth;
  402. __u32 c3_bitdepth;
  403. __u32 matrix[DITHER_MATRIX_SZ];
  404. };
  405. /**
  406. * struct drm_msm_pa_dither - dspp dither feature structure
  407. * @flags: for customizing operations
  408. * @strength: dither strength
  409. * @offset_en: offset enable bit
  410. * @matrix: dither data matrix
  411. */
  412. #define DRM_MSM_PA_DITHER
  413. struct drm_msm_pa_dither {
  414. __u64 flags;
  415. __u32 strength;
  416. __u32 offset_en;
  417. __u32 matrix[DITHER_MATRIX_SZ];
  418. };
  419. #endif /* _MSM_DRM_PP_H_ */