sde_drm.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SDE_DRM_H_
  6. #define _SDE_DRM_H_
  7. #include <drm/drm.h>
  8. #if defined(__cplusplus)
  9. extern "C" {
  10. #endif
  11. /* Total number of supported color planes */
  12. #define SDE_MAX_PLANES 4
  13. /* Total number of parameterized detail enhancer mapping curves */
  14. #define SDE_MAX_DE_CURVES 3
  15. /* Y/RGB and UV filter configuration */
  16. #define FILTER_EDGE_DIRECTED_2D 0x0
  17. #define FILTER_CIRCULAR_2D 0x1
  18. #define FILTER_SEPARABLE_1D 0x2
  19. #define FILTER_BILINEAR 0x3
  20. /* Alpha filters */
  21. #define FILTER_ALPHA_DROP_REPEAT 0x0
  22. #define FILTER_ALPHA_BILINEAR 0x1
  23. #define FILTER_ALPHA_2D 0x3
  24. /* Blend filters */
  25. #define FILTER_BLEND_CIRCULAR_2D 0x0
  26. #define FILTER_BLEND_SEPARABLE_1D 0x1
  27. /* LUT configuration flags */
  28. #define SCALER_LUT_SWAP 0x1
  29. #define SCALER_LUT_DIR_WR 0x2
  30. #define SCALER_LUT_Y_CIR_WR 0x4
  31. #define SCALER_LUT_UV_CIR_WR 0x8
  32. #define SCALER_LUT_Y_SEP_WR 0x10
  33. #define SCALER_LUT_UV_SEP_WR 0x20
  34. /**
  35. * Blend operations for "blend_op" property
  36. *
  37. * @SDE_DRM_BLEND_OP_NOT_DEFINED: No blend operation defined for the layer.
  38. * @SDE_DRM_BLEND_OP_OPAQUE: Apply a constant blend operation. The layer
  39. * would appear opaque in case fg plane alpha
  40. * is 0xff.
  41. * @SDE_DRM_BLEND_OP_PREMULTIPLIED: Apply source over blend rule. Layer already
  42. * has alpha pre-multiplication done. If the fg
  43. * plane alpha is less than 0xff, apply
  44. * modulation as well. This operation is
  45. * intended on layers having alpha channel.
  46. * @SDE_DRM_BLEND_OP_COVERAGE: Apply source over blend rule. Layer is not
  47. * alpha pre-multiplied. Apply
  48. * pre-multiplication. If fg plane alpha is
  49. * less than 0xff, apply modulation as well.
  50. * @SDE_DRM_BLEND_OP_MAX: Used to track maximum blend operation
  51. * possible by mdp.
  52. */
  53. #define SDE_DRM_BLEND_OP_NOT_DEFINED 0
  54. #define SDE_DRM_BLEND_OP_OPAQUE 1
  55. #define SDE_DRM_BLEND_OP_PREMULTIPLIED 2
  56. #define SDE_DRM_BLEND_OP_COVERAGE 3
  57. #define SDE_DRM_BLEND_OP_MAX 4
  58. /**
  59. * Bit masks for "src_config" property
  60. * construct bitmask via (1UL << SDE_DRM_<flag>)
  61. */
  62. #define SDE_DRM_DEINTERLACE 0 /* Specifies interlaced input */
  63. /* DRM bitmasks are restricted to 0..63 */
  64. #define SDE_DRM_BITMASK_COUNT 64
  65. /**
  66. * Framebuffer modes for "fb_translation_mode" PLANE and CONNECTOR property
  67. *
  68. * @SDE_DRM_FB_NON_SEC: IOMMU configuration for this framebuffer mode
  69. * is non-secure domain and requires
  70. * both stage I and stage II translations when
  71. * this buffer is accessed by the display HW.
  72. * This is the default mode of all frambuffers.
  73. * @SDE_DRM_FB_SEC: IOMMU configuration for this framebuffer mode
  74. * is secure domain and requires
  75. * both stage I and stage II translations when
  76. * this buffer is accessed by the display HW.
  77. * @SDE_DRM_FB_NON_SEC_DIR_TRANS: IOMMU configuration for this framebuffer mode
  78. * is non-secure domain and requires
  79. * only stage II translation when
  80. * this buffer is accessed by the display HW.
  81. * @SDE_DRM_FB_SEC_DIR_TRANS: IOMMU configuration for this framebuffer mode
  82. * is secure domain and requires
  83. * only stage II translation when
  84. * this buffer is accessed by the display HW.
  85. */
  86. #define SDE_DRM_FB_NON_SEC 0
  87. #define SDE_DRM_FB_SEC 1
  88. #define SDE_DRM_FB_NON_SEC_DIR_TRANS 2
  89. #define SDE_DRM_FB_SEC_DIR_TRANS 3
  90. /**
  91. * Secure levels for "security_level" CRTC property.
  92. * CRTC property which specifies what plane types
  93. * can be attached to this CRTC. Plane component
  94. * derives the plane type based on the FB_MODE.
  95. * @ SDE_DRM_SEC_NON_SEC: Both Secure and non-secure plane types can be
  96. * attached to this CRTC. This is the default state of
  97. * the CRTC.
  98. * @ SDE_DRM_SEC_ONLY: Only secure planes can be added to this CRTC. If a
  99. * CRTC is instructed to be in this mode it follows the
  100. * platform dependent restrictions.
  101. */
  102. #define SDE_DRM_SEC_NON_SEC 0
  103. #define SDE_DRM_SEC_ONLY 1
  104. /**
  105. * struct sde_drm_pix_ext_v1 - version 1 of pixel ext structure
  106. * @num_ext_pxls_lr: Number of total horizontal pixels
  107. * @num_ext_pxls_tb: Number of total vertical lines
  108. * @left_ftch: Number of extra pixels to overfetch from left
  109. * @right_ftch: Number of extra pixels to overfetch from right
  110. * @top_ftch: Number of extra lines to overfetch from top
  111. * @btm_ftch: Number of extra lines to overfetch from bottom
  112. * @left_rpt: Number of extra pixels to repeat from left
  113. * @right_rpt: Number of extra pixels to repeat from right
  114. * @top_rpt: Number of extra lines to repeat from top
  115. * @btm_rpt: Number of extra lines to repeat from bottom
  116. */
  117. struct sde_drm_pix_ext_v1 {
  118. /*
  119. * Number of pixels ext in left, right, top and bottom direction
  120. * for all color components.
  121. */
  122. int32_t num_ext_pxls_lr[SDE_MAX_PLANES];
  123. int32_t num_ext_pxls_tb[SDE_MAX_PLANES];
  124. /*
  125. * Number of pixels needs to be overfetched in left, right, top
  126. * and bottom directions from source image for scaling.
  127. */
  128. int32_t left_ftch[SDE_MAX_PLANES];
  129. int32_t right_ftch[SDE_MAX_PLANES];
  130. int32_t top_ftch[SDE_MAX_PLANES];
  131. int32_t btm_ftch[SDE_MAX_PLANES];
  132. /*
  133. * Number of pixels needs to be repeated in left, right, top and
  134. * bottom directions for scaling.
  135. */
  136. int32_t left_rpt[SDE_MAX_PLANES];
  137. int32_t right_rpt[SDE_MAX_PLANES];
  138. int32_t top_rpt[SDE_MAX_PLANES];
  139. int32_t btm_rpt[SDE_MAX_PLANES];
  140. };
  141. /**
  142. * struct sde_drm_scaler_v1 - version 1 of struct sde_drm_scaler
  143. * @lr: Pixel extension settings for left/right
  144. * @tb: Pixel extension settings for top/botton
  145. * @init_phase_x: Initial scaler phase values for x
  146. * @phase_step_x: Phase step values for x
  147. * @init_phase_y: Initial scaler phase values for y
  148. * @phase_step_y: Phase step values for y
  149. * @horz_filter: Horizontal filter array
  150. * @vert_filter: Vertical filter array
  151. */
  152. struct sde_drm_scaler_v1 {
  153. /*
  154. * Pix ext settings
  155. */
  156. struct sde_drm_pix_ext_v1 pe;
  157. /*
  158. * Phase settings
  159. */
  160. int32_t init_phase_x[SDE_MAX_PLANES];
  161. int32_t phase_step_x[SDE_MAX_PLANES];
  162. int32_t init_phase_y[SDE_MAX_PLANES];
  163. int32_t phase_step_y[SDE_MAX_PLANES];
  164. /*
  165. * Filter type to be used for scaling in horizontal and vertical
  166. * directions
  167. */
  168. uint32_t horz_filter[SDE_MAX_PLANES];
  169. uint32_t vert_filter[SDE_MAX_PLANES];
  170. };
  171. /**
  172. * struct sde_drm_de_v1 - version 1 of detail enhancer structure
  173. * @enable: Enables/disables detail enhancer
  174. * @sharpen_level1: Sharpening strength for noise
  175. * @sharpen_level2: Sharpening strength for context
  176. * @clip: Clip coefficient
  177. * @limit: Detail enhancer limit factor
  178. * @thr_quiet: Quite zone threshold
  179. * @thr_dieout: Die-out zone threshold
  180. * @thr_low: Linear zone left threshold
  181. * @thr_high: Linear zone right threshold
  182. * @prec_shift: Detail enhancer precision
  183. * @adjust_a: Mapping curves A coefficients
  184. * @adjust_b: Mapping curves B coefficients
  185. * @adjust_c: Mapping curves C coefficients
  186. */
  187. struct sde_drm_de_v1 {
  188. uint32_t enable;
  189. int16_t sharpen_level1;
  190. int16_t sharpen_level2;
  191. uint16_t clip;
  192. uint16_t limit;
  193. uint16_t thr_quiet;
  194. uint16_t thr_dieout;
  195. uint16_t thr_low;
  196. uint16_t thr_high;
  197. uint16_t prec_shift;
  198. int16_t adjust_a[SDE_MAX_DE_CURVES];
  199. int16_t adjust_b[SDE_MAX_DE_CURVES];
  200. int16_t adjust_c[SDE_MAX_DE_CURVES];
  201. };
  202. /*
  203. * Scaler configuration flags
  204. */
  205. /* Disable dynamic expansion */
  206. #define SDE_DYN_EXP_DISABLE 0x1
  207. #define SDE_DRM_QSEED3LITE
  208. #define SDE_DRM_QSEED4
  209. #define SDE_DRM_INLINE_PREDOWNSCALE
  210. /**
  211. * struct sde_drm_scaler_v2 - version 2 of struct sde_drm_scaler
  212. * @enable: Scaler enable
  213. * @dir_en: Detail enhancer enable
  214. * @pe: Pixel extension settings
  215. * @horz_decimate: Horizontal decimation factor
  216. * @vert_decimate: Vertical decimation factor
  217. * @init_phase_x: Initial scaler phase values for x
  218. * @phase_step_x: Phase step values for x
  219. * @init_phase_y: Initial scaler phase values for y
  220. * @phase_step_y: Phase step values for y
  221. * @preload_x: Horizontal preload value
  222. * @preload_y: Vertical preload value
  223. * @src_width: Source width
  224. * @src_height: Source height
  225. * @dst_width: Destination width
  226. * @dst_height: Destination height
  227. * @y_rgb_filter_cfg: Y/RGB plane filter configuration
  228. * @uv_filter_cfg: UV plane filter configuration
  229. * @alpha_filter_cfg: Alpha filter configuration
  230. * @blend_cfg: Selection of blend coefficients
  231. * @lut_flag: LUT configuration flags
  232. * @dir_lut_idx: 2d 4x4 LUT index
  233. * @y_rgb_cir_lut_idx: Y/RGB circular LUT index
  234. * @uv_cir_lut_idx: UV circular LUT index
  235. * @y_rgb_sep_lut_idx: Y/RGB separable LUT index
  236. * @uv_sep_lut_idx: UV separable LUT index
  237. * @de: Detail enhancer settings
  238. * @dir_weight: Directional Weight
  239. * @unsharp_mask_blend: Unsharp Blend Filter Ratio
  240. * @de_blend: Ratio of two unsharp mask filters
  241. * @flags: Scaler configuration flags
  242. * @pre_downscale_x_0 Pre-downscale ratio, x-direction, plane 0(Y/RGB)
  243. * @pre_downscale_x_1 Pre-downscale ratio, x-direction, plane 1(UV)
  244. * @pre_downscale_y_0 Pre-downscale ratio, y-direction, plane 0(Y/RGB)
  245. * @pre_downscale_y_1 Pre-downscale ratio, y-direction, plane 1(UV)
  246. */
  247. struct sde_drm_scaler_v2 {
  248. /*
  249. * General definitions
  250. */
  251. uint32_t enable;
  252. uint32_t dir_en;
  253. /*
  254. * Pix ext settings
  255. */
  256. struct sde_drm_pix_ext_v1 pe;
  257. /*
  258. * Decimation settings
  259. */
  260. uint32_t horz_decimate;
  261. uint32_t vert_decimate;
  262. /*
  263. * Phase settings
  264. */
  265. int32_t init_phase_x[SDE_MAX_PLANES];
  266. int32_t phase_step_x[SDE_MAX_PLANES];
  267. int32_t init_phase_y[SDE_MAX_PLANES];
  268. int32_t phase_step_y[SDE_MAX_PLANES];
  269. uint32_t preload_x[SDE_MAX_PLANES];
  270. uint32_t preload_y[SDE_MAX_PLANES];
  271. uint32_t src_width[SDE_MAX_PLANES];
  272. uint32_t src_height[SDE_MAX_PLANES];
  273. uint32_t dst_width;
  274. uint32_t dst_height;
  275. uint32_t y_rgb_filter_cfg;
  276. uint32_t uv_filter_cfg;
  277. uint32_t alpha_filter_cfg;
  278. uint32_t blend_cfg;
  279. uint32_t lut_flag;
  280. uint32_t dir_lut_idx;
  281. /* for Y(RGB) and UV planes*/
  282. uint32_t y_rgb_cir_lut_idx;
  283. uint32_t uv_cir_lut_idx;
  284. uint32_t y_rgb_sep_lut_idx;
  285. uint32_t uv_sep_lut_idx;
  286. /*
  287. * Detail enhancer settings
  288. */
  289. struct sde_drm_de_v1 de;
  290. uint32_t dir_weight;
  291. uint32_t unsharp_mask_blend;
  292. uint32_t de_blend;
  293. uint32_t flags;
  294. /*
  295. * Inline pre-downscale settings
  296. */
  297. uint32_t pre_downscale_x_0;
  298. uint32_t pre_downscale_x_1;
  299. uint32_t pre_downscale_y_0;
  300. uint32_t pre_downscale_y_1;
  301. };
  302. /* Number of dest scalers supported */
  303. #define SDE_MAX_DS_COUNT 2
  304. /*
  305. * Destination scaler flag config
  306. */
  307. #define SDE_DRM_DESTSCALER_ENABLE 0x1
  308. #define SDE_DRM_DESTSCALER_SCALE_UPDATE 0x2
  309. #define SDE_DRM_DESTSCALER_ENHANCER_UPDATE 0x4
  310. #define SDE_DRM_DESTSCALER_PU_ENABLE 0x8
  311. /**
  312. * struct sde_drm_dest_scaler_cfg - destination scaler config structure
  313. * @flags: Flag to switch between mode for destination scaler
  314. * refer to destination scaler flag config
  315. * @index: Destination scaler selection index
  316. * @lm_width: Layer mixer width configuration
  317. * @lm_height: Layer mixer height configuration
  318. * @scaler_cfg: The scaling parameters for all the mode except disable
  319. * Userspace pointer to struct sde_drm_scaler_v2
  320. */
  321. struct sde_drm_dest_scaler_cfg {
  322. uint32_t flags;
  323. uint32_t index;
  324. uint32_t lm_width;
  325. uint32_t lm_height;
  326. uint64_t scaler_cfg;
  327. };
  328. /**
  329. * struct sde_drm_dest_scaler_data - destination scaler data struct
  330. * @num_dest_scaler: Number of dest scalers to be configured
  331. * @ds_cfg: Destination scaler block configuration
  332. */
  333. struct sde_drm_dest_scaler_data {
  334. uint32_t num_dest_scaler;
  335. struct sde_drm_dest_scaler_cfg ds_cfg[SDE_MAX_DS_COUNT];
  336. };
  337. /*
  338. * Define constants for struct sde_drm_csc
  339. */
  340. #define SDE_CSC_MATRIX_COEFF_SIZE 9
  341. #define SDE_CSC_CLAMP_SIZE 6
  342. #define SDE_CSC_BIAS_SIZE 3
  343. /**
  344. * struct sde_drm_csc_v1 - version 1 of struct sde_drm_csc
  345. * @ctm_coeff: Matrix coefficients, in S31.32 format
  346. * @pre_bias: Pre-bias array values
  347. * @post_bias: Post-bias array values
  348. * @pre_clamp: Pre-clamp array values
  349. * @post_clamp: Post-clamp array values
  350. */
  351. struct sde_drm_csc_v1 {
  352. int64_t ctm_coeff[SDE_CSC_MATRIX_COEFF_SIZE];
  353. uint32_t pre_bias[SDE_CSC_BIAS_SIZE];
  354. uint32_t post_bias[SDE_CSC_BIAS_SIZE];
  355. uint32_t pre_clamp[SDE_CSC_CLAMP_SIZE];
  356. uint32_t post_clamp[SDE_CSC_CLAMP_SIZE];
  357. };
  358. /**
  359. * struct sde_drm_color - struct to store the color and alpha values
  360. * @color_0: Color 0 value
  361. * @color_1: Color 1 value
  362. * @color_2: Color 2 value
  363. * @color_3: Color 3 value
  364. */
  365. struct sde_drm_color {
  366. uint32_t color_0;
  367. uint32_t color_1;
  368. uint32_t color_2;
  369. uint32_t color_3;
  370. };
  371. /* Total number of supported dim layers */
  372. #define SDE_MAX_DIM_LAYERS 7
  373. /* SDE_DRM_DIM_LAYER_CONFIG_FLAG - flags for Dim Layer */
  374. /* Color fill inside of the rect, including border */
  375. #define SDE_DRM_DIM_LAYER_INCLUSIVE 0x1
  376. /* Color fill outside of the rect, excluding border */
  377. #define SDE_DRM_DIM_LAYER_EXCLUSIVE 0x2
  378. /**
  379. * struct sde_drm_dim_layer - dim layer cfg struct
  380. * @flags: Refer SDE_DRM_DIM_LAYER_CONFIG_FLAG for possible values
  381. * @stage: Blending stage of the dim layer
  382. * @color_fill: Color fill for dim layer
  383. * @rect: Dim layer coordinates
  384. */
  385. struct sde_drm_dim_layer_cfg {
  386. uint32_t flags;
  387. uint32_t stage;
  388. struct sde_drm_color color_fill;
  389. struct drm_clip_rect rect;
  390. };
  391. /**
  392. * struct sde_drm_dim_layer_v1 - version 1 of dim layer struct
  393. * @num_layers: Numer of Dim Layers
  394. * @layer: Dim layer user cfgs ptr for the num_layers
  395. */
  396. struct sde_drm_dim_layer_v1 {
  397. uint32_t num_layers;
  398. struct sde_drm_dim_layer_cfg layer_cfg[SDE_MAX_DIM_LAYERS];
  399. };
  400. /* Writeback Config version definition */
  401. #define SDE_DRM_WB_CFG 0x1
  402. /* SDE_DRM_WB_CONFIG_FLAGS - Writeback configuration flags */
  403. #define SDE_DRM_WB_CFG_FLAGS_CONNECTED (1<<0)
  404. /**
  405. * struct sde_drm_wb_cfg - Writeback configuration structure
  406. * @flags: see DRM_MSM_WB_CONFIG_FLAGS
  407. * @connector_id: writeback connector identifier
  408. * @count_modes: Count of modes in modes_ptr
  409. * @modes: Pointer to struct drm_mode_modeinfo
  410. */
  411. struct sde_drm_wb_cfg {
  412. uint32_t flags;
  413. uint32_t connector_id;
  414. uint32_t count_modes;
  415. uint64_t modes;
  416. };
  417. #define SDE_MAX_ROI_V1 4
  418. /**
  419. * struct sde_drm_roi_v1 - list of regions of interest for a drm object
  420. * @num_rects: number of valid rectangles in the roi array
  421. * @roi: list of roi rectangles
  422. */
  423. struct sde_drm_roi_v1 {
  424. uint32_t num_rects;
  425. struct drm_clip_rect roi[SDE_MAX_ROI_V1];
  426. };
  427. /**
  428. * Define extended power modes supported by the SDE connectors.
  429. */
  430. #define SDE_MODE_DPMS_ON 0
  431. #define SDE_MODE_DPMS_LP1 1
  432. #define SDE_MODE_DPMS_LP2 2
  433. #define SDE_MODE_DPMS_STANDBY 3
  434. #define SDE_MODE_DPMS_SUSPEND 4
  435. #define SDE_MODE_DPMS_OFF 5
  436. /**
  437. * sde recovery events for notifying client
  438. */
  439. #define SDE_RECOVERY_SUCCESS 0
  440. #define SDE_RECOVERY_CAPTURE 1
  441. #define SDE_RECOVERY_HARD_RESET 2
  442. /*
  443. * Colorimetry Data Block values
  444. * These bit nums are defined as per the CTA spec
  445. * and indicate the colorspaces supported by the sink
  446. */
  447. #define DRM_EDID_CLRMETRY_xvYCC_601 (1 << 0)
  448. #define DRM_EDID_CLRMETRY_xvYCC_709 (1 << 1)
  449. #define DRM_EDID_CLRMETRY_sYCC_601 (1 << 2)
  450. #define DRM_EDID_CLRMETRY_ADOBE_YCC_601 (1 << 3)
  451. #define DRM_EDID_CLRMETRY_ADOBE_RGB (1 << 4)
  452. #define DRM_EDID_CLRMETRY_BT2020_CYCC (1 << 5)
  453. #define DRM_EDID_CLRMETRY_BT2020_YCC (1 << 6)
  454. #define DRM_EDID_CLRMETRY_BT2020_RGB (1 << 7)
  455. #define DRM_EDID_CLRMETRY_DCI_P3 (1 << 15)
  456. /*
  457. * HDR Metadata
  458. * These are defined as per EDID spec and shall be used by the sink
  459. * to set the HDR metadata for playback from userspace.
  460. */
  461. #define HDR_PRIMARIES_COUNT 3
  462. /* HDR EOTF */
  463. #define HDR_EOTF_SDR_LUM_RANGE 0x0
  464. #define HDR_EOTF_HDR_LUM_RANGE 0x1
  465. #define HDR_EOTF_SMTPE_ST2084 0x2
  466. #define HDR_EOTF_HLG 0x3
  467. #define DRM_MSM_EXT_HDR_METADATA
  468. #define DRM_MSM_EXT_HDR_PLUS_METADATA
  469. struct drm_msm_ext_hdr_metadata {
  470. __u32 hdr_state; /* HDR state */
  471. __u32 eotf; /* electro optical transfer function */
  472. __u32 hdr_supported; /* HDR supported */
  473. __u32 display_primaries_x[HDR_PRIMARIES_COUNT]; /* Primaries x */
  474. __u32 display_primaries_y[HDR_PRIMARIES_COUNT]; /* Primaries y */
  475. __u32 white_point_x; /* white_point_x */
  476. __u32 white_point_y; /* white_point_y */
  477. __u32 max_luminance; /* Max luminance */
  478. __u32 min_luminance; /* Min Luminance */
  479. __u32 max_content_light_level; /* max content light level */
  480. __u32 max_average_light_level; /* max average light level */
  481. __u64 hdr_plus_payload; /* user pointer to dynamic HDR payload */
  482. __u32 hdr_plus_payload_size;/* size of dynamic HDR payload data */
  483. };
  484. /**
  485. * HDR sink properties
  486. * These are defined as per EDID spec and shall be used by the userspace
  487. * to determine the HDR properties to be set to the sink.
  488. */
  489. #define DRM_MSM_EXT_HDR_PROPERTIES
  490. #define DRM_MSM_EXT_HDR_PLUS_PROPERTIES
  491. struct drm_msm_ext_hdr_properties {
  492. __u8 hdr_metadata_type_one; /* static metadata type one */
  493. __u32 hdr_supported; /* HDR supported */
  494. __u32 hdr_eotf; /* electro optical transfer function */
  495. __u32 hdr_max_luminance; /* Max luminance */
  496. __u32 hdr_avg_luminance; /* Avg luminance */
  497. __u32 hdr_min_luminance; /* Min Luminance */
  498. __u32 hdr_plus_supported; /* HDR10+ supported */
  499. };
  500. /* HDR WRGB x and y index */
  501. #define DISPLAY_PRIMARIES_WX 0
  502. #define DISPLAY_PRIMARIES_WY 1
  503. #define DISPLAY_PRIMARIES_RX 2
  504. #define DISPLAY_PRIMARIES_RY 3
  505. #define DISPLAY_PRIMARIES_GX 4
  506. #define DISPLAY_PRIMARIES_GY 5
  507. #define DISPLAY_PRIMARIES_BX 6
  508. #define DISPLAY_PRIMARIES_BY 7
  509. #define DISPLAY_PRIMARIES_MAX 8
  510. struct drm_panel_hdr_properties {
  511. __u32 hdr_enabled;
  512. /* WRGB X and y values arrayed in format */
  513. /* [WX, WY, RX, RY, GX, GY, BX, BY] */
  514. __u32 display_primaries[DISPLAY_PRIMARIES_MAX];
  515. /* peak brightness supported by panel */
  516. __u32 peak_brightness;
  517. /* Blackness level supported by panel */
  518. __u32 blackness_level;
  519. };
  520. /**
  521. * struct drm_msm_event_req - Payload to event enable/disable ioctls.
  522. * @object_id: DRM object id. e.g.: for crtc pass crtc id.
  523. * @object_type: DRM object type. e.g.: for crtc set it to DRM_MODE_OBJECT_CRTC.
  524. * @event: Event for which notification is being enabled/disabled.
  525. * e.g.: for Histogram set - DRM_EVENT_HISTOGRAM.
  526. * @client_context: Opaque pointer that will be returned during event response
  527. * notification.
  528. * @index: Object index(e.g.: crtc index), optional for user-space to set.
  529. * Driver will override value based on object_id and object_type.
  530. */
  531. struct drm_msm_event_req {
  532. __u32 object_id;
  533. __u32 object_type;
  534. __u32 event;
  535. __u64 client_context;
  536. __u32 index;
  537. };
  538. /**
  539. * struct drm_msm_event_resp - payload returned when read is called for
  540. * custom notifications.
  541. * @base: Event type and length of complete notification payload.
  542. * @info: Contains information about DRM that which raised this event.
  543. * @data: Custom payload that driver returns for event type.
  544. * size of data = base.length - (sizeof(base) + sizeof(info))
  545. */
  546. struct drm_msm_event_resp {
  547. struct drm_event base;
  548. struct drm_msm_event_req info;
  549. __u8 data[];
  550. };
  551. /**
  552. * struct drm_msm_power_ctrl: Payload to enable/disable the power vote
  553. * @enable: enable/disable the power vote
  554. * @flags: operation control flags, for future use
  555. */
  556. struct drm_msm_power_ctrl {
  557. __u32 enable;
  558. __u32 flags;
  559. };
  560. #define DRM_SDE_WB_CONFIG 0x40
  561. #define DRM_MSM_REGISTER_EVENT 0x41
  562. #define DRM_MSM_DEREGISTER_EVENT 0x42
  563. #define DRM_MSM_RMFB2 0x43
  564. #define DRM_MSM_POWER_CTRL 0x44
  565. /* sde custom events */
  566. #define DRM_EVENT_HISTOGRAM 0x80000000
  567. #define DRM_EVENT_AD_BACKLIGHT 0x80000001
  568. #define DRM_EVENT_CRTC_POWER 0x80000002
  569. #define DRM_EVENT_SYS_BACKLIGHT 0x80000003
  570. #define DRM_EVENT_SDE_POWER 0x80000004
  571. #define DRM_EVENT_IDLE_NOTIFY 0x80000005
  572. #define DRM_EVENT_PANEL_DEAD 0x80000006 /* ESD event */
  573. #define DRM_EVENT_SDE_HW_RECOVERY 0X80000007
  574. #define DRM_EVENT_LTM_HIST 0X80000008
  575. #define DRM_EVENT_LTM_WB_PB 0X80000009
  576. #define DRM_EVENT_LTM_OFF 0X8000000A
  577. #define DRM_IOCTL_SDE_WB_CONFIG \
  578. DRM_IOW((DRM_COMMAND_BASE + DRM_SDE_WB_CONFIG), struct sde_drm_wb_cfg)
  579. #define DRM_IOCTL_MSM_REGISTER_EVENT DRM_IOW((DRM_COMMAND_BASE + \
  580. DRM_MSM_REGISTER_EVENT), struct drm_msm_event_req)
  581. #define DRM_IOCTL_MSM_DEREGISTER_EVENT DRM_IOW((DRM_COMMAND_BASE + \
  582. DRM_MSM_DEREGISTER_EVENT), struct drm_msm_event_req)
  583. #define DRM_IOCTL_MSM_RMFB2 DRM_IOW((DRM_COMMAND_BASE + \
  584. DRM_MSM_RMFB2), unsigned int)
  585. #define DRM_IOCTL_MSM_POWER_CTRL DRM_IOW((DRM_COMMAND_BASE + \
  586. DRM_MSM_POWER_CTRL), struct drm_msm_power_ctrl)
  587. #if defined(__cplusplus)
  588. }
  589. #endif
  590. #endif /* _SDE_DRM_H_ */