]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/virtgpu: Use vblank timer
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 8 Oct 2025 13:06:51 +0000 (15:06 +0200)
committerDmitry Osipenko <dmitry.osipenko@collabora.com>
Thu, 9 Oct 2025 03:07:21 +0000 (06:07 +0300)
commita036f5fceedb9fbd715565fef7b824a121503de7
treebc923e9879d9117bbbd0ce6c2ad8cd072d238e0b
parentdc84dbcc54d2f0f35942ca54aa7a04770aa97199
drm/virtgpu: Use vblank timer

Use a vblank timer to simulate the vblank interrupt. The DRM vblank
helpers provide an implementation on top of Linux' hrtimer. Virtgpu
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. Virtgpu's virtual hardware does not provide vblank interrupts, so
DRM sends each event ASAP. With the fast access times 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 virtgpu and all other virtual displays. See [1] for
a discussion in the context of hypervdrm.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/dri-devel/SN6PR02MB415702B00D6D52B0EE962C98D46CA@SN6PR02MB4157.namprd02.prod.outlook.com/
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://lore.kernel.org/r/20251008130701.246988-1-tzimmermann@suse.de
drivers/gpu/drm/virtio/virtgpu_display.c