dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>,
	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>,
	Jyri Sarha <jyri.sarha@iki.fi>,
	Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Devarsh Thakkar <devarsht@ti.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 22/28] drm/bridge_connector: Implement hw readout for connector
Date: Fri, 16 Oct 2026 20:06:11 +0200	[thread overview]
Message-ID: <2bb8d768-c8f2-4b2a-9a71-1194e1cbcbae@linux.intel.com> (raw)
In-Reply-To: <20261015-drm-state-readout-v6-22-6cc02cd10998@kernel.org>

Hey,

For the series:
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Would really love it if atomic_sro.[ch] is renamed to atomic_state_readout.[ch], so
we have a better idea what it's about. :-)

2 things to note:
- Hardware readout may be succesful, but the resulting state may not be valid.
  Think for example a crtc with a DP-MST connector, but the DP-MST connector
  is not yet detected at time of readout. crtc_state is invalid because connector_mask = 0.

It would be awesome if DP-MST would be detected before this point. I'm not sure this is
actually possible but it would make fastboot work on DP-MST as well.

- Alternatively some hardware may be connected to the wrong plane. Older i915 cards had a
  flexible mapping of plane 1 being connected to crtc 1 or 2, but for optimal performance you'd
  want it to be plane 1 to crtc 2. BIOS chose plane 1 to crtc 1.

Kind regards,
~Maarten Lankhorst

