ValveSoftware / gamescope

SteamOS session compositing window manager
Other
3.19k stars 214 forks source link

Gamescope runs fine, when it works then starts to stutter very badly on Fedora KDE #163

Open Melorn366 opened 3 years ago

Melorn366 commented 3 years ago

What repository did I use in order to install the latest gamescope on fedora ? This https://copr.fedorainfracloud.org/coprs/petrb/gamescope/packages/

Why did I use this repository when gamescope is available in the main repository? Because this issue was present with older gamescope builds (which is available on fedora)

What else do I notice during the time when the Bug happens?

GPU usage is 100% all the time.

What others programs do I use in order to make gamescope run at the best performance? Corectrl (to control gpu fancurve and set the gpu governor to performance along with cpu), gamemode (So that I can force the CPU to have a higher priority during steam gameplays. In gamemode.ini file i set renice to 10, desiredgov set to performance and finally softrealtime to auto )

Does this issue occur when gamemoded is not in use (deleted from the game launch section). Yes it happens. With the newer gamescope version and the older one which is available in fedora.

What files should I provide, so this issue could be sorted ?

justin8 commented 1 year ago

Sadly this issue still exists for me; when I enable steam overlay with or without the -e I get a black window (despite using the fullscreen flag in the gamescope command) and it never loads.

hikkidev commented 1 year ago

@Melorn366 please, rename this issue to make it easier to find

Sporknife commented 1 year ago

I still experience this issue when using gamescope.

Operating System: Arch Linux KDE Plasma Version: 5.26.5 KDE Frameworks Version: 5.102.0 Qt Version: 5.15.8 Kernel Version: 6.1.9-arch1-1 (64-bit) Graphics Platform: Wayland Processors: 12 × Intel® Core™ i7-8700 CPU @ 3.20GHz Memory: 15,5 GiB of RAM Graphics Processor: AMD Radeon RX 480 Graphics Mesa: 22.3.4-1, 23.1 (chaotic-aur)

cheungyau2022 commented 1 year ago

I am having the same issue. Ubuntu 22.04 with Nvidia Tesla P40. Games run fine for around half an hour, then frame drops severely, and frame time goes crazy. Without gamescope all games run perfectly. I will try enabling steam overlay and adding -e option.

zaskokus commented 1 year ago

It appears the bug gone with this solution. My steam overlay was off.

Enabling steam overlay prevents the issue for me as well. Tested in both DXVK (Kingdom Come Deliverance) and VKD3D (Cyberpunk 2077). Thank you @JPEspinoza

out of curiosity, what are your parameters to run KCD over gamescope? No matter what I do the game doesn't start (leaving wine components hanging and requiring to be killed manually). I get the splash screen and then nothing.

GrabbenD commented 1 year ago

How can I use GPUVIS to generate a graph with the right values to debug stutter (@ppascher mentioned that @emersion provided the correct commands in a IRC channel)? For reference, I'm using amdgpu with Mesa

Any help is highly appreciated!

bhavdeepsingh commented 11 months ago

Getting this issue with non steam games on steam deck. Does anyone have an idea of what workaround might work there? Enabling the overlay in game mode doesn’t appear to be a thing

Reddit thread: https://www.reddit.com/r/SteamDeck/s/KZ9lKAOLtw

sharkautarch commented 11 months ago

Getting this issue with non steam games on steam deck. Does anyone have an idea of what workaround might work there? Enabling the overlay in game mode doesn’t appear to be a thing

Reddit thread: https://www.reddit.com/r/SteamDeck/s/KZ9lKAOLtw

Looking at the reddit thread, looks like at some points there's a spike in one of the cpu cores (see time 0:02 of the video, time 0:04)... Not sure if gamescope is the actual process causing the spike, or if it is the game... Also maybe the games you're having issues with are just non-vulkan/non-d3d games? which would be significant because normally gamescope is forced to pass frames thru Xwayland for non-vulkan/non-d3d games...

If you can look at the terminal/stdout output of gamescope, you should be able to check if gamescope is able to bypass Xwayland by seeing if it prints lines that start with: [Gamescope WSI] Not sure how you find the terminal/stdout output of gamescope on the steam deck, ask @Joshua-Ashton if you don't know

If you determine that the problem is with games where gamescope isn't able to bypass Xwayland, then try launching said games with: gamescope <gamescope-params> -- env MESA_LOADER_DRIVER_OVERRIDE=zink <game> which may translate opengl stuff in a game to vulkan, which then allows gamescope to bypass Xwayland

EDIT: if you still end up experiencing stuttering, try building the gs-inline-paintall branch of my fork for now: I don't think the gs-inline-paintall branch will fix the issue, but it might reduce its severity. I think that to completely fix the issue, @Joshua-Ashton might need to look into moving the calls to XQueryPointer() to a worker thread or something, since it seems like it can block for around 1ms sometimes (and it is also a relatively big hotspot) gs-XQueryPointer

commands to clone and build it:

git clone https://github.com/sharkautarch/gamescope.git
cd gamescope
git checkout gs-inline-paintall
git submodule update --init --recursive
meson setup -Dc_args="-Wno-uninitialized -Wno-maybe-uninitialized" -Dcpp_args="-Wno-uninitialized -Wno-maybe-uninitialized" --reconfigure build
ninja -C build

commands to give it the ability to run it w/ realtime perms: setcap 'CAP_SYS_NICE=eip' build/src/gamescope

double check the directory where this branch was built (because I'm not sure how compiling and running stuff works on the steam deck): pwd copy the output of the above command (I'll refer to it as <path>)

run it like so:

yellowsink commented 6 months ago

This bug goes away for me when unsetting the LD_PRELOAD env var for the gamescope process (eg steam launch command like env LD_PRELOAD="" gamescope -w 1920 -h 1080 -f -- %command%)

Etmix commented 5 months ago

This bug goes away for me when unsetting the LD_PRELOAD env var for the gamescope process (eg steam launch command like env LD_PRELOAD="" gamescope -w 1920 -h 1080 -f -- %command%)

Thank you! This fixes the issue for me. Enabling the overlay and adding "-e" did not work.

Mentalgen commented 5 months ago

What's LD_PRELOAD being set to that's causing this then?

jamesdsparling commented 5 months ago

What's LD_PRELOAD being set to that's causing this then?

This is usually set to both the 32 and 64 bit gameoverlayrenderer.so dynamic libraries whether steam overlay is enabled or not. e.g: :/persist/home/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so:/persist/home/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so

jbellionjourdan commented 2 months ago

Not sure if it can help, but on my end this issue triggers only when --mangoapp is set.

When the game starts stuttering, hiding mangohud with RALT+F12 helps lowering the issue by ~75% but doesn't make it disappear.

Removing the --mangoapp flag when launching the game makes it completely disappear, i can play for one hour straight or more without any stuttering after the ~20min mark.

Forge64 commented 1 week ago

In gamemode.ini file i set renice to 10

10 or -10? Higher nice value means lower priority.

Accodin to this webside (you are wrong) https://gamecrate.com/linux-gaming-boost-your-performance-gamemode/25200 Quote "f you have four or more CPU cores. I like to set the “renice” value at “10” - this will increase the priority of your game’s process, telling Linux to prioritize the game’s CPU time."

For internet reference, the website linked was wrong. Quoting the nice manpage:

Run COMMAND with an adjusted niceness, which affects process scheduling. With no COMMAND, print the current niceness. Niceness values range from -20 (most favorable to the process) to 19 (least favorable to the process).