On Mon, Feb 24, 2025 at 06:14:22PM +0800, Jun Nie wrote: > Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> 于2025年2月22日周六 00:36写道: > > > > On Mon, Feb 17, 2025 at 10:16:02PM +0800, Jun Nie wrote: > > > Currently, SSPPs are assigned to a maximum of two pipes. However, > > > quad-pipe usage scenarios require four pipes and involve configuring > > > two stages. In quad-pipe case, the first two pipes share a set of > > > mixer configurations and enable multi-rect mode when certain > > > conditions are met. The same applies to the subsequent two pipes. > > > > > > Assign SSPPs to the pipes in each stage using a unified method and > > > to loop the stages accordingly. > > > > > > Signed-off-by: Jun Nie <jun.nie@xxxxxxxxxx> > > > --- > > > drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 63 +++++++++++++++++++------------ > > > 1 file changed, 39 insertions(+), 24 deletions(-) > > > > > > + for (stage_id = 0; stage_id < num_stages; stage_id++) { > > > + for (i = stage_id * PIPES_PER_STAGE; i < (stage_id + 1) * PIPES_PER_STAGE; i++) { > > Do you mean define and assign r_pipe / r_pipe_cfg here? No, because for i = num_stages-1, the r_pipe would point to invalid memory. > > > > + pipe = &pstate->pipe[i]; > > > + pipe_cfg = &pstate->pipe_cfg[i]; > > > + > > > + if (drm_rect_width(&pipe_cfg->src_rect) == 0) > > > + break; > > > + > > > + pipe->sspp = dpu_rm_reserve_sspp(&dpu_kms->rm, global_state, crtc, &reqs); > > > + if (!pipe->sspp) > > > + return -ENODEV; > > > + > > > + r_pipe = &pstate->pipe[i + 1]; > > > + r_pipe_cfg = &pstate->pipe_cfg[i + 1]; > > > + > > > + /* > > > + * If current pipe is the first pipe in pipe pair, check > > > + * multi-rect opportunity for the 2nd pipe in the pair. > > > + * SSPP multi-rect mode cross mixer pairs is not supported. > > > + */ > > > + if ((i % PIPES_PER_STAGE == 0) && > > > > Please move r_pipe / r_pipe_cfg definition and assignment here. > > r_pipe / r_pipe_cfg is used in this if(). Please see above question. Maybe we can rework it somehow. I really don't fancy the after-the-array pointer. > > > > > > > + drm_rect_width(&r_pipe_cfg->src_rect) != 0 && > > > + dpu_plane_try_multirect_parallel(pipe, pipe_cfg, r_pipe, r_pipe_cfg, > > > + pipe->sspp, > > > + msm_framebuffer_format(plane_state->fb), > > > + dpu_kms->catalog->caps->max_linewidth)) { > > > + i++; > > > + } else { > > > + /* multirect is not possible, use two SSPP blocks */ > > > + pipe->multirect_index = DPU_SSPP_RECT_SOLO; > > > + pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE; > > > + DPU_DEBUG_PLANE(pdpu, "allocating sspp_%d for pipe %d.\n", > > > + pipe->sspp->idx - SSPP_NONE, i); > > > + } > > > + } > > > } > > > > > > return dpu_plane_atomic_check_sspp(plane, state, crtc_state); > > > > > > -- > > > 2.34.1 > > > > > > > -- > > With best wishes > > Dmitry -- With best wishes Dmitry