VBLANK WORKS(9)
π vblank works π
okay so bestie, this page is from the Kernel API Manual, and it's giving βhow do we make picky hardware hit its deadlines without the scheduler ruining the vibeβ energy β¨
Many DRM drivers need to program hardware in a time-sensitive manner β like, many times with a deadline of starting and finishing within a certain region of the scanout π€ Most of the time, the safest way to accomplish this is to simply do said time-sensitive programming in the driver's IRQ handler, which lets drivers avoid being preempted during these critical regions. Or even better: the hardware may even handle applying such time-critical programming independently of the CPU. iconic behavior, honestly π
While there's a decent amount of hardware that's designed so that the CPU doesn't need to be concerned with extremely time-sensitive programming, there's a few situations where it can't be helped π Some unforgiving hardware may require that certain time-sensitive programming be handled completely by the CPU, and said programming may even take too long to handle in an IRQ handler. Another such situation would be where the driver needs to perform a task that needs to complete within a specific scanout period, but might possibly block and thus cannot be handled in an IRQ context. Both of these situations can't be solved perfectly in Linux since we're not a realtime kernel β and thus the scheduler may cause us to miss our deadline if it decides to preempt us π But for some drivers, it's good enough if we can lower our chance of being preempted to an absolute minimum π«Ά
This is where drm_vblank_work comes in. drm_vblank_work provides a simple generic delayed work implementation which delays work execution until a particular vblank has passed, and then executes the work at realtime priority π₯ This provides the best possible chance at performing time-sensitive hardware programming on time, even when the system is under heavy load. drm_vblank_work also supports rescheduling, so that self re-arming work items can be easily implemented π
π SEE ALSO π
- Kernel file
./drivers/gpu/drm/drm_vblank_work.c drm_vblank_work_schedule(9)drm_vblank_work_cancel_sync(9)drm_vblank_work_flush(9)drm_vblank_work_flush_all(9)drm_vblank_work_init(9)
mwah π β source ./drivers/gpu/drm, dated October 2026 π¦β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms