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 ?

petr666 commented 3 years ago

Hi, this is my repository, so only for clarification, despite package has version 3.7.1, it is actually built from master so it matches commit d537d6ac98fe6eccafda206dec0dd99c337f648c. I did not encounter this bug yet, but i am not using it very much, i was testing some games maybe for 30 minutes or so.

Melorn366 commented 3 years ago

@petr666 Hi there check out my video about this. launch option gamescope -w 1920 -h 1080 gamemoderun %command%

As I said in the video, i disabled futex2 so it is definitely not the one causing the issue. The bug happens randomly. The performance is very good until this bug happens (it can happend totally randomly, sometimes it need more then 30 mins). Using KDE (and the bug could be reproduced both in wayland and x11 session)

https://www.youtube.com/watch?v=i_09HOxnhJg

Kiwii commented 3 years ago

In gamemode.ini file i set renice to 10

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

Melorn366 commented 3 years 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."

Melorn366 commented 3 years ago

The issue is still present. Its definitely not caused by gamemode. For further testing purpose I deleted gamemode from my system, and just let gamescope run without even moving a mouse in menu. The issue appeared precisely at 30 mins. I tested this stock kernel (without any patches) and with custom tkg patches. The issue could have been reproduced at both times. So no matter what Desktop environment I use, it happens all the time. Tested on Fedora, Ubuntu, Arch, variants like (endeavour, garuda) . This issue still exist.

Melorn366 commented 3 years ago

As I said I would love to provide logs or anything that the dev needs. I just need explanation how to provide them.

emersion commented 3 years ago

Maybe trying to capture some traces with gpuvis when it's stuttering would help.

Melorn366 commented 3 years ago

Maybe trying to capture some traces with gpuvis when it's stuttering would help.

If you explain how to capture gpuvis traces during stutter, I would gladly help.

Recently the terminal post this while running games Unhandled NET_WM_STATE property change: _NET_WM _STATEMAXIMIZED HDRZ

Melorn366 commented 3 years ago

Okay. Figured it out that gpuvis is your tool emersion. Buit it using aur repo. Now how to find traces when it comes to steam games? Or how does it work? I would gladly help. I just need explanation.

ppascher commented 3 years ago

Have the same issue with "The Witcher 3". After ~24 minutes the game starts stuttering. FPS according to MangoHud drop from ~160 to ~80. Restarting the game helps (for another 24 minutes). If I start the game without gamescope the issue is gone. Running under Windows is fine as well. I tried different Proton Versions but it did not make a difference. This is on kernel 5.12.4 and mesa-git (as of 2021-05-15) with a 6900xt. Will try to get some traces/logs.

ppascher commented 3 years ago

Not sure if this is the same issue as the OP but the symptoms describe my issue. Here is a trace-cmd capture right after it started stuttering. witcher3_trace-cmd.dat.tar.gz. Frametimes start looking like this instead of a constant value/line: 20210516-131356_swappy

ppascher commented 3 years ago

Tried some more games. The stuttering appears after the 24 minute mark for The Witcher3 (DXVK) Cyberpunk 2077 (VKD3D) Doom Eternal (Vulkan) Book of Forbidden Tales 2 (OpenGL)

It does not seem to be temperature related as those are pretty stable after 10 minutes. To test I ran all fans at 100% speed which dropped the temperatures by 5-8°C but the issue still appeared after 24 minutes. And as mentioned before: without gamescope all those games work fine while having the same temperature.

ppascher commented 3 years ago

Still is an issue with latest master on my machine (arch 5.14.2, mesa-git): Tried a trace-cmd capture again (as last one did not contain required info from what @emersion told me in irc): 20210908_witcher3_trace-cmd.dat.tar.gz gpuvis screenshot of when the stuttering starts: image

ppascher commented 3 years ago

I just tried starting two games via gamescope with a 10 minute delay. Both windows ran next to each other on one screen (sway tiled mode). The first game (Kingdom Come Deliverance via DXVK) started stuttering as expected after ~24 minutes. The second game (Witcher3 / DXVK) ran fine for another 10 minutes and then also started stuttering. If I use the same setup but switch to a different workspace on the same monitor so that the games are not visible they run fine even after the 24 minute mark. So it appears the games have to be visible for 24 minutes for the bug to kick in. Edit: When started without gamescope both games run fine next to each other for >3h (as is the case when just running one game).

Melorn366 commented 3 years ago

Greetings ppacher. Yes we have the same issue. To be precise exactly the same ! Finally someone !

I am very worried about this issue. If steamdeck releases and this issue will be still present in December. Steamdeck will fail miserably. I truly wish team valve the best. But this issue haven't been fixed for half a year now.

This information is not reaching either Emerson or Plagmen ( Pierre-Loup A. of Valve)

BTW thx for sharing ppascher.

The 24 min mark is present ! After that it stutters.

ppascher. I have a question for you.

1.You say that gamescope run fine when you start it in a different workspace? I need to test this.

  1. How do you set up gamescope to play games at 1920x1080? are you setting it up like this ( -W 1920 -H 1080 or -w 1920 -h 1080) ? For me this does not change the resolution of games like warframe ( -w 1920 -h 1080) whit this nothing happens and the game start in 720p. 3.Are you using integer scaling ? Option -n
ppascher commented 3 years ago

I run at 3440x1440 and tried both -W/-H and -w/-h. I do not use -n. I tried running with and without gamemode/mangohud. I manually fullscreen my game as with the -f option games do not run. I use git master of sway/wlroots/mesa on arch. Tried both custom kernel and default distro kernel. Hopefully we can figure out what is causing this.

Melorn366 commented 3 years ago

Hey there ppasher, thx for the reply. I don't know what it is causing this, but it concerns me that plagman or emerson doesn't respond. Can you contact them ? They doesn't seem to notice our conversation..This is very serious bug.

emersion commented 3 years ago

This is an open-source project. Feel free to submit patches, but don't expect your bugs to magically fixed.

I don't have time to look into your issue at the moment.

Melorn366 commented 3 years ago

@emersion Greetings thx for responding. This has been an issue for months now and I pretty much bad at programming. But lets ask @ppascher

Btw emersion what kind of data do you need in the future in order for this to be fixed?

ppascher commented 3 years ago

One more thing I noticed is when I keep moving the mouse the stuttering is gone. As soon as I stop the cursor the stuttering is back.

ppascher commented 3 years ago

In case anyone else runs into this and is able to make sense of it here is another gpuvis screenshot of a trace with gamescope events logged while stuttering: 20211017-221126_gpuvis And here is the full trace file: 20211017_gamescope_trace-cmd.dat.tar.gz

ppascher commented 3 years ago

