Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] drm/gud: LUMINANCE updates in gud_connector_atomic_check() require 
modeset
--

commit 8034990b85e36e57451a40c677e5ac4037438eda
Author: Mario Limonciello <[email protected]>

drm/gud: add connector luminance support

This commit exposes GUD display brightness through the connector LUMINANCE
property when CONFIG_DRM_LUMINANCE is enabled, mirroring luminance changes
into tv.brightness during atomic check.

> diff --git a/drivers/gpu/drm/gud/gud_connector.c 
> b/drivers/gpu/drm/gud/gud_connector.c
> index ddbf3b3ebbca8..bfb298bbc9b51 100644
> --- a/drivers/gpu/drm/gud/gud_connector.c
> +++ b/drivers/gpu/drm/gud/gud_connector.c
> @@ -292,10 +292,19 @@ static int gud_connector_atomic_check(struct 
> drm_connector *connector,
>       struct drm_connector_state *old_state;
>  
>       new_state = drm_atomic_get_new_connector_state(state, connector);
> +     old_state = drm_atomic_get_old_connector_state(state, connector);
> +
> +     /*
> +      * LUMINANCE is sent to the device as tv.brightness in the same commit,
> +      * the brightness change below then triggers GUD_REQ_SET_STATE_CHECK.
> +      */
> +     if (connector->luminance_property &&
> +         old_state->luminance != new_state->luminance)
> +             new_state->tv.brightness = new_state->luminance;

[Severity: High]
Will mirroring new_state->luminance into new_state->tv.brightness here cause
non-modeset atomic commits that update LUMINANCE to fail with -EINVAL?

In gud_connector_atomic_check(), changing new_state->tv.brightness sets
new_crtc_state->connectors_changed:

        if (old_state->tv.margins.left != new_state->tv.margins.left ||
            ...
            old_state->tv.brightness != new_state->tv.brightness ||
            ...)
                new_crtc_state->connectors_changed = true;

When a userspace compositor updates LUMINANCE in a normal atomic commit
without DRM_MODE_ATOMIC_ALLOW_MODESET:

drm_mode_atomic_ioctl()
  -> drm_atomic_check_only()
    -> drm_atomic_helper_check()
      -> drm_atomic_helper_check_modeset()
        -> gud_connector_atomic_check()
      -> drm_atomic_helper_check_planes()
        -> gud_plane_atomic_check()

gud_plane_atomic_check() sees crtc_state->connectors_changed and sends
GUD_REQ_SET_STATE_CHECK to the USB device, but drm_atomic_check_only() then
rejects the commit because drm_atomic_crtc_needs_modeset(new_crtc_state) is
true when connectors_changed is set:

        if (!state->allow_modeset) {
                for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
                        if (drm_atomic_crtc_needs_modeset(new_crtc_state)) {
                                drm_dbg_atomic(dev, "[CRTC:%d:%s] requires full 
modeset\n",
                                               crtc->base.id, crtc->name);
                                return -EINVAL;
                        }
                }
        }

Even if DRM_MODE_ATOMIC_ALLOW_MODESET is passed, wouldn't setting
connectors_changed force a full CRTC modeset on every brightness adjustment?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/20261103-superm1-backlight-property-v11-0-00cce7b2b...@kernel.org?part=10

Reply via email to