doitsujin / dxvk

Vulkan-based implementation of D3D8, 9, 10 and 11 for Linux / Wine
zlib License
13.14k stars 846 forks source link

[d3d9] Stutter after 30-60mins of game play (various games) #2371

Open YellowOnion opened 2 years ago

YellowOnion commented 2 years ago

With both Sanctum 1 and Payday 1 I get massive stuttering after 30mins of game play:

Both games have this weird issue where the game has full FPS unless I start moving around with keyboard or mouse (I guess triggered by a scene update?)

image

Software information

Steam overlay isn't working either. Shadows seem broken in Payday (will file another bug report for that soon). using wined3d seems to crash Sanctum.

System information

Apitrace file(s)

Log files

SanctumGame-Win32-Shipping_d3d9.log SanctumGame-Win32-Shipping_d3d11.log SanctumGame-Win32-Shipping_dxgi.log steam-91600.log

doitsujin commented 2 years ago

are you on wayland or something? This smells like a WSI issue.

YellowOnion commented 2 years ago

@doitsujin Nope it's Xorg with Gnome. I don't get this issue with DX11 games, at least I don't seem to have it so predictably happen after x amount of game play.

Someone on discord mentioned I could run a debug build (I can't seem to find any) and run perf (I guess with record?) when the issue arises.

Here's the API trace of Sanctum: https://drive.google.com/file/d/12q6eQI6lyAFjhjr307B4Kfvde5lEgsDS/view?usp=sharing

K0bin commented 2 years ago

An apitrace isn't gonna be useful if it only happens after 30minutes.

YellowOnion commented 2 years ago

Another game with this issue: Dungeons of the Endless.

Could someone please assist with a debug build of dxvk so I can provide a log from perf? or advise on some other debugging tool or method?

soerengrunewald commented 2 years ago

We see this issue (or something very similar) in CS:GO with vulkan enabled. Although the game runs apperently with https://github.com/Joshua-Ashton/dxvk-native or some fork of it v1.9.1-100-g336868d.

One can easily replace libdxvk_d3d9.so in $STEAM/steamapps/common/Counter-Strike Global Offensive/bin/linux64 for testing and play some "Practice with Bots" or use a private server.

Anyhow, I rebased dxvk-native to v1.9.4 (and even beyond to gpu-sync-rework branch), but the issue persists. After ~26m the stuttering starts.

As far as I can tell, it has something to do with the input. If one opens up the in-game console the stuttering goes away, but as soon as mouse or keyboard is use the stutter is back, as long as there is some input. But in the end, this might be CS:GO specific.

I did all my testing under Wayland, but it also appears with Xorg.

Kernel: 5.16.9-200.fc35.x86_64 Mesa: 21.3.6-1 CPU: Ryzen 5600X GPU: RX Vega 56

YellowOnion commented 2 years ago

As far as I can tell, it has something to do with the input.

I get this as well, that's what I meant in the original post about using mouse or keyboard.

YellowOnion commented 2 years ago

@doitsujin What would you need to actually debug this? Considering it's input related I wouldn't be surprised if it was a wine or even a mesa bug, I just wish I could help someway, I just don't really know where to start with debugging GPU apps.

K0bin commented 2 years ago

If it is input related, it's unlikely to be caused by DXVK.

I just don't really know where to start with debugging GPU apps.

The GPU is sitting at 25% utilization, so the problem is in regular CPU code. I guess you could try building DXVK with symbols and attaching a profiler after the problem starts.

Blisto91 commented 2 years ago

Played a couple of games of Sanctum (max settings) which lasted total of around 1 hour and 20 mins. I didn't manage to reproduce the issue. Nvidia 960, 510.60, proton bleeding edge, fsync kernel (5.17), KDE Plasma Wayland and all that jazz. I didn't notice anything strange about GPU, VRAM, CPU or system memory behavior.

Later i'll try again with a older dxvk version and also on my AMD system (it seems people here reporting have amd gpu's?). Maybe without fsync also.

Blisto91 commented 2 years ago

Tried a couple of games in Sanctum again, this time on my amd system. R9 380 with 1-2 weeks old mesa git. Kernel, DE and all that is the same as last time. This time i used proton 7.0-1 which is 1.9.4 dxvk and i also had to use gamemode else this game shows one of the problems i have where mouse movement heavily stutters/semi freezes the game when i get in (not after x time). Anyway i did not reproduce it this time either.

I was also gonna try cs go in vulkan mode, but that seems to be unable to launch for me and some others at the moment. Moving on to trying Deus Ex: Human Revolution as a user at the proton repo had a issue that seemed similar.

Blisto91 commented 2 years ago