On 10/15/26 17:09, Maxime Ripard wrote:
> drm_bridge_connector allows to create a generic connector from a list of
> bridges.
> 
> However, it's a somewhat virtual connector, and relies on the bridges to
> implement its various capabilities.
> 
> What we actually want though is for the last bridge implementing
> hardware readout to fill the connector state from its own state.
> 
> Thus, implement a new op for bridge_connector to allow just
> that.
> 
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
> ---
>  drivers/gpu/drm/display/drm_bridge_connector.c | 35 ++++++++++++++++++++++++++
>  include/drm/drm_bridge.h                       | 27 ++++++++++++++++++++
>  2 files changed, 62 insertions(+)
> 
> diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c
> index 81f3e26f6fdf..dfc633bd8823 100644
> --- a/drivers/gpu/drm/display/drm_bridge_connector.c
> +++ b/drivers/gpu/drm/display/drm_bridge_connector.c
> @@ -8,10 +8,11 @@
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/property.h>
>  #include <linux/slab.h>
>  
> +#include <drm/drm_atomic_sro_helper.h>
>  #include <drm/drm_atomic_state_helper.h>
>  #include <drm/drm_bridge.h>
>  #include <drm/drm_bridge_connector.h>
>  #include <drm/drm_connector.h>
>  #include <drm/drm_device.h>
> @@ -65,10 +66,18 @@ struct drm_bridge_connector {
>  	 * @encoder:
>  	 *
>  	 * The encoder at the start of the bridges chain.
>  	 */
>  	struct drm_encoder *encoder;
> +	/**
> +	 * @bridge_connector_hw_readout:
> +	 *
> +	 * The last bridge in the chain (closest to the connector) that
> +	 * provides hardware state readout support, if any (see
> +	 * &DRM_BRIDGE_OP_CONNECTOR_HW_READOUT).
> +	 */
> +	struct drm_bridge *bridge_connector_hw_readout;
>  	/**
>  	 * @bridge_edid:
>  	 *
>  	 * The last bridge in the chain (closest to the connector) that provides
>  	 * EDID read support, if any (see &DRM_BRIDGE_OP_EDID).
> @@ -242,10 +251,30 @@ drm_bridge_connector_create_state(struct drm_connector *connector)
>  							      conn_state);
>  
>  	return conn_state;
>  }
>  
> +static int
> +drm_bridge_connector_readout_state(struct drm_connector *connector,
> +				   struct drm_atomic_sro_state *state,
> +				   struct drm_connector_state *conn_state)
> +{
> +	struct drm_bridge_connector *bridge_connector =
> +		to_drm_bridge_connector(connector);
> +	struct drm_bridge *readout =
> +		bridge_connector->bridge_connector_hw_readout;
> +	int ret;
> +
> +	if (readout) {
> +		ret = readout->funcs->atomic_sro_connector_readout(readout, state, conn_state);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	return 0;
> +}
> +
>  static enum drm_connector_color_format
>  drm_bridge_connector_color_format(const struct drm_connector_state *conn_state)
>  {
>  	struct drm_bridge_connector *bridge_connector =
>  		to_drm_bridge_connector(conn_state->connector);
> @@ -268,10 +297,12 @@ drm_bridge_connector_color_format(const struct drm_connector_state *conn_state)
>  }
>  
>  static const struct drm_connector_funcs drm_bridge_connector_funcs = {
>  	.fill_modes = drm_helper_probe_single_connector_modes,
>  	.atomic_create_state = drm_bridge_connector_create_state,
> +	.atomic_sro_readout_state = drm_bridge_connector_readout_state,
> +	.atomic_sro_compare_state = drm_atomic_helper_connector_compare_state,
>  	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>  	.debugfs_init = drm_bridge_connector_debugfs_init,
>  	.oob_hotplug_event = drm_bridge_connector_oob_hotplug_event,
>  	.color_format = drm_bridge_connector_color_format,
> @@ -894,10 +925,14 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
>  		if (!bridge->interlace_allowed)
>  			connector->interlace_allowed = false;
>  		if (!bridge->ycbcr_420_allowed)
>  			connector->ycbcr_420_allowed = false;
>  
> +		if (bridge->ops & DRM_BRIDGE_OP_CONNECTOR_HW_READOUT) {
> +			drm_bridge_put(bridge_connector->bridge_connector_hw_readout);
> +			bridge_connector->bridge_connector_hw_readout = drm_bridge_get(bridge);
> +		}
>  		/*
>  		 * Ensure the last bridge declares OP_EDID or OP_MODES or both.
>  		 */
>  		if (bridge->ops & DRM_BRIDGE_OP_EDID || bridge->ops & DRM_BRIDGE_OP_MODES) {
>  			drm_bridge_put(bridge_connector->bridge_edid);
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index fcccd8f6403d..7d6aaba0b82c 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -935,10 +935,30 @@ struct drm_bridge_funcs {
>  	 */
>  	int (*dp_audio_mute_stream)(struct drm_bridge *bridge,
>  				    struct drm_connector *connector,
>  				    bool enable, int direction);
>  
> +	/**
> +	 * @atomic_sro_connector_readout:
> +	 *
> +	 * This optional hook initializes the &struct drm_connector_state
> +	 * based on hardware state.
> +	 *
> +	 * It is implemented by bridges that set the
> +	 * %DRM_BRIDGE_OP_CONNECTOR_HW_READOUT flag in their
> +	 * &drm_bridge.ops. When using drm_bridge_connector, the last
> +	 * bridge in the chain with this flag set will have its hook
> +	 * called to fill the connector state.
> +	 *
> +	 * RETURNS:
> +	 *
> +	 * 0 on success, a negative error code otherwise.
> +	 */
> +	int (*atomic_sro_connector_readout)(struct drm_bridge *bridge,
> +					    struct drm_atomic_sro_state *state,
> +					    struct drm_connector_state *conn_state);
> +
>  	/**
>  	 * @debugfs_init:
>  	 *
>  	 * Allows bridges to create bridge-specific debugfs files.
>  	 */
> @@ -1075,10 +1095,17 @@ enum drm_bridge_ops {
>  	 * @DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME: The bridge supports
>  	 * &drm_bridge_funcs->hdmi_write_spd_infoframe and
>  	 * &drm_bridge_funcs->hdmi_clear_spd_infoframe callbacks.
>  	 */
>  	DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME = BIT(10),
> +	/**
> +	 * @DRM_BRIDGE_OP_CONNECTOR_HW_READOUT: The bridge supports the
> +	 * &drm_bridge_funcs.atomic_sro_connector_readout callback to
> +	 * fill the connector state from the bridge's own hardware state
> +	 * during state readout.
> +	 */
> +	DRM_BRIDGE_OP_CONNECTOR_HW_READOUT = BIT(11),
>  };
>  
>  /**
>   * struct drm_bridge - central DRM bridge control structure
>   */
> 


  parent reply	other threads:[~2026-10-16 18:05 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 15:08 [PATCH v6 00/28] drm: Implement state readout support Maxime Ripard
2026-10-15 15:08 ` [PATCH v6 01/28] drm/atomic: Fix private obj error handling Maxime Ripard
2026-10-15 15:23   ` sashiko-bot
2026-10-16 16:38   ` Maarten Lankhorst
2026-10-15 15:08 ` [PATCH v6 02/28] drm/atomic: Add drm_private_obj name Maxime Ripard
2026-10-15 15:23   ` sashiko-bot
2026-10-15 15:08 ` [PATCH v6 03/28] drm/bridge: Switch print_state to use bridge name Maxime Ripard
2026-10-15 15:34   ` sashiko-bot
2026-10-15 15:08 ` [PATCH v6 04/28] drm/bridge: Add drm_private_obj_is_bridge() Maxime Ripard
2026-10-15 15:28   ` sashiko-bot
2026-10-15 15:08 ` [PATCH v6 05/28] drm/atomic: Export drm_atomic_*_print_state Maxime Ripard
2026-10-15 15:33   ` sashiko-bot
2026-10-15 15:08 ` [PATCH v6 06/28] drm/atomic_sro: Create drm_atomic_sro_state container Maxime Ripard
2026-10-15 15:41   ` sashiko-bot
2026-10-15 15:08 ` [PATCH v6 07/28] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard
2026-10-15 15:46   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 08/28] drm/atomic_sro: Add atomic state readout infrastructure Maxime Ripard
2026-10-15 15:52   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 09/28] drm/atomic_sro: Add function to install state into drm objects Maxime Ripard
2026-10-15 15:56   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 10/28] drm/atomic_sro: Create documentation Maxime Ripard
2026-10-15 15:59   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 11/28] drm/bridge: Handle bridges with hardware state readout Maxime Ripard
2026-10-15 16:05   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 12/28] drm/mode-config: Read out hardware state in drm_mode_config_create_state Maxime Ripard
2026-10-15 16:14   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 13/28] drm/atomic_sro: Provide helpers to implement hardware state readout Maxime Ripard
2026-10-15 16:21   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 14/28] drm/mode-config: Introduce hw_reset hook Maxime Ripard
2026-10-15 15:09 ` [PATCH v6 15/28] drm/modeset-helper: Add drm_mode_config_helper_hw_reset() Maxime Ripard
2026-10-15 15:09 ` [PATCH v6 16/28] drm/atomic_helper: Compare actual and readout states once the commit is done Maxime Ripard
2026-10-15 16:31   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 17/28] drm/atomic-state-helper: Provide comparison macros Maxime Ripard
2026-10-15 16:39   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 18/28] drm/atomic-state-helper: Provide atomic_compare_state helpers Maxime Ripard
2026-10-15 16:50   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 19/28] drm/atomic-helper: Document State Read-Out as a state initialization approach Maxime Ripard
2026-10-15 16:53   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 20/28] drm/encoder: Create atomic_sro_get_current_crtc hook Maxime Ripard
2026-10-15 15:09 ` [PATCH v6 21/28] drm/bridge: display-connector: Implement readout support Maxime Ripard
2026-10-15 16:59   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 22/28] drm/bridge_connector: Implement hw readout for connector Maxime Ripard
2026-10-15 16:59   ` sashiko-bot
2026-10-16 18:06   ` Maarten Lankhorst [this message]
2026-10-15 15:09 ` [PATCH v6 23/28] drm/tidss: crtc: Add atomic_print_state implementation Maxime Ripard
2026-10-15 15:09 ` [PATCH v6 24/28] drm/tidss: dispc: Improve mode checking logs Maxime Ripard
2026-10-15 17:02   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 25/28] drm/tidss: Implement hw_reset Maxime Ripard
2026-10-15 17:09   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 26/28] drm/tidss: Implement readout support Maxime Ripard
2026-10-15 17:13   ` sashiko-bot
2026-10-15 15:09 ` [PATCH v6 27/28] drm/tidss: encoder: Implement atomic_sro_get_current_crtc Maxime Ripard
2026-10-15 15:09 ` [PATCH v6 28/28] drm/bridge: sii902x: Implement hw state readout Maxime Ripard
2026-10-15 17:20   ` sashiko-bot

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=2bb8d768-c8f2-4b2a-9a71-1194e1cbcbae@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=devarsht@ti.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=jyri.sarha@iki.fi \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tomi.valkeinen@ideasonboard.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox