From bde44378397b1969f2be5908f41083e900eb5294 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 8 Oct 2025 11:36:55 +0200 Subject: [PATCH] drm/bochs: Use vblank timer Use a vblank timer to simulate the vblank interrupt. The DRM vblank helpers provide an implementation on top of Linux' hrtimer. Bochs enables and disables the timer as part of the CRTC. The atomic_flush callback sets up the event. Like vblank interrupts, the vblank timer fires at the rate of the display refresh. Most userspace limits its page flip rate according to the DRM vblank event. Bochs' virtual hardware does not provide vblank interrupts, so DRM sends each event ASAP. With the fast access time of virtual display memory, the event rate is much higher than the display mode's refresh rate; creating the next page flip almost immediately. This leads to excessive CPU overhead from even small display updates, such as moving the mouse pointer. This problem affects bochs and all other virtual displays. See [1] for a discussion in the context of hypervdrm. Signed-off-by: Thomas Zimmermann Link: https://lore.kernel.org/dri-devel/SN6PR02MB415702B00D6D52B0EE962C98D46CA@SN6PR02MB4157.namprd02.prod.outlook.com/ # [1] Acked-by: Gerd Hoffmann Link: https://lore.kernel.org/r/20251008093931.19138-1-tzimmermann@suse.de --- drivers/gpu/drm/tiny/bochs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index d2d5e9f1269f8..71e874c19610a 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include