Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guillaume La Roque" <glaroque@baylibre.com>
Cc: dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH v3 8/9] drm/meson: clear pending primary updates while disabled
Date: Thu, 03 Dec 2026 20:41:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-248645@kernel.org> (raw)
In-Reply-To: <20261203-meson-g12a-osd2-v3-8-2cf76729b5d5@baylibre.com>

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@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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-12-03 20:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 19:55 [PATCH v3 0/9] drm/meson: add a second RGB plane on G12A Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 1/9] drm/meson: honor framebuffer offsets for the primary plane Guillaume La Roque
2026-12-03 20:18   ` sashiko-bot
2026-12-03 19:55 ` [PATCH v3 2/9] drm/meson: isolate primary plane scaler setup Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 3/9] drm/meson: keep RGB scanout state per OSD Guillaume La Roque
2026-12-03 20:21   ` sashiko-bot
2026-12-03 19:55 ` [PATCH v3 4/9] drm/meson: parameterize the G12A OSD color matrix setup Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 5/9] drm/meson: handle primary plane zpos allocation failure Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 6/9] drm/meson: select RGB plane registers by OSD index Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 7/9] drm/meson: serialize OSD state updates with the IRQ Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 8/9] drm/meson: clear pending primary updates while disabled Guillaume La Roque
2026-12-03 20:41   ` sashiko-bot [this message]
2026-12-03 19:55 ` [PATCH v3 9/9] drm/meson: add a linear RGB overlay on G12A OSD2 Guillaume La Roque

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-248645@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=glaroque@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox