sde_hw_mdss.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  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_lm {
  142. LM_0 = 1,
  143. LM_1,
  144. LM_2,
  145. LM_3,
  146. LM_4,
  147. LM_5,
  148. LM_DCWB_DUMMY_0,
  149. LM_DCWB_DUMMY_1,
  150. LM_6,
  151. LM_MAX
  152. };
  153. enum sde_stage {
  154. SDE_STAGE_BASE = 0,
  155. SDE_STAGE_0,
  156. SDE_STAGE_1,
  157. SDE_STAGE_2,
  158. SDE_STAGE_3,
  159. SDE_STAGE_4,
  160. SDE_STAGE_5,
  161. SDE_STAGE_6,
  162. SDE_STAGE_7,
  163. SDE_STAGE_8,
  164. SDE_STAGE_9,
  165. SDE_STAGE_10,
  166. SDE_STAGE_MAX
  167. };
  168. enum sde_dspp {
  169. DSPP_0 = 1,
  170. DSPP_1,
  171. DSPP_2,
  172. DSPP_3,
  173. DSPP_MAX
  174. };
  175. enum sde_ltm {
  176. LTM_0 = DSPP_0,
  177. LTM_1,
  178. LTM_MAX
  179. };
  180. enum sde_rc {
  181. RC_0 = DSPP_0,
  182. RC_1,
  183. RC_MAX
  184. };
  185. enum sde_ds {
  186. DS_TOP,
  187. DS_0,
  188. DS_1,
  189. DS_MAX
  190. };
  191. enum sde_ctl {
  192. CTL_0 = 1,
  193. CTL_1,
  194. CTL_2,
  195. CTL_3,
  196. CTL_4,
  197. CTL_5,
  198. CTL_MAX
  199. };
  200. enum sde_cdm {
  201. CDM_0 = 1,
  202. CDM_1,
  203. CDM_MAX
  204. };
  205. enum sde_pingpong {
  206. PINGPONG_0 = 1,
  207. PINGPONG_1,
  208. PINGPONG_2,
  209. PINGPONG_3,
  210. PINGPONG_4,
  211. PINGPONG_5,
  212. PINGPONG_CWB_0,
  213. PINGPONG_CWB_1,
  214. PINGPONG_S0,
  215. PINGPONG_MAX
  216. };
  217. enum sde_dsc {
  218. DSC_NONE = 0,
  219. DSC_0,
  220. DSC_1,
  221. DSC_2,
  222. DSC_3,
  223. DSC_4,
  224. DSC_5,
  225. DSC_MAX
  226. };
  227. enum sde_vdc {
  228. VDC_NONE = 0,
  229. VDC_0,
  230. VDC_1,
  231. VDC_MAX
  232. };
  233. enum sde_intf {
  234. INTF_0 = 1,
  235. INTF_1,
  236. INTF_2,
  237. INTF_3,
  238. INTF_4,
  239. INTF_5,
  240. INTF_6,
  241. INTF_MAX
  242. };
  243. enum sde_intf_type {
  244. INTF_NONE = 0x0,
  245. INTF_DSI = 0x1,
  246. INTF_HDMI = 0x3,
  247. INTF_LCDC = 0x5,
  248. INTF_EDP = 0x9,
  249. INTF_DP = 0xa,
  250. INTF_TYPE_MAX,
  251. /* virtual interfaces */
  252. INTF_WB = 0x100,
  253. };
  254. enum sde_intf_mode {
  255. INTF_MODE_NONE = 0,
  256. INTF_MODE_CMD,
  257. INTF_MODE_VIDEO,
  258. INTF_MODE_WB_BLOCK,
  259. INTF_MODE_WB_LINE,
  260. INTF_MODE_MAX
  261. };
  262. enum sde_wb {
  263. WB_0 = 1,
  264. WB_1,
  265. WB_2,
  266. WB_3,
  267. WB_MAX
  268. };
  269. enum sde_ad {
  270. AD_0 = 0x1,
  271. AD_1,
  272. AD_MAX
  273. };
  274. enum sde_cwb {
  275. CWB_0 = 0x1,
  276. CWB_1,
  277. CWB_2,
  278. CWB_3,
  279. CWB_4,
  280. CWB_5,
  281. CWB_MAX
  282. };
  283. enum sde_dcwb {
  284. DCWB_0 = 0x1,
  285. DCWB_1,
  286. DCWB_MAX
  287. };
  288. enum sde_wd_timer {
  289. WD_TIMER_0 = 0x1,
  290. WD_TIMER_1,
  291. WD_TIMER_2,
  292. WD_TIMER_3,
  293. WD_TIMER_4,
  294. WD_TIMER_5,
  295. WD_TIMER_MAX
  296. };
  297. enum sde_vbif {
  298. VBIF_0,
  299. VBIF_1,
  300. VBIF_MAX,
  301. VBIF_RT = VBIF_0,
  302. VBIF_NRT = VBIF_1
  303. };
  304. enum sde_iommu_domain {
  305. SDE_IOMMU_DOMAIN_UNSECURE,
  306. SDE_IOMMU_DOMAIN_SECURE,
  307. SDE_IOMMU_DOMAIN_MAX
  308. };
  309. enum sde_rot {
  310. ROT_0 = 1,
  311. ROT_MAX
  312. };
  313. enum sde_merge_3d {
  314. MERGE_3D_0 = 1,
  315. MERGE_3D_1,
  316. MERGE_3D_2,
  317. MERGE_3D_CWB_0,
  318. MERGE_3D_MAX
  319. };
  320. enum sde_qdss {
  321. QDSS_0,
  322. QDSS_MAX
  323. };
  324. /**
  325. * SDE HW,Component order color map
  326. */
  327. enum {
  328. C0_G_Y = 0,
  329. C1_B_Cb = 1,
  330. C2_R_Cr = 2,
  331. C3_ALPHA = 3
  332. };
  333. /**
  334. * enum sde_plane_type - defines how the color component pixel packing
  335. * @SDE_PLANE_INTERLEAVED : Color components in single plane
  336. * @SDE_PLANE_PLANAR : Color component in separate planes
  337. * @SDE_PLANE_PSEUDO_PLANAR : Chroma components interleaved in separate plane
  338. */
  339. enum sde_plane_type {
  340. SDE_PLANE_INTERLEAVED,
  341. SDE_PLANE_PLANAR,
  342. SDE_PLANE_PSEUDO_PLANAR,
  343. };
  344. /**
  345. * enum sde_chroma_samp_type - chroma sub-samplng type
  346. * @SDE_CHROMA_RGB : No chroma subsampling
  347. * @SDE_CHROMA_H2V1 : Chroma pixels are horizontally subsampled
  348. * @SDE_CHROMA_H1V2 : Chroma pixels are vertically subsampled
  349. * @SDE_CHROMA_420 : 420 subsampling
  350. */
  351. enum sde_chroma_samp_type {
  352. SDE_CHROMA_RGB,
  353. SDE_CHROMA_H2V1,
  354. SDE_CHROMA_H1V2,
  355. SDE_CHROMA_420
  356. };
  357. /**
  358. * sde_fetch_type - Defines How SDE HW fetches data
  359. * @SDE_FETCH_LINEAR : fetch is line by line
  360. * @SDE_FETCH_TILE : fetches data in Z order from a tile
  361. * @SDE_FETCH_UBWC : fetch and decompress data
  362. */
  363. enum sde_fetch_type {
  364. SDE_FETCH_LINEAR,
  365. SDE_FETCH_TILE,
  366. SDE_FETCH_UBWC
  367. };
  368. /**
  369. * Value of enum chosen to fit the number of bits
  370. * expected by the HW programming.
  371. */
  372. enum {
  373. COLOR_ALPHA_1BIT = 0,
  374. COLOR_ALPHA_4BIT = 1,
  375. COLOR_4BIT = 0,
  376. COLOR_5BIT = 1, /* No 5-bit Alpha */
  377. COLOR_6BIT = 2, /* 6-Bit Alpha also = 2 */
  378. COLOR_8BIT = 3, /* 8-Bit Alpha also = 3 */
  379. COLOR_16BIT = 3,
  380. };
  381. /**
  382. * enum sde_3d_blend_mode
  383. * Desribes how the 3d data is blended
  384. * @BLEND_3D_NONE : 3d blending not enabled
  385. * @BLEND_3D_FRAME_INT : Frame interleaving
  386. * @BLEND_3D_H_ROW_INT : Horizontal row interleaving
  387. * @BLEND_3D_V_ROW_INT : vertical row interleaving
  388. * @BLEND_3D_COL_INT : column interleaving
  389. * @BLEND_3D_MAX :
  390. */
  391. enum sde_3d_blend_mode {
  392. BLEND_3D_NONE = 0,
  393. BLEND_3D_FRAME_INT,
  394. BLEND_3D_H_ROW_INT,
  395. BLEND_3D_V_ROW_INT,
  396. BLEND_3D_COL_INT,
  397. BLEND_3D_MAX
  398. };
  399. /** struct sde_format - defines the format configuration which
  400. * allows SDE HW to correctly fetch and decode the format
  401. * @base: base msm_format struture containing fourcc code
  402. * @fetch_planes: how the color components are packed in pixel format
  403. * @element: element color ordering
  404. * @bits: element bit widths
  405. * @chroma_sample: chroma sub-samplng type
  406. * @unpack_align_msb: unpack aligned, 0 to LSB, 1 to MSB
  407. * @unpack_tight: 0 for loose, 1 for tight
  408. * @unpack_count: 0 = 1 component, 1 = 2 component
  409. * @bpp: bytes per pixel
  410. * @alpha_enable: whether the format has an alpha channel
  411. * @num_planes: number of planes (including meta data planes)
  412. * @fetch_mode: linear, tiled, or ubwc hw fetch behavior
  413. * @is_yuv: is format a yuv variant
  414. * @flag: usage bit flags
  415. * @tile_width: format tile width
  416. * @tile_height: format tile height
  417. */
  418. struct sde_format {
  419. struct msm_format base;
  420. enum sde_plane_type fetch_planes;
  421. u8 element[SDE_MAX_PLANES];
  422. u8 bits[SDE_MAX_PLANES];
  423. enum sde_chroma_samp_type chroma_sample;
  424. u8 unpack_align_msb;
  425. u8 unpack_tight;
  426. u8 unpack_count;
  427. u8 bpp;
  428. u8 alpha_enable;
  429. u8 num_planes;
  430. enum sde_fetch_type fetch_mode;
  431. DECLARE_BITMAP(flag, SDE_FORMAT_FLAG_BIT_MAX);
  432. u16 tile_width;
  433. u16 tile_height;
  434. };
  435. #define to_sde_format(x) container_of(x, struct sde_format, base)
  436. /**
  437. * struct sde_hw_fmt_layout - format information of the source pixel data
  438. * @format: pixel format parameters
  439. * @num_planes: number of planes (including meta data planes)
  440. * @width: image width
  441. * @height: image height
  442. * @total_size: total size in bytes
  443. * @plane_addr: address of each plane
  444. * @plane_size: length of each plane
  445. * @plane_pitch: pitch of each plane
  446. */
  447. struct sde_hw_fmt_layout {
  448. const struct sde_format *format;
  449. uint32_t num_planes;
  450. uint32_t width;
  451. uint32_t height;
  452. uint32_t total_size;
  453. uint32_t plane_addr[SDE_MAX_PLANES];
  454. uint32_t plane_size[SDE_MAX_PLANES];
  455. uint32_t plane_pitch[SDE_MAX_PLANES];
  456. };
  457. struct sde_rect {
  458. u16 x;
  459. u16 y;
  460. u16 w;
  461. u16 h;
  462. };
  463. struct sde_csc_cfg {
  464. /* matrix coefficients in S15.16 format */
  465. uint32_t csc_mv[SDE_CSC_MATRIX_COEFF_SIZE];
  466. uint32_t csc_pre_bv[SDE_CSC_BIAS_SIZE];
  467. uint32_t csc_post_bv[SDE_CSC_BIAS_SIZE];
  468. uint32_t csc_pre_lv[SDE_CSC_CLAMP_SIZE];
  469. uint32_t csc_post_lv[SDE_CSC_CLAMP_SIZE];
  470. };
  471. /**
  472. * struct sde_mdss_color - mdss color description
  473. * color 0 : green
  474. * color 1 : blue
  475. * color 2 : red
  476. * color 3 : alpha
  477. */
  478. struct sde_mdss_color {
  479. u32 color_0;
  480. u32 color_1;
  481. u32 color_2;
  482. u32 color_3;
  483. };
  484. /*
  485. * Define bit masks for h/w logging.
  486. */
  487. #define SDE_DBG_MASK_NONE (1 << 0)
  488. #define SDE_DBG_MASK_CDM (1 << 1)
  489. #define SDE_DBG_MASK_DSPP (1 << 2)
  490. #define SDE_DBG_MASK_INTF (1 << 3)
  491. #define SDE_DBG_MASK_LM (1 << 4)
  492. #define SDE_DBG_MASK_CTL (1 << 5)
  493. #define SDE_DBG_MASK_PINGPONG (1 << 6)
  494. #define SDE_DBG_MASK_SSPP (1 << 7)
  495. #define SDE_DBG_MASK_WB (1 << 8)
  496. #define SDE_DBG_MASK_TOP (1 << 9)
  497. #define SDE_DBG_MASK_VBIF (1 << 10)
  498. #define SDE_DBG_MASK_DSC (1 << 11)
  499. #define SDE_DBG_MASK_ROT (1 << 12)
  500. #define SDE_DBG_MASK_DS (1 << 13)
  501. #define SDE_DBG_MASK_REGDMA (1 << 14)
  502. #define SDE_DBG_MASK_UIDLE (1 << 15)
  503. #define SDE_DBG_MASK_SID (1 << 15)
  504. #define SDE_DBG_MASK_QDSS (1 << 16)
  505. #define SDE_DBG_MASK_VDC (1 << 17)
  506. /**
  507. * struct sde_hw_cp_cfg: hardware dspp/lm feature payload.
  508. * @payload: Feature specific payload.
  509. * @len: Length of the payload.
  510. * @ctl: control pointer associated with dspp/lm.
  511. * @last_feature: last feature that will be set.
  512. * @num_of_mixers: number of layer mixers for the display.
  513. * @mixer_info: mixer info pointer associated with lm.
  514. * @displayv: height of the display.
  515. * @displayh: width of the display.
  516. * @dspp[DSPP_MAX]: array of hw_dspp pointers associated with crtc.
  517. * @broadcast_disabled: flag indicating if broadcast should be avoided when
  518. * using LUTDMA
  519. */
  520. struct sde_hw_cp_cfg {
  521. void *payload;
  522. u32 len;
  523. void *ctl;
  524. u32 last_feature;
  525. u32 num_of_mixers;
  526. void *mixer_info;
  527. u32 displayv;
  528. u32 displayh;
  529. struct sde_hw_dspp *dspp[DSPP_MAX];
  530. bool broadcast_disabled;
  531. };
  532. /**
  533. * struct sde_hw_dim_layer: dim layer configs
  534. * @flags: Flag to represent INCLUSIVE/EXCLUSIVE
  535. * @stage: Blending stage of dim layer
  536. * @color_fill: Color fill to be used for the layer
  537. * @rect: Dim layer coordinates
  538. */
  539. struct sde_hw_dim_layer {
  540. uint32_t flags;
  541. uint32_t stage;
  542. struct sde_mdss_color color_fill;
  543. struct sde_rect rect;
  544. };
  545. /**
  546. * struct sde_splash_mem - Struct contains splah memory info
  547. * @splash_buf_size: Indicates the size of the memory region
  548. * @splash_buf_base: Address of specific splash memory region
  549. * @ramdump_size: Size of ramdump buffer region
  550. * @ramdump_base: Address of ramdump region reserved by bootloader
  551. * @ref_cnt: Tracks the map count to help in sharing splash memory
  552. */
  553. struct sde_splash_mem {
  554. u32 splash_buf_size;
  555. unsigned long splash_buf_base;
  556. u32 ramdump_size;
  557. unsigned long ramdump_base;
  558. u32 ref_cnt;
  559. };
  560. /**
  561. * struct sde_sspp_index_info - Struct containing sspp identifier info
  562. * @sspp: Enum value indicates sspp id
  563. * @is_virtual: Boolean to identify if virtual or base
  564. */
  565. struct sde_sspp_index_info {
  566. enum sde_sspp sspp;
  567. bool is_virtual;
  568. };
  569. /**
  570. * struct sde_splash_data - Struct contains details of resources and hw blocks
  571. * used in continuous splash on a specific display.
  572. * @cont_splash_enabled: Stores the cont_splash status (enabled/disabled)
  573. * @encoder: Pointer to the drm encoder object used for this display
  574. * @splash: Pointer to struct sde_splash_mem used for this display
  575. * @ctl_ids: Stores the valid MDSS ctl block ids for the current mode
  576. * @lm_ids: Stores the valid MDSS layer mixer block ids for the current mode
  577. * @dsc_ids: Stores the valid MDSS DSC block ids for the current mode
  578. * @vdc_ids: Stores the valid MDSS VDC block ids for the current mode
  579. * @pipes: Array of sspp info detected on this display
  580. * @ctl_cnt: Stores the active number of MDSS "top" blks of the current mode
  581. * @lm_cnt: Stores the active number of MDSS "LM" blks for the current mode
  582. * @dsc_cnt: Stores the active number of MDSS "dsc" blks for the current mode
  583. * @vdc_cnt: Stores the valid MDSS VDC block ids for the current mode
  584. * @pipe_cnt: Stores the active number of "sspp" blks connected
  585. */
  586. struct sde_splash_display {
  587. bool cont_splash_enabled;
  588. struct drm_encoder *encoder;
  589. struct sde_splash_mem *splash;
  590. u8 ctl_ids[MAX_DATA_PATH_PER_DSIPLAY];
  591. u8 lm_ids[MAX_DATA_PATH_PER_DSIPLAY];
  592. u8 dsc_ids[MAX_DATA_PATH_PER_DSIPLAY];
  593. u8 vdc_ids[MAX_DATA_PATH_PER_DSIPLAY];
  594. struct sde_sspp_index_info pipes[MAX_DATA_PATH_PER_DSIPLAY];
  595. u8 ctl_cnt;
  596. u8 lm_cnt;
  597. u8 dsc_cnt;
  598. u8 vdc_cnt;
  599. u8 pipe_cnt;
  600. };
  601. enum sde_handoff_type {
  602. SDE_SPLASH_HANDOFF,
  603. SDE_VM_HANDOFF,
  604. };
  605. /**
  606. * struct sde_splash_data - Struct contains details of continuous splash
  607. * for all the displays connected by probe time
  608. * @type: Indicates the type of handoff
  609. * @num_splash_regions: Indicates number of splash memory regions from dtsi
  610. * @num_splash_displays: Indicates count of active displays in continuous splash
  611. * @splash_mem: Array of all struct sde_splash_mem listed from dtsi
  612. * @splash_display: Array of all struct sde_splash_display
  613. */
  614. struct sde_splash_data {
  615. enum sde_handoff_type type;
  616. u32 num_splash_regions;
  617. u32 num_splash_displays;
  618. struct sde_splash_mem splash_mem[MAX_DSI_DISPLAYS];
  619. struct sde_splash_display splash_display[MAX_DSI_DISPLAYS];
  620. };
  621. /**
  622. * struct sde_hw_tear_check - Struct contains parameters to configure
  623. * tear-effect module. This structure is used to configure tear-check
  624. * logic present either in ping-pong or in interface module.
  625. * @vsync_count: Ratio of MDP VSYNC clk freq(Hz) to refresh rate divided
  626. * by no of lines
  627. * @sync_cfg_height: Total vertical lines (display height - 1)
  628. * @vsync_init_val: Init value to which the read pointer gets loaded at
  629. * vsync edge
  630. * @sync_threshold_start: Read pointer threshold start ROI for write operation
  631. * @sync_threshold_continue: The minimum number of lines the write pointer
  632. * needs to be above the read pointer
  633. * @start_pos: The position from which the start_threshold value is added
  634. * @rd_ptr_irq: The read pointer line at which interrupt has to be generated
  635. * @wr_ptr_irq: The write pointer line at which interrupt has to be generated
  636. * @hw_vsync_mode: Sync with external frame sync input
  637. */
  638. struct sde_hw_tear_check {
  639. u32 vsync_count;
  640. u32 sync_cfg_height;
  641. u32 vsync_init_val;
  642. u32 sync_threshold_start;
  643. u32 sync_threshold_continue;
  644. u32 start_pos;
  645. u32 rd_ptr_irq;
  646. u32 wr_ptr_irq;
  647. u8 hw_vsync_mode;
  648. };
  649. /**
  650. * struct sde_hw_autorefresh - Struct contains parameters to configure
  651. * auto-refresh mode for command mode panels
  652. * @enable: Enalbe or disable the auto-refresh mode
  653. * @frame_count: Auto-refresh frame counter at which update occurs
  654. */
  655. struct sde_hw_autorefresh {
  656. bool enable;
  657. u32 frame_count;
  658. };
  659. /**
  660. * struct sde_hw_pp_vsync_info - Struct contains parameters to configure
  661. * read and write pointers for command mode panels
  662. * @pp_idx: Ping-pong block index
  663. * @intf_idx: Interface block index
  664. * @rd_ptr_init_val: Value of rd pointer at vsync edge
  665. * @rd_ptr_frame_count: num frames sent since enabling interface
  666. * @rd_ptr_line_count: current line on panel (rd ptr)
  667. * @wr_ptr_line_count: current line within pp fifo (wr ptr)
  668. * @intf_frame_count: num frames read from intf
  669. */
  670. struct sde_hw_pp_vsync_info {
  671. u32 pp_idx;
  672. u32 intf_idx;
  673. u32 rd_ptr_init_val;
  674. u32 rd_ptr_frame_count;
  675. u32 rd_ptr_line_count;
  676. u32 wr_ptr_line_count;
  677. u32 intf_frame_count;
  678. };
  679. /**
  680. * struct sde_hw_noise_layer_cfg: Payload to enable/disable noise blend
  681. * @flags: operation control flags, for future use
  682. * @zposn: zorder required for noise
  683. * @zposattn: zorder required for noise
  684. * @attn_factor: factor in range of 1 to 255
  685. * @stength: strength in range of 0 to 6
  686. * @alpha_noise: factor in range of 1 to 255
  687. */
  688. struct sde_hw_noise_layer_cfg {
  689. u64 flags;
  690. u32 zposn;
  691. u32 zposattn;
  692. u32 attn_factor;
  693. u32 strength;
  694. u32 alpha_noise;
  695. };
  696. #endif /* _SDE_HW_MDSS_H */