linux/Documentation
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
..
ABI Linux 6.17-rc6 2025-09-15 17:51:07 +10:00
accel Documentation: accel: amdxdna: Update compiler information 2025-08-21 08:25:31 -07:00
accounting delaytop: enhance error logging and add PSI feature description 2025-08-02 12:01:41 -07:00
admin-guide Mitigate VMSCAPE issue with indirect branch predictor flushes 2025-09-10 20:52:16 -07:00
arch It has been a relatively busy cycle for docs, especially the build system: 2025-07-31 08:36:51 -07:00
block
bpf
cdrom cdrom: Call cdrom_mrw_exit from cdrom_release function 2025-07-22 19:10:17 -06:00
core-api module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES 2025-08-11 16:16:36 +02:00
cpu-freq
crypto crypto: engine - remove {prepare,unprepare}_crypt_hardware callbacks 2025-07-18 20:52:00 +10:00
dev-tools Networking changes for 6.17. 2025-07-30 08:58:55 -07:00
devicetree dt-bindings: display: imx: add HDMI PAI for i.MX8MP 2025-09-29 09:46:02 +08:00
doc-guide
driver-api cxl for v6.17 2025-08-01 15:47:06 -07:00
edac
fault-injection docs: fault-injection: drop reference to md-faulty 2025-07-24 08:31:46 -06:00
fb
features
filesystems f2fs-for-6.17-rc1 2025-08-04 16:27:21 -07:00
firmware_class
firmware-guide Merge branch 'acpi-misc' 2025-07-22 17:12:57 +02:00
fpga
gpu drm/vblank: Add vblank timer 2025-10-01 08:31:59 +02:00
hid
hwmon hwmon updates for v6.17 2025-07-31 13:34:06 -07:00
i2c
iio docs: iio: add ADXL313 accelerometer 2025-07-14 19:20:50 +01:00
images
infiniband
input Input: Add and document BTN_GRIP* 2025-07-27 01:41:20 -07:00
isdn
kbuild docs: kconfig: add alldefconfig to the all*configs 2025-07-26 15:31:29 +09:00
kernel-hacking
leds
litmus-tests
livepatch
locking
maintainer
mhi
misc-devices
mm Summary of significant series in this pull request: 2025-07-31 14:57:54 -07:00
netlabel
netlink netlink: specs: mptcp: fix if-idx attribute type 2025-09-09 18:39:52 -07:00
networking linux-can-fixes-for-6.17-20250910 2025-09-10 19:29:40 -07:00
nvdimm
nvme docs: nvme: fix grammar in nvme-pci-endpoint-target.rst 2025-07-17 13:38:07 +02:00
PCI selftests: pci_endpoint: Add doorbell test case 2025-07-24 16:51:47 -05:00
pcmcia
peci
power Merge branches 'pm-runtime' and 'pm-powercap' 2025-07-22 18:01:15 +02:00
process Documentation: smooth the text flow in the security bug reporting process 2025-08-17 12:23:30 +02:00
RCU rcu: Document concurrent quiescent state reporting for offline CPUs 2025-07-22 17:10:50 +05:30
rust
scheduler sched_ext: Changes for v6.17 2025-07-31 16:29:46 -07:00
scsi
security hardening updates for v6.17-rc1 2025-07-28 17:16:12 -07:00
sound ALSA: docs: Add documents for recently changes in snd-usb-audio 2025-08-29 11:17:35 +02:00
sphinx sphinx: kernel_abi: fix performance regression with O=<dir> 2025-07-24 08:36:17 -06:00
sphinx-static
spi
staging
sunrpc/xdr
target
tee
timers
tools tracing tools changes for 6.17: 2025-08-01 10:23:13 -07:00
trace tracing changes for 6.17 2025-08-01 10:29:36 -07:00
translations Summary of significant series in this pull request: 2025-07-31 14:57:54 -07:00
usb It has been a relatively busy cycle for docs, especially the build system: 2025-07-31 08:36:51 -07:00
userspace-api iommufd: Fix spelling errors in iommufd.rst 2025-08-18 11:15:06 -03:00
virt Documentation: KVM: Use unordered list for pre-init VGIC registers 2025-07-29 13:43:50 -04:00
w1
watchdog
wmi
.gitignore
atomic_bitops.txt
atomic_t.txt
Changes
CodingStyle
conf.py
docutils.conf
index.rst
Kconfig
Makefile
memory-barriers.txt
SubmittingPatches
subsystem-apis.rst