lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250124-atomic-needs-modeset-v1-3-b0c05c9eda0f@linaro.org>
Date: Fri, 24 Jan 2025 13:14:21 +0200
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: 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>, 
 Dave Airlie <airlied@...hat.com>, Jocelyn Falempe <jfalempe@...hat.com>, 
 Rob Clark <robdclark@...il.com>, Abhinav Kumar <quic_abhinavk@...cinc.com>, 
 Sean Paul <sean@...rly.run>, Marijn Suijten <marijn.suijten@...ainline.org>, 
 Kalyan Thota <quic_kalyant@...cinc.com>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org, 
 linux-arm-msm@...r.kernel.org, freedreno@...ts.freedesktop.org, 
 Simona Vetter <simona.vetter@...ll.ch>
Subject: [PATCH 3/6] drm/msm/dpu: stop upgrading commits by enabling
 allow_modeset

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@...ll.ch>
Closes: https://lore.kernel.org/r/20231010170746.617366-1-daniel.vetter@ffwll.ch/
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