ValveSoftware / gamescope

SteamOS session compositing window manager
Other
3.14k stars 211 forks source link

DOOM 2016 has V-Sync automatically applied in Steam Deck gamemode when using Vulkan #1113

Open Tobe95 opened 9 months ago

Tobe95 commented 9 months ago

First of all I'd like to preface that I'm not a Linux expert, so please forgive me if I'm sounding stupid or coming to the wrong conclusion.

Basically when running DOOM 2016 with the Deck's frame rate limiter and ingame V-Sync disabled, the game still always caps to the display's refresh rate: e.g. set the screen to 60hz, game caps at 60 FPS, set to 40hz game runs at 40 FPS.

This is only the case when running in gamemode however, Desktop mode (which I believe uses X11) has the framerate uncapped and reach around 100 FPS, which leads me to believe this could be an issue with either Gamescope or maybe Wayland.

Furthermore this only applies to Vulkan API, running the game in OpenGL mode has the FPS uncapped as intended. I've tried to start the game with MESA_VK_WSI_PRESENT_MODE=immediate %command% and vblank_mode=0 %command% as launch variables without any change, not sure if this even makes sense since it doesn't seem to be a Mesa issue when it's working under X11.

DOOM is the only game that exhibits this weird behaviour but also one of the few in my library that has Vulkan implemented natively instead of using DXVK for example. Because V-Sync is not applied in Desktop/X11 mode but forced in gamemode which uses Gamescope, I've come to think it's probably not the games 'fault' but rather something else going on.

AlexFolland commented 9 months ago

What happens with present mode "mailbox" instead of "immediate"? Also what happens when also adding "MANGOHUD=0"? Also what are the values of the frame-rate-related settings in the SteamOS quick settings menu (the one on the right)?

Tobe95 commented 9 months ago

Thanks for the reply, unfortunately nothing changed with these commands. "MANGOHUD=0" doesn't appear to be working since the overlay is still visible. I dug around in /bin/gamescope-session and stumbled upon this:

# TODO!
# Bring this back when gamescope side is more complete
#
# Remove vsync handling from Xwayland, we handle it in gamescope
#export vblank_mode=0
#export MESA_VK_WSI_PRESENT_MODE=immediate

While looking promising at first, nothing changed when I uncommented the last 2 lines and restarted the Deck. DOOM is still running with V-Sync. I also tried with "mailbox" mode instead of "immediate". There is another line which disables Mangohud completely when changed from export STEAM_USE_MANGOAPP=1 to export STEAM_USE_MANGOAPP=0 but no luck with this one either.

I've made a Video to further demonstrate the issue. Please ignore the slightly different UI, I've overclocked my screen to 70hz.

Note how only the game (but not the Deck UI) flickers when changing the framerate from limited to unlimited towards the end of the video, which I believe might be related to the V-Sync issue. This is different from the screen going completely black for a split second when changing the display refresh rate, which Decky Recorder is unable to capture.

LethalManBoob commented 4 months ago

this is still an issue

rKsanu2MMYvypWePtQWM commented 2 months ago

same for me!