sde_hw_sspp.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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_SSPP_H
  6. #define _SDE_HW_SSPP_H
  7. #include "sde_hw_catalog.h"
  8. #include "sde_hw_mdss.h"
  9. #include "sde_hw_util.h"
  10. #include "sde_reg_dma.h"
  11. #include "sde_hw_blk.h"
  12. #include "sde_formats.h"
  13. #include "sde_color_processing.h"
  14. struct sde_hw_pipe;
  15. /**
  16. * Flags
  17. */
  18. #define SDE_SSPP_SECURE_OVERLAY_SESSION 0x1
  19. #define SDE_SSPP_FLIP_LR 0x2
  20. #define SDE_SSPP_FLIP_UD 0x4
  21. #define SDE_SSPP_SOURCE_ROTATED_90 0x8
  22. #define SDE_SSPP_ROT_90 0x10
  23. #define SDE_SSPP_SOLID_FILL 0x20
  24. #define SDE_SSPP_RIGHT 0x40
  25. /**
  26. * Define all scaler feature bits in catalog
  27. */
  28. #define SDE_SSPP_SCALER ((1UL << SDE_SSPP_SCALER_RGB) | \
  29. (1UL << SDE_SSPP_SCALER_QSEED2) | \
  30. (1UL << SDE_SSPP_SCALER_QSEED3) | \
  31. (1UL << SDE_SSPP_SCALER_QSEED3LITE))
  32. /**
  33. * Component indices
  34. */
  35. enum {
  36. SDE_SSPP_COMP_0,
  37. SDE_SSPP_COMP_1_2,
  38. SDE_SSPP_COMP_2,
  39. SDE_SSPP_COMP_3,
  40. SDE_SSPP_COMP_MAX
  41. };
  42. /**
  43. * SDE_SSPP_RECT_SOLO - multirect disabled
  44. * SDE_SSPP_RECT_0 - rect0 of a multirect pipe
  45. * SDE_SSPP_RECT_1 - rect1 of a multirect pipe
  46. * SDE_SSPP_RECT_MAX - max enum of multirect pipe
  47. *
  48. * Note: HW supports multirect with either RECT0 or
  49. * RECT1. Considering no benefit of such configs over
  50. * SOLO mode and to keep the plane management simple,
  51. * we dont support single rect multirect configs.
  52. */
  53. enum sde_sspp_multirect_index {
  54. SDE_SSPP_RECT_SOLO = 0,
  55. SDE_SSPP_RECT_0,
  56. SDE_SSPP_RECT_1,
  57. SDE_SSPP_RECT_MAX,
  58. };
  59. enum sde_sspp_multirect_mode {
  60. SDE_SSPP_MULTIRECT_NONE = 0,
  61. SDE_SSPP_MULTIRECT_PARALLEL,
  62. SDE_SSPP_MULTIRECT_TIME_MX,
  63. };
  64. enum {
  65. SDE_FRAME_LINEAR,
  66. SDE_FRAME_TILE_A4X,
  67. SDE_FRAME_TILE_A5X,
  68. };
  69. enum sde_hw_filter {
  70. SDE_SCALE_FILTER_NEAREST = 0,
  71. SDE_SCALE_FILTER_BIL,
  72. SDE_SCALE_FILTER_PCMN,
  73. SDE_SCALE_FILTER_CA,
  74. SDE_SCALE_FILTER_MAX
  75. };
  76. enum sde_hw_filter_alpa {
  77. SDE_SCALE_ALPHA_PIXEL_REP,
  78. SDE_SCALE_ALPHA_BIL
  79. };
  80. enum sde_hw_filter_yuv {
  81. SDE_SCALE_2D_4X4,
  82. SDE_SCALE_2D_CIR,
  83. SDE_SCALE_1D_SEP,
  84. SDE_SCALE_BIL
  85. };
  86. struct sde_hw_sharp_cfg {
  87. u32 strength;
  88. u32 edge_thr;
  89. u32 smooth_thr;
  90. u32 noise_thr;
  91. };
  92. struct sde_hw_pixel_ext {
  93. /* scaling factors are enabled for this input layer */
  94. uint8_t enable_pxl_ext;
  95. int init_phase_x[SDE_MAX_PLANES];
  96. int phase_step_x[SDE_MAX_PLANES];
  97. int init_phase_y[SDE_MAX_PLANES];
  98. int phase_step_y[SDE_MAX_PLANES];
  99. /*
  100. * Number of pixels extension in left, right, top and bottom direction
  101. * for all color components. This pixel value for each color component
  102. * should be sum of fetch + repeat pixels.
  103. */
  104. int num_ext_pxls_left[SDE_MAX_PLANES];
  105. int num_ext_pxls_right[SDE_MAX_PLANES];
  106. int num_ext_pxls_top[SDE_MAX_PLANES];
  107. int num_ext_pxls_btm[SDE_MAX_PLANES];
  108. /*
  109. * Number of pixels needs to be overfetched in left, right, top and
  110. * bottom directions from source image for scaling.
  111. */
  112. int left_ftch[SDE_MAX_PLANES];
  113. int right_ftch[SDE_MAX_PLANES];
  114. int top_ftch[SDE_MAX_PLANES];
  115. int btm_ftch[SDE_MAX_PLANES];
  116. /*
  117. * Number of pixels needs to be repeated in left, right, top and
  118. * bottom directions for scaling.
  119. */
  120. int left_rpt[SDE_MAX_PLANES];
  121. int right_rpt[SDE_MAX_PLANES];
  122. int top_rpt[SDE_MAX_PLANES];
  123. int btm_rpt[SDE_MAX_PLANES];
  124. uint32_t roi_w[SDE_MAX_PLANES];
  125. uint32_t roi_h[SDE_MAX_PLANES];
  126. /*
  127. * Filter type to be used for scaling in horizontal and vertical
  128. * directions
  129. */
  130. enum sde_hw_filter horz_filter[SDE_MAX_PLANES];
  131. enum sde_hw_filter vert_filter[SDE_MAX_PLANES];
  132. };
  133. /**
  134. * struct sde_hw_pipe_cfg : Pipe description
  135. * @layout: format layout information for programming buffer to hardware
  136. * @src_rect: src ROI, caller takes into account the different operations
  137. * such as decimation, flip etc to program this field
  138. * @dest_rect: destination ROI.
  139. * @ horz_decimation : horizontal decimation factor( 0, 2, 4, 8, 16)
  140. * @ vert_decimation : vertical decimation factor( 0, 2, 4, 8, 16)
  141. * 2: Read 1 line/pixel drop 1 line/pixel
  142. * 4: Read 1 line/pixel drop 3 lines/pixels
  143. * 8: Read 1 line/pixel drop 7 lines/pixels
  144. * 16: Read 1 line/pixel drop 15 line/pixels
  145. */
  146. struct sde_hw_pipe_cfg {
  147. struct sde_hw_fmt_layout layout;
  148. struct sde_rect src_rect;
  149. struct sde_rect dst_rect;
  150. u8 horz_decimation;
  151. u8 vert_decimation;
  152. };
  153. /**
  154. * struct sde_hw_pipe_qos_cfg : Source pipe QoS configuration
  155. * @danger_lut: LUT for generate danger level based on fill level
  156. * @safe_lut: LUT for generate safe level based on fill level
  157. * @creq_lut: LUT for generate creq level based on fill level
  158. * @creq_vblank: creq value generated to vbif during vertical blanking
  159. * @danger_vblank: danger value generated during vertical blanking
  160. * @vblank_en: enable creq_vblank and danger_vblank during vblank
  161. * @danger_safe_en: enable danger safe generation
  162. */
  163. struct sde_hw_pipe_qos_cfg {
  164. u32 danger_lut;
  165. u32 safe_lut;
  166. u64 creq_lut;
  167. u32 creq_vblank;
  168. u32 danger_vblank;
  169. bool vblank_en;
  170. bool danger_safe_en;
  171. };
  172. /**
  173. * enum CDP preload ahead address size
  174. */
  175. enum {
  176. SDE_SSPP_CDP_PRELOAD_AHEAD_32,
  177. SDE_SSPP_CDP_PRELOAD_AHEAD_64
  178. };
  179. /**
  180. * struct sde_hw_pipe_cdp_cfg : CDP configuration
  181. * @enable: true to enable CDP
  182. * @ubwc_meta_enable: true to enable ubwc metadata preload
  183. * @tile_amortize_enable: true to enable amortization control for tile format
  184. * @preload_ahead: number of request to preload ahead
  185. * SDE_SSPP_CDP_PRELOAD_AHEAD_32,
  186. * SDE_SSPP_CDP_PRELOAD_AHEAD_64
  187. */
  188. struct sde_hw_pipe_cdp_cfg {
  189. bool enable;
  190. bool ubwc_meta_enable;
  191. bool tile_amortize_enable;
  192. u32 preload_ahead;
  193. };
  194. /**
  195. * enum system cache rotation operation mode
  196. */
  197. enum {
  198. SDE_PIPE_SC_OP_MODE_OFFLINE,
  199. SDE_PIPE_SC_OP_MODE_INLINE_SINGLE,
  200. SDE_PIPE_SC_OP_MODE_INLINE_LEFT,
  201. SDE_PIPE_SC_OP_MODE_INLINE_RIGHT,
  202. };
  203. /**
  204. * enum system cache read operation type
  205. */
  206. enum {
  207. SDE_PIPE_SC_RD_OP_TYPE_CACHEABLE,
  208. SDE_PIPE_SC_RD_OP_TYPE_RESERVED,
  209. SDE_PIPE_SC_RD_OP_TYPE_INVALIDATE,
  210. SDE_PIPE_SC_RD_OP_TYPE_EVICTION,
  211. };
  212. /**
  213. * struct sde_hw_pipe_sc_cfg - system cache configuration
  214. * @op_mode: rotation operating mode
  215. * @rd_en: system cache read enable
  216. * @rd_scid: system cache read block id
  217. * @rd_noallocate: system cache read no allocate attribute
  218. * @rd_op_type: system cache read operation type
  219. * @flags: dirty flags to change the configuration
  220. * @type: sys cache type
  221. */
  222. struct sde_hw_pipe_sc_cfg {
  223. u32 op_mode;
  224. bool rd_en;
  225. u32 rd_scid;
  226. bool rd_noallocate;
  227. u32 rd_op_type;
  228. u32 flags;
  229. enum sde_sys_cache_type type;
  230. };
  231. /**
  232. * struct sde_hw_pipe_uidle_cfg - uidle configuration
  233. * @enable: disables uidle
  234. * @fal_allowed_threshold: minimum fl to allow uidle
  235. * @fal10_exit_threshold: number of lines to indicate fal_10_exit is okay
  236. * @fal10_threshold: number of lines where fal_10_is okay
  237. * @fal1_threshold: number of lines where fal_1 is okay
  238. */
  239. struct sde_hw_pipe_uidle_cfg {
  240. u32 enable;
  241. u32 fal_allowed_threshold;
  242. u32 fal10_exit_threshold;
  243. u32 fal10_threshold;
  244. u32 fal1_threshold;
  245. };
  246. /**
  247. * struct sde_hw_pipe_ts_cfg - traffic shaper configuration
  248. * @size: size to prefill in bytes, or zero to disable
  249. * @time: time to prefill in usec, or zero to disable
  250. */
  251. struct sde_hw_pipe_ts_cfg {
  252. u64 size;
  253. u64 time;
  254. };
  255. /**
  256. * Maximum number of stream buffer plane
  257. */
  258. #define SDE_PIPE_SBUF_PLANE_NUM 2
  259. /**
  260. * struct sde_hw_sspp_ops - interface to the SSPP Hw driver functions
  261. * Caller must call the init function to get the pipe context for each pipe
  262. * Assumption is these functions will be called after clocks are enabled
  263. */
  264. struct sde_hw_sspp_ops {
  265. /**
  266. * setup_format - setup pixel format cropping rectangle, flip
  267. * @ctx: Pointer to pipe context
  268. * @fmt: Pointer to sde_format structure
  269. * @blend_enabled: flag indicating blend enabled or disabled on plane
  270. * @flags: Extra flags for format config
  271. * @index: rectangle index in multirect
  272. */
  273. void (*setup_format)(struct sde_hw_pipe *ctx,
  274. const struct sde_format *fmt,
  275. bool blend_enabled, u32 flags,
  276. enum sde_sspp_multirect_index index);
  277. /**
  278. * setup_rects - setup pipe ROI rectangles
  279. * @ctx: Pointer to pipe context
  280. * @cfg: Pointer to pipe config structure
  281. * @index: rectangle index in multirect
  282. */
  283. void (*setup_rects)(struct sde_hw_pipe *ctx,
  284. struct sde_hw_pipe_cfg *cfg,
  285. enum sde_sspp_multirect_index index);
  286. /**
  287. * setup_pe - setup pipe pixel extension
  288. * @ctx: Pointer to pipe context
  289. * @pe_ext: Pointer to pixel ext settings
  290. */
  291. void (*setup_pe)(struct sde_hw_pipe *ctx,
  292. struct sde_hw_pixel_ext *pe_ext);
  293. /**
  294. * setup_excl_rect - setup pipe exclusion rectangle
  295. * @ctx: Pointer to pipe context
  296. * @excl_rect: Pointer to exclclusion rect structure
  297. * @index: rectangle index in multirect
  298. */
  299. void (*setup_excl_rect)(struct sde_hw_pipe *ctx,
  300. struct sde_rect *excl_rect,
  301. enum sde_sspp_multirect_index index);
  302. /**
  303. * setup_sourceaddress - setup pipe source addresses
  304. * @ctx: Pointer to pipe context
  305. * @cfg: Pointer to pipe config structure
  306. * @index: rectangle index in multirect
  307. */
  308. void (*setup_sourceaddress)(struct sde_hw_pipe *ctx,
  309. struct sde_hw_pipe_cfg *cfg,
  310. enum sde_sspp_multirect_index index);
  311. /* get_sourceaddress - get pipe current source addresses of a plane
  312. * @ctx: Pointer to pipe context
  313. * @is_virtual: If true get address programmed for R1 in multirect
  314. */
  315. u32 (*get_sourceaddress)(struct sde_hw_pipe *ctx, bool is_virtual);
  316. /**
  317. * setup_csc - setup color space conversion
  318. * @ctx: Pointer to pipe context
  319. * @data: Pointer to config structure
  320. */
  321. void (*setup_csc)(struct sde_hw_pipe *ctx, struct sde_csc_cfg *data);
  322. /**
  323. * setup_solidfill - enable/disable colorfill
  324. * @ctx: Pointer to pipe context
  325. * @const_color: Fill color value
  326. * @flags: Pipe flags
  327. * @index: rectangle index in multirect
  328. */
  329. void (*setup_solidfill)(struct sde_hw_pipe *ctx, u32 color,
  330. enum sde_sspp_multirect_index index);
  331. /**
  332. * update_multirect - update multirect configuration
  333. * @ctx: Pointer to pipe context
  334. * @enable: Boolean to indicate enable or disable of given config
  335. * @index: rectangle index in multirect
  336. * @mode: parallel fetch / time multiplex multirect mode
  337. */
  338. void (*update_multirect)(struct sde_hw_pipe *ctx,
  339. bool enable,
  340. enum sde_sspp_multirect_index index,
  341. enum sde_sspp_multirect_mode mode);
  342. /**
  343. * setup_sharpening - setup sharpening
  344. * @ctx: Pointer to pipe context
  345. * @cfg: Pointer to config structure
  346. */
  347. void (*setup_sharpening)(struct sde_hw_pipe *ctx,
  348. struct sde_hw_sharp_cfg *cfg);
  349. /**
  350. * setup_pa_hue(): Setup source hue adjustment
  351. * @ctx: Pointer to pipe context
  352. * @cfg: Pointer to hue data
  353. */
  354. void (*setup_pa_hue)(struct sde_hw_pipe *ctx, void *cfg);
  355. /**
  356. * setup_pa_sat(): Setup source saturation adjustment
  357. * @ctx: Pointer to pipe context
  358. * @cfg: Pointer to saturation data
  359. */
  360. void (*setup_pa_sat)(struct sde_hw_pipe *ctx, void *cfg);
  361. /**
  362. * setup_pa_val(): Setup source value adjustment
  363. * @ctx: Pointer to pipe context
  364. * @cfg: Pointer to value data
  365. */
  366. void (*setup_pa_val)(struct sde_hw_pipe *ctx, void *cfg);
  367. /**
  368. * setup_pa_cont(): Setup source contrast adjustment
  369. * @ctx: Pointer to pipe context
  370. * @cfg: Pointer contrast data
  371. */
  372. void (*setup_pa_cont)(struct sde_hw_pipe *ctx, void *cfg);
  373. /**
  374. * setup_pa_memcolor - setup source color processing
  375. * @ctx: Pointer to pipe context
  376. * @type: Memcolor type (Skin, sky or foliage)
  377. * @cfg: Pointer to memory color config data
  378. */
  379. void (*setup_pa_memcolor)(struct sde_hw_pipe *ctx,
  380. enum sde_memcolor_type type, void *cfg);
  381. /**
  382. * setup_vig_gamut - setup 3D LUT Gamut in VIG pipes
  383. * @ctx: Pointer to pipe context
  384. * @cfg: Pointer to vig gamut data
  385. */
  386. void (*setup_vig_gamut)(struct sde_hw_pipe *ctx, void *cfg);
  387. /**
  388. * setup_vig_igc - setup 1D LUT IGC in VIG pipes
  389. * @ctx: Pointer to pipe context
  390. * @cfg: Pointer to vig igc data
  391. */
  392. void (*setup_vig_igc)(struct sde_hw_pipe *ctx, void *cfg);
  393. /**
  394. * setup_dma_igc - setup 1D LUT IGC in DMA pipes
  395. * @ctx: Pointer to pipe context
  396. * @cfg: Pointer to dma igc data
  397. * @idx: multirect index
  398. */
  399. void (*setup_dma_igc)(struct sde_hw_pipe *ctx, void *cfg,
  400. enum sde_sspp_multirect_index idx);
  401. /**
  402. * setup_dma_gc - setup 1D LUT GC in DMA pipes
  403. * @ctx: Pointer to pipe context
  404. * @cfg: Pointer to dma gc data
  405. * @idx: multirect index
  406. */
  407. void (*setup_dma_gc)(struct sde_hw_pipe *ctx, void *cfg,
  408. enum sde_sspp_multirect_index idx);
  409. /**
  410. * setup_qos_lut - setup danger, safe, creq LUTs
  411. * @ctx: Pointer to pipe context
  412. * @cfg: Pointer to pipe QoS configuration
  413. *
  414. */
  415. void (*setup_qos_lut)(struct sde_hw_pipe *ctx,
  416. struct sde_hw_pipe_qos_cfg *cfg);
  417. /**
  418. * setup_qos_ctrl - setup QoS control
  419. * @ctx: Pointer to pipe context
  420. * @cfg: Pointer to pipe QoS configuration
  421. *
  422. */
  423. void (*setup_qos_ctrl)(struct sde_hw_pipe *ctx,
  424. struct sde_hw_pipe_qos_cfg *cfg);
  425. /**
  426. * setup_histogram - setup histograms
  427. * @ctx: Pointer to pipe context
  428. * @cfg: Pointer to histogram configuration
  429. */
  430. void (*setup_histogram)(struct sde_hw_pipe *ctx,
  431. void *cfg);
  432. /**
  433. * setup_scaler - setup scaler
  434. * @ctx: Pointer to pipe context
  435. * @pipe_cfg: Pointer to pipe configuration
  436. * @pe_cfg: Pointer to pixel extension configuration
  437. * @scaler_cfg: Pointer to scaler configuration
  438. */
  439. void (*setup_scaler)(struct sde_hw_pipe *ctx,
  440. struct sde_hw_pipe_cfg *pipe_cfg,
  441. struct sde_hw_pixel_ext *pe_cfg,
  442. void *scaler_cfg);
  443. /**
  444. * setup_scaler_lut - setup scaler lut
  445. * @buf: Defines structure for reg dma ops on the reg dma buffer.
  446. * @scaler3_cfg: QSEEDv3 configuration
  447. * @offset: Scaler Offset
  448. */
  449. void (*setup_scaler_lut)(struct sde_reg_dma_setup_ops_cfg *buf,
  450. struct sde_hw_scaler3_cfg *scaler3_cfg,
  451. u32 offset);
  452. /**
  453. * setup_pre_downscale - setup pre-downscaler for inline rotation
  454. * @ctx: Pointer to pipe context
  455. * @pre_down: Pointer to pre-downscaler configuration
  456. */
  457. void (*setup_pre_downscale)(struct sde_hw_pipe *ctx,
  458. struct sde_hw_inline_pre_downscale_cfg *pre_down);
  459. /**
  460. * setup_sys_cache - setup system cache configuration
  461. * @ctx: Pointer to pipe context
  462. * @cfg: Pointer to system cache configuration
  463. */
  464. void (*setup_sys_cache)(struct sde_hw_pipe *ctx,
  465. struct sde_hw_pipe_sc_cfg *cfg);
  466. /**
  467. * setup_uidle - set uidle configuration
  468. * @ctx: Pointer to pipe context
  469. * @cfg: Pointer to uidle configuration
  470. * @index: rectangle index in multirect
  471. */
  472. void (*setup_uidle)(struct sde_hw_pipe *ctx,
  473. struct sde_hw_pipe_uidle_cfg *cfg,
  474. enum sde_sspp_multirect_index index);
  475. /**
  476. * setup_ts_prefill - setup prefill traffic shaper
  477. * @ctx: Pointer to pipe context
  478. * @cfg: Pointer to traffic shaper configuration
  479. * @index: rectangle index in multirect
  480. */
  481. void (*setup_ts_prefill)(struct sde_hw_pipe *ctx,
  482. struct sde_hw_pipe_ts_cfg *cfg,
  483. enum sde_sspp_multirect_index index);
  484. /**
  485. * setup_cdp - setup client driven prefetch
  486. * @ctx: Pointer to pipe context
  487. * @cfg: Pointer to cdp configuration
  488. * @index: rectangle index in multirect
  489. */
  490. void (*setup_cdp)(struct sde_hw_pipe *ctx,
  491. struct sde_hw_pipe_cdp_cfg *cfg,
  492. enum sde_sspp_multirect_index index);
  493. /**
  494. * setup_secure_address - setup secureity status of the source address
  495. * @ctx: Pointer to pipe context
  496. * @index: rectangle index in multirect
  497. * @enable: enable content protected buffer state
  498. */
  499. void (*setup_secure_address)(struct sde_hw_pipe *ctx,
  500. enum sde_sspp_multirect_index index,
  501. bool enable);
  502. /**
  503. * set_src_split_order - setup source split order priority
  504. * @ctx: Pointer to pipe context
  505. * @index: rectangle index in multirect
  506. * @enable: enable src split order
  507. */
  508. void (*set_src_split_order)(struct sde_hw_pipe *ctx,
  509. enum sde_sspp_multirect_index index, bool enable);
  510. /**
  511. * setup_inverse_pma - enable/disable alpha unmultiply unit (PMA)
  512. * @ctx: Pointer to pipe context
  513. * @index: Rectangle index in multirect
  514. * @enable: PMA enable/disable settings
  515. */
  516. void (*setup_inverse_pma)(struct sde_hw_pipe *ctx,
  517. enum sde_sspp_multirect_index index, u32 enable);
  518. /**
  519. * setup_dgm_csc - setup DGM color space conversion block and update lut
  520. * @ctx: Pointer to pipe context
  521. * @index: Rectangle index in multirect
  522. * @data: Pointer to config structure
  523. */
  524. void (*setup_dgm_csc)(struct sde_hw_pipe *ctx,
  525. enum sde_sspp_multirect_index index, struct sde_csc_cfg *data);
  526. /**
  527. * clear_meta_error - clear the meta error-code registers
  528. * @ctx: Pointer to pipe context
  529. * @multirect_index: rec in use
  530. */
  531. void (*clear_meta_error)(struct sde_hw_pipe *ctx, uint32_t multirect_index);
  532. /**
  533. * get_meta_error - get the meta error-code
  534. * @ctx: Pointer to pipe context
  535. * @multirect_index: rec in use
  536. */
  537. u32 (*get_meta_error)(struct sde_hw_pipe *ctx, uint32_t multirect_index);
  538. /**
  539. * clear_ubwc_error - clear the ubwc error-code registers
  540. * @ctx: Pointer to pipe context
  541. * @multirect_index: rec in use
  542. */
  543. void (*clear_ubwc_error)(struct sde_hw_pipe *ctx, uint32_t multirect_index);
  544. /**
  545. * get_ubwc_error - get the ubwc error-code
  546. * @ctx: Pointer to pipe context
  547. * @multirect_index: rec in use
  548. */
  549. u32 (*get_ubwc_error)(struct sde_hw_pipe *ctx, uint32_t multirect_index);
  550. /**
  551. * setup_fp16_csc - set FP16 CSC cp block
  552. * @ctx: Pointer to pipe object
  553. * @index: Pipe rectangle to operate on
  554. * @data: Pointer to sde_hw_cp_cfg object holding drm_msm_fp16_csc data
  555. */
  556. void (*setup_fp16_csc)(struct sde_hw_pipe *ctx,
  557. enum sde_sspp_multirect_index index, void *data);
  558. /**
  559. * sde_setup_fp16_gcv1 - set FP16 GC cp block
  560. * @ctx: Pointer to pipe object
  561. * @index: Pipe rectangle to operate on
  562. * @data: Pointer to sde_hw_cp_cfg object holding drm_msm_fp16_gc data
  563. */
  564. void (*setup_fp16_gc)(struct sde_hw_pipe *ctx,
  565. enum sde_sspp_multirect_index index, void *data);
  566. /**
  567. * sde_setup_fp16_igcv1 - set FP16 IGC cp block
  568. * @ctx: Pointer to pipe object
  569. * @index: Pipe rectangle to operate on
  570. * @data: Pointer to sde_hw_cp_cfg object containing bool data
  571. */
  572. void (*setup_fp16_igc)(struct sde_hw_pipe *ctx,
  573. enum sde_sspp_multirect_index index, void *data);
  574. /**
  575. * sde_setup_fp16_unmultv1 - set FP16 UNMULT cp block
  576. * @ctx: Pointer to pipe object
  577. * @index: Pipe rectangle to operate on
  578. * @data: Pointer to sde_hw_cp_cfg object containing bool data
  579. */
  580. void (*setup_fp16_unmult)(struct sde_hw_pipe *ctx,
  581. enum sde_sspp_multirect_index index, void *data);
  582. };
  583. /**
  584. * struct sde_hw_pipe - pipe description
  585. * @base: hardware block base structure
  586. * @hw: block hardware details
  587. * @catalog: back pointer to catalog
  588. * @mdp: pointer to associated mdp portion of the catalog
  589. * @idx: pipe index
  590. * @cap: pointer to layer_cfg
  591. * @ops: pointer to operations possible for this pipe
  592. */
  593. struct sde_hw_pipe {
  594. struct sde_hw_blk base;
  595. struct sde_hw_blk_reg_map hw;
  596. struct sde_mdss_cfg *catalog;
  597. struct sde_mdp_cfg *mdp;
  598. /* Pipe */
  599. enum sde_sspp idx;
  600. struct sde_sspp_cfg *cap;
  601. /* Ops */
  602. struct sde_hw_sspp_ops ops;
  603. struct sde_hw_ctl *ctl;
  604. };
  605. /**
  606. * sde_hw_pipe - convert base object sde_hw_base to container
  607. * @hw: Pointer to base hardware block
  608. * return: Pointer to hardware block container
  609. */
  610. static inline struct sde_hw_pipe *to_sde_hw_pipe(struct sde_hw_blk *hw)
  611. {
  612. return container_of(hw, struct sde_hw_pipe, base);
  613. }
  614. /**
  615. * sde_hw_sspp_init - initializes the sspp hw driver object.
  616. * Should be called once before accessing every pipe.
  617. * @idx: Pipe index for which driver object is required
  618. * @addr: Mapped register io address of MDP
  619. * @catalog : Pointer to mdss catalog data
  620. * @is_virtual_pipe: is this pipe virtual pipe
  621. */
  622. struct sde_hw_pipe *sde_hw_sspp_init(enum sde_sspp idx,
  623. void __iomem *addr, struct sde_mdss_cfg *catalog,
  624. bool is_virtual_pipe);
  625. /**
  626. * sde_hw_sspp_destroy(): Destroys SSPP driver context
  627. * should be called during Hw pipe cleanup.
  628. * @ctx: Pointer to SSPP driver context returned by sde_hw_sspp_init
  629. */
  630. void sde_hw_sspp_destroy(struct sde_hw_pipe *ctx);
  631. #endif /*_SDE_HW_SSPP_H */