dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v10 22/36] drm/bridge: display-connector: Implement readout support
Date: Fri, 27 Nov 2026 10:23:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-237117@kernel.org> (raw)
In-Reply-To: <20261127-drm-state-readout-v10-22-0259582d45a8@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/bridge: wrong readout check in
  display_connector_readout_state()
--

commit 39d422e25df5bd318f93970d46127f68b613b515
Author: Maxime Ripard <mripard@kernel.org>

drm/bridge: display-connector: Implement readout support

This commit implements the atomic_sro_readout_state hook for the
display-connector bridge to reconstruct its bus configuration and wires up
drm_atomic_helper_bridge_compare_state() as its state comparison hook.

> diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c
> index eb3412ec30a07..be375f86e0388 100644
> --- a/drivers/gpu/drm/bridge/display-connector.c
> +++ b/drivers/gpu/drm/bridge/display-connector.c
[ ... ]
> @@ -213,6 +216,76 @@ static u32 *display_connector_get_input_bus_fmts(struct drm_bridge *bridge,
>  							     num_input_fmts);
>  }
>  
> +/*
> + * Reconstruct the bridge bus configuration from the previous bridge's
> + * readout state and the connector's display_info.
> + *
[ ... ]
> + */
> +static int
> +display_connector_readout_state(struct drm_bridge *bridge,
> +				struct drm_atomic_sro_state *state,
> +				struct drm_bridge_state *bridge_state,
> +				struct drm_crtc_state *crtc_state,
> +				struct drm_connector_state *conn_state)
> +{
> +	struct drm_display_info *di = &conn_state->connector->display_info;
> +	struct drm_bridge *prev_bridge __free(drm_bridge_put) =
> +		drm_bridge_get_prev_bridge(bridge);
> +
> +	/*
> +	 * A previous bridge without readout support still gets a
> +	 * pristine state in the SRO state, which doesn't hold any
> +	 * meaningful bus configuration. Only use the state of bridges
> +	 * that were actually read out.
> +	 */
> +	if (prev_bridge && prev_bridge->base.funcs->atomic_sro_readout_state) {
> +		struct drm_private_state *prev_priv_state =
> +			drm_atomic_sro_get_private_obj_state(state,
> +							     &prev_bridge->base);
> +
> +		if (prev_priv_state) {
> +			struct drm_bridge_state *prev_bridge_state =
> +				drm_priv_to_bridge_state(prev_priv_state);
> +
> +			bridge_state->input_bus_cfg.format =
> +				prev_bridge_state->output_bus_cfg.format;
> +			bridge_state->input_bus_cfg.flags =
> +				prev_bridge_state->output_bus_cfg.flags;
> +			goto out_input;
> +		}
> +	}

[Severity: Medium]
Should this check prev_bridge->funcs->atomic_sro_readout_state instead of
prev_bridge->base.funcs->atomic_sro_readout_state?

When readout runs with DRM_ATOMIC_SRO_SKIP_MISSING_READOUT
(drm.atomic_readout=3), drm_bridge_attach() initializes prev_bridge->base
with drm_bridge_priv_state_funcs_with_sro even if the bridge driver has no
atomic_sro_readout_state callback:

drivers/gpu/drm/drm_bridge.c:drm_bridge_attach() {
    ...
	if (bridge->funcs &&
	    (bridge->funcs->atomic_sro_readout_state ||
	     (drm_atomic_sro_status >= DRM_ATOMIC_SRO_SKIP_MISSING_READOUT)) &&
	    (bridge->funcs->atomic_sro_compare_state ||
	     (drm_atomic_sro_status >= DRM_ATOMIC_SRO_SKIP_MISSING_COMPARE)))
		ret = drm_atomic_private_obj_init(bridge->dev, &bridge->base,
						  bridge->name,
						  &drm_bridge_priv_state_funcs_with_sro);
    ...
}

Because drm_bridge_priv_state_funcs_with_sro always sets
base.funcs->atomic_sro_readout_state to drm_bridge_atomic_readout_priv_state,
this condition evaluates to true for an unimplemented previous bridge and
copies zeroed format and flags from its pristine state instead of falling
back to MEDIA_BUS_FMT_FIXED and di->bus_flags, causing false state comparison
mismatches in drm_atomic_helper_bridge_compare_state().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-drm-state-readout-v10-0-0259582d45a8@kernel.org?part=22

  reply	other threads:[~2026-11-27 10:23 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  9:52 [PATCH v10 00/36] drm: Implement state readout support Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 01/36] drm/bridge-helper: Don't unlock the connection mutex after a backoff Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 02/36] drm/tests: hdmi-state-helper: Handle EDEADLK in the 420-only test Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 03/36] drm/tests: hdmi-state-helper: Handle EDEADLK in the color format test Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 04/36] drm/atomic: Add drm_private_obj name Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 05/36] drm/bridge: Switch print_state to use bridge name Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 06/36] drm/atomic_sro: Create drm_atomic_sro_state container Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 07/36] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 08/36] drm/atomic_sro: Add atomic state readout infrastructure Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 09/36] drm/atomic_sro: Create documentation Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 10/36] drm/bridge: Handle bridges with hardware state readout Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 11/36] drm/mode-config: Read out hardware state in drm_mode_config_create_initial_state Maxime Ripard
2026-11-27 10:09   ` sashiko-bot
2026-11-27  9:52 ` [PATCH v10 12/36] drm/atomic_sro: Provide helpers to implement hardware state readout Maxime Ripard
2026-11-27 10:15   ` sashiko-bot
2026-11-27  9:52 ` [PATCH v10 13/36] drm/mode-config: Introduce hw_reset hook Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 14/36] drm/modeset-helper: Add drm_mode_config_helper_hw_reset() Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 15/36] drm/atomic_helper: Compare actual and readout states once the commit is done Maxime Ripard
2026-11-27  9:52 ` [PATCH v10 16/36] drm/atomic-state-helper: Provide comparison macros Maxime Ripard
2026-11-27 11:20   ` Tomi Valkeinen
2026-11-27  9:52 ` [PATCH v10 17/36] drm/atomic-state-helper: Provide atomic_compare_state helpers Maxime Ripard
2026-11-27 10:09   ` sashiko-bot
2026-11-27  9:53 ` [PATCH v10 18/36] drm/atomic-helper: Document State Read-Out as a state initialization approach Maxime Ripard
2026-11-27  9:53 ` [PATCH v10 19/36] drm/tests: kunit: Add a drm_printer helper Maxime Ripard
2026-11-27  9:53 ` [PATCH v10 20/36] drm/tests: Add tests for the atomic state readout Maxime Ripard
2026-11-27  9:53 ` [PATCH v10 21/36] drm/encoder: Create atomic_sro_get_current_crtc hook Maxime Ripard
2026-11-27  9:53 ` [PATCH v10 22/36] drm/bridge: display-connector: Implement readout support Maxime Ripard
2026-11-27 10:23   ` sashiko-bot [this message]
2026-11-27  9:53 ` [PATCH v10 23/36] drm/bridge_connector: Implement hw readout for connector Maxime Ripard
2026-11-27  9:53 ` [PATCH v10 24/36] drm/atomic_sro: Provide helpers to find the refresh rate from a clock Maxime Ripard
2026-11-28 22:56   ` kernel test robot
2026-11-27  9:53 ` [PATCH v10 25/36] drm/tidss: Implement hw_reset Maxime Ripard
2026-11-27 10:15   ` sashiko-bot
2026-11-27  9:53 ` [PATCH v10 26/36] drm/tidss: dispc: Add hardware state readout helpers Maxime Ripard
2026-11-27 10:13   ` sashiko-bot
2026-11-27  9:53 ` [PATCH v10 27/36] drm/tidss: crtc: Implement hardware state readout Maxime Ripard
2026-11-27 10:15   ` sashiko-bot
2026-11-27  9:53 ` [PATCH v10 28/36] drm/tidss: encoder: " Maxime Ripard
2026-11-27  9:53 ` [PATCH v10 29/36] drm/tidss: kms: Hook up " Maxime Ripard
2026-11-27 10:15   ` sashiko-bot
2026-11-27  9:53 ` [PATCH v10 30/36] drm/tidss: plane: Implement " Maxime Ripard
2026-11-27 10:20   ` sashiko-bot
2026-11-27  9:53 ` [PATCH v10 31/36] drm/tidss: encoder: Implement atomic_sro_get_current_crtc Maxime Ripard
2026-11-27  9:53 ` [PATCH v10 32/36] drm/bridge: sii902x: Implement hw state readout Maxime Ripard
2026-11-27 10:24   ` sashiko-bot
2026-11-27  9:53 ` [PATCH v10 33/36] drm/panel: Implement state readout support Maxime Ripard
2026-11-27  9:53 ` [PATCH DO NOT MERGE v10 34/36] fixup! drm/tidss: dispc: Add hardware state readout helpers Maxime Ripard
2026-11-27  9:53 ` [PATCH DO NOT MERGE v10 35/36] drm/tidss: oldi: Implement hardware state readout Maxime Ripard
2026-11-27 10:22   ` sashiko-bot
2026-11-27  9:53 ` [PATCH HACK v10 36/36] drm/panel: Prepare and enable panels read out as active Maxime Ripard

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=sashiko-outbox-237117@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mripard@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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