protonscr

Ubuntu - bad stuttering with nvidia, maybe nvidia cache issues

steamclosed NVIDIA driversDistro Family: Ubuntu
ValveSoftware/steam-for-linux#9717 · opened 2023-06-24 by stubkan · updated 2023-07-29 · 6 comments · github
1 matching comments, n / p to jump
Sstubkan 2023-06-24 github

Your system information

  • Steam client version (build number or date): 1687386907 (up to date)
  • Distribution (e.g. Ubuntu): Linux Mint 21 (essentially Ubuntu 22.04)
  • Opted into Steam client beta?: [Yes/No] No
  • Have you checked for system updates?: [Yes/No] Yes
  • Steam Logs: [generate by running this command in a terminal tar -zcvf ~/Desktop/steam-logs.tar.gz ~/.steam/steam/logs]
  • GPU: Nvidia/Intel/AMD Nvidia RTX 2060

steam-logs.tar.gz

steam-275850.log

Please describe your issue in as much detail as possible:

I recently updated my Ubuntu version from 20 or 21, cant remember. This has had the side effect of making my steam games which were originally smooth prior to this to be now stuttering badly. I believe this is due to the infamous shader caching problems. Before the upgrade, stuttering was a SLIGHT problem, which went away with proton-GE and dxvk_async=1 enabling asychronous cache updating (before this update).

Now, stuttering is a big problem and dxvk_async=1 or RADV_PERFTEST=gpl does not fix it at all. I have my steam library on a second hard drive because my laptop space is limited, but it wasn't a problem before.

I have tried :

  • Disabling steam graphics precaching so it uses native/proton caching instead,
  • Different proton versions, proton-GE, even linux native binaries, all are bad.
    (Apparently Proton-GE 7-45 removes the dxvk_async patch entirely, only works with proton 7-44 or older)
  • Using RADV_PERFTEST=gpl %command% with latest proton-ge / proton versions
  • Switching the cpu governor from powersave to performance.
  • Making sure I have nvidia proprietry drivers, updating to latest.
  • Changing PowerMixer from Adapative to Maximum Performance in NVIDIA settings
  • Manually setting the nvidia shader environment vars
    __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 to allow the cache to get as big as it wants
    __GL_SHADER_DISK_CACHE_PATH to force it to appear on the main ssd, to be faster
  • Also cannot locate game_d3d11.log or game_dxgi.log anywhere in my steamapps or compatdata folders which may mean dxvk d3d11 isnt being loaded at all
  • When I check ~/.nv cache when the game is running and setting that path theres only a 50 or 100mb cache which seems small to me.

Not sure what else to try. I am fairly sure it's a shader problem since the game goes from maximum smooth fps to stuttering at 10 fps when I move into a new area.

Also I am unable to confirm dxvk is actually running - since no logs are generated, I am using no mans sky as a tester game which is a d3d 11 game. I can get proton to output a log in the home directory, but the only info it actually gives me is info: DXVK: v2.0-async. It doesnt tell me if dxvk or gpl is being used or not, just that dxvk exists. The only time dxvk or gpl appears anywhere in ~/.steam/steam/logs are when I launch the game with those in the command line, so those arent too helpful either.

Cchriku 2023-06-26 github

could it be https://forums.developer.nvidia.com/t/vulkan-app-with-vk-present-mode-fifo-khr-vsync-causes-desktop-stuttering-across-entire-system-when-moving-or-resizing-any-window-linux-x11/185015/6 ?
The whole system getting laggy and stuttering as soon as one application uses vsync is happening for me and it seems impossible to disable vsync of the steam client.

in any case, forcing steam to CPU renderer via the mesa device select layer fixed it for me.

Sstubkan 2023-06-26 github

I am assuming it is shader or ingame specific since this occurs at predictable times, not tied to window adjustments - ie, while ingame and moving into a new area or engaging new enemies. Which loads in new game content, immediately causing stuttering and going from 120 fps to 10-20

Regardless, I'll try to look into what that is and see if it improves

Cchriku 2023-06-26 github

The title is misleading and the whole system becomes unusable at the same time, independently of resizing windows.

But good to know that this has nothing to do with my issue.

Sstubkan 2023-06-27 github

From reading that link, I think there are a few things that need to be checked... System wide V-sync and display composition pipeline must be on, to fix that (resizing window issue)

I checked with glxgears what my fps is (if v-sync is on, it would be 60 or 120) and got 18,000 fps, I ran glxgears and dragged the window all over the screen, but still got 18,000 fps, so may be a different issue.

I tried replicating it as linked in that issue with the vkcube app, and moving window was smooth. But resizing the other window with the vkcube running did make the fps drop and add stuttering, but only resizing it, not moving windows, so maybe yes it is this issue.

Checked full compositing pipeline is on - Its not available as an option, even tho nvidia-drm.modeset=1. I tried forcing it on the command line, throwing an error with (Attribute not available) - because Nvidia PRIME display here doesn't use that, it uses something else called PRIME Synchronization to sync screens instead.

This is likely because the system is a laptop with two integrated gpus. I checked with xrandr --prop | less and found the line "PRIME Synchronization: 1" under nvidia GPU, indicating it is enabled.

The thread says the solution is to switch the vulkan application’s presentation mode to VK_PRESENT_MODE_IMMEDIATE_KHR which fixes the issue entirely.

How do I do that, for steam/proton games ? According to this comment thread in the dxvk code, it automatically goes to IMMEDIATE when vsync is off (https://github.com/doitsujin/dxvk/commit/109300d5412da59106621964a909225d19b736ed#commitcomment-32014996) as well as stating that the option for the user to set the mode manually was removed. So forcing IMMEDIATE may not even be possible?

Sstubkan 2023-07-29 github

I now believe this is due to thermald overzealously throttling cpu frequency as this issue disappears when thermald is removed from the system, as well as monitoring cpu temp/freq points to cpu being throttled to minimum speed when stuttering happens.

Can see my linked issue above if you wish to investigate further.

As Im unsure removing thermald cpu thermal control from the system is safe, that solution isnt ideal.

Kkisak-valve maintainer 2023-07-29 github

Hello @stubkan, having no software based backoff for thermal regulation is unwise. There should be hardware fail-safes, but those will either force a system shutdown or cut power if you hit them. Older note on the same topic: https://github.com/ValveSoftware/csgo-osx-linux/issues/141#issuecomment-1016483190

General thermal regulation is a system config issue that the Steam client shouldn't meddle with.