ValveSoftware / gamescope

SteamOS session compositing window manager
Other
2.83k stars 189 forks source link

Stutters of 60 ms when a keyboard input is made after a prolonged game session #1292

Open troy0h opened 1 month ago

troy0h commented 1 month ago

image Any game I run with gamescope, after about an hour, the game will start to have large frametime spikes. These frametime spikes happen every time a keyboard input is made (both pressing and releasing a key), and are up to 60 ms. This makes games pretty much unplayable. I've had this in Team Fortress 2, Lethal Company and Helldivers 2.

kisak-valve commented 1 month ago

Hello @troy0h, this reads similarly to https://github.com/ValveSoftware/csgo-osx-linux/issues/2901 / https://github.com/ValveSoftware/Source-1-Games/issues/5767. Do you happen to have the Steam overlay disabled, and if that's true, does enabling it have an effect?

MGThePro commented 1 month ago

I've been experiencing the same issue in cs2. The issue happened only after switching to using gamescope, so I don't think it has anything to do with the game (but I can't 100% rule it out)

I have the steam overlay enabled, but I can't open it so not sure if that could affect it

troy0h commented 1 month ago

Hello @troy0h, this reads similarly to ValveSoftware/csgo-osx-linux#2901 / ValveSoftware/Source-1-Games#5767. Do you happen to have the Steam overlay disabled, and if that's true, does enabling it have an effect?

Hi, I can't even seem to get the steam overlay working in game, I add the -e flag, but it doesn't make shift - tab work in games My lethal company launch options are gamescope -f -w 2560 -h 1440 -- gamemoderun mangohud %command% My helldivers 2 launch options are gamescope -f -r 165 -w 2560 -h 1440 -e -- gamemoderun mangohud %command% --use-d3d11 both have the same issue, even though only Helldivers 2 actually has -e to enable Steam integration, while Lethal Company doesn't

sharkautarch commented 1 month ago

If you don’t have steam overlay disabled in steam’s options for that game, it could still have an effect on gamescope’s performance, even if you are unable to bring up the overlay w/ shift + tab. This is because steam overlay is a dynamic library loaded w/ LD_PRELOAD. Due to how LD_PRELOAD and environment variables work, this may mean that steam overlay may try to load itself into gamescope…

sharkautarch commented 1 month ago

Tho it is definitely possible there’s some weird issue happening in gamescope itself. I’m planning on hooking up Tracy profiler into gamescope, which would hopefully reveal the exact source of these sudden slowdowns. Especially since I’ve seen other unique & specific situations where gamescope will stutter for unclear reasons

troy0h commented 1 month ago

If you don’t have steam overlay disabled in steam’s options for that game, it could still have an effect on gamescope’s performance, even if you are unable to bring up the overlay w/ shift + tab. This is because steam overlay is a dynamic library loaded w/ LD_PRELOAD. Due to how LD_PRELOAD and environment variables work, this may mean that steam overlay may try to load itself into gamescope…

I've experienced it happening with or without the steam overlay, it doesnt make a difference (at least for me)

JimBimBum commented 1 month ago

this doesn't seem to be a gamescope or wayland issue, i use x11 and have this issue only with TF2 only with vulkan enabled. seems fine on opengl or i can't tell. only pattern i've found is around 2.5 GBs of ram used tf2 starts doing that. it is clearly has something to do with input but idk what or why.

first joined, no stutters image now stutters image image

JimBimBum commented 1 month ago

maybe an sdl3 issue?

BigBrotherLovesYou commented 1 month ago

Also suffering from this, both Wayland and X11 sessions. KDE 6.0.4.1 (so with the fix referenced in) kernel 6.9.1 Arch Linux, latest mesa-tkg-git

Joshua-Ashton commented 1 month ago

Please try adding LD_PRELOAD="" before launching Gamescope

JimBimBum commented 1 month ago

just turning on steam overlay fixes this for me but idk about you though.