Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0A073BD225 for ; Tue, 19 May 2026 21:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779225121; cv=none; b=adRMUWsHJC0M8+jlPm/GEEA/X+SQ/ylDU1SZECnkbk/XGGpLoNPNJPB2dk6CKx26Vahj7I+S3XXD+5JnHNWGpHtxlM8/xDzx5UL6oLao8E2gHHGDOjhp3aJ4HpBEhH7qIN24cafpFEC8gk380OTfVbKe73rNnj6IDqFmqvY13M4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779225121; c=relaxed/simple; bh=Tw3Mg3HwI+kvIeJbirQf+eO5cQWaJEo3CH+16VVhhd4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U7+t/WnjsuksEZPJ/Com5cqYirkJ4BmN5xD5zfub/P3zDQnA61fkB+iw2m8ymhsRRJloi1sVsXcDf1kEY8NnH3olq0NnE/XzatpUB1PScx2Jih94uaWLEvUb000uZZ2G/Ag3NFHh2AbBsN9V8zoHRqoNv3HkmWx7Kd+La+4VT88= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=QSTzYNdd; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="QSTzYNdd" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=fv3F4vcs7w0hgz7fUYNfTQhxOQaYZd+KTTBptaKiGRU=; b=QSTzYNddf/6fZPFDEGvw75Gohu pCJjDZWm4UQDk4IgQaeFCsUbaDgjMqICW3aSnxxwReGNLoLzJQ22U0mF1Fh5N0npG69Obenq0I9NF YH33xljHHvOY9LoynE6DsrirGVIu3dwo/4RBoUl2HuCPerFh+WgGWXRv5rpbjjP8XwEbWHfshbJ9c +R/xQQJt17mZ2t2Th5ZyO9UrRxqu7BYMjsPynZMQuytHHIVzODGGuV6402F2pARdZZUOO6Y/phLYD lIvakZYd/o2NNpwFsbfKpLtUwNFNvHF29Ss5lMp/xsCSIacG8KCW9EKNEygZycJx0WrALupZCXDrH f9zau6cg==; Received: from [79.117.146.159] (helo=killbill.home) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wPRin-003Ppa-3y; Tue, 19 May 2026 23:11:25 +0200 From: Melissa Wen 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 , Simon Ser , Uma Shankar , Chaitanya Kumar Borah , Xaver Hugl , Pekka Paalanen , Louis Chauvet , Matthew Schwartz , amd-gfx@lists.freedesktop.org, kernel-dev@igalia.com, Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , 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 Message-ID: <20260519211111.228303-3-mwen@igalia.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260519211111.228303-1-mwen@igalia.com> References: <20260519211111.228303-1-mwen@igalia.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Melissa Wen --- 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