mirror-linux/Documentation/gpu
Thomas Zimmermann 74afeb8128 drm/vblank: Add vblank timer
The vblank timer simulates a vblank interrupt for hardware without
support. Rate-limits the display update frequency.

DRM drivers for hardware without vblank support apply display updates
ASAP. A vblank event informs DRM clients of the completed update.
Userspace compositors immediately schedule the next update, which
creates significant load on virtualization outputs. Display updates
are usually fast on virtualization outputs, as their framebuffers are
in regular system memory and there's no hardware vblank interrupt to
throttle the update rate.

The vblank timer is a HR timer that signals the vblank in software.
It limits the update frequency of a DRM driver similar to a hardware
vblank interrupt. The timer is not synchronized to the actual vblank
interval of the display.

The code has been adopted from vkms, which added the funtionality
in commit 3a0709928b ("drm/vkms: Add vblank events simulated by
hrtimers").

The new implementation is part of the existing vblank support,
which sets up the timer automatically. Drivers only have to start
and cancel the vblank timer as part of enabling and disabling the
CRTC. The new vblank helper library provides callbacks for struct
drm_crtc_funcs.

The standard way for handling vblank is to call drm_crtc_handle_vblank().
Drivers that require additional processing, such as vkms, can init
handle_vblank_timeout in struct drm_crtc_helper_funcs to refer to
their timeout handler.

There's a possible deadlock between drm_crtc_handle_vblank() and
hrtimer_cancel(). [1] The implementation avoids to call hrtimer_cancel()
directly and instead signals to the timer function to not restart
itself.

v4:
- fix possible race condition between timeout and atomic commit (Michael)
v3:
- avoid deadlock when cancelling timer (Ville, Lyude)
v2:
- implement vblank timer entirely in vblank helpers
- downgrade overrun warning to debug
- fix docs

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Link: https://lore.kernel.org/all/20250510094757.4174662-1-zengheng4@huawei.com/ # [1]
Link: https://lore.kernel.org/r/20250916083816.30275-2-tzimmermann@suse.de
2025-10-01 08:31:59 +02:00
..
amdgpu docs: gpu: amdgpu: Fix spelling in amdgpu documentation 2025-08-27 13:57:48 -04:00
bridge
dp-mst
imagination drm/imagination: Numerous documentation fixes. 2023-11-28 18:56:03 +01:00
nova Documentation: gpu: nova-core: Document basics of the Falcon 2025-07-09 00:19:17 +02:00
rfc drm/gpusvm, drm/pagemap: Move migration functionality to drm_pagemap 2025-06-26 18:00:07 +02:00
xe drm/xe/doc: Document device wedged and runtime survivability 2025-08-26 10:11:34 -04:00
afbc.rst
automated_testing.rst drm/ci: enable lockdep detection 2025-03-12 08:16:31 +05:30
backlight.rst
driver-uapi.rst drm: Add UAPI for the Asahi driver 2025-04-08 17:15:57 -04:00
drivers.rst Nova changes for v6.15 2025-03-13 06:03:55 +10:00
drm-client.rst drm/client: Move client event handlers to drm_client_event.c 2024-10-18 09:23:03 +02:00
drm-compute.rst kernel/cgroup: Add "dmem" memory accounting cgroup 2025-01-06 17:24:38 +01:00
drm-internals.rst drm/doc: Document KUnit expectations 2025-02-26 16:04:15 +01:00
drm-kms-helpers.rst drm/vblank: Add vblank timer 2025-10-01 08:31:59 +02:00
drm-kms.rst drm/panic: Add a drm panic handler 2024-04-15 16:12:49 +02:00
drm-mm.rst Documentation/gpu: VM_BIND locking document 2023-11-29 20:54:43 +01:00
drm-uapi.rst drm: Add a vendor-specific recovery method to drm device wedged uevent 2025-08-26 10:11:34 -04:00
drm-usage-stats.rst Documentation/gpu: Clarify format of driver-specific fidnfo keys 2025-02-07 15:22:46 +01:00
drm-vm-bind-async.rst
drm-vm-bind-locking.rst Documentation/gpu: VM_BIND locking document 2023-11-29 20:54:43 +01:00
i915.rst drm/i915/flipq: Provide the nuts and bolts code for flip queue 2025-06-27 15:54:43 +03:00
implementation_guidelines.rst Documentation/gpu: VM_BIND locking document 2023-11-29 20:54:43 +01:00
index.rst drm/doc: Include new drm-compute documentation 2025-01-15 09:45:54 +01:00
introduction.rst MAINATINERS: update drm maintainer contacts 2024-09-03 20:07:57 +02:00
kms-properties.csv drm/connector: hdmi: Add Broadcast RGB property 2024-05-28 10:24:37 +02:00
komeda-kms.rst Documentation/gpu: Fix typo in Documentation/gpu/komeda-kms.rst 2024-09-05 14:33:06 -06:00
mcde.rst
meson.rst
msm-crash-dump.rst
msm-preemption.rst Documentation: document adreno preemption 2024-10-04 08:47:29 -07:00
nouveau.rst Documentation: nouveau: Update GSP message queue kernel-doc reference 2025-06-13 16:46:35 +02:00
panfrost.rst drm/panfrost: Replace fdinfo's profiling debugfs knob with sysfs 2024-03-11 13:27:10 +01:00
panthor.rst Documentation/gpu: Add fdinfo meanings of panthor-*-memory tags 2025-02-07 15:23:39 +01:00
pl111.rst
tegra.rst
todo.rst drm/dumb-buffers: Provide helper to set pitch and size 2025-09-29 13:57:43 +02:00
tve200.rst
v3d.rst
vc4.rst
vga-switcheroo.rst
vgaarbiter.rst Documentation: vgaarbiter: Fix grammar 2025-03-19 15:11:49 +01:00
vkms.rst drm/vkms: Add how to run the Kunit tests 2025-05-28 16:19:14 +02:00
xen-front.rst
zynqmp.rst drm: xlnx: zynqmp_dpsub: Fix kernel doc 2025-01-16 12:45:16 +01:00