[PATCH v3 8/9] drm/meson: clear pending primary updates while disabled
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Dec 3 12:41:19 PST 2026
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/meson: stale osd[0].commit race remains after
meson_crtc_atomic_flush()
--
commit a6c0c91ee07dba45520e5b6a8a5a8aea3e7d0fd6
Author: Guillaume La Roque <glaroque at baylibre.com>
drm/meson: clear pending primary updates while disabled
This commit moves clearing priv->viu.osd[0].commit in meson_crtc_irq() outside
the enabled check so pending primary plane updates are cleared on vsync even
when OSD1 is disabled.
> diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
> index 70acb034b8125..19412d0d74328 100644
> --- a/drivers/gpu/drm/meson/meson_crtc.c
> +++ b/drivers/gpu/drm/meson/meson_crtc.c
> @@ -400,9 +400,8 @@ void meson_crtc_irq(struct meson_drm *priv)
> priv->afbcd.ops->enable(priv);
> meson_crtc->vsync_forced = true;
> }
> -
> - priv->viu.osd[0].commit = false;
> }
> + priv->viu.osd[0].commit = false;
>
> spin_unlock_irqrestore(&priv->drm->event_lock, flags);
[Severity: Medium]
Can priv->viu.osd[0].commit still remain set when OSD1 is re-enabled?
meson_crtc_atomic_begin() arms meson_crtc->event before atomic_flush(), and
meson_crtc_atomic_flush() still sets priv->viu.osd[0].commit = true even when
OSD1 is disabled. If a vsync IRQ runs between the two on a nonblocking
commit, it clears the flag and signals flip_done before atomic_flush():
CPU0 CPU1 (<hardirq>)
/* Commit 1: OSD1 disabled */
meson_crtc_atomic_begin()
meson_crtc->event = state->event
meson_crtc_irq()
osd[0].commit = false
drm_crtc_send_vblank_event()
/* signals Commit 1 flip_done */
meson_crtc_atomic_flush()
osd[0].commit = true
drm_atomic_helper_commit_hw_done()
/* Commit 2: re-enables OSD1 */
drm_crtc_commit_wait() /* passes */
meson_plane_atomic_update()
osd[0].enabled = true
meson_crtc_irq()
/* enabled && commit are true */
meson_crtc_flush_osd() <-- early
Because Commit 2 only waits on Commit 1's hw_done and flip_done,
meson_plane_atomic_update() can re-enable OSD1 while the stale commit flag is
still set. A vsync IRQ before Commit 2's atomic_flush() then latches the new
register cache prematurely, causing tearing or desynchronized plane updates.
Gating priv->viu.osd[0].commit = true on priv->viu.osd[0].enabled in
meson_crtc_atomic_flush(), clearing commit in meson_plane_atomic_disable(),
and arming meson_crtc->event in meson_crtc_atomic_flush() under event_lock
would prevent the stale flag from surviving across commits.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-meson-g12a-osd2-v3-0-2cf76729b5d5@baylibre.com?part=8
More information about the linux-amlogic
mailing list