From: Guillaume La Roque <glaroque@baylibre.com>
To: Neil Armstrong <neil.armstrong@linaro.org>,
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>,
linux-kernel@vger.kernel.org,
Guillaume La Roque <glaroque@baylibre.com>
Subject: [PATCH v4 8/9] drm/meson: publish pending OSD updates with the flip event
Date: Fri, 04 Dec 2026 09:08:09 +0100 [thread overview]
Message-ID: <20261204-meson-g12a-osd2-v4-8-ad356340dbd6@baylibre.com> (raw)
In-Reply-To: <20261204-meson-g12a-osd2-v4-0-ad356340dbd6@baylibre.com>
atomic_begin exposes the flip event before atomic_flush publishes the
plane updates. An IRQ can complete the commit early and leave a pending
OSD1 update behind while the plane is disabled.
Publish the event and pending updates together under event_lock. Take
the matching event when the IRQ consumes the register cache, so an event
published later waits for the next IRQ. Clear the primary pending flag
on disable and leave it clear while the plane is disabled.
Fixes: cc0c43a0450c ("drm/meson: Use crtc_state for hdisplay and fix atomic flush/enable sync for vsync commit")
Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
---
drivers/gpu/drm/meson/meson_crtc.c | 38 ++++++++++++++++---------------------
drivers/gpu/drm/meson/meson_plane.c | 1 +
2 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
index 70acb034b812..6fefae538766 100644
--- a/drivers/gpu/drm/meson/meson_crtc.c
+++ b/drivers/gpu/drm/meson/meson_crtc.c
@@ -224,44 +224,33 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc,
}
}
-static void meson_crtc_atomic_begin(struct drm_crtc *crtc,
+static void meson_crtc_atomic_flush(struct drm_crtc *crtc,
struct drm_atomic_commit *state)
{
struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
+ struct meson_drm *priv = meson_crtc->priv;
unsigned long flags;
- if (crtc->state->event) {
+ if (crtc->state->event)
WARN_ON(drm_crtc_vblank_get(crtc) != 0);
- spin_lock_irqsave(&crtc->dev->event_lock, flags);
+ spin_lock_irqsave(&priv->drm->event_lock, flags);
+ priv->viu.osd[0].commit = priv->viu.osd[0].enabled;
+ priv->viu.vd1_commit = true;
+ if (crtc->state->event) {
meson_crtc->event = crtc->state->event;
- spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
crtc->state->event = NULL;
}
-}
-
-static void meson_crtc_atomic_flush(struct drm_crtc *crtc,
- struct drm_atomic_commit *state)
-{
- 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 = {
- .atomic_begin = meson_crtc_atomic_begin,
.atomic_flush = meson_crtc_atomic_flush,
.atomic_enable = meson_crtc_atomic_enable,
.atomic_disable = meson_crtc_atomic_disable,
};
static const struct drm_crtc_helper_funcs meson_g12a_crtc_helper_funcs = {
- .atomic_begin = meson_crtc_atomic_begin,
.atomic_flush = meson_crtc_atomic_flush,
.atomic_enable = meson_g12a_crtc_atomic_enable,
.atomic_disable = meson_g12a_crtc_atomic_disable,
@@ -340,6 +329,7 @@ static void meson_g12a_crtc_enable_vd1(struct meson_drm *priv)
void meson_crtc_irq(struct meson_drm *priv)
{
struct meson_crtc *meson_crtc = to_meson_crtc(priv->crtc);
+ struct drm_pending_vblank_event *event = NULL;
unsigned long flags;
spin_lock_irqsave(&priv->drm->event_lock, flags);
@@ -400,8 +390,13 @@ 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;
+ /* Complete only the event associated with the updates just applied. */
+ if (!meson_crtc->vsync_disabled) {
+ event = meson_crtc->event;
+ meson_crtc->event = NULL;
}
spin_unlock_irqrestore(&priv->drm->event_lock, flags);
@@ -681,10 +676,9 @@ void meson_crtc_irq(struct meson_drm *priv)
drm_crtc_handle_vblank(priv->crtc);
spin_lock_irqsave(&priv->drm->event_lock, flags);
- if (meson_crtc->event) {
- drm_crtc_send_vblank_event(priv->crtc, meson_crtc->event);
+ if (event) {
+ drm_crtc_send_vblank_event(priv->crtc, event);
drm_crtc_vblank_put(priv->crtc);
- meson_crtc->event = NULL;
}
spin_unlock_irqrestore(&priv->drm->event_lock, flags);
}
diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
index 2a45f5653f48..694c54fa52d8 100644
--- a/drivers/gpu/drm/meson/meson_plane.c
+++ b/drivers/gpu/drm/meson/meson_plane.c
@@ -430,6 +430,7 @@ static void meson_plane_atomic_disable(struct drm_plane *plane,
spin_lock_irqsave(&priv->drm->event_lock, flags);
meson_plane->enabled = false;
priv->viu.osd[meson_plane->index].enabled = false;
+ priv->viu.osd[meson_plane->index].commit = false;
spin_unlock_irqrestore(&priv->drm->event_lock, flags);
if (priv->afbcd.ops) {
--
2.34.1
_______________________________________________
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-04 8:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 8:08 [PATCH v4 0/9] drm/meson: add a second RGB plane on G12A Guillaume La Roque
2026-12-04 8:08 ` [PATCH v4 1/9] drm/meson: honor framebuffer offsets for the primary plane Guillaume La Roque
2026-12-04 8:30 ` sashiko-bot
2026-12-04 8:08 ` [PATCH v4 2/9] drm/meson: isolate primary plane scaler setup Guillaume La Roque
2026-12-04 8:08 ` [PATCH v4 3/9] drm/meson: keep RGB scanout state per OSD Guillaume La Roque
2026-12-04 8:08 ` [PATCH v4 4/9] drm/meson: parameterize the G12A OSD color matrix setup Guillaume La Roque
2026-12-04 8:08 ` [PATCH v4 5/9] drm/meson: handle primary plane zpos allocation failure Guillaume La Roque
2026-12-04 8:08 ` [PATCH v4 6/9] drm/meson: select RGB plane registers by OSD index Guillaume La Roque
2026-12-04 8:08 ` [PATCH v4 7/9] drm/meson: serialize OSD state updates with the IRQ Guillaume La Roque
2026-12-04 8:30 ` sashiko-bot
2026-12-04 8:08 ` Guillaume La Roque [this message]
2026-12-04 8:41 ` [PATCH v4 8/9] drm/meson: publish pending OSD updates with the flip event sashiko-bot
2026-12-04 8:08 ` [PATCH v4 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=20261204-meson-g12a-osd2-v4-8-ad356340dbd6@baylibre.com \
--to=glaroque@baylibre.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.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®