Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/atomic: hidden CRTC color model not reset outside
  drm_mode_atomic_ioctl()
--

commit 988786e967d206ee7e346b8385770656e4c8ad9e
Author: Melissa Wen <[email protected]>

drm/atomic: set hidden CRTC color mgmt model to default values

This commit resets the hidden CRTC color management properties (either the
legacy LUT/CTM blobs or the colorop pipeline) to default values on each
CRTC included in an atomic ioctl commit.

> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
> b/drivers/gpu/drm/drm_atomic_uapi.c
> index afac90d5d7e0a..fe676e612d414 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -1687,6 +1687,32 @@ static void complete_signaling(struct drm_device *dev,
>       kfree(fence_state);
>  }
>  
> +static void
> +reset_crtc_color_mgmt_props(struct drm_atomic_commit *state,
> +                         struct drm_file *file_priv,
> +                         bool async_flip)
> +{
> +     struct drm_crtc_state *crtc_state;
> +     struct drm_crtc *crtc;
> +     bool changed;
> +     int i;
> +
> +     /* Async page flip doesn't change properties */
> +     if (async_flip)
> +             return;
> +
> +     for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
> +             if (file_priv->crtc_color_pipeline) {
> +                     changed = 
> drm_property_replace_blob(&crtc_state->degamma_lut, NULL);
> +                     changed |= drm_property_replace_blob(&crtc_state->ctm, 
> NULL);
> +                     changed |= 
> drm_property_replace_blob(&crtc_state->gamma_lut, NULL);
> +             } else {
> +                     changed = drm_atomic_set_colorop_for_crtc(crtc_state, 
> NULL);
> +             }
> +             crtc_state->color_mgmt_changed |= changed;
> +     }
> +}
> +
>  static void
>  set_async_flip(struct drm_atomic_commit *state)
>  {
> @@ -1845,6 +1871,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>               drm_mode_object_put(obj);
>       }
>  
> +     reset_crtc_color_mgmt_props(state, file_priv, async_flip);

[Severity: Medium]
Does calling reset_crtc_color_mgmt_props() only in drm_mode_atomic_ioctl()
leave crtc_state->color_pipeline active when a later client updates CRTC
color properties through other atomic commit paths?

For example, after a client with DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE sets a
CRTC color pipeline, switching to a client or helper that updates gamma or
CTM via drm_crtc_legacy_gamma_set() (DRM_IOCTL_MODE_SETGAMMA),
set_property_atomic() (DRM_IOCTL_MODE_OBJ_SETPROPERTY), or fbdev's
setcmap_atomic() commits the new LUT/CTM blobs without clearing
crtc_state->color_pipeline.  Because drivers program CRTC color management
from color_pipeline whenever it is non-NULL and only fall back to
degamma_lut, ctm, and gamma_lut otherwise, those updates are silently
ignored while the previous client's color pipeline remains active.

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

Reply via email to