Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm/dpu: Refactor SSPP to compatible DPU 13.0.0

DPU version 13.0.0 introduces structural changes including
register additions, removals, and relocations.

Refactor SSPP-related code to be compatible with DPU 13.0.0
modifications.

Co-developed-by: Yongxing Mou <yongxing.mou@oss.qualcomm.com>
Signed-off-by: Yongxing Mou <yongxing.mou@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/698710/
Link: https://lore.kernel.org/r/20260115092749.533-10-yuanjie.yang@oss.qualcomm.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

authored by

Yuanjie Yang and committed by
Dmitry Baryshkov
cc4b81f1 b78956dc

+111 -41
+59 -41
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
··· 147 147 static void dpu_hw_sspp_setup_multirect(struct dpu_sw_pipe *pipe) 148 148 { 149 149 struct dpu_hw_sspp *ctx = pipe->sspp; 150 - u32 mode_mask; 151 150 152 151 if (!ctx) 153 152 return; 153 + 154 + dpu_hw_setup_multirect_impl(pipe, ctx, SSPP_MULTIRECT_OPMODE); 155 + } 156 + 157 + void dpu_hw_setup_multirect_impl(struct dpu_sw_pipe *pipe, 158 + struct dpu_hw_sspp *ctx, u32 op_mode_off) 159 + { 160 + u32 mode_mask; 154 161 155 162 if (pipe->multirect_index == DPU_SSPP_RECT_SOLO) { 156 163 /** ··· 167 160 */ 168 161 mode_mask = 0; 169 162 } else { 170 - mode_mask = DPU_REG_READ(&ctx->hw, SSPP_MULTIRECT_OPMODE); 163 + mode_mask = DPU_REG_READ(&ctx->hw, op_mode_off); 171 164 mode_mask |= pipe->multirect_index; 172 165 if (pipe->multirect_mode == DPU_SSPP_MULTIRECT_TIME_MX) 173 166 mode_mask |= BIT(2); ··· 175 168 mode_mask &= ~BIT(2); 176 169 } 177 170 178 - DPU_REG_WRITE(&ctx->hw, SSPP_MULTIRECT_OPMODE, mode_mask); 171 + DPU_REG_WRITE(&ctx->hw, op_mode_off, mode_mask); 179 172 } 180 173 181 - static void _sspp_setup_opmode(struct dpu_hw_sspp *ctx, 174 + void dpu_hw_sspp_setup_opmode(struct dpu_hw_sspp *ctx, 182 175 u32 mask, u8 en) 183 176 { 184 177 const struct dpu_sspp_sub_blks *sblk = ctx->cap->sblk; ··· 198 191 DPU_REG_WRITE(&ctx->hw, sblk->scaler_blk.base + SSPP_VIG_OP_MODE, opmode); 199 192 } 200 193 201 - static void _sspp_setup_csc10_opmode(struct dpu_hw_sspp *ctx, 194 + void dpu_hw_sspp_setup_csc10_opmode(struct dpu_hw_sspp *ctx, 202 195 u32 mask, u8 en) 203 196 { 204 197 const struct dpu_sspp_sub_blks *sblk = ctx->cap->sblk; ··· 220 213 const struct msm_format *fmt, u32 flags) 221 214 { 222 215 struct dpu_hw_sspp *ctx = pipe->sspp; 223 - struct dpu_hw_blk_reg_map *c; 224 - u32 chroma_samp, unpack, src_format; 225 - u32 opmode = 0; 226 - u32 fast_clear = 0; 227 216 u32 op_mode_off, unpack_pat_off, format_off, ubwc_ctrl_off, ubwc_error_off; 228 217 229 218 if (!ctx || !fmt) ··· 246 243 ubwc_error_off = SSPP_UBWC_ERROR_STATUS; 247 244 } 248 245 } 246 + 247 + dpu_hw_setup_format_impl(pipe, fmt, flags, ctx, op_mode_off, 248 + unpack_pat_off, format_off, 249 + ubwc_ctrl_off, ubwc_error_off); 250 + } 251 + 252 + void dpu_hw_setup_format_impl(struct dpu_sw_pipe *pipe, const struct msm_format *fmt, 253 + u32 flags, struct dpu_hw_sspp *ctx, u32 op_mode_off, 254 + u32 unpack_pat_off, u32 format_off, u32 ubwc_ctrl_off, 255 + u32 ubwc_error_off) 256 + { 257 + struct dpu_hw_blk_reg_map *c; 258 + u32 chroma_samp, unpack, src_format; 259 + u32 opmode; 260 + u32 fast_clear; 249 261 250 262 c = &ctx->hw; 251 263 opmode = DPU_REG_READ(c, op_mode_off); ··· 349 331 350 332 /* update scaler opmode, if appropriate */ 351 333 if (test_bit(DPU_SSPP_CSC, &ctx->cap->features)) 352 - _sspp_setup_opmode(ctx, VIG_OP_CSC_EN | VIG_OP_CSC_SRC_DATAFMT, 334 + dpu_hw_sspp_setup_opmode(ctx, VIG_OP_CSC_EN | VIG_OP_CSC_SRC_DATAFMT, 353 335 MSM_FORMAT_IS_YUV(fmt)); 354 336 else if (test_bit(DPU_SSPP_CSC_10BIT, &ctx->cap->features)) 355 - _sspp_setup_csc10_opmode(ctx, 337 + dpu_hw_sspp_setup_csc10_opmode(ctx, 356 338 VIG_CSC_10_EN | VIG_CSC_10_SRC_DATAFMT, 357 339 MSM_FORMAT_IS_YUV(fmt)); 358 340 ··· 421 403 tot_req_pixels[3]); 422 404 } 423 405 424 - static void _dpu_hw_sspp_setup_scaler3(struct dpu_hw_sspp *ctx, 406 + void dpu_hw_sspp_setup_scaler3(struct dpu_hw_sspp *ctx, 425 407 struct dpu_hw_scaler3_cfg *scaler3_cfg, 426 408 const struct msm_format *format) 427 409 { ··· 441 423 struct dpu_sw_pipe_cfg *cfg) 442 424 { 443 425 struct dpu_hw_sspp *ctx = pipe->sspp; 444 - struct dpu_hw_blk_reg_map *c; 445 - u32 src_size, src_xy, dst_size, dst_xy; 446 426 u32 src_size_off, src_xy_off, out_size_off, out_xy_off; 447 427 448 428 if (!ctx || !cfg) 449 429 return; 450 - 451 - c = &ctx->hw; 452 430 453 431 if (pipe->multirect_index == DPU_SSPP_RECT_SOLO || 454 432 pipe->multirect_index == DPU_SSPP_RECT_0) { ··· 459 445 out_xy_off = SSPP_OUT_XY_REC1; 460 446 } 461 447 462 - 463 - /* src and dest rect programming */ 464 - src_xy = (cfg->src_rect.y1 << 16) | cfg->src_rect.x1; 465 - src_size = (drm_rect_height(&cfg->src_rect) << 16) | 466 - drm_rect_width(&cfg->src_rect); 467 - dst_xy = (cfg->dst_rect.y1 << 16) | cfg->dst_rect.x1; 468 - dst_size = (drm_rect_height(&cfg->dst_rect) << 16) | 469 - drm_rect_width(&cfg->dst_rect); 470 - 471 - /* rectangle register programming */ 472 - DPU_REG_WRITE(c, src_size_off, src_size); 473 - DPU_REG_WRITE(c, src_xy_off, src_xy); 474 - DPU_REG_WRITE(c, out_size_off, dst_size); 475 - DPU_REG_WRITE(c, out_xy_off, dst_xy); 448 + dpu_hw_setup_rects_impl(pipe, cfg, ctx, src_size_off, 449 + src_xy_off, out_size_off, out_xy_off); 476 450 } 477 451 478 452 static void dpu_hw_sspp_setup_sourceaddress(struct dpu_sw_pipe *pipe, ··· 517 515 DPU_REG_WRITE(&ctx->hw, SSPP_SRC_YSTRIDE1, ystride1); 518 516 } 519 517 520 - static void dpu_hw_sspp_setup_csc(struct dpu_hw_sspp *ctx, 518 + void dpu_hw_sspp_setup_csc(struct dpu_hw_sspp *ctx, 521 519 const struct dpu_csc_cfg *data) 522 520 { 523 521 u32 offset; ··· 539 537 static void dpu_hw_sspp_setup_solidfill(struct dpu_sw_pipe *pipe, u32 color) 540 538 { 541 539 struct dpu_hw_sspp *ctx = pipe->sspp; 542 - struct dpu_hw_fmt_layout cfg; 540 + u32 const_clr_off; 543 541 544 542 if (!ctx) 545 543 return; 544 + 545 + if (pipe->multirect_index == DPU_SSPP_RECT_SOLO || 546 + pipe->multirect_index == DPU_SSPP_RECT_0) 547 + const_clr_off = SSPP_SRC_CONSTANT_COLOR; 548 + else 549 + const_clr_off = SSPP_SRC_CONSTANT_COLOR_REC1; 550 + 551 + dpu_hw_setup_solidfill_impl(pipe, color, ctx, const_clr_off); 552 + } 553 + 554 + void dpu_hw_setup_solidfill_impl(struct dpu_sw_pipe *pipe, 555 + u32 color, struct dpu_hw_sspp *ctx, 556 + u32 const_clr_off) 557 + { 558 + struct dpu_hw_fmt_layout cfg; 546 559 547 560 /* cleanup source addresses */ 548 561 memset(&cfg, 0, sizeof(cfg)); 549 562 ctx->ops.setup_sourceaddress(pipe, &cfg); 550 563 551 - if (pipe->multirect_index == DPU_SSPP_RECT_SOLO || 552 - pipe->multirect_index == DPU_SSPP_RECT_0) 553 - DPU_REG_WRITE(&ctx->hw, SSPP_SRC_CONSTANT_COLOR, color); 554 - else 555 - DPU_REG_WRITE(&ctx->hw, SSPP_SRC_CONSTANT_COLOR_REC1, 556 - color); 564 + DPU_REG_WRITE(&ctx->hw, const_clr_off, color); 557 565 } 558 566 559 567 static void dpu_hw_sspp_setup_qos_lut(struct dpu_hw_sspp *ctx, ··· 577 565 cfg); 578 566 } 579 567 568 + void dpu_hw_sspp_setup_qos_ctrl_impl(struct dpu_hw_sspp *ctx, 569 + bool danger_safe_en, u32 ctrl_off) 570 + { 571 + DPU_REG_WRITE(&ctx->hw, ctrl_off, 572 + danger_safe_en ? SSPP_QOS_CTRL_DANGER_SAFE_EN : 0); 573 + } 574 + 580 575 static void dpu_hw_sspp_setup_qos_ctrl(struct dpu_hw_sspp *ctx, 581 576 bool danger_safe_en) 582 577 { 583 578 if (!ctx) 584 579 return; 585 580 586 - DPU_REG_WRITE(&ctx->hw, SSPP_QOS_CTRL, 587 - danger_safe_en ? SSPP_QOS_CTRL_DANGER_SAFE_EN : 0); 581 + dpu_hw_sspp_setup_qos_ctrl_impl(ctx, danger_safe_en, SSPP_QOS_CTRL); 588 582 } 589 583 590 584 static void dpu_hw_sspp_setup_cdp(struct dpu_sw_pipe *pipe, ··· 645 627 c->ops.setup_multirect = dpu_hw_sspp_setup_multirect; 646 628 647 629 if (test_bit(DPU_SSPP_SCALER_QSEED3_COMPATIBLE, &features)) 648 - c->ops.setup_scaler = _dpu_hw_sspp_setup_scaler3; 630 + c->ops.setup_scaler = dpu_hw_sspp_setup_scaler3; 649 631 650 632 if (test_bit(DPU_SSPP_CDP, &features)) 651 633 c->ops.setup_cdp = dpu_hw_sspp_setup_cdp;
+52
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
··· 332 332 int _dpu_hw_sspp_init_debugfs(struct dpu_hw_sspp *hw_pipe, struct dpu_kms *kms, 333 333 struct dentry *entry); 334 334 335 + void dpu_hw_sspp_setup_opmode(struct dpu_hw_sspp *ctx, 336 + u32 mask, u8 en); 337 + 338 + void dpu_hw_sspp_setup_csc10_opmode(struct dpu_hw_sspp *ctx, 339 + u32 mask, u8 en); 340 + 341 + void dpu_hw_sspp_setup_scaler3(struct dpu_hw_sspp *ctx, 342 + struct dpu_hw_scaler3_cfg *scaler3_cfg, 343 + const struct msm_format *format); 344 + 345 + void dpu_hw_sspp_setup_csc(struct dpu_hw_sspp *ctx, 346 + const struct dpu_csc_cfg *data); 347 + 348 + void dpu_hw_setup_multirect_impl(struct dpu_sw_pipe *pipe, 349 + struct dpu_hw_sspp *ctx, 350 + u32 op_mode_off); 351 + 352 + void dpu_hw_setup_format_impl(struct dpu_sw_pipe *pipe, const struct msm_format *fmt, 353 + u32 flags, struct dpu_hw_sspp *ctx, 354 + u32 op_mode_off, u32 unpack_pat_off, u32 format_off, 355 + u32 ubwc_ctrl_off, u32 ubwc_err_off); 356 + 357 + static inline void dpu_hw_setup_rects_impl(struct dpu_sw_pipe *pipe, struct dpu_sw_pipe_cfg *cfg, 358 + struct dpu_hw_sspp *ctx, u32 src_size_off, 359 + u32 src_xy_off, u32 out_size_off, u32 out_xy_off) 360 + { 361 + struct dpu_hw_blk_reg_map *c; 362 + u32 src_size, src_xy, dst_size, dst_xy; 363 + 364 + c = &ctx->hw; 365 + 366 + /* src and dest rect programming */ 367 + src_xy = (cfg->src_rect.y1 << 16) | cfg->src_rect.x1; 368 + src_size = (drm_rect_height(&cfg->src_rect) << 16) | 369 + drm_rect_width(&cfg->src_rect); 370 + dst_xy = (cfg->dst_rect.y1 << 16) | cfg->dst_rect.x1; 371 + dst_size = (drm_rect_height(&cfg->dst_rect) << 16) | 372 + drm_rect_width(&cfg->dst_rect); 373 + 374 + /* rectangle register programming */ 375 + DPU_REG_WRITE(c, src_size_off, src_size); 376 + DPU_REG_WRITE(c, src_xy_off, src_xy); 377 + DPU_REG_WRITE(c, out_size_off, dst_size); 378 + DPU_REG_WRITE(c, out_xy_off, dst_xy); 379 + } 380 + 381 + void dpu_hw_setup_solidfill_impl(struct dpu_sw_pipe *pipe, 382 + u32 color, struct dpu_hw_sspp *ctx, u32 const_clr_off); 383 + 384 + void dpu_hw_sspp_setup_qos_ctrl_impl(struct dpu_hw_sspp *ctx, 385 + bool danger_safe_en, u32 ctrl_off); 386 + 335 387 #endif /*_DPU_HW_SSPP_H */ 336 388