some more information: starting steam via gamescope (either from within sway or directly from tty with /usr/local/bin/gamescope -e -f -- steam -tenfoot -steamos -fulldesktopres and then a steam game does not cause these stutters. Starting steam from within sway without gamescope and then using the steam game launch options to start a game via gamescope causes these stutters after ~24-25 minutes.

jarrard commented 3 years ago

ARK goes into stutter mode after 20mins with gamescope, no idea whats going on.

jarrard commented 2 years ago

I just remembered; I believe this stutter happens with gamescope and Star Citizen (via wine). So that is yet another game that gets this bug and surely a solution can be found.

Plagman commented 2 years ago

@ppascher interesting trace, thanks a lot! Looks like something is keeping the steamcompmgr thread busy for a long time. This would be great to look at such a trace with latest gpu-trace, which also includes a perf capture.

Separate from that, worth re-testing with current master, as the buffer import path has changed significantly and might interact with this issue.

ppascher commented 2 years ago

@Plagman Sorry, did not get a notification and just now saw your reply. I just tested with kernel 5.15.11, mesa, wlroots, gamescope git master as of today and still run into this issue. I created a new capture using gpu-trace and sent you a download link through the valvesoftware contact page (I get an error when trying to attach the file to this comment) This trace shows the stuttering and also a brief period where the stutter was reduced when I kept moving the mouse. Thank you for looking into this.

JPEspinoza commented 2 years ago

Hello, I don't know if this is related, but someone on Reddit asked me to mention it here.

On Fedora 35 with Gnome, Nvidia and Xorg (no Gamescope), when I play Valheim (Native, Vulkan) it starts stuttering after about 30 minutes unless I enable the Steam overlay, which seems to workaround the bug. To be clear: Steam overlay disabled = stuttering and low FPS after ~30 minutes, Steam overlay enabled = normal performance. I don't need to open the overlay in game either, just having it be enabled works. I do have an FPS counter though.

Maybe the Steam overlay has something to do with this issue? Or whatever it does bypasses the error? Again, I'm not using Gamescope, so its probably a completely different issue specific to Valheim.

More people mentioning the bug in this thread: https://www.reddit.com/r/linux_gaming/comments/lmslz9/best_settings_to_optimize_valheim/

jarrard commented 2 years ago

I do believe Mortal Online 2 stutters with gamescope after 20mins or so. I noticed at main menu a distinct mouse cursor stutter (can't get into game due to queue, but yeah, stutter).

Sure hope this stutter issue can be resolved. Kind of makes GS pointless otherwise, and it may also occur on steamdeck once in peoples hands.

Melorn366 commented 2 years ago

Yup the problem still exists. So weird. Only AMD GPU card are affected, with Intel processor ?

On Wed, Feb 2, 2022 at 6:27 AM jarrard @.***> wrote:

I do believe Mortal Online 2 stutters with gamescope after 20mins or so. I noticed at main menu a distinct mouse cursor stutter (can't get into game due to queue, but yeah, stutter).

Sure hope this stutter issue can be resolved. Kind of makes GS pointless otherwise, and it may also occur on steamdeck once in peoples hands.

— Reply to this email directly, view it on GitHub https://github.com/Plagman/gamescope/issues/163#issuecomment-1027599257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN7SZSWCVRULNNQMJTDWV6LUZC6E7ANCNFSM4XAY46PQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

jarrard commented 2 years ago

AMD 5700G and 6800XT here.

Melorn366 commented 2 years ago

Well then it seems that It is not a build specific problem, at one point, since you use AMD processor and still has it. But on the other hand, we both use AMD GPU (or maybe this is a stupid question from me from the start). Gamescope could be run only on AMD GPUs right?

On Wed, Feb 2, 2022 at 1:52 PM jarrard @.***> wrote:

AMD 5700G and 6800XT here.

— Reply to this email directly, view it on GitHub https://github.com/Plagman/gamescope/issues/163#issuecomment-1027911071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN7SZSQEUTU5HNGMSP6YA4TUZESIZANCNFSM4XAY46PQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

zoktiik commented 2 years ago

I've had multiple games give me this same issue. My system is running Fedora Workstation 35 with the sentry/kernel-fsync and gloriouseggroll/mesa-aco coprs enabled (though I still had the gamescope issue with kernel and mesa from the official Fedora repositories). I installed KDE alongside the stock GNOME, still using gdm as my display manager, but stopped using KDE due to a very bad bug with kwin involving how it handles fullscreen apps (system failure when one loses focus).

Right now, I'm using GNOME on X11 and continue to have this issue with any game I run under gamescope. I have the "disable unredirect fullscreen windows" extension installed. Generally, I tend to run my games with mangohud, gamemode, and FSR enabled. Mangohud showing the frametime issue is weird -- it shows up in Sleeping Dogs DE and Risk of Rain 2 as that same series of spikes, but on Dishonored 1 the frametime graph remains a flatline while the frametime issue remains obvious.

My version of gamescope is from the official Fedora repositories, version 3.8.4. In my launch options I have gamescope and its arguments first, then the Wine AMD FSR environment variables, then mangohud and gamemoderun. I generally use Proton-7.0rc6-GE-1 to run my games. I have an AMD Ryzen 9 3900X CPU and an AMD RX 5700 XT GPU.

I hope this information helps to figure out the root cause of this issue. If any more information about my setup is needed, please feel free to ping me.

Addendum: It seems that Fedora's version of gamescope is being held back at 3.8.4, all the way up to Rawhide for some reason. I tried compiling gamescope myself and was only partially successful; 3.11 and 3.10 depend on wayland-server>=1.20, which is only in Rawhide right now. Fedora 35 is currently stuck with libwayland-server-1.19.0. My own attempt at compiling 3.9.5 was successful, though I wasn't able to get libxcb-errors. However, when testing out my build with Entropy : Zero (no MangoHUD), gamescope continued to suffer from this same framerate & stuttering issue after about <30m.

ilievi187 commented 2 years ago

Hi guys , any update on the bug ? I am testing from 2 days now with csgo , however the bug appear randomly , the game start to lose frames and just start to stutter really bad , i have to relaunch it ; Ths things happened before the fsr to be added in gamescope , that's why i didnt use it either before, same bug in all kind of games ; I hope is gonna be fixed somehow , but the strange thing is there no input nothing i really dont understand why is happening ? Also not to mention during the tests in last 2 days i really fell like i have really big input lag in the moment but than suddenly there is no at all , maybe because of xorg or what i dont really know , i hope this gonna be fixed anytime soon , My dream was to see FSR in CSGO and now is REAL , however this bug kinda smells really bad. I had to reconnect 2-3 times in single competitive match but its worth it. I am running the game now with something like a 400 fps at 1080p with rx 550 4gb from asus :D , imagine how good FSR is , i hope someone gonna help to fix this thing , because the NAtive FSR is gonna come build into the driver (for ShinDowns) and i dont know what's gonna happend for our GNU/Linux. Guys Keep it UP !!!

I Belive!

Btw is the game overlay gonna work ?

cactushydrocodone commented 2 years ago

This is most likely not a gamescope, but an AMD issue, as my pc crashes after i exit the game. Very similar to the crashes i had on windows with amd too. I could try mesa from mesa-git, maybe its fixed there

ilievi187 commented 2 years ago

Hi , guys i have to inform everyone , gamescope works perfectly fine now.. However don't forget to install the Black Mesa package (gperftools) . I can't use it right now because i am mostly playing CS:GO competitive and there is some kind of delay i am feeling it when i use gamescope with fsr , i am gonna test tomorrow without AMD FSR just to be sure that is only from gamescope.

On Sun, 20 Feb 2022 at 13:51, cactushydrocodone @.***> wrote:

This is most likely not a gamescope, but an AMD issue, as my pc crashes after i exit the game. Very similar to the crashes i had on windows with amd too. I could try mesa from mesa-git, maybe its fixed there

— Reply to this email directly, view it on GitHub https://github.com/Plagman/gamescope/issues/163#issuecomment-1046219955, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWIPNBADKMXCNXC3TTW5WVTU4DISNANCNFSM4XAY46PQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

zoktiik commented 2 years ago

Hello, @ilievi187. Would you be willing to give your OS name and version, as well as your version of gamescope? It's possible you're not currently running on a system that is affected by this bug.

ilievi187 commented 2 years ago

Zoktik i am running Arch Rolling , there is no bugs except little bit of mouse delay ,just a little little tiny bit most of the users are not going to notice it .

On Sun, 20 Feb 2022 at 20:21, zoktiik @.***> wrote:

Hello, @ilievi187. Would you be willing to give your OS name and version, as well as your version of gamescope? It's possible you're not currently running on a system that is affected by this bug.

— Reply to this email directly, view it on GitHub https://github.com/Plagman/gamescope/issues/163#issuecomment-1046293853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWIPNBAYMMTKHO22INCXERTU4EWKTANCNFSM4XAY46PQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

zoktiik commented 2 years ago

Zoktik i am running Arch Rolling

@ilievi187 Alright, that's good to know. What is your version of gamescope? Also, could you please tell us the last version of gamescope that was causing the stuttering issues for you? That's if you can remember it, or find it in your system logs.

madmonki commented 2 years ago

Any solutions? I get this issue on Apex and Elden Ring but probably I will get on every game. My launch options are gamemoderun gamescope -e -f -- %command% . Distro is Endeavour (arch btw) and using kde-wayland.

cactushydrocodone commented 2 years ago

The issue just disappeared for me. Im on arch, maybe an update of some package fixed it

madmonki commented 2 years ago

Hello, I don't know if this is related, but someone on Reddit asked me to mention it here.

On Fedora 35 with Gnome, Nvidia and Xorg (no Gamescope), when I play Valheim (Native, Vulkan) it starts stuttering after about 30 minutes unless I enable the Steam overlay, which seems to workaround the bug. To be clear: Steam overlay disabled = stuttering and low FPS after ~30 minutes, Steam overlay enabled = normal performance. I don't need to open the overlay in game either, just having it be enabled works. I do have an FPS counter though.

Maybe the Steam overlay has something to do with this issue? Or whatever it does bypasses the error? Again, I'm not using Gamescope, so its probably a completely different issue specific to Valheim.

More people mentioning the bug in this thread: https://www.reddit.com/r/linux_gaming/comments/lmslz9/best_settings_to_optimize_valheim/

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

ppascher commented 2 years 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

itspngu commented 2 years ago

I can confirm that enabling the Steam overlay "fixes" the issue. I'm on Fedora (Rawhide) aswell.

itspngu commented 2 years ago

It's related to -e/--steam, which I had in my commandline because my cursor wasn't working as reported by others in #420. Removing that and using Proton 6.3 instead of 7 (tried both Experimental and GE) allows me to turn off the Steam overlay and not have the degradation after 24 minutes.

/cc @Plagman

ghost commented 2 years ago

Same issue in Back 4 Blood on Fedora Silverblue 37 flatpak gamescope/steam versions, using -f and -r flags, 6700 XT GPU. Game runs fine for a while and ~30 minutes later the frame timing jumps up and down with extreme unplayable stutters. Whether I set max_fps or v-sync in game doesn't seem to matter.

madmonki commented 2 years ago

you should have -e in flags and enable steam overlay. @mystrdat

CartoonFan commented 2 years ago

Ran into this issue too, unfortunately :cry:

Nvidia GTX 960, Ryzen 3700X, Arch Linux, Openbox, Castlevania Advance Collection, Proton-tkg 7.18.r11.gaabde227, Linux 5.19.14-270-tkg-bmq

Here's my Steam launch options:

gamescope -w 1280 -h 720 -r 60 -o 60 -n -i -Y -e -- obs-gamecapture %command%

And here are the proton logs: steam-1552550_gamescope_no_overlay.log steam-1552550_no_gamescope_no_overlay.log

I'm running vk-capture, but I can't imagine the problem is there, right? For me, the time limit is about 27-28 minutes before the stuttering starts. I don't have concrete proof, but I suspect that the game window needs to be in focus for the stuttering to happen; I feel like the game was running for >28 minutes with no problem, but after about...maybe 11 minutes of in-focus gameplay, the stutters happened.

Running with the overlay helped, but I'm recording game footage, so it's not really an optimal solution. Running without gamescope and without the overlay also worked fine, in my brief testing. It also doesn't seem Wine-specific: I encountered slowdowns with Risk of Rain as well (again with gamescope on and the overlay off).

Anyway, I'm happy to provide more information if it'll help :+1:

CartoonFan commented 2 years ago

I managed to take a picture with MangoHud running (sorry for the tiny font :rofl:) :

2022-10-23_21-37_gamescope_stutter

Like before, the stutters happened after somewhere between 95-96K frames--roughly 28 minutes of gameplay. Curiously, GPU usage seems to be reduced after the stutters begin; it went from 20-30% usage to 10-20% usage :confused: .

I also managed to get some logs (again, from MangoHud):

game_2022-10-23_23-15-07.csv

game_2022-10-23_23-15-07_summary.csv

There seems to be a bunch of weird 14 FPS dips surrounded by normal FPS rates :thinking:

My gamescope params are here:

-w 1600 -h 900 -W 1600 -H 900 -r 60 -o 60 -i -n -Y -e

If possible, I'd really love to see a fix that's not just "turn on the steam overlay" :pray:

(Also, IMO, this bug is up there with #216 and #577 for me...but those I can kind of work around :laughing:)

Sturmlocke86 commented 2 years ago

Same issue here on Ubuntu 22.10 and Nvidia T600 with 515 drivers installed. Going to try the suggested launch command addition -e plus will also enable Steam Overlay, as I usually turn Steam Overlay off, and report back how it goes. Installed Gamescope via Ubuntu 22.10 repos. Tried Proton Exp and Proton 7 so far.

Sturmlocke86 commented 2 years ago

Update

Ok, doing what the others suggested "fixed" the issue on my end as well: Activate Steam Overlay, add -e line to Gamescope launch command in Steam, use Proton 6, 7 or Exp - works with all of them. Performance is more or less normal after this. Usable workaround for now, but not optimal when recording or streaming via OBS ofc. That said, wouldn't mind donating a few coins to fix this.