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