1
2
3
4
5 #ifndef _DPU_HW_SSPP_H
6 #define _DPU_HW_SSPP_H
7
8 #include "dpu_hw_catalog.h"
9 #include "dpu_hw_mdss.h"
10 #include "dpu_hw_util.h"
11 #include "dpu_hw_blk.h"
12 #include "dpu_formats.h"
13
14 struct dpu_hw_pipe;
15
16
17
18
19 #define DPU_SSPP_FLIP_LR BIT(0)
20 #define DPU_SSPP_FLIP_UD BIT(1)
21 #define DPU_SSPP_SOURCE_ROTATED_90 BIT(2)
22 #define DPU_SSPP_ROT_90 BIT(3)
23 #define DPU_SSPP_SOLID_FILL BIT(4)
24
25
26
27
28 #define DPU_SSPP_SCALER ((1UL << DPU_SSPP_SCALER_RGB) | \
29 (1UL << DPU_SSPP_SCALER_QSEED2) | \
30 (1UL << DPU_SSPP_SCALER_QSEED3))
31
32
33
34
35 enum {
36 DPU_SSPP_COMP_0,
37 DPU_SSPP_COMP_1_2,
38 DPU_SSPP_COMP_2,
39 DPU_SSPP_COMP_3,
40
41 DPU_SSPP_COMP_MAX
42 };
43
44
45
46
47
48
49
50
51
52
53
54 enum dpu_sspp_multirect_index {
55 DPU_SSPP_RECT_SOLO = 0,
56 DPU_SSPP_RECT_0,
57 DPU_SSPP_RECT_1,
58 };
59
60 enum dpu_sspp_multirect_mode {
61 DPU_SSPP_MULTIRECT_NONE = 0,
62 DPU_SSPP_MULTIRECT_PARALLEL,
63 DPU_SSPP_MULTIRECT_TIME_MX,
64 };
65
66 enum {
67 DPU_FRAME_LINEAR,
68 DPU_FRAME_TILE_A4X,
69 DPU_FRAME_TILE_A5X,
70 };
71
72 enum dpu_hw_filter {
73 DPU_SCALE_FILTER_NEAREST = 0,
74 DPU_SCALE_FILTER_BIL,
75 DPU_SCALE_FILTER_PCMN,
76 DPU_SCALE_FILTER_CA,
77 DPU_SCALE_FILTER_MAX
78 };
79
80 enum dpu_hw_filter_alpa {
81 DPU_SCALE_ALPHA_PIXEL_REP,
82 DPU_SCALE_ALPHA_BIL
83 };
84
85 enum dpu_hw_filter_yuv {
86 DPU_SCALE_2D_4X4,
87 DPU_SCALE_2D_CIR,
88 DPU_SCALE_1D_SEP,
89 DPU_SCALE_BIL
90 };
91
92 struct dpu_hw_sharp_cfg {
93 u32 strength;
94 u32 edge_thr;
95 u32 smooth_thr;
96 u32 noise_thr;
97 };
98
99 struct dpu_hw_pixel_ext {
100
101 uint8_t enable_pxl_ext;
102
103 int init_phase_x[DPU_MAX_PLANES];
104 int phase_step_x[DPU_MAX_PLANES];
105 int init_phase_y[DPU_MAX_PLANES];
106 int phase_step_y[DPU_MAX_PLANES];
107
108
109
110
111
112
113 int num_ext_pxls_left[DPU_MAX_PLANES];
114 int num_ext_pxls_right[DPU_MAX_PLANES];
115 int num_ext_pxls_top[DPU_MAX_PLANES];
116 int num_ext_pxls_btm[DPU_MAX_PLANES];
117
118
119
120
121
122 int left_ftch[DPU_MAX_PLANES];
123 int right_ftch[DPU_MAX_PLANES];
124 int top_ftch[DPU_MAX_PLANES];
125 int btm_ftch[DPU_MAX_PLANES];
126
127
128
129
130
131 int left_rpt[DPU_MAX_PLANES];
132 int right_rpt[DPU_MAX_PLANES];
133 int top_rpt[DPU_MAX_PLANES];
134 int btm_rpt[DPU_MAX_PLANES];
135
136 uint32_t roi_w[DPU_MAX_PLANES];
137 uint32_t roi_h[DPU_MAX_PLANES];
138
139
140
141
142
143 enum dpu_hw_filter horz_filter[DPU_MAX_PLANES];
144 enum dpu_hw_filter vert_filter[DPU_MAX_PLANES];
145
146 };
147
148
149
150
151
152
153
154
155
156
157 struct dpu_hw_pipe_cfg {
158 struct dpu_hw_fmt_layout layout;
159 struct drm_rect src_rect;
160 struct drm_rect dst_rect;
161 enum dpu_sspp_multirect_index index;
162 enum dpu_sspp_multirect_mode mode;
163 };
164
165
166
167
168
169
170
171
172
173
174
175 struct dpu_hw_pipe_qos_cfg {
176 u32 danger_lut;
177 u32 safe_lut;
178 u64 creq_lut;
179 u32 creq_vblank;
180 u32 danger_vblank;
181 bool vblank_en;
182 bool danger_safe_en;
183 };
184
185
186
187
188 enum {
189 DPU_SSPP_CDP_PRELOAD_AHEAD_32,
190 DPU_SSPP_CDP_PRELOAD_AHEAD_64
191 };
192
193
194
195
196
197
198
199
200
201
202 struct dpu_hw_pipe_cdp_cfg {
203 bool enable;
204 bool ubwc_meta_enable;
205 bool tile_amortize_enable;
206 u32 preload_ahead;
207 };
208
209
210
211
212
213
214 struct dpu_hw_pipe_ts_cfg {
215 u64 size;
216 u64 time;
217 };
218
219
220
221
222
223
224 struct dpu_hw_sspp_ops {
225
226
227
228
229
230
231
232 void (*setup_format)(struct dpu_hw_pipe *ctx,
233 const struct dpu_format *fmt, u32 flags,
234 enum dpu_sspp_multirect_index index);
235
236
237
238
239
240
241
242 void (*setup_rects)(struct dpu_hw_pipe *ctx,
243 struct dpu_hw_pipe_cfg *cfg,
244 enum dpu_sspp_multirect_index index);
245
246
247
248
249
250
251 void (*setup_pe)(struct dpu_hw_pipe *ctx,
252 struct dpu_hw_pixel_ext *pe_ext);
253
254
255
256
257
258
259
260 void (*setup_sourceaddress)(struct dpu_hw_pipe *ctx,
261 struct dpu_hw_pipe_cfg *cfg,
262 enum dpu_sspp_multirect_index index);
263
264
265
266
267
268
269 void (*setup_csc)(struct dpu_hw_pipe *ctx, struct dpu_csc_cfg *data);
270
271
272
273
274
275
276
277
278 void (*setup_solidfill)(struct dpu_hw_pipe *ctx, u32 color,
279 enum dpu_sspp_multirect_index index);
280
281
282
283
284
285
286
287
288 void (*setup_multirect)(struct dpu_hw_pipe *ctx,
289 enum dpu_sspp_multirect_index index,
290 enum dpu_sspp_multirect_mode mode);
291
292
293
294
295
296
297 void (*setup_sharpening)(struct dpu_hw_pipe *ctx,
298 struct dpu_hw_sharp_cfg *cfg);
299
300
301
302
303
304
305
306 void (*setup_danger_safe_lut)(struct dpu_hw_pipe *ctx,
307 struct dpu_hw_pipe_qos_cfg *cfg);
308
309
310
311
312
313
314
315 void (*setup_creq_lut)(struct dpu_hw_pipe *ctx,
316 struct dpu_hw_pipe_qos_cfg *cfg);
317
318
319
320
321
322
323
324 void (*setup_qos_ctrl)(struct dpu_hw_pipe *ctx,
325 struct dpu_hw_pipe_qos_cfg *cfg);
326
327
328
329
330
331
332 void (*setup_histogram)(struct dpu_hw_pipe *ctx,
333 void *cfg);
334
335
336
337
338
339
340
341
342 void (*setup_scaler)(struct dpu_hw_pipe *ctx,
343 struct dpu_hw_pipe_cfg *pipe_cfg,
344 struct dpu_hw_pixel_ext *pe_cfg,
345 void *scaler_cfg);
346
347
348
349
350
351 u32 (*get_scaler_ver)(struct dpu_hw_pipe *ctx);
352
353
354
355
356
357
358 void (*setup_cdp)(struct dpu_hw_pipe *ctx,
359 struct dpu_hw_pipe_cdp_cfg *cfg);
360 };
361
362
363
364
365
366
367
368
369
370
371
372 struct dpu_hw_pipe {
373 struct dpu_hw_blk base;
374 struct dpu_hw_blk_reg_map hw;
375 struct dpu_mdss_cfg *catalog;
376 struct dpu_mdp_cfg *mdp;
377
378
379 enum dpu_sspp idx;
380 const struct dpu_sspp_cfg *cap;
381
382
383 struct dpu_hw_sspp_ops ops;
384 };
385
386
387
388
389
390
391
392
393
394 struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,
395 void __iomem *addr, struct dpu_mdss_cfg *catalog,
396 bool is_virtual_pipe);
397
398
399
400
401
402
403 void dpu_hw_sspp_destroy(struct dpu_hw_pipe *ctx);
404
405 #endif
406