Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/bridge: check crtc_state->active in
  drm_bridge_atomic_readout_priv_state()
--

commit f5a0fcf4814d5306f865f770861315035338896e
Author: Maxime Ripard <[email protected]>

drm/bridge: Handle bridges with hardware state readout

This commit adds hardware state readout and installation wrappers for DRM
bridges, looking up the corresponding connector and CRTC states for the
bridge's pipeline before invoking the bridge hooks.

> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index b6cdbc172f689..868558a09f951 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c

[ ... ]

> +static int
> +drm_bridge_atomic_readout_priv_state(struct drm_private_obj *obj,
> +                                  struct drm_atomic_sro_state *state,
> +                                  struct drm_private_state *priv_state)
> +{
> +     struct drm_bridge *bridge = drm_priv_to_bridge(obj);
> +     struct drm_encoder *encoder = bridge->encoder;
> +     const struct drm_bridge_funcs *bridge_funcs = bridge->funcs;
> +     struct drm_crtc_state *crtc_state;
> +     struct drm_bridge_state *bridge_state;
> +     struct drm_connector_state *conn_state;
> +     int ret;
> +
> +     /*
> +      * If the bridge's encoder has no routed connector or no
> +      * active CRTC, the pipeline is disabled and there is nothing
> +      * to read out. Keep the pristine default state created by
> +      * &drm_mode_config_helper_funcs.atomic_sro_build_state.
> +      */
> +     conn_state = find_connector_state_for_encoder(state, encoder);
> +     if (!conn_state)
> +             return 0;
> +
> +     if (!conn_state->crtc)
> +             return 0;
> +
> +     crtc_state = drm_atomic_sro_get_crtc_state(state, conn_state->crtc);
> +     if (!crtc_state)
> +             return 0;

[Severity: Medium]
Should this check !crtc_state->active as well, matching the comment above
and drm_bridge_atomic_install_priv_state() below?

drm_atomic_helper_sro_readout_crtcs_state() populates a non-NULL
crtc_state in the readout container even when the CRTC is inactive, so
checking only !crtc_state will still invoke atomic_sro_readout_state() on
a disabled pipeline if conn_state->crtc is set while crtc_state->active is
false.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=17

Reply via email to