[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ag7drc3bwzlmktbknoo2gzulaziva2mj7d2ze4wc26ng23336k@f5o6ue2skit5>
Date: Thu, 9 Jan 2025 06:24:17 +0200
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Abhinav Kumar <quic_abhinavk@...cinc.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, Rob Clark <robdclark@...il.com>,
Sean Paul <sean@...rly.run>, Marijn Suijten <marijn.suijten@...ainline.org>,
Chandan Uddaraju <chandanu@...eaurora.org>, Jeykumar Sankaran <jsanka@...eaurora.org>,
Jordan Crouse <jordan@...micpenguin.net>, Sravanthi Kollukuduru <skolluku@...eaurora.org>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Archit Taneja <architt@...eaurora.org>, Rajesh Yadav <ryadav@...eaurora.org>,
linux-arm-msm@...r.kernel.org, freedreno@...ts.freedesktop.org,
Simona Vetter <simona.vetter@...ll.ch>
Subject: Re: [PATCH 6/6] drm/msm/dpu: don't set crtc_state->mode_changed from
atomic_check()
On Wed, Jan 08, 2025 at 06:27:13PM -0800, Abhinav Kumar wrote:
>
>
> On 12/21/2024 9:00 PM, Dmitry Baryshkov wrote:
> > The MSM driver uses drm_atomic_helper_check() which mandates that none
> > of the atomic_check() callbacks toggles crtc_state->mode_changed.
> > Perform corresponding check before calling the drm_atomic_helper_check()
> > function.
> >
> > Fixes: 8b45a26f2ba9 ("drm/msm/dpu: reserve cdm blocks for writeback in case of YUV output")
> > Reported-by: Simona Vetter <simona.vetter@...ll.ch>
> > Closes: https://lore.kernel.org/dri-devel/ZtW_S0j5AEr4g0QW@phenom.ffwll.local/
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> > ---
> > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 32 +++++++++++++++++++++++++----
> > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 4 ++++
> > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 26 +++++++++++++++++++++++
> > drivers/gpu/drm/msm/msm_atomic.c | 13 +++++++++++-
> > drivers/gpu/drm/msm/msm_kms.h | 7 +++++++
> > 5 files changed, 77 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > index 209e6fb605b2d8724935b62001032e7d39540366..b7c3aa8d0e2ca58091deacdeaccb0819d2bf045c 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > @@ -753,6 +753,34 @@ static void dpu_encoder_assign_crtc_resources(struct dpu_kms *dpu_kms,
> > cstate->num_mixers = num_lm;
> > }
> > +/**
> > + * dpu_encoder_virt_check_mode_changed: check if full modeset is required
> > + * @drm_enc: Pointer to drm encoder structure
> > + * @crtc_state: Corresponding CRTC state to be checked
> > + * @conn_state: Corresponding Connector's state to be checked
> > + *
> > + * Check if the changes in the object properties demand full mode set.
> > + */
> > +int dpu_encoder_virt_check_mode_changed(struct drm_encoder *drm_enc,
> > + struct drm_crtc_state *crtc_state,
> > + struct drm_connector_state *conn_state)
> > +{
> > + struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
> > + struct msm_display_topology topology;
> > +
> > + DPU_DEBUG_ENC(dpu_enc, "\n");
> > +
> > + /* Using mode instead of adjusted_mode as it wasn't computed yet */
> > + topology = dpu_encoder_get_topology(dpu_enc, &crtc_state->mode, crtc_state, conn_state);
> > +
> > + if (topology.needs_cdm && !dpu_enc->cur_master->hw_cdm)
> > + crtc_state->mode_changed = true;
> > + else if (!topology.needs_cdm && dpu_enc->cur_master->hw_cdm)
> > + crtc_state->mode_changed = true;
> > +
> > + return 0;
> > +}
>
> How will this work exactly?
>
> needs_cdm is set in the encoder's atomic_check which is called inside
> drm_atomic_helper_check(). But this function is called before that.
>
> So needs_cdm will never hit.
>
Please refer to the previous patch, it should answer your question.
>
> > +
> > static int dpu_encoder_virt_atomic_check(
> > struct drm_encoder *drm_enc,
> > struct drm_crtc_state *crtc_state,
> > @@ -786,10 +814,6 @@ static int dpu_encoder_virt_atomic_check(
> > topology = dpu_encoder_get_topology(dpu_enc, adj_mode, crtc_state, conn_state);
> > - if (topology.needs_cdm && !dpu_enc->cur_master->hw_cdm)
> > - crtc_state->mode_changed = true;
> > - else if (!topology.needs_cdm && dpu_enc->cur_master->hw_cdm)
> > - crtc_state->mode_changed = true;
> > /*
> > * Release and Allocate resources on every modeset
> > */
--
With best wishes
Dmitry
Powered by blists - more mailing lists