Re: [PATCH v2 05/14] drm/msm/dpu: handle pipes as array

From: Dmitry Baryshkov
Date: Fri Oct 11 2024 - 03:26:40 EST


On Fri, 11 Oct 2024 at 10:18, Jun Nie <jun.nie@xxxxxxxxxx> wrote:
>
> Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> 于2024年10月11日周五 15:10写道:
> >
> > On Fri, 11 Oct 2024 at 09:49, Jun Nie <jun.nie@xxxxxxxxxx> wrote:
> > >
> > > Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> 于2024年10月10日周四 21:08写道:
> > > >
> > > > On Wed, Oct 09, 2024 at 04:50:18PM GMT, Jun Nie wrote:
> > > > > Store pipes in array with removing dedicated r_pipe. There are
> > > > > 2 pipes in a drm plane at most currently. While 4 pipes are
> > > > > needed for new usage case. This change generalize the handling
> > > > > to pipe pair and ease handling to another pipe pair later.
> > > > >
> > > > > Signed-off-by: Jun Nie <jun.nie@xxxxxxxxxx>
> > > > > ---
> > > > > drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 34 +++---
> > > > > drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 167 ++++++++++++++++--------------
> > > > > drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h | 12 +--
> > > > > drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 10 +-
> > > > > 4 files changed, 111 insertions(+), 112 deletions(-)
> > > > >

> > > > > @@ -1410,17 +1416,24 @@ static void _dpu_plane_atomic_disable(struct drm_plane *plane)
> > > > > {
> > > > > struct drm_plane_state *state = plane->state;
> > > > > struct dpu_plane_state *pstate = to_dpu_plane_state(state);
> > > > > - struct dpu_sw_pipe *r_pipe = &pstate->r_pipe;
> > > > > + struct dpu_sw_pipe *pipe;
> > > > > + int i;
> > > > > +
> > > > > + for (i = 0; i < PIPES_PER_STAGE; i += 1) {
> > > > > + pipe = &pstate->pipe[i];
> > > > > + if (!pipe->sspp)
> > > > > + continue;
> > > > >
> > > > > - trace_dpu_plane_disable(DRMID(plane), false,
> > > > > - pstate->pipe.multirect_mode);
> > > > > + trace_dpu_plane_disable(DRMID(plane), false,
> > > > > + pstate->pipe[i].multirect_mode);
> > > > >
> > > > > - if (r_pipe->sspp) {
> > > > > - r_pipe->multirect_index = DPU_SSPP_RECT_SOLO;
> > > > > - r_pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE;
> > > > > + if (pipe->sspp && pipe->multirect_index == DPU_SSPP_RECT_1) {
> > > >
> > > > if (i > 1)
> > >
> > > Is there any case that pipe->multirect_index == DPU_SSPP_RECT_1 and i == 0 ?
> >
> > You are converting the code. Please don't change the logic. Original
> > code had separate handling for r_pipe. After your conversion it should
> > be if (i == 1) or if (i > 0), which means a typo in my review comment.
> >
> I see. You want to keep logic unchanged, with only handling the pipe in array.
> Handling to multiple pipe pairs can be added later.

Yes. Please never mix "rewrite" and "change the logic" together. It
complicates the review and is generally error-prone.

--
With best wishes
Dmitry