(Deus Ex) The person mentioned it occurring after 5 to 15 min, but i played the first area(s) a couple of times without reproducing. ~30 min ish each time. First time with same setup as above except no gamemode and second with me downgrading to regular mesa 22.0 and kernel 5.15. I was playing the game in dx9 mode and besides regular shader compilation stuttering the game seemed to run pretty well.

Interestingly in dx11 mode i can make the game freeze in some sections (not always) by just moving my mouse fast back and forth. This is usually solved by gamemode, but haven't tested that here.

YellowOnion commented 2 years ago

I haven't been playing many d3d9 games lately, and the last time I played one I didn't notice any issues, I wonder if something has been fixed.

Blisto91 commented 2 years ago

Ye. I tried giving it a few more shots in Sanctum and Deus Ex. I tried with proton 6.3-8 which uses 1.9.2. I tried downdating drivers to 21.3.7 and in Deus Ex i also tried using the async version of 1.9.2. But still nothing. (always with gaming mode enabled) Probably won't be able to reproduce the original issue.

Blisto91 commented 2 years ago

Just an update for the user who was experiencing something similar in deus ex. For them it seems to be the steam overlay causing the issue and it doesn't happen when they run the game with a couple of launch options. The talk about the options can be found from here and below. https://github.com/ValveSoftware/Proton/issues/47#issuecomment-1089520218

Blisto91 commented 2 years ago

@YellowOnion Just a friendly ping. Did the issue ever pop up again or did this go away?

YellowOnion commented 2 years ago

No I haven't seen it, I'll close this :-)

YellowOnion commented 1 year ago

Started playing Killing Floor and Dungeon Defenders and I'm still seeing the issue, I have a New GPU, 5700 XT, but same issue. None of my Vulkan overlays work, so perhaps it's a 32-bit issue.

I see this issue too: https://github.com/ValveSoftware/steam-for-linux/issues/9225

@Blisto91

Blisto91 commented 1 year ago

I played a over one and a half hour session of Dungeon Defenders with Proton BE to try and reproduce this. Still haven't been able to.

YellowOnion commented 1 year ago

I think this is unique to NixOS and the Environment for 32bit games missing some critical stuff. I might open a bug on NixOS tracker.

correii commented 1 year ago

I’m experiencing this issue on my steam deck using any version of dxvk + any version of wine/proton playing Black Ops 2. After 30 min, any keyboard or mouse input causes huge spikes in frame time making the game unplayable. The only fix is closing and restarting the game.

Interestingly, xinput controller input does not cause the frame time spikes.

I’ve tried every environment variable, most of the settings in dxvk.conf, every wine/proton version that will run the game, and every dxvk version down to 1.7.3. Nothing has worked to stop the undesirable behavior.

I do think this is limited to 32 bit or dx9 games. It may also be exclusive to ARCH based systems. I’d bet it has something to do with how memory is handled, since the behavior only occurs once the game has been running for 30+ minutes.

Whatever the problem is, I really hope it gets fixed soon because this is driving me NUTS

Blisto91 commented 1 year ago

Does it happen with wined3d. If the game runs with that.

correii commented 1 year ago

The game will launch with wined3d but gets stuck on “awaiting textures” when trying to load into a match.

edit: I’m using the Plutonium client LanLauncher for BO2 btw, if that matters.

YellowOnion commented 1 year ago

The game will launch with wined3d but gets stuck on “awaiting textures” when trying to load into a match.

edit: I’m using the Plutonium client LanLauncher for BO2 btw, if that matters.

Try LD_PRELOAD="" %command% in your launch options, I think the issue is with the injection of the 32bit dlls.

correii commented 1 year ago

I’m not using proton through steam, I’m using bottles/lutris. Does that work as an environment variable, or do I need to manually edit the dxvk.conf?

YellowOnion commented 1 year ago

I’m not using proton through steam, I’m using bottles/lutris. Does that work as an environment variable, or do I need to manually edit the dxvk.conf?

If it's not steam I would recommend disabling overlays, my issue works by turning off the steam overlay, but it needs to be after steam injects it using that envar, so your solution might be different.

I'm on my phone atm so can't help much.

correii commented 1 year ago

DUDE IT WORKED THANK YOU SO MUCH I’ve literally spent hours a day for the past MONTH trying to fix this, you are my HERO!

edit: for anyone else using bottles/Lutris, just add “LD_PRELOAD” as either an environment variable for the prefix or as a launch argument for the exe. I did it to both so idk which one actually gives the effect, but it doesn’t really matter.

Thank you again YellowOnion🙏🙏🙏

Blisto91 commented 1 year ago

So the stutter is gone? Or wined3d launches the game?