Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 2 related pre-existing issues it does not
introduce:
- [High] drm/loongson: live state mutation in
  lsdc_cursor_plane_atomic_async_check() [1]
- [Medium] drm/loongson: incomplete state copy in
  lsdc_cursor_plane_atomic_async_update() [2]
--

commit 7aa4a6090dacda1cd98d23702b18772083dad3be
Author: Ville Syrjälä <[email protected]>

drm/atomic: s/async/bypass/

This commit renames the atomic plane async update helpers, hooks, and
state flags to "bypass" across the DRM core and display drivers.

[ ... ]

> diff --git a/drivers/gpu/drm/loongson/lsdc_plane.c 
> b/drivers/gpu/drm/loongson/lsdc_plane.c
> index c425288ba4909..59f85072273a6 100644
> --- a/drivers/gpu/drm/loongson/lsdc_plane.c
> +++ b/drivers/gpu/drm/loongson/lsdc_plane.c
> @@ -172,9 +172,9 @@ static const struct drm_plane_helper_funcs 
> lsdc_primary_helper_funcs = {
>       .atomic_disable = lsdc_primary_atomic_disable,
>  };
>  
> -static int lsdc_cursor_plane_atomic_async_check(struct drm_plane *plane,
> -                                             struct drm_atomic_commit *state,
> -                                             bool flip)
> +static int lsdc_cursor_plane_atomic_bypass_check(struct drm_plane *plane,
> +                                              struct drm_atomic_commit 
> *state,
> +                                              bool flip)
>  {
>       struct drm_plane_state *new_state;
>       struct drm_crtc_state *crtc_state;

[Severity: High]
This problem wasn't introduced by this patch, but should
lsdc_cursor_plane_atomic_bypass_check() pass new_state instead of
plane->state to drm_atomic_helper_check_plane_state() [1]?

drivers/gpu/drm/loongson/lsdc_plane.c:lsdc_cursor_plane_atomic_bypass_check() {
        ...
        return drm_atomic_helper_check_plane_state(plane->state,
                                                   crtc_state,
                                                   DRM_PLANE_NO_SCALING,
                                                   DRM_PLANE_NO_SCALING,
                                                   true, true);
}

drm_atomic_helper_check_plane_state() updates src, dst, and visible on the
passed-in state, so passing plane->state mutates the live committed state
during the check phase, racing with concurrent readers and corrupting
active state if the check fails or runs as TEST_ONLY.

> @@ -219,8 +219,8 @@ static int lsdc_cursor_plane_atomic_async_check(struct 
> drm_plane *plane,
>                                                  true, true);
>  }
>  
> -static void lsdc_cursor_plane_atomic_async_update(struct drm_plane *plane,
> -                                               struct drm_atomic_commit 
> *state)
> +static void lsdc_cursor_plane_atomic_bypass_update(struct drm_plane *plane,
> +                                                struct drm_atomic_commit 
> *state)
>  {
>       struct lsdc_cursor *cursor = to_lsdc_cursor(plane);
>       const struct lsdc_cursor_plane_ops *ops = cursor->ops;

[Severity: Medium]
This problem wasn't introduced by this patch, but does
lsdc_cursor_plane_atomic_bypass_update() leave plane->state with stale
clipping rectangles and visibility [2]?

drivers/gpu/drm/loongson/lsdc_plane.c:lsdc_cursor_plane_atomic_bypass_update() {
        ...
        plane->state->src_x = new_state->src_x;
        plane->state->src_y = new_state->src_y;
        plane->state->src_h = new_state->src_h;
        plane->state->src_w = new_state->src_w;
        swap(plane->state->fb, new_state->fb);
        ...
}

The in-place state update copies the integer coordinates and swaps fb, but
never copies src, dst, or visible from new_state into plane->state, leaving
them out of sync with the updated coordinates once the check phase stops
mutating plane->state directly.

[1] https://sashiko.dev/#/bug/linux-6b50e65f-5d91-4154-8ead-a7e41b3bb981
[2] https://sashiko.dev/#/bug/linux-39745fec-ddf4-4f7a-a3b2-188ca2cfda2a

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to