sde_hw_mdss.h 21 KB

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