[PATCH v2 22/28] drm/encoder: Create atomic_sro_get_current_crtc hook
From: Maxime Ripard
Date: Thu Apr 23 2026 - 06:23:55 EST
In order for drivers to implement drm_connectors atomic_state_readout
hooks, they need to query the hardware and lookup the CRTC to set
drm_connector_state.crtc.
It should be easy enough for drivers that are tightly integrated from
the CRTC to the connectors, but if the driver uses bridges, there's no
coupling between the CRTC and encoder, and the bridge driver.
The only thing the bridge has access to is the encoder, but the
relationship between a CRTC and an encoder isn't a fixed mapping at the
framework level, and thus the bridge can't deduce which CRTC is feeding
its encoder.
Create a new hook for encoders to implement to return the
CRTC they are currently connected to.
Signed-off-by: Maxime Ripard <mripard@xxxxxxxxxx>
---
include/drm/drm_encoder.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h
index eded7c34481a..7f41ec0a68dc 100644
--- a/include/drm/drm_encoder.h
+++ b/include/drm/drm_encoder.h
@@ -87,10 +87,28 @@ struct drm_encoder_funcs {
* @debugfs_init:
*
* Allows encoders to create encoder-specific debugfs files.
*/
void (*debugfs_init)(struct drm_encoder *encoder, struct dentry *root);
+
+ /**
+ * @atomic_sro_get_current_crtc:
+ *
+ * This optional hook is called during hardware state readout
+ * to determine which CRTC is currently driving this encoder.
+ *
+ * It is needed by the bridge connector readout code to
+ * establish the CRTC-encoder-connector association from the
+ * hardware state, since the relationship between a CRTC and
+ * an encoder is not a fixed mapping at the framework level.
+ *
+ * RETURNS:
+ *
+ * The CRTC currently associated with the encoder if enabled,
+ * NULL otherwise.
+ */
+ struct drm_crtc *(*atomic_sro_get_current_crtc)(struct drm_encoder *encoder);
};
/**
* struct drm_encoder - central DRM encoder structure
* @dev: parent DRM device
--
2.53.0