vulkan/wsi/wayland: Use frog-fifo-v1 protocol for FIFO
This MR adds support for the 'frog-fifo-v1' protocol from frog-protocols, a new repo of Wayland protocols that we intend to be more iterative and experimental than upstream.
FIFO is fundamentally broken under Mesa's Wayland WSI right now in two main ways:
-
Swapchain starvation caused by being required to stall for the 'frame' event. This leads to it only ever being possible to have 1 image in flight at a time, which starves the GPU of work and can lead to lower performance and stutters.
-
Applications using FIFO stall when occluded. With this protocol, the compositor has more information about the client using FIFO, and thus can use an implementation defined virtual refresh rate when the client's surface is not visible.
These not just small edgecases, these are huge gaping issues, that block eg. SDL from picking Wayland by default (https://github.com/libsdl-org/SDL/pull/9383). It is time to finally do something about these problems and begin to unblock this functionality for users.
Notably, we have been shipping essentially this functionality in SteamOS/Gamescope since 3.5 when we moved to using the Wayland WSI, but implementing this in our own Gamescope WSI layer, as the GPU starvation of the FIFO implementation right now, hits really hard in this performance and power envelope. It is a serious and genuine problem.
FIFO been broken like this since the entire lifetime of the Mesa Wayland WSI, and attempts have gone back multiple years to fix either problem 1 or 2, but none have landed, and users who want better GPU-bound performance and their games to not freeze and disconnect them when occluded have been forced to use X11/XWayland.
We need to fix this, and it has been far too long. Having an implementation landed and able to be used by regular users, will not only be beneficial for the users, but can help prove the solution in the real world, and also find any problems that might arise with an upstream variant. This is all voluntary and opt-in by compositors that expose the frog-fifo-v1
protocol.
This MR adds a meson wrap for frog-protocols and pulls it in at version 0.01.
System packages will be preferred over the wrap if available -- Arch, Fedora 41, Fedora 40 currently have packaging for frog-protocols already.
There is a KWin (KDE Plasma) MR for supporting this protocol here by Xaver Hugl, which it can be tested with: