sde_hw_mdss.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SDE_HW_MDSS_H
  6. #define _SDE_HW_MDSS_H
  7. #include <linux/kernel.h>
  8. #include <linux/err.h>
  9. #include "msm_drv.h"
  10. #define SDE_DBG_NAME "sde"
  11. #define SDE_NONE 0
  12. #ifndef SDE_CSC_MATRIX_COEFF_SIZE
  13. #define SDE_CSC_MATRIX_COEFF_SIZE 9
  14. #endif
  15. #ifndef SDE_CSC_CLAMP_SIZE
  16. #define SDE_CSC_CLAMP_SIZE 6
  17. #endif
  18. #ifndef SDE_CSC_BIAS_SIZE
  19. #define SDE_CSC_BIAS_SIZE 3
  20. #endif
  21. #ifndef SDE_MAX_PLANES
  22. #define SDE_MAX_PLANES 4
  23. #endif
  24. #define PIPES_PER_STAGE 2
  25. #ifndef SDE_MAX_DE_CURVES
  26. #define SDE_MAX_DE_CURVES 3
  27. #endif
  28. #define MAX_DSI_DISPLAYS 2
  29. #define MAX_DATA_PATH_PER_DSIPLAY 4
  30. enum sde_format_flags {
  31. SDE_FORMAT_FLAG_YUV_BIT,
  32. SDE_FORMAT_FLAG_DX_BIT,
  33. SDE_FORMAT_FLAG_COMPRESSED_BIT,
  34. SDE_FORMAT_FLAG_ALPHA_SWAP_BIT,
  35. SDE_FORMAT_FLAG_FP16_BIT,
  36. SDE_FORMAT_FLAG_BIT_MAX,
  37. };
  38. #define SDE_FORMAT_FLAG_YUV BIT(SDE_FORMAT_FLAG_YUV_BIT)
  39. #define SDE_FORMAT_FLAG_DX BIT(SDE_FORMAT_FLAG_DX_BIT)
  40. #define SDE_FORMAT_FLAG_COMPRESSED BIT(SDE_FORMAT_FLAG_COMPRESSED_BIT)
  41. #define SDE_FORMAT_FLAG_ALPHA_SWAP BIT(SDE_FORMAT_FLAG_ALPHA_SWAP_BIT)
  42. #define SDE_FORMAT_FLAG_FP16 BIT(SDE_FORMAT_FLAG_FP16_BIT)
  43. #define SDE_FORMAT_IS_YUV(X) \
  44. (test_bit(SDE_FORMAT_FLAG_YUV_BIT, (X)->flag))
  45. #define SDE_FORMAT_IS_DX(X) \
  46. (test_bit(SDE_FORMAT_FLAG_DX_BIT, (X)->flag))
  47. #define SDE_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == SDE_FETCH_LINEAR)
  48. #define SDE_FORMAT_IS_TILE(X) \
  49. (((X)->fetch_mode == SDE_FETCH_UBWC) && \
  50. !test_bit(SDE_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag))
  51. #define SDE_FORMAT_IS_UBWC(X) \
  52. (((X)->fetch_mode == SDE_FETCH_UBWC) && \
  53. test_bit(SDE_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag))
  54. #define SDE_FORMAT_IS_ALPHA_SWAPPED(X) \
  55. (test_bit(SDE_FORMAT_FLAG_ALPHA_SWAP_BIT, (X)->flag))
  56. #define SDE_FORMAT_IS_FP16(X) \
  57. (test_bit(SDE_FORMAT_FLAG_FP16_BIT, (X)->flag))
  58. #define MDP_TICK_COUNT 16
  59. #define XO_CLK_RATE 19200
  60. #define MS_TICKS_IN_SEC 1000
  61. #define CALCULATE_WD_LOAD_VALUE(fps) \
  62. ((uint32_t)((MS_TICKS_IN_SEC * XO_CLK_RATE)/(MDP_TICK_COUNT * fps)))
  63. #define SDE_BLEND_FG_ALPHA_FG_CONST (0 << 0)
  64. #define SDE_BLEND_FG_ALPHA_BG_CONST (1 << 0)
  65. #define SDE_BLEND_FG_ALPHA_FG_PIXEL (2 << 0)
  66. #define SDE_BLEND_FG_ALPHA_BG_PIXEL (3 << 0)
  67. #define SDE_BLEND_FG_INV_ALPHA (1 << 2)
  68. #define SDE_BLEND_FG_MOD_ALPHA (1 << 3)
  69. #define SDE_BLEND_FG_INV_MOD_ALPHA (1 << 4)
  70. #define SDE_BLEND_FG_TRANSP_EN (1 << 5)
  71. #define SDE_BLEND_BG_ALPHA_FG_CONST (0 << 8)
  72. #define SDE_BLEND_BG_ALPHA_BG_CONST (1 << 8)
  73. #define SDE_BLEND_BG_ALPHA_FG_PIXEL (2 << 8)
  74. #define SDE_BLEND_BG_ALPHA_BG_PIXEL (3 << 8)
  75. #define SDE_BLEND_BG_INV_ALPHA (1 << 10)
  76. #define SDE_BLEND_BG_MOD_ALPHA (1 << 11)
  77. #define SDE_BLEND_BG_INV_MOD_ALPHA (1 << 12)
  78. #define SDE_BLEND_BG_TRANSP_EN (1 << 13)
  79. #define SDE_VSYNC0_SOURCE_GPIO 0
  80. #define SDE_VSYNC1_SOURCE_GPIO 1
  81. #define SDE_VSYNC2_SOURCE_GPIO 2
  82. #define SDE_VSYNC_SOURCE_INTF_0 3
  83. #define SDE_VSYNC_SOURCE_INTF_1 4
  84. #define SDE_VSYNC_SOURCE_INTF_2 5
  85. #define SDE_VSYNC_SOURCE_INTF_3 6
  86. #define SDE_VSYNC_SOURCE_WD_TIMER_4 11
  87. #define SDE_VSYNC_SOURCE_WD_TIMER_3 12
  88. #define SDE_VSYNC_SOURCE_WD_TIMER_2 13
  89. #define SDE_VSYNC_SOURCE_WD_TIMER_1 14
  90. #define SDE_VSYNC_SOURCE_WD_TIMER_0 15
  91. enum sde_hw_blk_type {
  92. SDE_HW_BLK_TOP = 0,
  93. SDE_HW_BLK_SSPP,
  94. SDE_HW_BLK_LM,
  95. SDE_HW_BLK_DSPP,
  96. SDE_HW_BLK_DS,
  97. SDE_HW_BLK_CTL,
  98. SDE_HW_BLK_CDM,
  99. SDE_HW_BLK_PINGPONG,
  100. SDE_HW_BLK_INTF,
  101. SDE_HW_BLK_WB,
  102. SDE_HW_BLK_DSC,
  103. SDE_HW_BLK_VDC,
  104. SDE_HW_BLK_MERGE_3D,
  105. SDE_HW_BLK_QDSS,
  106. SDE_HW_BLK_MAX,
  107. };
  108. enum sde_uidle {
  109. UIDLE = 0x1,
  110. UIDLE_MAX,
  111. };
  112. enum sde_mdp {
  113. MDP_TOP = 0x1,
  114. MDP_MAX,
  115. };
  116. enum sde_sspp {
  117. SSPP_NONE,
  118. SSPP_VIG0,
  119. SSPP_VIG1,
  120. SSPP_VIG2,
  121. SSPP_VIG3,
  122. SSPP_RGB0,
  123. SSPP_RGB1,
  124. SSPP_RGB2,
  125. SSPP_RGB3,
  126. SSPP_DMA0,
  127. SSPP_DMA1,
  128. SSPP_DMA2,
  129. SSPP_DMA3,
  130. SSPP_CURSOR0,
  131. SSPP_CURSOR1,
  132. SSPP_MAX
  133. };
  134. enum sde_sspp_type {
  135. SSPP_TYPE_VIG,
  136. SSPP_TYPE_RGB,
  137. SSPP_TYPE_DMA,
  138. SSPP_TYPE_CURSOR,
  139. SSPP_TYPE_MAX
  140. };
  141. enum sde_sspp_rect {
  142. R0,
  143. R1,
  144. R_MAX
  145. };
  146. enum sde_lm {
  147. LM_0 = 1,
  148. LM_1,
  149. LM_2,
  150. LM_3,
  151. LM_4,
  152. LM_5,
  153. LM_DCWB_DUMMY_0,
  154. LM_DCWB_DUMMY_1,
  155. LM_6,
  156. LM_MAX
  157. };
  158. enum sde_stage {
  159. SDE_STAGE_BASE = 0,
  160. SDE_STAGE_0,
  161. SDE_STAGE_1,
  162. SDE_STAGE_2,
  163. SDE_STAGE_3,
  164. SDE_STAGE_4,
  165. SDE_STAGE_5,
  166. SDE_STAGE_6,
  167. SDE_STAGE_7,
  168. SDE_STAGE_8,
  169. SDE_STAGE_9,
  170. SDE_STAGE_10,
  171. SDE_STAGE_MAX
  172. };
  173. enum sde_dspp {
  174. DSPP_0 = 1,
  175. DSPP_1,
  176. DSPP_2,
  177. DSPP_3,
  178. DSPP_MAX
  179. };
  180. enum sde_ltm {
  181. LTM_0 = DSPP_0,
  182. LTM_1,
  183. LTM_MAX
  184. };
  185. enum sde_rc {
  186. RC_0 = DSPP_0,
  187. RC_1,
  188. RC_MAX
  189. };
  190. enum sde_ds {
  191. DS_TOP,
  192. DS_0,
  193. DS_1,
  194. DS_MAX
  195. };
  196. enum sde_ctl {
  197. CTL_0 = 1,
  198. CTL_1,
  199. CTL_2,
  200. CTL_3,
  201. CTL_4,
  202. CTL_5,
  203. CTL_MAX
  204. };
  205. enum sde_cdm {
  206. CDM_0 = 1,
  207. CDM_1,
  208. CDM_MAX
  209. };
  210. enum sde_pingpong {
  211. PINGPONG_0 = 1,
  212. PINGPONG_1,
  213. PINGPONG_2,
  214. PINGPONG_3,
  215. PINGPONG_4,
  216. PINGPONG_5,
  217. PINGPONG_CWB_0,
  218. PINGPONG_CWB_1,
  219. PINGPONG_S0,
  220. PINGPONG_MAX
  221. };
  222. enum sde_dsc {
  223. DSC_NONE = 0,
  224. DSC_0,
  225. DSC_1,
  226. DSC_2,
  227. DSC_3,
  228. DSC_4,
  229. DSC_5,
  230. DSC_MAX
  231. };
  232. enum sde_vdc {
  233. VDC_NONE = 0,
  234. VDC_0,
  235. VDC_1,
  236. VDC_MAX
  237. };
  238. enum sde_intf {
  239. INTF_0 = 1,
  240. INTF_1,
  241. INTF_2,
  242. INTF_3,
  243. INTF_4,
  244. INTF_5,
  245. INTF_6,
  246. INTF_MAX
  247. };
  248. enum sde_intf_type {
  249. INTF_NONE = 0x0,
  250. INTF_DSI = 0x1,
  251. INTF_HDMI = 0x3,
  252. INTF_LCDC = 0x5,
  253. INTF_EDP = 0x9,
  254. INTF_DP = 0xa,
  255. INTF_TYPE_MAX,
  256. /* virtual interfaces */
  257. INTF_WB = 0x100,
  258. };
  259. enum sde_intf_mode {
  260. INTF_MODE_NONE = 0,
  261. INTF_MODE_CMD,
  262. INTF_MODE_VIDEO,
  263. INTF_MODE_WB_BLOCK,
  264. INTF_MODE_WB_LINE,
  265. INTF_MODE_MAX
  266. };
  267. enum sde_wb {
  268. WB_0 = 1,
  269. WB_1,
  270. WB_2,
  271. WB_3,
  272. WB_MAX
  273. };
  274. enum sde_ad {
  275. AD_0 = 0x1,
  276. AD_1,
  277. AD_MAX
  278. };
  279. enum sde_cwb {
  280. CWB_0 = 0x1,
  281. CWB_1,
  282. CWB_2,
  283. CWB_3,
  284. CWB_4,
  285. CWB_5,
  286. CWB_MAX
  287. };
  288. enum sde_dcwb {
  289. DCWB_0 = 0x1,
  290. DCWB_1,
  291. DCWB_MAX
  292. };
  293. enum sde_wd_timer {
  294. WD_TIMER_0 = 0x1,
  295. WD_TIMER_1,
  296. WD_TIMER_2,
  297. WD_TIMER_3,
  298. WD_TIMER_4,
  299. WD_TIMER_5,
  300. WD_TIMER_MAX
  301. };
  302. enum sde_vbif {
  303. VBIF_0,
  304. VBIF_1,
  305. VBIF_MAX,
  306. VBIF_RT = VBIF_0,
  307. VBIF_NRT = VBIF_1
  308. };
  309. enum sde_iommu_domain {
  310. SDE_IOMMU_DOMAIN_UNSECURE,
  311. SDE_IOMMU_DOMAIN_SECURE,
  312. SDE_IOMMU_DOMAIN_MAX
  313. };
  314. enum sde_rot {
  315. ROT_0 = 1,
  316. ROT_MAX
  317. };
  318. enum sde_merge_3d {
  319. MERGE_3D_0 = 1,
  320. MERGE_3D_1,
  321. MERGE_3D_2,
  322. MERGE_3D_CWB_0,
  323. MERGE_3D_MAX
  324. };
  325. enum sde_qdss {
  326. QDSS_0,
  327. QDSS_MAX
  328. };
  329. /**
  330. * SDE HW,Component order color map
  331. */
  332. enum {
  333. C0_G_Y = 0,
  334. C1_B_Cb = 1,
  335. C2_R_Cr = 2,
  336. C3_ALPHA = 3
  337. };
  338. /**
  339. * enum sde_plane_type - defines how the color component pixel packing
  340. * @SDE_PLANE_INTERLEAVED : Color components in single plane
  341. * @SDE_PLANE_PLANAR : Color component in separate planes
  342. * @SDE_PLANE_PSEUDO_PLANAR : Chroma components interleaved in separate plane
  343. */
  344. enum sde_plane_type {
  345. SDE_PLANE_INTERLEAVED,
  346. SDE_PLANE_PLANAR,
  347. SDE_PLANE_PSEUDO_PLANAR,
  348. };
  349. /**
  350. * enum sde_chroma_samp_type - chroma sub-samplng type
  351. * @SDE_CHROMA_RGB : No chroma subsampling
  352. * @SDE_CHROMA_H2V1 : Chroma pixels are horizontally subsampled
  353. * @SDE_CHROMA_H1V2 : Chroma pixels are vertically subsampled
  354. * @SDE_CHROMA_420 : 420 subsampling
  355. */
  356. enum sde_chroma_samp_type {
  357. SDE_CHROMA_RGB,
  358. SDE_CHROMA_H2V1,
  359. SDE_CHROMA_H1V2,
  360. SDE_CHROMA_420
  361. };
  362. /**
  363. * sde_fetch_type - Defines How SDE HW fetches data
  364. * @SDE_FETCH_LINEAR : fetch is line by line
  365. * @SDE_FETCH_TILE : fetches data in Z order from a tile
  366. * @SDE_FETCH_UBWC : fetch and decompress data
  367. */
  368. enum sde_fetch_type {
  369. SDE_FETCH_LINEAR,
  370. SDE_FETCH_TILE,
  371. SDE_FETCH_UBWC
  372. };
  373. /**
  374. * Value of enum chosen to fit the number of bits
  375. * expected by the HW programming.
  376. */
  377. enum {
  378. COLOR_ALPHA_1BIT = 0,
  379. COLOR_ALPHA_4BIT = 1,
  380. COLOR_4BIT = 0,
  381. COLOR_5BIT = 1, /* No 5-bit Alpha */
  382. COLOR_6BIT = 2, /* 6-Bit Alpha also = 2 */
  383. COLOR_8BIT = 3, /* 8-Bit Alpha also = 3 */
  384. COLOR_16BIT = 3,
  385. };
  386. /**
  387. * enum sde_3d_blend_mode
  388. * Desribes how the 3d data is blended
  389. * @BLEND_3D_NONE : 3d blending not enabled
  390. * @BLEND_3D_FRAME_INT : Frame interleaving
  391. * @BLEND_3D_H_ROW_INT : Horizontal row interleaving
  392. * @BLEND_3D_V_ROW_INT : vertical row interleaving
  393. * @BLEND_3D_COL_INT : column interleaving
  394. * @BLEND_3D_MAX :
  395. */
  396. enum sde_3d_blend_mode {
  397. BLEND_3D_NONE = 0,
  398. BLEND_3D_FRAME_INT,
  399. BLEND_3D_H_ROW_INT,
  400. BLEND_3D_V_ROW_INT,
  401. BLEND_3D_COL_INT,
  402. BLEND_3D_MAX
  403. };
  404. /** struct sde_format - defines the format configuration which
  405. * allows SDE HW to correctly fetch and decode the format
  406. * @base: base msm_format struture containing fourcc code
  407. * @fetch_planes: how the color components are packed in pixel format
  408. * @element: element color ordering
  409. * @bits: element bit widths
  410. * @chroma_sample: chroma sub-samplng type
  411. * @unpack_align_msb: unpack aligned, 0 to LSB, 1 to MSB
  412. * @unpack_tight: 0 for loose, 1 for tight
  413. * @unpack_count: 0 = 1 component, 1 = 2 component
  414. * @bpp: bytes per pixel
  415. * @alpha_enable: whether the format has an alpha channel
  416. * @num_planes: number of planes (including meta data planes)
  417. * @fetch_mode: linear, tiled, or ubwc hw fetch behavior
  418. * @is_yuv: is format a yuv variant
  419. * @flag: usage bit flags
  420. * @tile_width: format tile width
  421. * @tile_height: format tile height
  422. */
  423. struct sde_format {
  424. struct msm_format base;
  425. enum sde_plane_type fetch_planes;
  426. u8 element[SDE_MAX_PLANES];
  427. u8 bits[SDE_MAX_PLANES];
  428. enum sde_chroma_samp_type chroma_sample;
  429. u8 unpack_align_msb;
  430. u8 unpack_tight;
  431. u8 unpack_count;
  432. u8 bpp;
  433. u8 alpha_enable;
  434. u8 num_planes;
  435. enum sde_fetch_type fetch_mode;
  436. DECLARE_BITMAP(flag, SDE_FORMAT_FLAG_BIT_MAX);
  437. u16 tile_width;
  438. u16 tile_height;
  439. };
  440. #define to_sde_format(x) container_of(x, struct sde_format, base)
  441. /**
  442. * struct sde_hw_fmt_layout - format information of the source pixel data
  443. * @format: pixel format parameters
  444. * @num_planes: number of planes (including meta data planes)
  445. * @width: image width
  446. * @height: image height
  447. * @total_size: total size in bytes
  448. * @plane_addr: address of each plane
  449. * @plane_size: length of each plane
  450. * @plane_pitch: pitch of each plane
  451. */
  452. struct sde_hw_fmt_layout {
  453. const struct sde_format *format;
  454. uint32_t num_planes;
  455. uint32_t width;
  456. uint32_t height;
  457. uint32_t total_size;
  458. uint32_t plane_addr[SDE_MAX_PLANES];
  459. uint32_t plane_size[SDE_MAX_PLANES];
  460. uint32_t plane_pitch[SDE_MAX_PLANES];
  461. };
  462. struct sde_rect {
  463. u16 x;
  464. u16 y;
  465. u16 w;
  466. u16 h;
  467. };
  468. struct sde_csc_cfg {
  469. /* matrix coefficients in S15.16 format */
  470. uint32_t csc_mv[SDE_CSC_MATRIX_COEFF_SIZE];
  471. uint32_t csc_pre_bv[SDE_CSC_BIAS_SIZE];
  472. uint32_t csc_post_bv[SDE_CSC_BIAS_SIZE];
  473. uint32_t csc_pre_lv[SDE_CSC_CLAMP_SIZE];
  474. uint32_t csc_post_lv[SDE_CSC_CLAMP_SIZE];
  475. };
  476. /**
  477. * struct sde_mdss_color - mdss color description
  478. * color 0 : green
  479. * color 1 : blue
  480. * color 2 : red
  481. * color 3 : alpha
  482. */
  483. struct sde_mdss_color {
  484. u32 color_0;
  485. u32 color_1;
  486. u32 color_2;
  487. u32 color_3;
  488. };
  489. /*
  490. * Define bit masks for h/w logging.
  491. */
  492. #define SDE_DBG_MASK_NONE (1 << 0)
  493. #define SDE_DBG_MASK_CDM (1 << 1)
  494. #define SDE_DBG_MASK_DSPP (1 << 2)
  495. #define SDE_DBG_MASK_INTF (1 << 3)
  496. #define SDE_DBG_MASK_LM (1 << 4)
  497. #define SDE_DBG_MASK_CTL (1 << 5)
  498. #define SDE_DBG_MASK_PINGPONG (1 << 6)
  499. #define SDE_DBG_MASK_SSPP (1 << 7)
  500. #define SDE_DBG_MASK_WB (1 << 8)
  501. #define SDE_DBG_MASK_TOP (1 << 9)
  502. #define SDE_DBG_MASK_VBIF (1 << 10)
  503. #define SDE_DBG_MASK_DSC (1 << 11)
  504. #define SDE_DBG_MASK_ROT (1 << 12)
  505. #define SDE_DBG_MASK_DS (1 << 13)
  506. #define SDE_DBG_MASK_REGDMA (1 << 14)
  507. #define SDE_DBG_MASK_UIDLE (1 << 15)
  508. #define SDE_DBG_MASK_SID (1 << 15)
  509. #define SDE_DBG_MASK_QDSS (1 << 16)
  510. #define SDE_DBG_MASK_VDC (1 << 17)
  511. /**
  512. * struct sde_hw_cp_cfg: hardware dspp/lm feature payload.
  513. * @payload: Feature specific payload.
  514. * @len: Length of the payload.
  515. * @ctl: control pointer associated with dspp/lm.
  516. * @last_feature: last feature that will be set.
  517. * @num_of_mixers: number of layer mixers for the display.
  518. * @mixer_info: mixer info pointer associated with lm.
  519. * @displayv: height of the display.
  520. * @displayh: width of the display.
  521. * @dspp[DSPP_MAX]: array of hw_dspp pointers associated with crtc.
  522. * @broadcast_disabled: flag indicating if broadcast should be avoided when
  523. * using LUTDMA
  524. * @panel_height: height of display panel in pixels.
  525. * @panel_width: width of display panel in pixels.
  526. * @valid_skip_blend_plane: true if skip plane params are valid
  527. * @skip_blend_plane: plane which has been skipped staging into layer mixer
  528. * @skip_blend_plane_w: skip plane width
  529. * @skip_blend_plane_h: skip plane height
  530. */
  531. struct sde_hw_cp_cfg {
  532. void *payload;
  533. u32 len;
  534. void *ctl;
  535. u32 last_feature;
  536. u32 num_of_mixers;
  537. void *mixer_info;
  538. u32 displayv;
  539. u32 displayh;
  540. struct sde_hw_dspp *dspp[DSPP_MAX];
  541. bool broadcast_disabled;
  542. u32 panel_height;
  543. u32 panel_width;
  544. bool valid_skip_blend_plane;
  545. enum sde_sspp skip_blend_plane;
  546. u32 skip_blend_plane_w;
  547. u32 skip_blend_plane_h;
  548. };
  549. /**
  550. * struct sde_hw_dim_layer: dim layer configs
  551. * @flags: Flag to represent INCLUSIVE/EXCLUSIVE
  552. * @stage: Blending stage of dim layer
  553. * @color_fill: Color fill to be used for the layer
  554. * @rect: Dim layer coordinates
  555. */
  556. struct sde_hw_dim_layer {
  557. uint32_t flags;
  558. uint32_t stage;
  559. struct sde_mdss_color color_fill;
  560. struct sde_rect rect;
  561. };
  562. /**
  563. * struct sde_splash_mem - Struct contains splah memory info
  564. * @splash_buf_size: Indicates the size of the memory region
  565. * @splash_buf_base: Address of specific splash memory region
  566. * @ramdump_size: Size of ramdump buffer region
  567. * @ramdump_base: Address of ramdump region reserved by bootloader
  568. * @ref_cnt: Tracks the map count to help in sharing splash memory
  569. */
  570. struct sde_splash_mem {
  571. u32 splash_buf_size;
  572. unsigned long splash_buf_base;
  573. u32 ramdump_size;
  574. unsigned long ramdump_base;
  575. u32 ref_cnt;
  576. };
  577. /**
  578. * struct sde_sspp_index_info - Struct informing which pipes are staged on
  579. * particular display
  580. * @pipes: bitmap, bit index is true if rect_0 of that pipe is staged,
  581. * else is false
  582. * @virt_pipes: bitmap, bit index is true if rect_1 of that pipe is staged,
  583. * else set to false
  584. * @bordercolor: True if border color is enabled
  585. */
  586. struct sde_sspp_index_info {
  587. DECLARE_BITMAP(pipes, SSPP_MAX);
  588. DECLARE_BITMAP(virt_pipes, SSPP_MAX);
  589. bool bordercolor;
  590. };
  591. /**
  592. * struct sde_splash_data - Struct contains details of resources and hw blocks
  593. * used in continuous splash on a specific display.
  594. * @cont_splash_enabled: Stores the cont_splash status (enabled/disabled)
  595. * @encoder: Pointer to the drm encoder object used for this display
  596. * @splash: Pointer to struct sde_splash_mem used for this display
  597. * @demura: Pointer to struct sde_splash_mem used for demura cont splash
  598. * @ctl_ids: Stores the valid MDSS ctl block ids for the current mode
  599. * @lm_ids: Stores the valid MDSS layer mixer block ids for the current mode
  600. * @dsc_ids: Stores the valid MDSS DSC block ids for the current mode
  601. * @vdc_ids: Stores the valid MDSS VDC block ids for the current mode
  602. * @pipes: Array of sspp info detected on this display
  603. * @ctl_cnt: Stores the active number of MDSS "top" blks of the current mode
  604. * @lm_cnt: Stores the active number of MDSS "LM" blks for the current mode
  605. * @dsc_cnt: Stores the active number of MDSS "dsc" blks for the current mode
  606. * @vdc_cnt: Stores the valid MDSS VDC block ids for the current mode
  607. */
  608. struct sde_splash_display {
  609. bool cont_splash_enabled;
  610. struct drm_encoder *encoder;
  611. struct sde_splash_mem *splash;
  612. struct sde_splash_mem *demura;
  613. u8 ctl_ids[MAX_DATA_PATH_PER_DSIPLAY];
  614. u8 lm_ids[MAX_DATA_PATH_PER_DSIPLAY];
  615. u8 dsc_ids[MAX_DATA_PATH_PER_DSIPLAY];
  616. u8 vdc_ids[MAX_DATA_PATH_PER_DSIPLAY];
  617. struct sde_sspp_index_info pipe_info;
  618. u8 ctl_cnt;
  619. u8 lm_cnt;
  620. u8 dsc_cnt;
  621. u8 vdc_cnt;
  622. };
  623. enum sde_handoff_type {
  624. SDE_SPLASH_HANDOFF,
  625. SDE_VM_HANDOFF,
  626. };
  627. /**
  628. * struct sde_splash_data - Struct contains details of continuous splash
  629. * for all the displays connected by probe time
  630. * @type: Indicates the type of handoff
  631. * @num_splash_regions: Indicates number of splash memory regions from dtsi
  632. * @num_splash_displays: Indicates count of active displays in continuous splash
  633. * @splash_mem: Array of all struct sde_splash_mem listed from dtsi
  634. * @demura_mem: Array of all demura memory regions listed from dtsi
  635. * @splash_display: Array of all struct sde_splash_display
  636. */
  637. struct sde_splash_data {
  638. enum sde_handoff_type type;
  639. u32 num_splash_regions;
  640. u32 num_splash_displays;
  641. struct sde_splash_mem splash_mem[MAX_DSI_DISPLAYS];
  642. struct sde_splash_mem demura_mem[MAX_DSI_DISPLAYS];
  643. struct sde_splash_display splash_display[MAX_DSI_DISPLAYS];
  644. };
  645. /**
  646. * struct sde_hw_tear_check - Struct contains parameters to configure
  647. * tear-effect module. This structure is used to configure tear-check
  648. * logic present either in ping-pong or in interface module.
  649. * @vsync_count: Ratio of MDP VSYNC clk freq(Hz) to refresh rate divided
  650. * by no of lines
  651. * @sync_cfg_height: Total vertical lines (display height - 1)
  652. * @vsync_init_val: Init value to which the read pointer gets loaded at
  653. * vsync edge
  654. * @sync_threshold_start: Read pointer threshold start ROI for write operation
  655. * @sync_threshold_continue: The minimum number of lines the write pointer
  656. * needs to be above the read pointer
  657. * @start_pos: The position from which the start_threshold value is added
  658. * @rd_ptr_irq: The read pointer line at which interrupt has to be generated
  659. * @wr_ptr_irq: The write pointer line at which interrupt has to be generated
  660. * @hw_vsync_mode: Sync with external frame sync input
  661. */
  662. struct sde_hw_tear_check {
  663. u32 vsync_count;
  664. u32 sync_cfg_height;
  665. u32 vsync_init_val;
  666. u32 sync_threshold_start;
  667. u32 sync_threshold_continue;
  668. u32 start_pos;
  669. u32 rd_ptr_irq;
  670. u32 wr_ptr_irq;
  671. u8 hw_vsync_mode;
  672. };
  673. /**
  674. * struct sde_hw_autorefresh - Struct contains parameters to configure
  675. * auto-refresh mode for command mode panels
  676. * @enable: Enalbe or disable the auto-refresh mode
  677. * @frame_count: Auto-refresh frame counter at which update occurs
  678. */
  679. struct sde_hw_autorefresh {
  680. bool enable;
  681. u32 frame_count;
  682. };
  683. /**
  684. * struct sde_hw_pp_vsync_info - Struct contains parameters to configure
  685. * read and write pointers for command mode panels
  686. * @pp_idx: Ping-pong block index
  687. * @intf_idx: Interface block index
  688. * @rd_ptr_init_val: Value of rd pointer at vsync edge
  689. * @rd_ptr_frame_count: num frames sent since enabling interface
  690. * @rd_ptr_line_count: current line on panel (rd ptr)
  691. * @wr_ptr_line_count: current line within pp fifo (wr ptr)
  692. * @intf_frame_count: num frames read from intf
  693. */
  694. struct sde_hw_pp_vsync_info {
  695. u32 pp_idx;
  696. u32 intf_idx;
  697. u32 rd_ptr_init_val;
  698. u32 rd_ptr_frame_count;
  699. u32 rd_ptr_line_count;
  700. u32 wr_ptr_line_count;
  701. u32 intf_frame_count;
  702. };
  703. /**
  704. * struct sde_hw_noise_layer_cfg: Payload to enable/disable noise blend
  705. * @flags: operation control flags, for future use
  706. * @noise_blend_stage: blend stage required for noise layer
  707. * @attn_blend_stage: blend stage required for attn layer
  708. * @attn_factor: factor in range of 1 to 255
  709. * @stength: strength in range of 0 to 6
  710. * @alpha_noise: factor in range of 1 to 255
  711. */
  712. struct sde_hw_noise_layer_cfg {
  713. u64 flags;
  714. u32 noise_blend_stage;
  715. u32 attn_blend_stage;
  716. u32 attn_factor;
  717. u32 strength;
  718. u32 alpha_noise;
  719. };
  720. #endif /* _SDE_HW_MDSS_H */