sde_hw_mdss.h 20 KB

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