sde_hw_sspp.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  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_SSPP_H
  7. #define _SDE_HW_SSPP_H
  8. #include "sde_hw_catalog.h"
  9. #include "sde_hw_mdss.h"
  10. #include "sde_hw_util.h"
  11. #include "sde_reg_dma.h"
  12. #include "sde_formats.h"
  13. #include "sde_color_processing.h"
  14. #include "sde_hw_vbif.h"
  15. struct sde_hw_pipe;
  16. /**
  17. * Flags
  18. */
  19. #define SDE_SSPP_SECURE_OVERLAY_SESSION 0x1
  20. #define SDE_SSPP_FLIP_LR 0x2
  21. #define SDE_SSPP_FLIP_UD 0x4
  22. #define SDE_SSPP_SOURCE_ROTATED_90 0x8
  23. #define SDE_SSPP_ROT_90 0x10
  24. #define SDE_SSPP_SOLID_FILL 0x20
  25. #define SDE_SSPP_RIGHT 0x40
  26. /**
  27. * Define all scaler feature bits in catalog
  28. */
  29. #define SDE_SSPP_SCALER ((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. enum sde_sspp_ucsc_gc {
  87. UCSC_GC_MODE_DISABLE = 0,
  88. UCSC_GC_MODE_SRGB,
  89. UCSC_GC_MODE_PQ,
  90. UCSC_GC_MODE_GAMMA2_2,
  91. UCSC_GC_MODE_HLG,
  92. };
  93. enum sde_sspp_ucsc_igc {
  94. UCSC_IGC_MODE_DISABLE = 0,
  95. UCSC_IGC_MODE_SRGB,
  96. UCSC_IGC_MODE_REC709,
  97. UCSC_IGC_MODE_GAMMA2_2,
  98. UCSC_IGC_MODE_HLG,
  99. UCSC_IGC_MODE_PQ,
  100. };
  101. struct sde_hw_sharp_cfg {
  102. u32 strength;
  103. u32 edge_thr;
  104. u32 smooth_thr;
  105. u32 noise_thr;
  106. };
  107. struct sde_hw_pixel_ext {
  108. /* scaling factors are enabled for this input layer */
  109. uint8_t enable_pxl_ext;
  110. int init_phase_x[SDE_MAX_PLANES];
  111. int phase_step_x[SDE_MAX_PLANES];
  112. int init_phase_y[SDE_MAX_PLANES];
  113. int phase_step_y[SDE_MAX_PLANES];
  114. /*
  115. * Number of pixels extension in left, right, top and bottom direction
  116. * for all color components. This pixel value for each color component
  117. * should be sum of fetch + repeat pixels.
  118. */
  119. int num_ext_pxls_left[SDE_MAX_PLANES];
  120. int num_ext_pxls_right[SDE_MAX_PLANES];
  121. int num_ext_pxls_top[SDE_MAX_PLANES];
  122. int num_ext_pxls_btm[SDE_MAX_PLANES];
  123. /*
  124. * Number of pixels needs to be overfetched in left, right, top and
  125. * bottom directions from source image for scaling.
  126. */
  127. int left_ftch[SDE_MAX_PLANES];
  128. int right_ftch[SDE_MAX_PLANES];
  129. int top_ftch[SDE_MAX_PLANES];
  130. int btm_ftch[SDE_MAX_PLANES];
  131. /*
  132. * Number of pixels needs to be repeated in left, right, top and
  133. * bottom directions for scaling.
  134. */
  135. int left_rpt[SDE_MAX_PLANES];
  136. int right_rpt[SDE_MAX_PLANES];
  137. int top_rpt[SDE_MAX_PLANES];
  138. int btm_rpt[SDE_MAX_PLANES];
  139. uint32_t roi_w[SDE_MAX_PLANES];
  140. uint32_t roi_h[SDE_MAX_PLANES];
  141. /*
  142. * Filter type to be used for scaling in horizontal and vertical
  143. * directions
  144. */
  145. enum sde_hw_filter horz_filter[SDE_MAX_PLANES];
  146. enum sde_hw_filter vert_filter[SDE_MAX_PLANES];
  147. };
  148. /**
  149. * struct sde_hw_pipe_cfg : Pipe description
  150. * @layout: format layout information for programming buffer to hardware
  151. * @src_rect: src ROI, caller takes into account the different operations
  152. * such as decimation, flip etc to program this field
  153. * @dest_rect: destination ROI.
  154. * @ horz_decimation : horizontal decimation factor( 0, 2, 4, 8, 16)
  155. * @ vert_decimation : vertical decimation factor( 0, 2, 4, 8, 16)
  156. * 2: Read 1 line/pixel drop 1 line/pixel
  157. * 4: Read 1 line/pixel drop 3 lines/pixels
  158. * 8: Read 1 line/pixel drop 7 lines/pixels
  159. * 16: Read 1 line/pixel drop 15 line/pixels
  160. */
  161. struct sde_hw_pipe_cfg {
  162. struct sde_hw_fmt_layout layout;
  163. struct sde_rect src_rect;
  164. struct sde_rect dst_rect;
  165. u8 horz_decimation;
  166. u8 vert_decimation;
  167. };
  168. /**
  169. * struct sde_hw_pipe_qos_cfg : Source pipe QoS configuration
  170. * @danger_lut: LUT for generate danger level based on fill level
  171. * @safe_lut: LUT for generate safe level based on fill level
  172. * @creq_lut: LUT for generate creq level based on fill level
  173. * @creq_vblank: creq value generated to vbif during vertical blanking
  174. * @danger_vblank: danger value generated during vertical blanking
  175. * @vblank_en: enable creq_vblank and danger_vblank during vblank
  176. * @danger_safe_en: enable danger safe generation
  177. */
  178. struct sde_hw_pipe_qos_cfg {
  179. u32 danger_lut;
  180. u32 safe_lut;
  181. u64 creq_lut;
  182. u32 creq_vblank;
  183. u32 danger_vblank;
  184. bool vblank_en;
  185. bool danger_safe_en;
  186. };
  187. /**
  188. * enum CDP preload ahead address size
  189. */
  190. enum {
  191. SDE_SSPP_CDP_PRELOAD_AHEAD_32,
  192. SDE_SSPP_CDP_PRELOAD_AHEAD_64
  193. };
  194. /**
  195. * struct sde_hw_pipe_cdp_cfg : CDP configuration
  196. * @enable: true to enable CDP
  197. * @ubwc_meta_enable: true to enable ubwc metadata preload
  198. * @tile_amortize_enable: true to enable amortization control for tile format
  199. * @preload_ahead: number of request to preload ahead
  200. * SDE_SSPP_CDP_PRELOAD_AHEAD_32,
  201. * SDE_SSPP_CDP_PRELOAD_AHEAD_64
  202. */
  203. struct sde_hw_pipe_cdp_cfg {
  204. bool enable;
  205. bool ubwc_meta_enable;
  206. bool tile_amortize_enable;
  207. u32 preload_ahead;
  208. };
  209. /**
  210. * enum system cache rotation operation mode
  211. */
  212. enum {
  213. SDE_PIPE_SC_OP_MODE_OFFLINE,
  214. SDE_PIPE_SC_OP_MODE_INLINE_SINGLE,
  215. SDE_PIPE_SC_OP_MODE_INLINE_LEFT,
  216. SDE_PIPE_SC_OP_MODE_INLINE_RIGHT,
  217. };
  218. /**
  219. * enum system cache read operation type
  220. */
  221. enum {
  222. SDE_PIPE_SC_RD_OP_TYPE_CACHEABLE,
  223. SDE_PIPE_SC_RD_OP_TYPE_RESERVED,
  224. SDE_PIPE_SC_RD_OP_TYPE_INVALIDATE,
  225. SDE_PIPE_SC_RD_OP_TYPE_EVICTION,
  226. };
  227. /**
  228. * struct sde_hw_pipe_sc_cfg - system cache configuration
  229. * @op_mode: rotation operating mode
  230. * @rd_en: system cache read enable
  231. * @rd_scid: system cache read block id
  232. * @rd_noallocate: system cache read no allocate attribute
  233. * @rd_op_type: system cache read operation type
  234. * @flags: dirty flags to change the configuration
  235. * @type: sys cache type
  236. */
  237. struct sde_hw_pipe_sc_cfg {
  238. u32 op_mode;
  239. bool rd_en;
  240. u32 rd_scid;
  241. bool rd_noallocate;
  242. u32 rd_op_type;
  243. u32 flags;
  244. enum sde_sys_cache_type type;
  245. };
  246. /**
  247. * struct sde_hw_pipe_uidle_cfg - uidle configuration
  248. * @enable: disables uidle
  249. * @fal_allowed_threshold: minimum fl to allow uidle
  250. * @fal10_exit_threshold: number of lines to indicate fal_10_exit is okay
  251. * @fal10_threshold: number of lines where fal_10_is okay
  252. * @fal1_threshold: number of lines where fal_1 is okay
  253. * @fill_level_scale: scale factor on the fal10 threshold
  254. */
  255. struct sde_hw_pipe_uidle_cfg {
  256. u32 enable;
  257. u32 fal_allowed_threshold;
  258. u32 fal10_exit_threshold;
  259. u32 fal10_threshold;
  260. u32 fal1_threshold;
  261. u32 fill_level_scale;
  262. };
  263. /**
  264. * struct sde_hw_pipe_ts_cfg - traffic shaper configuration
  265. * @size: size to prefill in bytes, or zero to disable
  266. * @time: time to prefill in usec, or zero to disable
  267. */
  268. struct sde_hw_pipe_ts_cfg {
  269. u64 size;
  270. u64 time;
  271. };
  272. /**
  273. * Maximum number of stream buffer plane
  274. */
  275. #define SDE_PIPE_SBUF_PLANE_NUM 2
  276. /**
  277. * struct sde_hw_pipe_line_insertion_cfg - line insertion config
  278. * @enable: line insertion is enabled
  279. * @dummy_lines: dummy lines before active lines
  280. * @first_active_lines: number of active lines before first dummy lines
  281. * @active_lines: active lines
  282. * @dst_h: total active lines plus dummy lines
  283. */
  284. struct sde_hw_pipe_line_insertion_cfg {
  285. bool enable;
  286. u32 dummy_lines;
  287. u32 first_active_lines;
  288. u32 active_lines;
  289. u32 dst_h;
  290. };
  291. /**
  292. * struct sde_hw_sspp_ops - interface to the SSPP Hw driver functions
  293. * Caller must call the init function to get the pipe context for each pipe
  294. * Assumption is these functions will be called after clocks are enabled
  295. */
  296. struct sde_hw_sspp_ops {
  297. /**
  298. * setup_format - setup pixel format cropping rectangle, flip
  299. * @ctx: Pointer to pipe context
  300. * @fmt: Pointer to sde_format structure
  301. * @blend_enabled: flag indicating blend enabled or disabled on plane
  302. * @flags: Extra flags for format config
  303. * @index: rectangle index in multirect
  304. */
  305. void (*setup_format)(struct sde_hw_pipe *ctx,
  306. const struct sde_format *fmt,
  307. bool blend_enabled, u32 flags,
  308. enum sde_sspp_multirect_index index);
  309. /**
  310. * setup_rects - setup pipe ROI rectangles
  311. * @ctx: Pointer to pipe context
  312. * @cfg: Pointer to pipe config structure
  313. * @index: rectangle index in multirect
  314. */
  315. void (*setup_rects)(struct sde_hw_pipe *ctx,
  316. struct sde_hw_pipe_cfg *cfg,
  317. enum sde_sspp_multirect_index index);
  318. /**
  319. * setup_pe - setup pipe pixel extension
  320. * @ctx: Pointer to pipe context
  321. * @pe_ext: Pointer to pixel ext settings
  322. */
  323. void (*setup_pe)(struct sde_hw_pipe *ctx,
  324. struct sde_hw_pixel_ext *pe_ext);
  325. /**
  326. * setup_excl_rect - setup pipe exclusion rectangle
  327. * @ctx: Pointer to pipe context
  328. * @excl_rect: Pointer to exclclusion rect structure
  329. * @index: rectangle index in multirect
  330. */
  331. void (*setup_excl_rect)(struct sde_hw_pipe *ctx,
  332. struct sde_rect *excl_rect,
  333. enum sde_sspp_multirect_index index);
  334. /**
  335. * setup_sourceaddress - setup pipe source addresses
  336. * @ctx: Pointer to pipe context
  337. * @cfg: Pointer to pipe config structure
  338. * @index: rectangle index in multirect
  339. */
  340. void (*setup_sourceaddress)(struct sde_hw_pipe *ctx,
  341. struct sde_hw_pipe_cfg *cfg,
  342. enum sde_sspp_multirect_index index);
  343. /* get_sourceaddress - get pipe current source addresses of a plane
  344. * @ctx: Pointer to pipe context
  345. * @is_virtual: If true get address programmed for R1 in multirect
  346. */
  347. u32 (*get_sourceaddress)(struct sde_hw_pipe *ctx, bool is_virtual);
  348. /**
  349. * setup_csc - setup color space conversion
  350. * @ctx: Pointer to pipe context
  351. * @data: Pointer to config structure
  352. */
  353. void (*setup_csc)(struct sde_hw_pipe *ctx, struct sde_csc_cfg *data);
  354. /**
  355. * setup_solidfill - enable/disable colorfill
  356. * @ctx: Pointer to pipe context
  357. * @const_color: Fill color value
  358. * @flags: Pipe flags
  359. * @index: rectangle index in multirect
  360. */
  361. void (*setup_solidfill)(struct sde_hw_pipe *ctx, u32 color,
  362. enum sde_sspp_multirect_index index);
  363. /**
  364. * update_multirect - update multirect configuration
  365. * @ctx: Pointer to pipe context
  366. * @enable: Boolean to indicate enable or disable of given config
  367. * @index: rectangle index in multirect
  368. * @mode: parallel fetch / time multiplex multirect mode
  369. */
  370. void (*update_multirect)(struct sde_hw_pipe *ctx,
  371. bool enable,
  372. enum sde_sspp_multirect_index index,
  373. enum sde_sspp_multirect_mode mode);
  374. /**
  375. * setup_sharpening - setup sharpening
  376. * @ctx: Pointer to pipe context
  377. * @cfg: Pointer to config structure
  378. */
  379. void (*setup_sharpening)(struct sde_hw_pipe *ctx,
  380. struct sde_hw_sharp_cfg *cfg);
  381. /**
  382. * setup_pa_hue(): Setup source hue adjustment
  383. * @ctx: Pointer to pipe context
  384. * @cfg: Pointer to hue data
  385. */
  386. void (*setup_pa_hue)(struct sde_hw_pipe *ctx, void *cfg);
  387. /**
  388. * setup_pa_sat(): Setup source saturation adjustment
  389. * @ctx: Pointer to pipe context
  390. * @cfg: Pointer to saturation data
  391. */
  392. void (*setup_pa_sat)(struct sde_hw_pipe *ctx, void *cfg);
  393. /**
  394. * setup_pa_val(): Setup source value adjustment
  395. * @ctx: Pointer to pipe context
  396. * @cfg: Pointer to value data
  397. */
  398. void (*setup_pa_val)(struct sde_hw_pipe *ctx, void *cfg);
  399. /**
  400. * setup_pa_cont(): Setup source contrast adjustment
  401. * @ctx: Pointer to pipe context
  402. * @cfg: Pointer contrast data
  403. */
  404. void (*setup_pa_cont)(struct sde_hw_pipe *ctx, void *cfg);
  405. /**
  406. * setup_pa_memcolor - setup source color processing
  407. * @ctx: Pointer to pipe context
  408. * @type: Memcolor type (Skin, sky or foliage)
  409. * @cfg: Pointer to memory color config data
  410. */
  411. void (*setup_pa_memcolor)(struct sde_hw_pipe *ctx,
  412. enum sde_memcolor_type type, void *cfg);
  413. /**
  414. * setup_vig_gamut - setup 3D LUT Gamut in VIG pipes
  415. * @ctx: Pointer to pipe context
  416. * @cfg: Pointer to vig gamut data
  417. */
  418. void (*setup_vig_gamut)(struct sde_hw_pipe *ctx, void *cfg);
  419. /**
  420. * setup_vig_igc - setup 1D LUT IGC in VIG pipes
  421. * @ctx: Pointer to pipe context
  422. * @cfg: Pointer to vig igc data
  423. */
  424. void (*setup_vig_igc)(struct sde_hw_pipe *ctx, void *cfg);
  425. /**
  426. * setup_dma_igc - setup 1D LUT IGC in DMA pipes
  427. * @ctx: Pointer to pipe context
  428. * @cfg: Pointer to dma igc data
  429. * @idx: multirect index
  430. */
  431. void (*setup_dma_igc)(struct sde_hw_pipe *ctx, void *cfg,
  432. enum sde_sspp_multirect_index idx);
  433. /**
  434. * setup_dma_gc - setup 1D LUT GC in DMA pipes
  435. * @ctx: Pointer to pipe context
  436. * @cfg: Pointer to dma gc data
  437. * @idx: multirect index
  438. */
  439. void (*setup_dma_gc)(struct sde_hw_pipe *ctx, void *cfg,
  440. enum sde_sspp_multirect_index idx);
  441. /**
  442. * setup_qos_lut - setup danger, safe, creq LUTs
  443. * @ctx: Pointer to pipe context
  444. * @cfg: Pointer to pipe QoS configuration
  445. *
  446. */
  447. void (*setup_qos_lut)(struct sde_hw_pipe *ctx,
  448. struct sde_hw_pipe_qos_cfg *cfg);
  449. /**
  450. * setup_qos_ctrl - setup QoS control
  451. * @ctx: Pointer to pipe context
  452. * @cfg: Pointer to pipe QoS configuration
  453. *
  454. */
  455. void (*setup_qos_ctrl)(struct sde_hw_pipe *ctx,
  456. struct sde_hw_pipe_qos_cfg *cfg);
  457. /**
  458. * setup_histogram - setup histograms
  459. * @ctx: Pointer to pipe context
  460. * @cfg: Pointer to histogram configuration
  461. */
  462. void (*setup_histogram)(struct sde_hw_pipe *ctx,
  463. void *cfg);
  464. /**
  465. * setup_scaler - setup scaler
  466. * @ctx: Pointer to pipe context
  467. * @pipe_cfg: Pointer to pipe configuration
  468. * @pe_cfg: Pointer to pixel extension configuration
  469. * @scaler_cfg: Pointer to scaler configuration
  470. */
  471. void (*setup_scaler)(struct sde_hw_pipe *ctx,
  472. struct sde_hw_pipe_cfg *pipe_cfg,
  473. struct sde_hw_pixel_ext *pe_cfg,
  474. void *scaler_cfg);
  475. /**
  476. * setup_scaler_lut - setup scaler lut
  477. * @buf: Defines structure for reg dma ops on the reg dma buffer.
  478. * @scaler3_cfg: QSEEDv3 configuration
  479. * @offset: Scaler Offset
  480. */
  481. void (*setup_scaler_lut)(struct sde_reg_dma_setup_ops_cfg *buf,
  482. struct sde_hw_scaler3_cfg *scaler3_cfg,
  483. u32 offset);
  484. /**
  485. * setup_pre_downscale - setup pre-downscaler for inline rotation
  486. * @ctx: Pointer to pipe context
  487. * @pre_down: Pointer to pre-downscaler configuration
  488. */
  489. void (*setup_pre_downscale)(struct sde_hw_pipe *ctx,
  490. struct sde_hw_inline_pre_downscale_cfg *pre_down);
  491. /**
  492. * setup_sys_cache - setup system cache configuration
  493. * @ctx: Pointer to pipe context
  494. * @cfg: Pointer to system cache configuration
  495. */
  496. void (*setup_sys_cache)(struct sde_hw_pipe *ctx,
  497. struct sde_hw_pipe_sc_cfg *cfg);
  498. /**
  499. * setup_uidle - set uidle configuration
  500. * @ctx: Pointer to pipe context
  501. * @cfg: Pointer to uidle configuration
  502. * @index: rectangle index in multirect
  503. */
  504. void (*setup_uidle)(struct sde_hw_pipe *ctx,
  505. struct sde_hw_pipe_uidle_cfg *cfg,
  506. enum sde_sspp_multirect_index index);
  507. /**
  508. * setup_uidle_fill_scale - set uidle fill scale factor
  509. * @ctx: Pointer to pipe context
  510. * @cfg: Pointer to uidle configuration
  511. */
  512. void (*setup_uidle_fill_scale)(struct sde_hw_pipe *ctx,
  513. struct sde_hw_pipe_uidle_cfg *cfg);
  514. /**
  515. * setup_ts_prefill - setup prefill traffic shaper
  516. * @ctx: Pointer to pipe context
  517. * @cfg: Pointer to traffic shaper configuration
  518. * @index: rectangle index in multirect
  519. */
  520. void (*setup_ts_prefill)(struct sde_hw_pipe *ctx,
  521. struct sde_hw_pipe_ts_cfg *cfg,
  522. enum sde_sspp_multirect_index index);
  523. /**
  524. * setup_cdp - setup client driven prefetch
  525. * @ctx: Pointer to pipe context
  526. * @cfg: Pointer to cdp configuration
  527. * @index: rectangle index in multirect
  528. */
  529. void (*setup_cdp)(struct sde_hw_pipe *ctx,
  530. struct sde_hw_pipe_cdp_cfg *cfg,
  531. enum sde_sspp_multirect_index index);
  532. /**
  533. * setup_secure_address - setup secureity status of the source address
  534. * @ctx: Pointer to pipe context
  535. * @index: rectangle index in multirect
  536. * @enable: enable content protected buffer state
  537. */
  538. void (*setup_secure_address)(struct sde_hw_pipe *ctx,
  539. enum sde_sspp_multirect_index index,
  540. bool enable);
  541. /**
  542. * set_src_split_order - setup source split order priority
  543. * @ctx: Pointer to pipe context
  544. * @index: rectangle index in multirect
  545. * @enable: enable src split order
  546. */
  547. void (*set_src_split_order)(struct sde_hw_pipe *ctx,
  548. enum sde_sspp_multirect_index index, bool enable);
  549. /**
  550. * setup_inverse_pma - enable/disable alpha unmultiply unit (PMA)
  551. * @ctx: Pointer to pipe context
  552. * @index: Rectangle index in multirect
  553. * @enable: PMA enable/disable settings
  554. */
  555. void (*setup_inverse_pma)(struct sde_hw_pipe *ctx,
  556. enum sde_sspp_multirect_index index, u32 enable);
  557. /**
  558. * setup_dgm_csc - setup DGM color space conversion block and update lut
  559. * @ctx: Pointer to pipe context
  560. * @index: Rectangle index in multirect
  561. * @data: Pointer to config structure
  562. */
  563. void (*setup_dgm_csc)(struct sde_hw_pipe *ctx,
  564. enum sde_sspp_multirect_index index, struct sde_csc_cfg *data);
  565. /**
  566. * clear_meta_error - clear the meta error-code registers
  567. * @ctx: Pointer to pipe context
  568. * @multirect_index: rec in use
  569. */
  570. void (*clear_meta_error)(struct sde_hw_pipe *ctx,
  571. enum sde_sspp_multirect_index multirect_index);
  572. /**
  573. * get_meta_error - get the meta error-code
  574. * @ctx: Pointer to pipe context
  575. * @multirect_index: rec in use
  576. */
  577. u32 (*get_meta_error)(struct sde_hw_pipe *ctx,
  578. enum sde_sspp_multirect_index multirect_index);
  579. /**
  580. * clear_ubwc_error - clear the ubwc error-code registers
  581. * @ctx: Pointer to pipe context
  582. * @multirect_index: rec in use
  583. */
  584. void (*clear_ubwc_error)(struct sde_hw_pipe *ctx,
  585. enum sde_sspp_multirect_index multirect_index);
  586. /**
  587. * get_ubwc_error - get the ubwc error-code
  588. * @ctx: Pointer to pipe context
  589. * @multirect_index: rec in use
  590. */
  591. u32 (*get_ubwc_error)(struct sde_hw_pipe *ctx,
  592. enum sde_sspp_multirect_index multirect_index);
  593. /**
  594. * get_ubwc_stats_data - get ubwc stats data
  595. * @ctx: Pointer to pipe context
  596. * @multirect_index: rec in use
  597. * @data: Pointer to ubwc data to populate
  598. */
  599. void (*get_ubwc_stats_data)(struct sde_hw_pipe *ctx,
  600. enum sde_sspp_multirect_index multirect_index,
  601. struct sde_drm_ubwc_stats_data *data);
  602. /**
  603. * set_ubwc_stats_roi - set ubwc stats roi
  604. * @ctx: Pointer to pipe context
  605. * @multirect_index: rec in use
  606. * @roi: roi to be programmed
  607. */
  608. void (*set_ubwc_stats_roi)(struct sde_hw_pipe *ctx,
  609. enum sde_sspp_multirect_index multirect_index,
  610. struct sde_drm_ubwc_stats_roi *roi);
  611. /**
  612. * setup_fp16_csc - set FP16 CSC cp block
  613. * @ctx: Pointer to pipe object
  614. * @index: Pipe rectangle to operate on
  615. * @data: Pointer to sde_hw_cp_cfg object holding drm_msm_fp16_csc data
  616. */
  617. void (*setup_fp16_csc)(struct sde_hw_pipe *ctx,
  618. enum sde_sspp_multirect_index index, void *data);
  619. /**
  620. * sde_setup_fp16_gcv1 - set FP16 GC cp block
  621. * @ctx: Pointer to pipe object
  622. * @index: Pipe rectangle to operate on
  623. * @data: Pointer to sde_hw_cp_cfg object holding drm_msm_fp16_gc data
  624. */
  625. void (*setup_fp16_gc)(struct sde_hw_pipe *ctx,
  626. enum sde_sspp_multirect_index index, void *data);
  627. /**
  628. * sde_setup_fp16_igcv1 - set FP16 IGC cp block
  629. * @ctx: Pointer to pipe object
  630. * @index: Pipe rectangle to operate on
  631. * @data: Pointer to sde_hw_cp_cfg object containing bool data
  632. */
  633. void (*setup_fp16_igc)(struct sde_hw_pipe *ctx,
  634. enum sde_sspp_multirect_index index, void *data);
  635. /**
  636. * sde_setup_fp16_unmultv1 - set FP16 UNMULT cp block
  637. * @ctx: Pointer to pipe object
  638. * @index: Pipe rectangle to operate on
  639. * @data: Pointer to sde_hw_cp_cfg object containing bool data
  640. */
  641. void (*setup_fp16_unmult)(struct sde_hw_pipe *ctx,
  642. enum sde_sspp_multirect_index index, void *data);
  643. /**
  644. * setup_line_insertion - setup line insertion
  645. * @ctx: Pointer to pipe context
  646. * @cfg: Pointer to line insertion configuration
  647. */
  648. void (*setup_line_insertion)(struct sde_hw_pipe *ctx,
  649. enum sde_sspp_multirect_index index,
  650. struct sde_hw_pipe_line_insertion_cfg *cfg);
  651. /**
  652. * setup_ucsc_csc - set UCSC CSC cp block
  653. * @ctx: Pointer to pipe object
  654. * @index: Pipe rectangle to operate on
  655. * @data: Pointer to sde_hw_cp_cfg object holding drm_msm_ucsc_csc data
  656. */
  657. void (*setup_ucsc_csc)(struct sde_hw_pipe *ctx,
  658. enum sde_sspp_multirect_index index, void *data);
  659. /**
  660. * sde_setup_ucsc_gcv1 - set UCSC GC cp block
  661. * @ctx: Pointer to pipe object
  662. * @index: Pipe rectangle to operate on
  663. * @mode: Pointer to sde_hw_cp_cfg object holding GC mode data
  664. */
  665. void (*setup_ucsc_gc)(struct sde_hw_pipe *ctx,
  666. enum sde_sspp_multirect_index index, void *data);
  667. /**
  668. * sde_setup_ucsc_igcv1 - set UCSC IGC cp block
  669. * @ctx: Pointer to pipe object
  670. * @index: Pipe rectangle to operate on
  671. * @mode: Pointer to sde_hw_cp_cfg object containing IGC mode data
  672. */
  673. void (*setup_ucsc_igc)(struct sde_hw_pipe *ctx,
  674. enum sde_sspp_multirect_index index, void *data);
  675. /**
  676. * sde_setup_ucsc_unmultv1 - set UCSC UNMULT cp block
  677. * @ctx: Pointer to pipe object
  678. * @index: Pipe rectangle to operate on
  679. * @data: Pointer to sde_hw_cp_cfg object containing bool data
  680. */
  681. void (*setup_ucsc_unmult)(struct sde_hw_pipe *ctx,
  682. enum sde_sspp_multirect_index index, void *data);
  683. /**
  684. * sde_setup_ucsc_alpha_ditherv1 - set UCSC ALPHA DITHER cp block
  685. * @ctx: Pointer to pipe object
  686. * @index: Pipe rectangle to operate on
  687. * @data: Pointer to sde_hw_cp_cfg object containing bool data
  688. */
  689. void (*setup_ucsc_alpha_dither)(struct sde_hw_pipe *ctx,
  690. enum sde_sspp_multirect_index index, void *data);
  691. };
  692. /**
  693. * struct sde_hw_pipe - pipe description
  694. * @base: hardware block base structure
  695. * @hw: block hardware details
  696. * @catalog: back pointer to catalog
  697. * @mdp: pointer to associated mdp portion of the catalog
  698. * @idx: pipe index
  699. * @cap: pointer to layer_cfg
  700. * @ops: pointer to operations possible for this pipe
  701. */
  702. struct sde_hw_pipe {
  703. struct sde_hw_blk_reg_map hw;
  704. struct sde_mdss_cfg *catalog;
  705. struct sde_mdp_cfg *mdp;
  706. /* Pipe */
  707. enum sde_sspp idx;
  708. struct sde_sspp_cfg *cap;
  709. /* Ops */
  710. struct sde_hw_sspp_ops ops;
  711. struct sde_hw_ctl *ctl;
  712. };
  713. /**
  714. * sde_hw_sspp_init - initializes the sspp hw driver object.
  715. * Should be called once before accessing every pipe.
  716. * @idx: Pipe index for which driver object is required
  717. * @addr: Mapped register io address of MDP
  718. * @catalog : Pointer to mdss catalog data
  719. * @is_virtual_pipe: is this pipe virtual pipe
  720. * @client: Pointer to VBIF clock client info
  721. */
  722. struct sde_hw_pipe *sde_hw_sspp_init(enum sde_sspp idx,
  723. void __iomem *addr, struct sde_mdss_cfg *catalog,
  724. bool is_virtual_pipe, struct sde_vbif_clk_client *client);
  725. /**
  726. * sde_hw_sspp_destroy(): Destroys SSPP driver context
  727. * should be called during Hw pipe cleanup.
  728. * @ctx: Pointer to SSPP driver context returned by sde_hw_sspp_init
  729. */
  730. void sde_hw_sspp_destroy(struct sde_hw_pipe *ctx);
  731. #endif /*_SDE_HW_SSPP_H */