sde_drm.h 22 KB

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