From: Thomas Zimmermann <tzimmermann@suse.de>
To: mhklinux@outlook.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, airlied@gmail.com, simona@ffwll.ch,
drawat.floss@gmail.com, javierm@redhat.com, kraxel@redhat.com,
louis.chauvet@bootlin.com, hamohammed.sa@gmail.com,
melissa.srw@gmail.com, fvogt@suse.com
Cc: dri-devel@lists.freedesktop.org, linux-hyperv@vger.kernel.org,
virtualization@lists.linux.dev,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 6/6] drm/fb-helper: Synchronize dirty worker with vblank
Date: Thu, 5 Jun 2025 17:24:44 +0200 [thread overview]
Message-ID: <20250605152637.98493-7-tzimmermann@suse.de> (raw)
In-Reply-To: <20250605152637.98493-1-tzimmermann@suse.de>
Before updating the display from the console's shadow buffer, the dirty
worker now waits for a vblank. This allows several screen updates to pile
up and acts as a rate limiter. If a DRM master is present, it could
interfere with the vblank. Don't wait in this case.
v3:
* add back helper->lock
* acquire DRM master status while waiting for vblank
v2:
* don't hold helper->lock while waiting for vblank
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/drm_fb_helper.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 937c3939e502..e0b780634a84 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -364,9 +364,29 @@ static void drm_fb_helper_fb_dirty(struct drm_fb_helper *helper)
struct drm_device *dev = helper->dev;
struct drm_clip_rect *clip = &helper->damage_clip;
struct drm_clip_rect clip_copy;
+ struct drm_crtc *crtc;
unsigned long flags;
int ret;
+ /*
+ * Rate-limit update frequency to vblank. If there's a DRM master
+ * present, it could interfere while we're waiting for the vblank
+ * event. Don't wait in this case.
+ */
+ mutex_lock(&helper->lock);
+ if (!drm_master_internal_acquire(helper->dev)) {
+ goto unlock;
+ }
+ crtc = helper->client.modesets[0].crtc;
+ ret = drm_crtc_vblank_get(crtc);
+ if (!ret) {
+ drm_crtc_wait_one_vblank(crtc);
+ drm_crtc_vblank_put(crtc);
+ }
+ drm_master_internal_release(helper->dev);
+unlock:
+ mutex_unlock(&helper->lock);
+
if (drm_WARN_ON_ONCE(dev, !helper->funcs->fb_dirty))
return;
--
2.49.0
prev parent reply other threads:[~2025-06-05 15:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-05 15:24 [RFC PATCH 0/6] drm: Add vblank timers for devices without interrupts Thomas Zimmermann
2025-06-05 15:24 ` [PATCH 1/6] drm/vblank: Add vblank timer Thomas Zimmermann
2025-06-06 8:43 ` Louis Chauvet
2025-06-10 15:36 ` Thomas Zimmermann
2025-06-05 15:24 ` [PATCH 2/6] drm/vkms: Use " Thomas Zimmermann
2025-06-06 9:14 ` Louis Chauvet
2025-06-05 15:24 ` [PATCH 3/6] drm/simpledrm: " Thomas Zimmermann
2025-06-05 15:24 ` [PATCH 4/6] drm/bochs: " Thomas Zimmermann
2025-06-05 15:24 ` [PATCH 5/6] drm/hypervdrm: " Thomas Zimmermann
2025-06-05 15:24 ` Thomas Zimmermann [this message]
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=20250605152637.98493-7-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=drawat.floss@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=fvogt@suse.com \
--cc=hamohammed.sa@gmail.com \
--cc=javierm@redhat.com \
--cc=kraxel@redhat.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=louis.chauvet@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=melissa.srw@gmail.com \
--cc=mhklinux@outlook.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=virtualization@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