From: Melissa Wen <mwen@igalia.com>
To: airlied@gmail.com, alexander.deucher@amd.com,
christian.koenig@amd.com, harry.wentland@amd.com,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
simona@ffwll.ch, siqueira@igalia.com, sunpeng.li@amd.com,
tzimmermann@suse.de
Cc: Alex Hung <alex.hung@amd.com>, Simon Ser <contact@emersion.fr>,
Uma Shankar <uma.shankar@intel.com>,
Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>,
Xaver Hugl <xaver.hugl@kde.org>,
Pekka Paalanen <pekka.paalanen@collabora.com>,
Louis Chauvet <louis.chauvet@bootlin.com>,
Matthew Schwartz <matthew.schwartz@linux.dev>,
amd-gfx@lists.freedesktop.org, kernel-dev@igalia.com,
Rob Clark <robin.clark@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: [PATCH v6 2/6] drm/atomic: reject colorop update from inactive color pipeline
Date: Tue, 19 May 2026 23:09:05 +0200 [thread overview]
Message-ID: <20260519211111.228303-3-mwen@igalia.com> (raw)
In-Reply-To: <20260519211111.228303-1-mwen@igalia.com>
Only allow updates on colorops that are part of an active pipeline.
Check if a colorop in a new state belongs to a color pipeline which was
set as a plane color_pipeline property and therefore is an active color
pipeline. If not, reject the atomic state. Performing this check later
in drm_atomic_check_only() to remove the ordering dependency that would
exist if done at the time of colorop property setting.
Suggested-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Signed-off-by: Melissa Wen <mwen@igalia.com>
---
drivers/gpu/drm/drm_atomic.c | 38 ++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 28831a548b0c..659cf56150e5 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -812,6 +812,33 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
return 0;
}
+/**
+ * drm_atomic_colorop_check - check new colorop state
+ * @new_colorop_state: new colorop state to check
+ *
+ * Ensure that the colorop in @new_colorop_state belongs to an active color
+ * pipeline, i.e. it's in the chain of colorops set to the color_pipeline
+ * property of a plane state.
+ *
+ * Returns: 0 on success, -EINVAL otherwise.
+ */
+static int drm_atomic_colorop_check(const struct drm_colorop_state *new_colorop_state)
+{
+ struct drm_colorop *colorop, *color_pipeline;
+ struct drm_plane_state *new_plane_state;
+
+ new_plane_state = drm_atomic_get_new_plane_state(new_colorop_state->state,
+ new_colorop_state->colorop->plane);
+ color_pipeline = new_plane_state ? new_plane_state->color_pipeline :
+ new_colorop_state->colorop->plane->state->color_pipeline;
+
+ for (colorop = color_pipeline; colorop; colorop = colorop->next)
+ if (colorop == new_colorop_state->colorop)
+ return 0;
+
+ return -EINVAL;
+}
+
static void drm_atomic_colorop_print_state(struct drm_printer *p,
const struct drm_colorop_state *state)
{
@@ -1665,6 +1692,8 @@ int drm_atomic_check_only(struct drm_atomic_commit *state)
struct drm_plane *plane;
struct drm_plane_state *old_plane_state;
struct drm_plane_state *new_plane_state;
+ struct drm_colorop *colorop;
+ struct drm_colorop_state *new_colorop_state;
struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state;
struct drm_crtc_state *new_crtc_state;
@@ -1681,6 +1710,15 @@ int drm_atomic_check_only(struct drm_atomic_commit *state)
requested_crtc |= drm_crtc_mask(crtc);
}
+ for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) {
+ ret = drm_atomic_colorop_check(new_colorop_state);
+ if (ret) {
+ drm_dbg_atomic(dev, "[COLOROP:%d:%d] is not part of an active color pipeline.\n",
+ colorop->base.id, colorop->type);
+ return ret;
+ }
+ }
+
for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
ret = drm_atomic_plane_check(old_plane_state, new_plane_state);
if (ret) {
--
2.53.0
next prev parent reply other threads:[~2026-05-19 21:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 21:09 [PATCH v6 0/6] drm/atomic: track individual colorop updates Melissa Wen
2026-05-19 21:09 ` [PATCH v6 1/6] drm/atomic: only add colorop state from active color pipeline Melissa Wen
2026-05-25 12:24 ` Claude review: " Claude Code Review Bot
2026-05-19 21:09 ` Melissa Wen [this message]
2026-05-21 11:00 ` [PATCH v6 2/6] drm/atomic: reject colorop update from inactive " Borah, Chaitanya Kumar
2026-05-21 12:56 ` Melissa Wen
2026-05-21 13:18 ` Melissa Wen
2026-05-25 12:24 ` Claude review: " Claude Code Review Bot
2026-05-19 21:09 ` [PATCH v6 3/6] drm/colorop: Remove read-only comments from interpolation fields Melissa Wen
2026-05-25 12:24 ` Claude review: " Claude Code Review Bot
2026-05-19 21:09 ` [PATCH v6 4/6] drm/colorop: make lut(1/3)d_interpolation mutable Melissa Wen
2026-05-21 11:17 ` Borah, Chaitanya Kumar
2026-05-21 13:27 ` Melissa Wen
2026-05-25 12:24 ` Claude review: " Claude Code Review Bot
2026-05-19 21:09 ` [PATCH v6 5/6] drm/atomic: track individual colorop updates Melissa Wen
2026-05-25 12:24 ` Claude review: " Claude Code Review Bot
2026-05-19 21:09 ` [PATCH v6 6/6] drm/amd/display: use plane color_mgmt_changed to track colorop changes Melissa Wen
2026-05-25 12:24 ` Claude review: " Claude Code Review Bot
2026-05-25 12:24 ` Claude review: drm/atomic: track individual colorop updates Claude Code Review Bot
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=20260519211111.228303-3-mwen@igalia.com \
--to=mwen@igalia.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=alex.hung@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=chaitanya.kumar.borah@intel.com \
--cc=christian.koenig@amd.com \
--cc=contact@emersion.fr \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=jesszhan0024@gmail.com \
--cc=kernel-dev@igalia.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=louis.chauvet@bootlin.com \
--cc=lumag@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marijn.suijten@somainline.org \
--cc=matthew.schwartz@linux.dev \
--cc=mripard@kernel.org \
--cc=pekka.paalanen@collabora.com \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=siqueira@igalia.com \
--cc=sunpeng.li@amd.com \
--cc=tzimmermann@suse.de \
--cc=uma.shankar@intel.com \
--cc=xaver.hugl@kde.org \
/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