From: Neil Armstrong <neil.armstrong@linaro.org>
To: Guillaume La Roque <glaroque@baylibre.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Kevin Hilman <khilman@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: dri-devel@lists.freedesktop.org,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Simona Vetter <simona.vetter@ffwll.ch>
Subject: Re: [PATCH v2 7/9] drm/meson: serialize OSD state updates with the IRQ
Date: Thu, 3 Dec 2026 20:33:28 +0100 [thread overview]
Message-ID: <605cc69b-52e3-42be-8182-20347728ad0f@linaro.org> (raw)
In-Reply-To: <20261203-meson-g12a-osd2-v2-7-8a4a57d32e20@baylibre.com>
On 12/3/26 20:21, Guillaume La Roque wrote:
> Use event_lock when the IRQ consumes the cached OSD state and when atomic
> flush publishes the commit flags, matching the lock held by plane update.
>
> Clear the cached enable state under the same lock before disabling the
> primary hardware. This prevents the IRQ from programming it during
> teardown and prepares the shared state handling for a second OSD.
>
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> ---
> drivers/gpu/drm/meson/meson_crtc.c | 13 +++++++++++++
> drivers/gpu/drm/meson/meson_plane.c | 9 ++++++---
> 2 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
> index 71efaa58c183..70acb034b812 100644
> --- a/drivers/gpu/drm/meson/meson_crtc.c
> +++ b/drivers/gpu/drm/meson/meson_crtc.c
> @@ -168,13 +168,16 @@ static void meson_g12a_crtc_atomic_disable(struct drm_crtc *crtc,
> {
> struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
> struct meson_drm *priv = meson_crtc->priv;
> + unsigned long flags;
>
> DRM_DEBUG_DRIVER("\n");
>
> drm_crtc_vblank_off(crtc);
>
> + spin_lock_irqsave(&priv->drm->event_lock, flags);
> priv->viu.osd[0].enabled = false;
> priv->viu.osd[0].commit = false;
> + spin_unlock_irqrestore(&priv->drm->event_lock, flags);
>
> priv->viu.vd1_enabled = false;
> priv->viu.vd1_commit = false;
> @@ -193,11 +196,13 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc,
> {
> struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
> struct meson_drm *priv = meson_crtc->priv;
> + unsigned long flags;
>
> DRM_DEBUG_DRIVER("\n");
>
> drm_crtc_vblank_off(crtc);
>
> + spin_lock_irqsave(&priv->drm->event_lock, flags);
> priv->viu.osd[0].enabled = false;
> priv->viu.osd[0].commit = false;
>
> @@ -208,6 +213,7 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc,
> writel_bits_relaxed(VPP_OSD1_POSTBLEND | VPP_VD1_POSTBLEND |
> VPP_VD1_PREBLEND | VPP_POSTBLEND_ENABLE, 0,
> priv->io_base + _REG(VPP_MISC));
> + spin_unlock_irqrestore(&priv->drm->event_lock, flags);
>
> if (crtc->state->event && !crtc->state->active) {
> spin_lock_irq(&crtc->dev->event_lock);
> @@ -239,9 +245,12 @@ static void meson_crtc_atomic_flush(struct drm_crtc *crtc,
> {
> struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
> struct meson_drm *priv = meson_crtc->priv;
> + unsigned long flags;
>
> + spin_lock_irqsave(&priv->drm->event_lock, flags);
> priv->viu.osd[0].commit = true;
> priv->viu.vd1_commit = true;
> + spin_unlock_irqrestore(&priv->drm->event_lock, flags);
> }
>
> static const struct drm_crtc_helper_funcs meson_crtc_helper_funcs = {
> @@ -333,6 +342,8 @@ void meson_crtc_irq(struct meson_drm *priv)
> struct meson_crtc *meson_crtc = to_meson_crtc(priv->crtc);
> unsigned long flags;
>
> + spin_lock_irqsave(&priv->drm->event_lock, flags);
> +
> /* Update the OSD registers */
> if (priv->viu.osd[0].enabled && priv->viu.osd[0].commit) {
> meson_crtc_flush_osd(priv, 0);
> @@ -393,6 +404,8 @@ void meson_crtc_irq(struct meson_drm *priv)
> priv->viu.osd[0].commit = false;
> }
>
> + spin_unlock_irqrestore(&priv->drm->event_lock, flags);
> +
> /* Update the VD1 registers */
> if (priv->viu.vd1_enabled && priv->viu.vd1_commit) {
>
> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index 4d8580263d36..ea198582ebbc 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -413,6 +413,12 @@ static void meson_plane_atomic_disable(struct drm_plane *plane,
> {
> struct meson_plane *meson_plane = to_meson_plane(plane);
> struct meson_drm *priv = meson_plane->priv;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&priv->drm->event_lock, flags);
> + meson_plane->enabled = false;
> + priv->viu.osd[meson_plane->index].enabled = false;
> + spin_unlock_irqrestore(&priv->drm->event_lock, flags);
>
> if (priv->afbcd.ops) {
> priv->afbcd.ops->reset(priv);
> @@ -426,9 +432,6 @@ static void meson_plane_atomic_disable(struct drm_plane *plane,
> else
> writel_bits_relaxed(VPP_OSD1_POSTBLEND, 0,
> priv->io_base + _REG(VPP_MISC));
> -
> - meson_plane->enabled = false;
> - priv->viu.osd[meson_plane->index].enabled = false;
> }
>
> static const struct drm_plane_helper_funcs meson_plane_helper_funcs = {
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Thanks,
Neil
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-12-03 20:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 19:21 [PATCH v2 0/9] drm/meson: add a second RGB plane on G12A Guillaume La Roque
2026-12-03 19:21 ` [PATCH v2 1/9] drm/meson: honor framebuffer offsets for the primary plane Guillaume La Roque
2026-12-03 19:31 ` Neil Armstrong
2026-12-03 19:43 ` sashiko-bot
2026-12-03 19:21 ` [PATCH v2 2/9] drm/meson: isolate primary plane scaler setup Guillaume La Roque
2026-12-03 19:32 ` Neil Armstrong
2026-12-03 19:21 ` [PATCH v2 3/9] drm/meson: keep RGB scanout state per OSD Guillaume La Roque
2026-12-03 19:32 ` Neil Armstrong
2026-12-03 19:21 ` [PATCH v2 4/9] drm/meson: parameterize the G12A OSD color matrix setup Guillaume La Roque
2026-12-03 19:21 ` [PATCH v2 5/9] drm/meson: handle primary plane zpos allocation failure Guillaume La Roque
2026-12-03 19:21 ` [PATCH v2 6/9] drm/meson: select RGB plane registers by OSD index Guillaume La Roque
2026-12-03 19:33 ` Neil Armstrong
2026-12-03 19:21 ` [PATCH v2 7/9] drm/meson: serialize OSD state updates with the IRQ Guillaume La Roque
2026-12-03 19:33 ` Neil Armstrong [this message]
2026-12-03 19:21 ` [PATCH v2 8/9] drm/meson: clear pending primary updates while disabled Guillaume La Roque
2026-12-03 19:33 ` Neil Armstrong
2026-12-03 19:21 ` [PATCH v2 9/9] drm/meson: add a linear RGB overlay on G12A OSD2 Guillaume La Roque
2026-12-03 19:34 ` Neil Armstrong
2026-12-03 19:38 ` [PATCH v2 0/9] drm/meson: add a second RGB plane on G12A Neil Armstrong
2026-12-03 19:58 ` 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=605cc69b-52e3-42be-8182-20347728ad0f@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=glaroque@baylibre.com \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=mripard@kernel.org \
--cc=simona.vetter@ffwll.ch \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®