ValveSoftware / SteamVR-for-Linux

Issue tracker for the Linux port of SteamVR
917 stars 45 forks source link

[PERF] Latest SteamVR version jerks around and stutters a lot #631

Open Dwood15 opened 10 months ago

Dwood15 commented 10 months ago

Describe the bug

When using SteamVR with the new UI, it introduce intermittent stalls in frame output, and is generally incredibly laggy. Whenever I move my head the game follows, then it jerks around, and is generally unplayable even when the overlay is closed.

To Reproduce

There's no specific error and I'm not skilled enough in debugging to know how to guarantee anyone else gets this issues, so if commenters having the same issues as me can help add details, it would be very nice.

It happens in games like beat saber and tetris effect, as well as the base Home and Non-Home environments, which prior to the latest updates with the new UI, only the SteamVR-Home environments ever lagged. At this point VR is impossible to use.

Expected behavior

For SteamVR not to turn into a slideshow whenever I move my head. and to easily get 120fps

System Information (please complete the following information):

Performance Data (optional, but very helpful):

OS: Manjaro Linux x86_64 Kernel: 6.1.55-1-MANJARO CPU: AMD Ryzen Threadripper 3960X (48) @ 3.8GHz GPU: NVIDIA RTX A6000 Memory: 5.92GiB / 125.67GiB (4%)

Perf measurements not taken yet- the issues are visibly apparent on my setup with my ampere gpu.

Screenshots If applicable, add screenshots to help explain your problem. If possible, also include screenshot of vrmonitor's timing graph.

Additional context Add any other context about the problem here.

Note: Commenters who are also experiencing this issue are encouraged to include the "System Information" and "Perf Data" sections in their replies.

Will detail in comments any further debugging I attempt.

Dwood15 commented 10 months ago

force-closing the vrwebhelper and performance returns to what I expect.

Current theory: Latest vrwebhelper is missing a special sauce for hardware decoding that was in the earlier version. Either way, the webhelper is clearly the root problem.

NewtSoup commented 10 months ago

See also: https://github.com/ValveSoftware/SteamVR-for-Linux/issues/613

NewtSoup commented 10 months ago

@Dwood15 I have to say that killing all instances of VR Webhelper did increase the performance in Fallout 4 VR to the point where it was almost playable! I was unable to check the timing graph because doing so disables the VR Dashboard and Overlays of course. I was still getting some double vision when moving and or turning but it was less intense than previously

Dwood15 commented 10 months ago

@NewtSoup Yeah, even with the webview killed, the performance of various VR games on linux still massively underperforms. At least with the webview down, things like Beat Saber are still usable.

Unfortunately this comes with a massive cost, like you said.

hennakin commented 9 months ago

If Valve would open-source the dependencies we could debug this and help. Linux-VR really seems broken at this time. I would put some code in it to measure timing and needed time for critical function calls and make some unit testing for this with sane thresholds before failing on your testing-environment - so one could get the timing straight before releasing anything. What I don´t understand is why is vrwebhelper and steam webhelper doing really anything when not displaying something. In such timing critical applications like VR it seems a bad decision for me letting some stuff going on in the background that seems to be not needed at that time.

PhilT commented 7 months ago

Have you tried disabling Async reprojection in steam? This helped me. https://www.gamingonlinux.com/2021/08/having-vr-issues-on-linux-you-should-look-to-disable-async-reprojection/

Patola commented 3 months ago

Ok... I've tried all the solutions described here from killing vrwebhelper to disable or enable async reprojection and none of them worked. So I've found a solution that worked for me, which I explained in issue #657 --

I thought that stutter (also present in SteamVR 2.5.5) was due to something much more trivial, excessive logging, and it seems it is. I mounted ~/.local/share/Steam/logs as a tmpfs filesystem with owner/group as my own user and then the stutter is GONE!

The logs in there have a lot of trivial warnings repeated ad nauseum several times per second. This is useless/wasteful, but it hits the filesystem in a chorus a thousand times per second, and it's no wonder that it hinders the ability of games to keep the frame window stable.

Why is there so much logging, anyway? It doesn't seem it's sent to steam servers or something, and I see no way to turn it off. If a log falls in the middle of the forest and no one reads it, have those log messages really happened?

To me the only thing these logs inform is that steam and its subsystems like SteamVR are in a really bad shape, with lots of problems in their plumbing. Rejected connections, wrong inputs, mishandled files, stuff not found, and still it can run games and seems to work fine. Additionally, in my experience on bug reports here, on most cases these warning/error messages are useless to the diagnostics of the problem.

My hack to get stable frames is so good that I'm adding it to /etc/fstab. It forgets all files once I reboot, of course, but if I need them to a bug report or something they're still there, in my RAM.

wallcarpet40 commented 3 months ago

I mentioned the same in my comment https://github.com/ValveSoftware/SteamVR-for-Linux/issues/667#issuecomment-2094826635 that vrwebhelper keeps writing to the disk at 8MB/s with considerable CPU usage and if you leave SteamVR on for a while, you can see, that it keeps increasing the RAM usage to over 2,2 Gigabytes despite the fact that no game is running (not even SteamVR Home).

"Luckily" on Fedora 40, vrwebhelper requires SDL_VIDEODRIVER=x11 in it's launch script and without it, vrwebhelper does not start and the performance goes back to normal.

Hisanatos commented 2 months ago

Hey, I haven't had this problem under X11, but after explicit sync was added to Nvidia driver I tried Wayland and encountered the problem specified in the issue image

This makes VR totally unplayable under Wayland.

Hisanatos commented 2 months ago

Hey, I've got some spare time on Weekend and downgraded Nvidia drivers from 555 to 550, and the stuttering is gone, something ticked me off, when Monado experienced the same behaviour. obraz I'll retest on Wayland and edit this message, and open an issue on Nvidia forums some time later.

EDIT: Yeah, this time it's on Nvidia obraz

jp7677 commented 2 months ago

This post hints that disabling GSP on the 555 driver also solves it https://forums.developer.nvidia.com/t/enabling-gsp-makes-steamvr-unplayable-on-rtx-3090ti/298694

NewtSoup commented 2 months ago

This post hints that disabling GSP on the 555 driver also solves it https://forums.developer.nvidia.com/t/enabling-gsp-makes-steamvr-unplayable-on-rtx-3090ti/298694

What is GSP? Is it a setting that is turned off in Steam VR?

jp7677 commented 2 months ago

This post hints that disabling GSP on the 555 driver also solves it https://forums.developer.nvidia.com/t/enabling-gsp-makes-steamvr-unplayable-on-rtx-3090ti/298694

What is GSP? Is it a setting that is turned off in Steam VR?

See https://download.nvidia.com/XFree86/Linux-x86_64/555.58.02/README/gsp.html

Hisanatos commented 1 month ago

For anyone who struggles (took me like 3 hours) with setting this up (as it resolved my problem) you can open a terminal and type nvidia-smi -q | grep "GSP"

If you get GSP Firmware Version : N/A You are golden if not and instead of N/A you have some numbers you will encounter this problem on Nvidia drivers.

I had gone to /etc/modprobe.d/ created nvidia.conf file and inside put this

options nvidia NVreg_EnableGpuFirmware=0

After dracut-rebuild and restart I no longer experience those horrendous stuttering.

Hope this helps anyone who have similar distros to me, and point others to the right direction.

NewtSoup commented 1 month ago

Replying to https://github.com/ValveSoftware/SteamVR-for-Linux/issues/631#issuecomment-2236518224

Is there an AMD equivalent? I'm not using an nVidia card - RX6700XT