Anssi Saari's recommendation led me to learn a number of interesting things 
about vertical sync and framerate that I would like to share. I also found 
solutions that seem to be working well so far in Rise of the Tomb Raider and 
Team Fortress 2.

One of the things that I found out was that mesa has a built-in way to prevent 
tearing. It effectively uses the MAILBOX present mode (see 
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPresentModeKHR.html)
 for applications that would otherwise produce tearing (see 
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8197). This leads to 
what was, to me, the suprising result of disabling in-game Vsync: the reported 
frame rate may exceed my display's maximum refresh rate, but tearing is not 
observed. Stuttering is reduced compared to when I had in-game vertical sync 
enabled.

I also learned that while the code to enable variable refresh rate in GNOME 
exists, it has yet to be merged (see 
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154). Therefore, for 
the time being, I won't be relying on that to keep my gameplay experience 
smooth.

While it's nice to have tear-free gameplay thanks to MAILBOX present mode, I 
would still like to have the other benefit of enabling in-game vertical sync, 
which is the framerate cap. Limiting framerate can reduce power consumption and 
coil whine. Thankfully, I can use MangoHud to acheive this. As a nice bonus, it 
can also display & record frametimes. I have been unsuccessful so far at using 
MangoHud with Team Fortress 2, but libstrangle (see 
https://gitlab.com/torkel104/libstrangle) did work for applying a framerate cap.

MangoHud & libstrangle can even force MAILBOX present mode, so even if the 
default behavior of mesa changes, I should be covered, at least for Vulkan 
games. Curiously, the forced MAILBOX present mode seems to apply to Team 
Fortress 2 despite it being an OpenGL game, but that's a question for another 
thread.

TL;DR: Mesa doesn't (currently) allow tearing to happen under Wayland, so one 
can simply disable in-game vertical sync and optionally cap the framerate with 
a tool like MangoHud. Framerate limits higher than the display's max refresh 
rate work best for me.

Reply via email to