Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] SCDC sync fails to handle scrambler teardown on disconnect, leaving 
the source scrambler active when swapping to a non-scrambling sink.
--

--- Patch [22]: [PATCH v10 22/69] drm/display: hdmi-state-helper: Sync SCDC 
state on hotplug ---
commit 7cc2ce705b4793d8696717d86562fbd6c0bde231
Author: Cristian Ciocaltea <[email protected]>

drm/display: hdmi-state-helper: Sync SCDC state on hotplug

This commit hooks drm_connector_hdmi_sync_scdc() into the connect and
disconnect paths in drm_atomic_helper_connector_hdmi_update() to synchronize
the SCDC status on hotplug events.

> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c 
> b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> index 4a93c279c9a76..3377ea9361209 100644
> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> @@ -1205,13 +1205,16 @@ drm_atomic_helper_connector_hdmi_update(struct 
> drm_connector *connector,
>                                       enum drm_connector_status status)
>  {
>       const struct drm_edid *drm_edid;
> +     int ret = 0;
>  
>       if (status == connector_status_disconnected) {
> -             // TODO: also handle scramber, HDMI sink disconnected.
> -             drm_connector_hdmi_audio_plugged_notify(connector, false);
> -             drm_edid_connector_update(connector, NULL);
> -             drm_connector_cec_phys_addr_invalidate(connector);
> -             return 0;
> +             ret = drm_connector_hdmi_sync_scdc(connector, false, ctx);

[Severity: High]
Does this call successfully tear down the scrambler on disconnect?

Looking at drm_connector_hdmi_sync_scdc() in drm_hdmi_helper.c, it seems
to return immediately if the plugged parameter is false:

int drm_connector_hdmi_sync_scdc(struct drm_connector *connector, bool plugged,
                                 struct drm_modeset_acquire_ctx *ctx)
{
        ...
        if (!connector || !plugged || !ctx)
                return 0;

This would make the disconnect call a no-op, failing to disable the source
scrambler.

Additionally, if a non-scrambling sink is subsequently plugged in, the
connect path will call drm_connector_hdmi_sync_scdc() with plugged set to
true, which also bails out early:

        if (!connector->ddc || !drm_scdc_sink_supports_scrambling(connector))
                return 0;

Could this leave the source scrambler incorrectly enabled if a user swaps from
an HDMI 2.0 monitor to an older HDMI 1.4 monitor, resulting in broken display
output due to mismatched hardware state?

> +             if (ret != -EDEADLK) {
> +                     drm_connector_hdmi_audio_plugged_notify(connector, 
> false);
> +                     drm_edid_connector_update(connector, NULL);
> +                     drm_connector_cec_phys_addr_invalidate(connector);
> +             }
> +             return ret;
>       }

[ ... ]

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

Reply via email to