From nobody Fri Dec 19 17:17:07 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 EF6063148C1; Fri, 5 Dec 2025 09:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764928387; cv=none; b=ejS339LQMBNetrKmzy5MM6fJM9QoNoO1LwKCAT4M31hwmoTqRxM0z+s01XPwMdXs+/Jhhnm5mDSKwADKREeSYe9p1UvpBNktS46taFc/eWC5UZROzJKYC3gPDP7q+4dv4c6bo4n7IuhoiFQfQ5xCbI/usTFqTIwzfQDTPW4DLu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764928387; c=relaxed/simple; bh=H3iYoV2u9r8Jk4Es7Q8H1ijV4oQjUUL3oWEdE+IWF8Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CGkoaAoaSQaZ2v6X3sFqpP1M4q9DVaFUBqy/M1Z4B7edAILITXWbpYb4BjkkNSiOv6L5dOh1i6qe8TlklL9ALGS56+cV2rMmwtBHrvdxtEjacGuWnOeXfhtywy5yPxVDPzGo1zBC5G3c1wLxPnMGCLNmIZMwzqYR48iLvzm+8io= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=t+Pobx3k; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="t+Pobx3k" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 019281698; Fri, 5 Dec 2025 10:50:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1764928213; bh=H3iYoV2u9r8Jk4Es7Q8H1ijV4oQjUUL3oWEdE+IWF8Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=t+Pobx3kWZWMt/3iPVjse+cvhwXCnHnZpzWU+hyTGXOBYs8yPG53Z1DqYRIWUPCNM FrcTw6jPw3mKIhhgP36dIh/aOirHRPV51KTDhk68K+Z/a3YxsFIQ4PCcqb0TXk4SpB 8ZfnaRqMLFqTFV6mOAEGRvCHpz4lNrHt3bDFHoO4= From: Tomi Valkeinen Date: Fri, 05 Dec 2025 11:51:50 +0200 Subject: [PATCH 3/4] drm/atomic-helper: Export and namespace some functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251205-drm-seq-fix-v1-3-fda68fa1b3de@ideasonboard.com> References: <20251205-drm-seq-fix-v1-0-fda68fa1b3de@ideasonboard.com> In-Reply-To: <20251205-drm-seq-fix-v1-0-fda68fa1b3de@ideasonboard.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Dmitry Baryshkov , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Jyri Sarha Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski , Louis-Alexis Eyraud , Aradhya Bhatia , Linus Walleij , Chaoyi Chen , Vicente Bergas , Marek Vasut , Tomi Valkeinen , stable@vger.kernel.org X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=10930; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=F5H0/6LPFd3VrdUCkl9TQQyakRyv9LISoY+KgS2MwLA=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBpMqtWaJNXojh3c+Ewaz+pFtky4IV5bYpYBocWO kPXpLijOauJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCaTKrVgAKCRD6PaqMvJYe 9Y60EACrZv4FojLk5Y7t5enoqig0Hgz/HdhYosA2II+6nNilUBS9lP/OAg9+qOVdNVudJwPVqeX CwjSNT4YSflCDKkfJ2/IYwdjTV1m/qGmWZlznMS8VLeSKJLfLYqeZySRBcRGwRWmVRCErieMUkg nxtHmxbyo1/qfbB6JUkJRytwf144bK12v/X7FHAjnpwVcVfKB1CNgrpctfH05741rkl0oUlHwIy zAse1ZQPK8N3WQHBGw+06kYNhzR+2FdB2/AwTrarPoI8x6dDc9ImyBthsszprfFwIgVZ0ewXXd7 t+3q8fM2Cs/QDNBdpSRkGWHr7yEqNcVTt77OqTj1Pam/TzsbyqtshD7c5djEqaDzBr96bApBP/R 9rFUd6E/01vq4gqHcYuc1Qzzk1kup3t4ZgkJuhjlL9FVqDwU9yARCjBFn6FN6BaZ4gBFcOtS54b cyeJVqz3UvPW9IsatN3AFxHf2cfW4B1PUPK0Xy73NVtILGgMrfzYV9yA2jZaLoSgn1tbTpLaybF FXGBUMtomHdEhOmqIXSvCaY8OsxmNIRpoSu0311OqjjwLe3UIMlbqa90rxRf6jAJWXQuTd4P/8x 4Q5hCpvIfhTtuUMm5u/Gb5THP4g8aP2LYSZf3p4DFQf166yrmybKXzdBQI8Yzdia2e5ZvjFJoP8 yxbsgfLSjtP3mjw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 From: Linus Walleij Export and namespace those not prefixed with drm_* so it becomes possible to write custom commit tail functions in individual drivers using the helper infrastructure. Tested-by: Marek Vasut Reviewed-by: Maxime Ripard Signed-off-by: Linus Walleij [Tomi: Resolved conflicts, fixed indentation] Signed-off-by: Tomi Valkeinen Cc: stable@vger.kernel.org # v6.17+ Reviewed-by: Aradhya Bhatia --- drivers/gpu/drm/drm_atomic_helper.c | 122 +++++++++++++++++++++++++++++---= ---- include/drm/drm_atomic_helper.h | 22 +++++++ 2 files changed, 121 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atom= ic_helper.c index ef97f37560b2..5beea645035f 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1162,8 +1162,18 @@ crtc_needs_disable(struct drm_crtc_state *old_state, new_state->self_refresh_active; } =20 -static void -encoder_bridge_disable(struct drm_device *dev, struct drm_atomic_state *st= ate) +/** + * drm_atomic_helper_commit_encoder_bridge_disable - disable bridges and e= ncoder + * @dev: DRM device + * @state: the driver state object + * + * Loops over all connectors in the current state and if the CRTC needs + * it, disables the bridge chain all the way, then disables the encoder + * afterwards. + */ +void +drm_atomic_helper_commit_encoder_bridge_disable(struct drm_device *dev, + struct drm_atomic_state *state) { struct drm_connector *connector; struct drm_connector_state *old_conn_state, *new_conn_state; @@ -1229,9 +1239,18 @@ encoder_bridge_disable(struct drm_device *dev, struc= t drm_atomic_state *state) } } } +EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_disable); =20 -static void -crtc_disable(struct drm_device *dev, struct drm_atomic_state *state) +/** + * drm_atomic_helper_commit_crtc_disable - disable CRTSs + * @dev: DRM device + * @state: the driver state object + * + * Loops over all CRTCs in the current state and if the CRTC needs + * it, disables it. + */ +void +drm_atomic_helper_commit_crtc_disable(struct drm_device *dev, struct drm_a= tomic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state, *new_crtc_state; @@ -1282,9 +1301,18 @@ crtc_disable(struct drm_device *dev, struct drm_atom= ic_state *state) drm_crtc_vblank_put(crtc); } } +EXPORT_SYMBOL(drm_atomic_helper_commit_crtc_disable); =20 -static void -encoder_bridge_post_disable(struct drm_device *dev, struct drm_atomic_stat= e *state) +/** + * drm_atomic_helper_commit_encoder_bridge_post_disable - post-disable enc= oder bridges + * @dev: DRM device + * @state: the driver state object + * + * Loops over all connectors in the current state and if the CRTC needs + * it, post-disables all encoder bridges. + */ +void +drm_atomic_helper_commit_encoder_bridge_post_disable(struct drm_device *de= v, struct drm_atomic_state *state) { struct drm_connector *connector; struct drm_connector_state *old_conn_state, *new_conn_state; @@ -1335,15 +1363,16 @@ encoder_bridge_post_disable(struct drm_device *dev,= struct drm_atomic_state *sta drm_bridge_put(bridge); } } +EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_post_disable); =20 static void disable_outputs(struct drm_device *dev, struct drm_atomic_state *state) { - encoder_bridge_disable(dev, state); + drm_atomic_helper_commit_encoder_bridge_disable(dev, state); =20 - encoder_bridge_post_disable(dev, state); + drm_atomic_helper_commit_encoder_bridge_post_disable(dev, state); =20 - crtc_disable(dev, state); + drm_atomic_helper_commit_crtc_disable(dev, state); } =20 /** @@ -1446,8 +1475,17 @@ void drm_atomic_helper_calc_timestamping_constants(s= truct drm_atomic_state *stat } EXPORT_SYMBOL(drm_atomic_helper_calc_timestamping_constants); =20 -static void -crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *state) +/** + * drm_atomic_helper_commit_crtc_set_mode - set the new mode + * @dev: DRM device + * @state: the driver state object + * + * Loops over all connectors in the current state and if the mode has + * changed, change the mode of the CRTC, then call down the bridge + * chain and change the mode in all bridges as well. + */ +void +drm_atomic_helper_commit_crtc_set_mode(struct drm_device *dev, struct drm_= atomic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *new_crtc_state; @@ -1508,6 +1546,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atom= ic_state *state) drm_bridge_put(bridge); } } +EXPORT_SYMBOL(drm_atomic_helper_commit_crtc_set_mode); =20 /** * drm_atomic_helper_commit_modeset_disables - modeset commit to disable o= utputs @@ -1531,12 +1570,21 @@ void drm_atomic_helper_commit_modeset_disables(stru= ct drm_device *dev, drm_atomic_helper_update_legacy_modeset_state(dev, state); drm_atomic_helper_calc_timestamping_constants(state); =20 - crtc_set_mode(dev, state); + drm_atomic_helper_commit_crtc_set_mode(dev, state); } EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_disables); =20 -static void drm_atomic_helper_commit_writebacks(struct drm_device *dev, - struct drm_atomic_state *state) +/** + * drm_atomic_helper_commit_writebacks - issue writebacks + * @dev: DRM device + * @state: atomic state object being committed + * + * This loops over the connectors, checks if the new state requires + * a writeback job to be issued and in that case issues an atomic + * commit on each connector. + */ +void drm_atomic_helper_commit_writebacks(struct drm_device *dev, + struct drm_atomic_state *state) { struct drm_connector *connector; struct drm_connector_state *new_conn_state; @@ -1555,9 +1603,18 @@ static void drm_atomic_helper_commit_writebacks(stru= ct drm_device *dev, } } } +EXPORT_SYMBOL(drm_atomic_helper_commit_writebacks); =20 -static void -encoder_bridge_pre_enable(struct drm_device *dev, struct drm_atomic_state = *state) +/** + * drm_atomic_helper_commit_encoder_bridge_pre_enable - pre-enable bridges + * @dev: DRM device + * @state: atomic state object being committed + * + * This loops over the connectors and if the CRTC needs it, pre-enables + * the entire bridge chain. + */ +void +drm_atomic_helper_commit_encoder_bridge_pre_enable(struct drm_device *dev,= struct drm_atomic_state *state) { struct drm_connector *connector; struct drm_connector_state *new_conn_state; @@ -1588,9 +1645,18 @@ encoder_bridge_pre_enable(struct drm_device *dev, st= ruct drm_atomic_state *state drm_bridge_put(bridge); } } +EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_pre_enable); =20 -static void -crtc_enable(struct drm_device *dev, struct drm_atomic_state *state) +/** + * drm_atomic_helper_commit_crtc_enable - enables the CRTCs + * @dev: DRM device + * @state: atomic state object being committed + * + * This loops over CRTCs in the new state, and of the CRTC needs + * it, enables it. + */ +void +drm_atomic_helper_commit_crtc_enable(struct drm_device *dev, struct drm_at= omic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state; @@ -1619,9 +1685,18 @@ crtc_enable(struct drm_device *dev, struct drm_atomi= c_state *state) } } } +EXPORT_SYMBOL(drm_atomic_helper_commit_crtc_enable); =20 -static void -encoder_bridge_enable(struct drm_device *dev, struct drm_atomic_state *sta= te) +/** + * drm_atomic_helper_commit_encoder_bridge_enable - enables the bridges + * @dev: DRM device + * @state: atomic state object being committed + * + * This loops over all connectors in the new state, and of the CRTC needs + * it, enables the entire bridge chain. + */ +void +drm_atomic_helper_commit_encoder_bridge_enable(struct drm_device *dev, str= uct drm_atomic_state *state) { struct drm_connector *connector; struct drm_connector_state *new_conn_state; @@ -1664,6 +1739,7 @@ encoder_bridge_enable(struct drm_device *dev, struct = drm_atomic_state *state) drm_bridge_put(bridge); } } +EXPORT_SYMBOL(drm_atomic_helper_commit_encoder_bridge_enable); =20 /** * drm_atomic_helper_commit_modeset_enables - modeset commit to enable out= puts @@ -1682,11 +1758,11 @@ encoder_bridge_enable(struct drm_device *dev, struc= t drm_atomic_state *state) void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state) { - crtc_enable(dev, state); + drm_atomic_helper_commit_crtc_enable(dev, state); =20 - encoder_bridge_pre_enable(dev, state); + drm_atomic_helper_commit_encoder_bridge_pre_enable(dev, state); =20 - encoder_bridge_enable(dev, state); + drm_atomic_helper_commit_encoder_bridge_enable(dev, state); =20 drm_atomic_helper_commit_writebacks(dev, state); } diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helpe= r.h index 53382fe93537..e154ee4f0696 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -60,6 +60,12 @@ int drm_atomic_helper_check_plane_state(struct drm_plane= _state *plane_state, int drm_atomic_helper_check_planes(struct drm_device *dev, struct drm_atomic_state *state); int drm_atomic_helper_check_crtc_primary_plane(struct drm_crtc_state *crtc= _state); +void drm_atomic_helper_commit_encoder_bridge_disable(struct drm_device *de= v, + struct drm_atomic_state *state); +void drm_atomic_helper_commit_crtc_disable(struct drm_device *dev, + struct drm_atomic_state *state); +void drm_atomic_helper_commit_encoder_bridge_post_disable(struct drm_devic= e *dev, + struct drm_atomic_state *state); int drm_atomic_helper_check(struct drm_device *dev, struct drm_atomic_state *state); void drm_atomic_helper_commit_tail(struct drm_atomic_state *state); @@ -89,8 +95,24 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm= _device *dev, void drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *sta= te); =20 +void drm_atomic_helper_commit_crtc_set_mode(struct drm_device *dev, + struct drm_atomic_state *state); + void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev, struct drm_atomic_state *state); + +void drm_atomic_helper_commit_writebacks(struct drm_device *dev, + struct drm_atomic_state *state); + +void drm_atomic_helper_commit_encoder_bridge_pre_enable(struct drm_device = *dev, + struct drm_atomic_state *state); + +void drm_atomic_helper_commit_crtc_enable(struct drm_device *dev, + struct drm_atomic_state *state); + +void drm_atomic_helper_commit_encoder_bridge_enable(struct drm_device *dev, + struct drm_atomic_state *state); + void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *old_state); =20 --=20 2.43.0