0001
0002
0003
0004
0005 #ifndef _DPU_HW_SSPP_H
0006 #define _DPU_HW_SSPP_H
0007
0008 #include "dpu_hw_catalog.h"
0009 #include "dpu_hw_mdss.h"
0010 #include "dpu_hw_util.h"
0011 #include "dpu_formats.h"
0012
0013 struct dpu_hw_pipe;
0014
0015
0016
0017
0018 #define DPU_SSPP_FLIP_LR BIT(0)
0019 #define DPU_SSPP_FLIP_UD BIT(1)
0020 #define DPU_SSPP_SOURCE_ROTATED_90 BIT(2)
0021 #define DPU_SSPP_ROT_90 BIT(3)
0022 #define DPU_SSPP_SOLID_FILL BIT(4)
0023
0024
0025
0026
0027 #define DPU_SSPP_SCALER (BIT(DPU_SSPP_SCALER_RGB) | \
0028 BIT(DPU_SSPP_SCALER_QSEED2) | \
0029 BIT(DPU_SSPP_SCALER_QSEED3) | \
0030 BIT(DPU_SSPP_SCALER_QSEED3LITE) | \
0031 BIT(DPU_SSPP_SCALER_QSEED4))
0032
0033
0034
0035
0036 #define DPU_SSPP_CSC_ANY (BIT(DPU_SSPP_CSC) | \
0037 BIT(DPU_SSPP_CSC_10BIT))
0038
0039
0040
0041
0042 enum {
0043 DPU_SSPP_COMP_0,
0044 DPU_SSPP_COMP_1_2,
0045 DPU_SSPP_COMP_2,
0046 DPU_SSPP_COMP_3,
0047
0048 DPU_SSPP_COMP_MAX
0049 };
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 enum dpu_sspp_multirect_index {
0062 DPU_SSPP_RECT_SOLO = 0,
0063 DPU_SSPP_RECT_0,
0064 DPU_SSPP_RECT_1,
0065 };
0066
0067 enum dpu_sspp_multirect_mode {
0068 DPU_SSPP_MULTIRECT_NONE = 0,
0069 DPU_SSPP_MULTIRECT_PARALLEL,
0070 DPU_SSPP_MULTIRECT_TIME_MX,
0071 };
0072
0073 enum {
0074 DPU_FRAME_LINEAR,
0075 DPU_FRAME_TILE_A4X,
0076 DPU_FRAME_TILE_A5X,
0077 };
0078
0079 enum dpu_hw_filter {
0080 DPU_SCALE_FILTER_NEAREST = 0,
0081 DPU_SCALE_FILTER_BIL,
0082 DPU_SCALE_FILTER_PCMN,
0083 DPU_SCALE_FILTER_CA,
0084 DPU_SCALE_FILTER_MAX
0085 };
0086
0087 enum dpu_hw_filter_alpa {
0088 DPU_SCALE_ALPHA_PIXEL_REP,
0089 DPU_SCALE_ALPHA_BIL
0090 };
0091
0092 enum dpu_hw_filter_yuv {
0093 DPU_SCALE_2D_4X4,
0094 DPU_SCALE_2D_CIR,
0095 DPU_SCALE_1D_SEP,
0096 DPU_SCALE_BIL
0097 };
0098
0099 struct dpu_hw_sharp_cfg {
0100 u32 strength;
0101 u32 edge_thr;
0102 u32 smooth_thr;
0103 u32 noise_thr;
0104 };
0105
0106 struct dpu_hw_pixel_ext {
0107
0108 uint8_t enable_pxl_ext;
0109
0110 int init_phase_x[DPU_MAX_PLANES];
0111 int phase_step_x[DPU_MAX_PLANES];
0112 int init_phase_y[DPU_MAX_PLANES];
0113 int phase_step_y[DPU_MAX_PLANES];
0114
0115
0116
0117
0118
0119
0120 int num_ext_pxls_left[DPU_MAX_PLANES];
0121 int num_ext_pxls_right[DPU_MAX_PLANES];
0122 int num_ext_pxls_top[DPU_MAX_PLANES];
0123 int num_ext_pxls_btm[DPU_MAX_PLANES];
0124
0125
0126
0127
0128
0129 int left_ftch[DPU_MAX_PLANES];
0130 int right_ftch[DPU_MAX_PLANES];
0131 int top_ftch[DPU_MAX_PLANES];
0132 int btm_ftch[DPU_MAX_PLANES];
0133
0134
0135
0136
0137
0138 int left_rpt[DPU_MAX_PLANES];
0139 int right_rpt[DPU_MAX_PLANES];
0140 int top_rpt[DPU_MAX_PLANES];
0141 int btm_rpt[DPU_MAX_PLANES];
0142
0143 uint32_t roi_w[DPU_MAX_PLANES];
0144 uint32_t roi_h[DPU_MAX_PLANES];
0145
0146
0147
0148
0149
0150 enum dpu_hw_filter horz_filter[DPU_MAX_PLANES];
0151 enum dpu_hw_filter vert_filter[DPU_MAX_PLANES];
0152
0153 };
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164 struct dpu_hw_pipe_cfg {
0165 struct dpu_hw_fmt_layout layout;
0166 struct drm_rect src_rect;
0167 struct drm_rect dst_rect;
0168 enum dpu_sspp_multirect_index index;
0169 enum dpu_sspp_multirect_mode mode;
0170 };
0171
0172
0173
0174
0175
0176
0177
0178
0179 struct dpu_hw_pipe_qos_cfg {
0180 u32 creq_vblank;
0181 u32 danger_vblank;
0182 bool vblank_en;
0183 bool danger_safe_en;
0184 };
0185
0186
0187
0188
0189 enum {
0190 DPU_SSPP_CDP_PRELOAD_AHEAD_32,
0191 DPU_SSPP_CDP_PRELOAD_AHEAD_64
0192 };
0193
0194
0195
0196
0197
0198
0199 struct dpu_hw_pipe_ts_cfg {
0200 u64 size;
0201 u64 time;
0202 };
0203
0204
0205
0206
0207
0208
0209 struct dpu_hw_sspp_ops {
0210
0211
0212
0213
0214
0215
0216
0217 void (*setup_format)(struct dpu_hw_pipe *ctx,
0218 const struct dpu_format *fmt, u32 flags,
0219 enum dpu_sspp_multirect_index index);
0220
0221
0222
0223
0224
0225
0226
0227 void (*setup_rects)(struct dpu_hw_pipe *ctx,
0228 struct dpu_hw_pipe_cfg *cfg,
0229 enum dpu_sspp_multirect_index index);
0230
0231
0232
0233
0234
0235
0236 void (*setup_pe)(struct dpu_hw_pipe *ctx,
0237 struct dpu_hw_pixel_ext *pe_ext);
0238
0239
0240
0241
0242
0243
0244
0245 void (*setup_sourceaddress)(struct dpu_hw_pipe *ctx,
0246 struct dpu_hw_pipe_cfg *cfg,
0247 enum dpu_sspp_multirect_index index);
0248
0249
0250
0251
0252
0253
0254 void (*setup_csc)(struct dpu_hw_pipe *ctx, const struct dpu_csc_cfg *data);
0255
0256
0257
0258
0259
0260
0261
0262
0263 void (*setup_solidfill)(struct dpu_hw_pipe *ctx, u32 color,
0264 enum dpu_sspp_multirect_index index);
0265
0266
0267
0268
0269
0270
0271
0272
0273 void (*setup_multirect)(struct dpu_hw_pipe *ctx,
0274 enum dpu_sspp_multirect_index index,
0275 enum dpu_sspp_multirect_mode mode);
0276
0277
0278
0279
0280
0281
0282 void (*setup_sharpening)(struct dpu_hw_pipe *ctx,
0283 struct dpu_hw_sharp_cfg *cfg);
0284
0285
0286
0287
0288
0289
0290
0291
0292 void (*setup_danger_safe_lut)(struct dpu_hw_pipe *ctx,
0293 u32 danger_lut,
0294 u32 safe_lut);
0295
0296
0297
0298
0299
0300
0301
0302 void (*setup_creq_lut)(struct dpu_hw_pipe *ctx,
0303 u64 creq_lut);
0304
0305
0306
0307
0308
0309
0310
0311 void (*setup_qos_ctrl)(struct dpu_hw_pipe *ctx,
0312 struct dpu_hw_pipe_qos_cfg *cfg);
0313
0314
0315
0316
0317
0318
0319 void (*setup_histogram)(struct dpu_hw_pipe *ctx,
0320 void *cfg);
0321
0322
0323
0324
0325
0326
0327
0328 void (*setup_scaler)(struct dpu_hw_pipe *ctx,
0329 struct dpu_hw_pipe_cfg *pipe_cfg,
0330 void *scaler_cfg);
0331
0332
0333
0334
0335
0336 u32 (*get_scaler_ver)(struct dpu_hw_pipe *ctx);
0337
0338
0339
0340
0341
0342
0343
0344 void (*setup_cdp)(struct dpu_hw_pipe *ctx,
0345 struct dpu_hw_cdp_cfg *cfg,
0346 enum dpu_sspp_multirect_index index);
0347 };
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359 struct dpu_hw_pipe {
0360 struct dpu_hw_blk base;
0361 struct dpu_hw_blk_reg_map hw;
0362 const struct dpu_mdss_cfg *catalog;
0363 const struct dpu_mdp_cfg *mdp;
0364
0365
0366 enum dpu_sspp idx;
0367 const struct dpu_sspp_cfg *cap;
0368
0369
0370 struct dpu_hw_sspp_ops ops;
0371 };
0372
0373 struct dpu_kms;
0374
0375
0376
0377
0378
0379
0380
0381
0382 struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,
0383 void __iomem *addr, const struct dpu_mdss_cfg *catalog,
0384 bool is_virtual_pipe);
0385
0386
0387
0388
0389
0390
0391 void dpu_hw_sspp_destroy(struct dpu_hw_pipe *ctx);
0392
0393 void dpu_debugfs_sspp_init(struct dpu_kms *dpu_kms, struct dentry *debugfs_root);
0394 int _dpu_hw_sspp_init_debugfs(struct dpu_hw_pipe *hw_pipe, struct dpu_kms *kms, struct dentry *entry);
0395
0396 #endif
0397