Draft: Add support for async page flip or tearing
This MR is a WIP (Incomplete)
Allow tearing for clients that request it and if the underlying HW supports Atomic Async page flips. There are two presentation modes Vsync (flip happens at every vblank) vs Async (flip happens immediately i.e. it does not wait for vblank):
- Vsync: The latest available frame from the client gets presented with VSync, tearing is not observed.
- Async (tearing): Frames from the client are presented with asynchronous page flips as soon as possible after commit, tearing can be observed.
NOTE:
- So far, this MR tries to read HW Async page flip capability, sets client's request to enable/disable tearing support
- Work currently in-progress: Core changes to handle tearing and do the page flip without waiting for vblank
- WIP: Some opens, do we need to handle tearing vs VRR?
- For more details, please check upstream plans for tearing support in gnome mutter #2517
Resources
(individual implementations for each compositor)
- https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1495
- https://invent.kde.org/plasma/kwin/-/merge_requests/927
- https://github.com/Plagman/gamescope/pull/597
Dependencies
On Intel platforms, it depends on !4063
Validation Strategies
Build this MR and it should mostly work. On Intel platforms, you need a workaround patch in Mesa until MR !4063 gets merged, which is waiting for Kernel uapi to get reviewed & merged in the drm-tip.
Steps to validate it with a Weston demo app:
- $ ~/weston-simple-egl -v -f -t
- Where v – Draw vertical bar, f – Full screen, t – Enable Tearing, T – Toggle Tearing every 5 seconds
Edited by Naveen Kumar