From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Dave Airlie <airlied@redhat.com>,
Jocelyn Falempe <jfalempe@redhat.com>,
Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
Kalyan Thota <quic_kalyant@quicinc.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
Simona Vetter <simona.vetter@ffwll.ch>
Subject: [PATCH 3/6] drm/msm/dpu: stop upgrading commits by enabling allow_modeset
Date: Fri, 24 Jan 2025 13:14:21 +0200 [thread overview]
Message-ID: <20250124-atomic-needs-modeset-v1-3-b0c05c9eda0f@linaro.org> (raw)
In-Reply-To: <20250124-atomic-needs-modeset-v1-0-b0c05c9eda0f@linaro.org>
As pointed out by the commit c5e3306a424b ("drm/atomic: clarify the
rules around drm_atomic_state->allow_modeset"), the drivers are now
allowed to set the drm_atomic_state.allow_modeset flag, as it might
break userspace API. Stop upgrading the commit to full modeset. Instead
set the drm_crtc_state.mode_changed if modeset is allowed and if CTM has
been enabled or disabled AND check that DSPPs are assigned to the CRTC
if CTM is enabled.
NOTE: This change has userspace impact, as now non-modeset commits which
enable CTM will fail.
Fixes: 82836692d5d7 ("drm/msm/dpu: manage DPU resources if CTM is requested")
Reported-by: Simona Vetter <simona.vetter@ffwll.ch>
Closes: https://lore.kernel.org/r/20231010170746.617366-1-daniel.vetter@ffwll.ch/
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 9 +++++++++
drivers/gpu/drm/msm/msm_atomic.c | 10 ++--------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index a24fedb5ba4f1c84777b71c669bac0241acdd421..84313bc1f9888452914612fab559b390cf38c705 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -828,6 +828,15 @@ static int dpu_encoder_virt_atomic_check(
global_state, crtc_state);
}
+ if (crtc_state->ctm) {
+ struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc_state);
+ int i;
+
+ for (i = 0; i < cstate->num_mixers; i++)
+ if (!cstate->mixers[i].hw_dspp)
+ return -EINVAL;
+ }
+
trace_dpu_enc_atomic_check_flags(DRMID(drm_enc), adj_mode->flags);
return ret;
diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
index 5c8c0661cfcd85445950e0f273b8879e7f077727..fdbe49edf2e1506ebeab500e782d456d77ba4fcf 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -189,17 +189,11 @@ int msm_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
struct drm_crtc *crtc;
int i, ret = 0;
- /*
- * FIXME: stop setting allow_modeset and move this check to the DPU
- * driver.
- */
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
new_crtc_state, i) {
- if ((old_crtc_state->ctm && !new_crtc_state->ctm) ||
- (!old_crtc_state->ctm && new_crtc_state->ctm)) {
+ if ((!!old_crtc_state->ctm != !!new_crtc_state->ctm) &&
+ state->allow_modeset)
new_crtc_state->mode_changed = true;
- state->allow_modeset = true;
- }
}
if (kms && kms->funcs && kms->funcs->check_mode_changed)
--
2.39.5
next prev parent reply other threads:[~2025-01-24 11:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 11:14 [PATCH 0/6] drm: introduce atomic_needs_modeset() callbacks Dmitry Baryshkov
2025-01-24 11:14 ` [PATCH 1/6] drm/atomic-helper: add atomic_needs_modeset callbacks Dmitry Baryshkov
2025-01-24 11:14 ` [PATCH 2/6] drm/mgag200: move format check to drm_plane_helper.atomic_needs_modeset Dmitry Baryshkov
2025-01-24 11:14 ` Dmitry Baryshkov [this message]
2025-01-24 11:14 ` [PATCH 4/6] drm/msm/dpu: move CTM check to drm_crtc_helper.atomic_needs_modeset Dmitry Baryshkov
2025-01-24 11:14 ` [PATCH 5/6] drm/msm/dpu: use atomic_needs_modeset for CDM check Dmitry Baryshkov
2025-01-24 11:14 ` [PATCH 6/6] drm/msm: drop msm_atomic_check wrapper Dmitry Baryshkov
2025-01-24 12:10 ` [PATCH 0/6] drm: introduce atomic_needs_modeset() callbacks Ville Syrjälä
2025-01-24 12:59 ` Simona Vetter
2025-01-24 13:12 ` Ville Syrjälä
2025-01-24 15:37 ` Simona Vetter
2025-01-24 16:14 ` Ville Syrjälä
2025-01-27 20:33 ` Simona Vetter
2025-01-24 16:16 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250124-atomic-needs-modeset-v1-3-b0c05c9eda0f@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=airlied@gmail.com \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jfalempe@redhat.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marijn.suijten@somainline.org \
--cc=mripard@kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_kalyant@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=simona.vetter@ffwll.ch \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®