From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E7A8CD4F5B for ; Tue, 19 May 2026 21:11:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B61010EE68; Tue, 19 May 2026 21:11:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="KWMVJnT6"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C2BB10E3EB; Tue, 19 May 2026 21:11:51 +0000 (UTC) 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=q6BcCcRV+cJhBvv8K0mcGHuB1HRoFJa0mBIPtr1U/78=; b=KWMVJnT6YtJPZixNM095MdriYM JoVJOdqX9gFYR8jEfaVysbJ+MPetUqSssyIvAdjCPNYc/NjTFpMd0vL20XpgFLnuazZKGcuq+yZ2/ YqQ7pd/hDT0vTaf1wSnOkaCmtzbOtZAZR3PsFwH3QF+vX6bG8YSysdFnqFfrY472S44ta+vWDMkAs 9qccGhLqhaHrKB9CFkfB/gmtClWk9EgCng1XEICPcD+iiwiccB6FRckZCnwXbS6JPHUi8bqME6uVb LcZBXgyhxh9Plv14AT2SP2CDcx9mibgf291GZwxcXDNxjgj1TWVS8nfy1JZjE0gPbuUQX1PtYbgYQ H6nfLToQ==; 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 1wPRil-003Ppa-DO; Tue, 19 May 2026 23:11:23 +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 1/6] drm/atomic: only add colorop state from active color pipeline Date: Tue, 19 May 2026 23:09:04 +0200 Message-ID: <20260519211111.228303-2-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> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of adding colorop state of all colorops of a given plane, only get those from an active color pipeline of this plane. Reviewed-by: Chaitanya Kumar Borah Signed-off-by: Melissa Wen --- v5: fix kernel-doc for plane_state (kernel bot) v6: correctly reword state to plane_state (Chaitanya) --- drivers/gpu/drm/drm_atomic.c | 40 ++++++++++++++--------------- drivers/gpu/drm/drm_atomic_helper.c | 9 +++---- include/drm/drm_atomic.h | 2 +- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 170de30c28ae..28831a548b0c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1591,26 +1591,26 @@ drm_atomic_add_affected_planes(struct drm_atomic_commit *state, if (IS_ERR(plane_state)) return PTR_ERR(plane_state); - if (plane_state->color_pipeline) { - ret = drm_atomic_add_affected_colorops(state, plane); - if (ret) - return ret; - } + ret = drm_atomic_add_affected_colorops(plane_state, plane); + if (ret) + return ret; } return 0; } EXPORT_SYMBOL(drm_atomic_add_affected_planes); /** - * drm_atomic_add_affected_colorops - add colorops for plane - * @state: atomic state + * drm_atomic_add_affected_colorops - add active colorops for plane + * @plane_state: DRM plane state * @plane: DRM plane * * This function walks the current configuration and adds all colorops - * currently used by @plane to the atomic configuration @state. This is useful - * when an atomic commit also needs to check all currently enabled colorop on - * @plane, e.g. when changing the mode. It's also useful when re-enabling a plane - * to avoid special code to force-enable all colorops. + * currently used by a @plane to the atomic plane configuration @plane_state. + * It only adds colorops that belong to an active color pipeline, i.e., + * colorops that are in the chain set to the plane's color_pipeline property. + * This function is useful when an atomic commit needs to check all currently + * enabled colorop on @plane, e.g. when changing the mode; and when re-enabling + * a plane to avoid special code to force-enable all colorops. * * Since acquiring a colorop state will always also acquire the w/w mutex of the * current plane for that colorop (if there is any) adding all the colorop states for @@ -1622,23 +1622,23 @@ EXPORT_SYMBOL(drm_atomic_add_affected_planes); * sequence must be restarted. All other errors are fatal. */ int -drm_atomic_add_affected_colorops(struct drm_atomic_commit *state, +drm_atomic_add_affected_colorops(struct drm_plane_state *plane_state, struct drm_plane *plane) { struct drm_colorop *colorop; struct drm_colorop_state *colorop_state; - WARN_ON(!drm_atomic_get_new_plane_state(state, plane)); + if (!plane_state || !plane_state->color_pipeline) + return 0; drm_dbg_atomic(plane->dev, - "Adding all current colorops for [PLANE:%d:%s] to %p\n", - plane->base.id, plane->name, state); + "Adding all current active colorops for [PLANE:%d:%s] to %p\n", + plane->base.id, plane->name, plane_state->state); - drm_for_each_colorop(colorop, plane->dev) { - if (colorop->plane != plane) - continue; - - colorop_state = drm_atomic_get_colorop_state(state, colorop); + for (colorop = plane_state->color_pipeline; + colorop; + colorop = colorop->next) { + colorop_state = drm_atomic_get_colorop_state(plane_state->state, colorop); if (IS_ERR(colorop_state)) return PTR_ERR(colorop_state); } diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 51f39edc31ed..f1638087cdec 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3752,12 +3752,9 @@ drm_atomic_helper_duplicate_state(struct drm_device *dev, goto free; } - if (plane_state->color_pipeline) { - err = drm_atomic_add_affected_colorops(state, plane); - if (err) - goto free; - } - + err = drm_atomic_add_affected_colorops(plane_state, plane); + if (err) + goto free; } drm_connector_list_iter_begin(dev, &conn_iter); diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 1a80a8cdf269..7bba193cd973 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -919,7 +919,7 @@ int __must_check drm_atomic_add_affected_planes(struct drm_atomic_commit *state, struct drm_crtc *crtc); int __must_check -drm_atomic_add_affected_colorops(struct drm_atomic_commit *state, +drm_atomic_add_affected_colorops(struct drm_plane_state *plane_state, struct drm_plane *plane); int __must_check drm_atomic_check_only(struct drm_atomic_commit *state); -- 2.53.0