From: Maxime Ripard <mripard@kernel.org>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Douglas Anderson <dianders@chromium.org>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Maxime Ripard <mripard@kernel.org>
Subject: [PATCH v2 30/35] drm/bridge: Provide pointers to the connector and crtc in bridge state
Date: Tue, 04 Feb 2025 15:57:58 +0100 [thread overview]
Message-ID: <20250204-bridge-connector-v2-30-35dd6c834e08@kernel.org> (raw)
In-Reply-To: <20250204-bridge-connector-v2-0-35dd6c834e08@kernel.org>
Now that connectors are no longer necessarily created by the bridges
drivers themselves but might be created by drm_bridge_connector, it's
pretty hard for bridge drivers to retrieve pointers to the connector and
CRTC they are attached to.
Indeed, the only way to retrieve the CRTC is to follow the drm_bridge
encoder field, and then the drm_encoder crtc field, both of them being
deprecated.
And for the connector, since we can have multiple connectors attached to
a CRTC, we don't really have a reliable way to get it.
Let's provide both pointers in the drm_bridge_state structure so we
don't have to follow deprecated, non-atomic, pointers, and be more
consistent with the other KMS entities.
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
drivers/gpu/drm/drm_atomic_state_helper.c | 5 +++++
drivers/gpu/drm/drm_bridge.c | 5 +++++
include/drm/drm_atomic.h | 14 ++++++++++++++
3 files changed, 24 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
index 519228eb109533d2596e899a57b571fa0995824f..66661dca077215b78dffca7bc1712f56d35e3918 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -777,10 +777,15 @@ EXPORT_SYMBOL(drm_atomic_helper_bridge_duplicate_state);
* that don't subclass the bridge state.
*/
void drm_atomic_helper_bridge_destroy_state(struct drm_bridge *bridge,
struct drm_bridge_state *state)
{
+ if (state->connector) {
+ drm_connector_put(state->connector);
+ state->connector = NULL;
+ }
+
kfree(state);
}
EXPORT_SYMBOL(drm_atomic_helper_bridge_destroy_state);
/**
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index ad91a0ac375a9c8cf82834354ec7f654a59a7292..fcff08c7d609477b7cadabc109f0b543a6b9b506 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -803,10 +803,15 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge,
bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state,
bridge);
if (WARN_ON(!bridge_state))
return -EINVAL;
+ bridge_state->crtc = crtc_state->crtc;
+
+ drm_connector_get(conn_state->connector);
+ bridge_state->connector = conn_state->connector;
+
if (bridge->funcs->atomic_check) {
ret = bridge->funcs->atomic_check(bridge, bridge_state,
crtc_state, conn_state);
if (ret)
return ret;
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 7af43062e5ca8c30b3fd600a34543e79137ab3ea..12f3676b85454e81de74c6b5eec700a355d42836 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -1197,10 +1197,24 @@ struct drm_bridge_state {
/**
* @bridge: the bridge this state refers to
*/
struct drm_bridge *bridge;
+ /**
+ * @crtc: CRTC the bridge is connected to, NULL if disabled.
+ *
+ * Do not change this directly.
+ */
+ struct drm_crtc *crtc;
+
+ /**
+ * @connector: The connector the bridge is connected to, NULL if disabled.
+ *
+ * Do not change this directly.
+ */
+ struct drm_connector *connector;
+
/**
* @input_bus_cfg: input bus configuration
*/
struct drm_bus_cfg input_bus_cfg;
--
2.48.0
next prev parent reply other threads:[~2025-02-04 15:00 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 14:57 [PATCH v2 00/35] drm/bridge: Various quality of life improvements Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 01/35] drm/atomic: Document history of drm_atomic_state Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 02/35] drm/bridge: Pass full state to atomic_pre_enable Maxime Ripard
2025-02-05 2:53 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 03/35] drm/bridge: Pass full state to atomic_enable Maxime Ripard
2025-02-05 2:54 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 04/35] drm/bridge: Pass full state to atomic_disable Maxime Ripard
2025-02-05 3:19 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 05/35] drm/bridge: Pass full state to atomic_post_disable Maxime Ripard
2025-02-08 5:19 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 06/35] drm/atomic-helper: Fix commit_tail state variable name Maxime Ripard
2025-02-09 1:20 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 07/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_dependencies() Maxime Ripard
2025-02-09 2:01 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 08/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail() Maxime Ripard
2025-02-09 2:03 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 09/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail_rpm() Maxime Ripard
2025-02-09 2:03 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 10/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_modeset_disables() Maxime Ripard
2025-02-09 2:11 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 11/35] drm/atomic-helper: Change parameter name of disable_outputs() Maxime Ripard
2025-02-09 2:12 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 12/35] drm/bridge: Change parameter name of drm_atomic_bridge_chain_disable() Maxime Ripard
2025-02-09 2:45 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 13/35] drm/bridge: Change parameter name of drm_atomic_bridge_chain_post_disable() Maxime Ripard
2025-02-08 1:08 ` Doug Anderson
2025-02-04 14:57 ` [PATCH v2 14/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_update_legacy_modeset_state() Maxime Ripard
2025-02-09 5:08 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 15/35] drm/atomic-helper: Change parameter name of crtc_set_mode() Maxime Ripard
2025-02-09 5:08 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 16/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_planes() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 17/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_modeset_enables() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 18/35] drm/bridge: Change parameter name of drm_atomic_bridge_chain_pre_enable() Maxime Ripard
2025-02-08 1:08 ` Doug Anderson
2025-02-04 14:57 ` [PATCH v2 19/35] drm/bridge: Change parameter name of drm_atomic_bridge_chain_enable() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 20/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_writebacks() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 21/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_fake_vblank() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 22/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_hw_done() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 23/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_vblanks() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 24/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_cleanup_planes() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 25/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_cleanup_done() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 26/35] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_flip_done() Maxime Ripard
2025-02-04 14:57 ` [PATCH v2 27/35] drm/bridge: Add encoder parameter to drm_bridge_funcs.attach Maxime Ripard
2025-02-09 6:18 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 28/35] drm/bridge: Provide a helper to retrieve current bridge state Maxime Ripard
2025-02-09 6:12 ` Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 29/35] drm/bridge: Assume that a bridge is atomic if it has atomic_reset Maxime Ripard
2025-02-09 6:18 ` Dmitry Baryshkov
2025-02-04 14:57 ` Maxime Ripard [this message]
2025-02-09 7:00 ` [PATCH v2 30/35] drm/bridge: Provide pointers to the connector and crtc in bridge state Dmitry Baryshkov
2025-02-04 14:57 ` [PATCH v2 31/35] drm/bridge: Make encoder pointer deprecated Maxime Ripard
2025-02-09 7:01 ` Dmitry Baryshkov
2025-02-04 14:58 ` [PATCH v2 32/35] drm/bridge: cdns-csi: Switch to atomic helpers Maxime Ripard
2025-02-09 7:06 ` Dmitry Baryshkov
2025-02-04 14:58 ` [PATCH v2 33/35] drm/bridge: tc358775: Switch to atomic commit Maxime Ripard
2025-02-09 7:07 ` Dmitry Baryshkov
2025-02-04 14:58 ` [PATCH v2 34/35] drm/bridge: tc358768: Convert to atomic helpers Maxime Ripard
2025-02-09 7:13 ` Dmitry Baryshkov
2025-02-11 14:33 ` Maxime Ripard
2025-02-12 0:38 ` Dmitry Baryshkov
2025-02-12 8:24 ` Maxime Ripard
2025-02-12 10:51 ` Dmitry Baryshkov
2025-02-04 14:58 ` [PATCH v2 35/35] drm/bridge: ti-sn65dsi86: Use bridge_state crtc pointer Maxime Ripard
2025-02-08 1:44 ` Doug Anderson
2025-02-11 13:14 ` Maxime Ripard
2025-02-11 17:52 ` Doug Anderson
2025-02-11 22:16 ` Doug Anderson
2025-02-12 15:14 ` Doug Anderson
2025-02-09 3:27 ` [PATCH v2 00/35] drm/bridge: Various quality of life improvements Dmitry Baryshkov
2025-02-11 13:17 ` Maxime Ripard
2025-02-12 0:51 ` Dmitry Baryshkov
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=20250204-bridge-connector-v2-30-35dd6c834e08@kernel.org \
--to=mripard@kernel.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.