From: Thomas Zimmermann <tzimmermann@suse.de>
To: simona@ffwll.ch, airlied@gmail.com, mdaenzer@redhat.com,
pekka.paalanen@collabora.com, jadahl@gmail.com,
contact@emersion.fr, maarten.lankhorst@linux.intel.com,
mripard@kernel.org
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev,
spice-devel@lists.freedesktop.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 2/9] drm/vblank: Add DRM_VBLANK_FLAG_SIMULATED
Date: Fri, 15 May 2026 13:55:07 +0200 [thread overview]
Message-ID: <20260515120916.333614-3-tzimmermann@suse.de> (raw)
In-Reply-To: <20260515120916.333614-1-tzimmermann@suse.de>
Add DRM_VBLANK_FLAG_SIMULATED for CRTCs that do not have a hardware
vblank interrupt. Setting the flag tells DRM to not report vblank
capabilities from the WAIT_VBLANK ioctl.
DRM_IOCTL_WAIT_VBLANK queries timestamps from a vblank event or waits
for the next vblank event to occur. DRM clients use this functionality
to synchronize their output with the display's vblank phase. Hence this
is only supported for hardware implementations.
Software implementations are not synchronized to the display and merely
act as a rate limiter for page-flip events. The WAIT_VBLANK ioctl thus
should fail with an error.
Suggested-by: Simona Vetter <simona@ffwll.ch>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/drm_vblank.c | 3 +++
include/drm/drm_vblank.h | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 21ca91b4c014..92b699a4e8be 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1794,6 +1794,9 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
vblank = drm_vblank_crtc(dev, pipe);
+ if (vblank->flags & DRM_VBLANK_FLAG_SIMULATED)
+ return -EOPNOTSUPP;
+
/* If the counter is currently enabled and accurate, short-circuit
* queries to return the cached timestamp of the last vblank.
*/
diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h
index 39a201b83781..03fa7259b6ac 100644
--- a/include/drm/drm_vblank.h
+++ b/include/drm/drm_vblank.h
@@ -37,6 +37,11 @@ struct drm_device;
struct drm_crtc;
struct drm_vblank_work;
+/**
+ * DRM_VBLANK_FLAG_SIMULATED - vblank uses a software timer
+ */
+#define DRM_VBLANK_FLAG_SIMULATED BIT(1)
+
/**
* struct drm_pending_vblank_event - pending vblank event tracking
*/
--
2.54.0
next prev parent reply other threads:[~2026-05-15 12:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 11:55 [PATCH 0/9] drm: Limit DRM_IOCTL_WAIT_VBLANK to vblank interrupts Thomas Zimmermann
2026-05-15 11:55 ` [PATCH 1/9] drm/vblank: Add drmm_vblank_init() to indicate managed cleanup Thomas Zimmermann
2026-05-15 11:55 ` Thomas Zimmermann [this message]
2026-05-15 11:55 ` [PATCH 3/9] drm/amdgpu: vkms: Set DRM_VBLANK_FLAG_SIMULATED Thomas Zimmermann
2026-05-15 11:55 ` [PATCH 4/9] drm/bochs: " Thomas Zimmermann
2026-05-15 11:55 ` [PATCH 5/9] drm/cirrus: " Thomas Zimmermann
2026-05-15 11:55 ` [PATCH 6/9] drm/hypervdrm: " Thomas Zimmermann
2026-05-15 11:55 ` [PATCH 7/9] drm/qxl: " Thomas Zimmermann
2026-05-15 11:55 ` [PATCH 8/9] drm/virtgpu: " Thomas Zimmermann
2026-05-15 11:55 ` [PATCH 9/9] drm/vkms: " Thomas Zimmermann
2026-05-15 15:12 ` [PATCH 0/9] drm: Limit DRM_IOCTL_WAIT_VBLANK to vblank interrupts Michel Dänzer
2026-05-15 16:56 ` Michel Dänzer
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=20260515120916.333614-3-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=contact@emersion.fr \
--cc=dri-devel@lists.freedesktop.org \
--cc=jadahl@gmail.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mdaenzer@redhat.com \
--cc=mripard@kernel.org \
--cc=pekka.paalanen@collabora.com \
--cc=simona@ffwll.ch \
--cc=spice-devel@lists.freedesktop.org \
--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