protonscr

[PERF] Poor Performance and Audio Crackling on Radeon RX 580 After Fresh Reinstall of Ubuntu Studio 10 Xfce [SOLVED]

steamvrclosed perf
ValveSoftware/SteamVR-for-Linux#485 · opened 2021-12-02 by KawaneRio · updated 2021-12-04 · 6 comments · github
KKawaneRio 2021-12-02 github

I didn't know where to write this, but I'll write it here.

image

I've recently did a fresh reinstall of my Operating System and since then, I have this issue where performance is, um... not so great.
Granted the hardware is not exactly identical, but I should, theoretically, or have at least expected, to get better performance, not worse.

Synopsis

I have performed a Hardware Upgrade in hopes of a better SteamVR experience. On my Gigabyte X570 UD Motherboard, I have replaced my old AMD Ryzen 5 3600 for a new AMD Ryzen 7 5700G, and increased my memory by swapping out a pair of 8GB Corsair Vengeance LPX for a new pair of 16GB Corsair Vengeance LPX. All the other hardware remained the same including the AMD Radeon Sapphire RX 580 8GB. Then I upgraded my Operating System and reinstalled Steam. SteamVR works. And I'm grateful for that. However, as my avarice takes over, I wish SteamVR had better performance.

Summary
CPU: AMD Ryzen 5 3600AMD Ryzen 7 5700G
RAM: 36GB48GB
GPU: AMD Radeon Sapphire RX 580 8GB (same)
Motherboard: Gigabyte X570 UD (same)
Kernel: 5.4.0-84-lowlatency5.11.0-41-lowlatency

Context

Before Hardware Upgrade

Back when I was using linux 5.4.0-*kernel, I could play VRChat rather fine with some occasional pink stripes (display error) showing up on my SteamVR.

However, for the most part, everything was fine.

スクリーンショット_2021-11-01_08-17-19

This is the type of graph I expect from playing VRChat on a RX 580
スクリーンショット_2021-11-01_15-17-38

Despite the Glitchy Cyberpunk Overlay Graphics, the performance is unaffected.
image

My SteamVR System Report from 2021/10/7
https://gist.github.com/KawaneRio/1669e18a7b4af4197ea88f173c3798bc

After Hardware Upgrade

BIOS Update Required

PC does not POST

After upgrading my CPU from Ryzen 5 3600 to Ryzen 7 5700G, the first thing I've noticed was that my PC would not start, or POST. After a bit of research, it turns out that my Motherboard Gigabyte X570 UD (rev 1.0) did not in fact support my Ryzen 7 5700G until 2021/07/13. Since my BIOS was never once updated after my purchase from 2020, my BIOS version was F1. I needed to at least upgrade my BIOS to version F35 to get my PC to POST with my Ryzen 7 5700G.

image

Thankfully, I did not have to buy another CPU because Gigabyte X570 UD supports Q-Flash Plus. By formatting my 8GB USB Thumbstick to FAT32 format and decompressing the aforementioned binaries onto it, then renaming the .bin file to GIGABYTE.bin and sticking the USB stick into the white USB slot that says BIOS USB on the backside of my PC, then pushing the little black button underneath that says Q-Flash Plus for a few seconds and waiting for several minutes, I had successfully installed BIOS version F35 onto my Gigabyte X570 UD motherboard without having to purchase another CPU.

Then my PC booted. With the new Ryzen 7 5700G CPU, Radeon RX 580 GPU, and the 48145MiB of Memory showing up on neofetch, everything seemed fine and there was peace... But not for long.

GUI Freeze, Safe Graphics Freeze, LiveUSB Freeze, and Memtest86+ Freeze

Memtest86+ on Ubuntu 20.04 LTS turns out to be the culprit

After upgrading my RAM from 32GB to 48GB, My OS would boot... but then completely just freeze after a few minutes. I've tried Booting in Safe Graphics Mode and tried booting from LiveUSBs but... nothing. My machine would seemingly boot fine, but then just freeze a few minutes in, regardless of activity.
After several days of disconnecting/reconnecting a bunch of Display Cables, and countless nights of rebooting and testing with different BIOS settings (enabling/disabling CSM, SVM, Secure Boot, etc...), my PC just stopped loading DE's and would just throw me into the CLI.

image

[FAILED] Failed to start Detect the available GPUs and deal with any system changes.
See 'systemctl status gpu-manager.service' for details.
[FAILED] Failed to start Light Display Manager
See 'systemctl status lightdm.service' for details.

The good news was, though, the CLI would not freeze.
I had initially suspected that what I had was a faulty RAM, since my Memtest86+ was freezing at 9% or 54% on first test. every. single. time.

Memtest86 5 01 9percent freeze

However. I didn't have a faulty RAM. What I [also] had was a faulty memtest.
To be specific, a latest bug that exists specifically in Ubuntu 20.04 LTS's version of memtest86+...

https://bugs.launchpad.net/ubuntu/+source/memtest86+/+bug/1876157

at this point I'm beginning to hate my life.

and doing a fresh reinstallation of my Ubuntu Studio (Xfce) with linux 5.11.0 kernel, alongside a complete reinstall of Steam, things were never the same.

Screenshot of "SteamVR has encountered a critical error."

スクリーンショット_2021-11-16_21-33-13

To Reproduce

Steps to reproduce the behavior:

  1. Upgrade the X570 Motherboard BIOS to version F36e
    1.2. reboot
    1.3. add GRUB_CMDLINE_LINUX="iommu=soft" to /etc/default/grub and sudo update-grub
    1.4. Enable SVM via M.I.T. > Advanced Frequency Settings > Advanced CPU Settings > SVM Mode in the BIOS
    1.5. Change IOMMU setting from AUTO to Enabled in the BIOS
    1.6. reboot
  2. Boot into LiveUSB
    2.1. Wipe Everything out from the SSD and install Ubuntu Studio 10 Xfce. Do Not Reboot.
    2.2. tar --extract --verbose --keep-old-files --file /media/ubuntu-studio/onikamasu4/backup.tar.gz --directory /media/ubuntu-studio/1*******-****-****-****-************/
    2.3. After tar is decompressed on the freshly installed system, reboot
3. `sudo chmod ugo+wx /media/kawanerio/onikamasu4/` to fix permission for external drive.

sudo chmod ugo+wx /media/kawanerio/onikamasu4/

image

4. Open Blender and see if OpenCL is available... it is!

image

5. `sudo apt upgrade`; `sudo apt autoremove`; `sudo apt update`

sudo apt upgrade

image

sudo apt autoremove

image

sudo apt update

image

  1. Open Steam and see if I can play VRChat... nope:(
    6.1. Open Steam and see if I can play SteamVR... nope:(
  2. cd amdgpu-pro-21.30-1290604-ubuntu-20.04/
    7.1. ./amdgpu-install --uninstall
    7.2 sudo apt autoremove and sudo apt update
    7.4 ./amdgpu-install --opencl=legacy,rocr --no-dkms
    7.5 sudo apt autoremove; sudo apt update; sudo apt upgrade; and sudo apt update
    7.9 reboot
  3. Open SteamVR... it starts! But now it encounters a critical error.
  4. Uninstall SteamVR and Reinstall SteamVR. Follow the prompt and run usr/sbin/setcap as superuser.
  5. Open SteamVR... it starts! But now it's giving me an error [307]. Tried with Proton Experimental and Proton 5.13-6 but with no luck. The SteamVR version is linux_v1.14 1.14.16.
  6. Tried sudo mv /usr/share/vulkan/icd.d/intel_icd.x86_64.json /usr/share/vulkan/icd.d/intel_icd.x86_64.json.disabled but SteamVR is still not working.
  7. sudo apt install linux-lowlatency-steamvr-20.04 and sudo apt install mesa-vulkan-drivers mesa-vulkan-drivers:i386 (this was around the time where I just started running commands without knowing what exactly they do)
  8. Ubuntu Software Application says I can upgrade my softwares. Upgrade now.
    13.1. Ubuntu Software gives me a warning about how it could not install amdgpu-dkms and the distribution upgrade process was aborted.
  9. sudo apt autoremovelibllvm12.0-amdgpu and libllvm12.0-amdgpu:i386 will be removed.
    14.1 Y.

Expected behavior

  1. Install Ubuntu
  2. Install Steam
  3. Play VRChat

System Information

  • Distribution: Ubuntu 20.04.3 LTS (Focal Fossa)
  • SteamVR version: Tested with [1.20.4] and [1.21.3]
  • Steam client version: Built Dec 2 2021, at 07:36:11
  • Opted into Steam client beta?: Yes
  • Graphics driver version: vulkaninfo | grep driverInfo
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 3.  Skipping ICD.
	driverInfo         = 
	driverInfo                                           = 

...wait, what?
I mean, vulkaninfo works fine... here's vulkaninfo > vulkaninfo.log from 2021/12/03... Here are the relevant snippets:

VkPhysicalDeviceDriverProperties:
---------------------------------
	driverID           = DRIVER_ID_AMD_OPEN_SOURCE
	driverName         = AMD open-source driver
	driverInfo         = 
	conformanceVersion = 1.2.5.2
VkPhysicalDeviceVulkan12Properties:
-----------------------------------
	driverID                                             = DRIVER_ID_AMD_OPEN_SOURCE
	driverName                                           = AMD open-source driver
	driverInfo                                           = 
	conformanceVersion                                   = 1.2.5.2
	denormBehaviorIndependence                           = 
︙

...okay. maybe maybe there's a tiny chance that my Vulkan Drivers are not installed properly...

Gist for SteamVR System Information:

SteamVR 1.20.4
SteamVR 1.21.3

Performance Data

  • CPU: AMD Ryzen 7 5700G with Radeon Graphics
  • GPU: Radeon RX 580 Series (POLARIS10 DRM 3.43.0 5.11.0-41-lowlatency LLVM 12.0.1) v: 4.6 Mesa 21.3.0-devel
  • SteamVR Beta: Gist for perf top
  • SteamVR Beta: Link to gpuvis trace

Screenshots of Frame Timing 1.21.3

Sound would occasionally cut off and on as soon as I start SteamVR. There would constantly be a lot of unpleasant "choppy" noise (The Japanese onomatopoeia for this specific noise is ブチブチ), although the frames seem to be okay, despite the horrid magenta display error seen on VRMonitor. All the Overlays, including the Steam logo that comes up when I'm using the controllers, are glitched up.

スクリーンショット_2021-12-03_06-37-56

Detail View. I'm just sitting in my SteamVR void not doing anything. Frames seem fine. SteamVR Home is Disabled for good.

スクリーンショット_2021-12-03_06-38-19

When I play VRChat, that's when things get a bit heavy. Just sitting in my Home World with VRChat telling me I have 90 FPS certainly does not feel like I'm getting anywhere near 90 FPS at all.

スクリーンショット_2021-12-03_06-49-56

Detail View. Just sitting in my Home World not doing anything.

スクリーンショット_2021-12-03_06-50-08

Now, actually going to other worlds, seeing particles and mirrors, that's when VRChat becomes very difficult to enjoy. This is just me, by myself and nobody else, going to vket3 Neo-Shibuya.

スクリーンショット_2021-12-03_07-18-03

Detail View.

スクリーンショット_2021-12-03_07-18-10

Screenshot of Steamvr-trace
image

TL;DR

My HMD is slow and has super-choppy audio. I can't enjoy VR because I can't hear people half the time. I didn't have this problem last month. I sad.


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

CChristophHaag 2021-12-02 github

Use radv, not amdvlk.

KKawaneRio 2021-12-03 github

@ChristophHaag

Use radv, not amdvlk.

a a a (This comment is making me want to really install arch instead of gaming with ubuntu)

Okay, please correct me if I'm wrong. What you call amdvlk in the arch realm is known as cd /home/kawanerio/amdgpu-pro-21.30-1290604-ubuntu-20.04/ && ./amdgpu-install or basically amdgpu-install in the Debian realm, and what you call radv is equivalent to libvulkan1 mesa-vulkan-drivers vulkan-utils in the Debian realm, right? And in order to work with the latest Mesa Drivers for Vulkan on an ubuntu machine, I should probably enable oibaf's Updated Open Graphics Drivers PPA via add-apt-repository ppa:oibaf/graphics-drivers and then installing the said Vulkan Packages thru sudo apt install libvulkan1 mesa-vulkan-drivers vulkan-utils, correct?

And because I don't want multiple (and possibly conflicting) drivers, along with the fact that I don't want amdgpu-pro-installed drivers, I should probably uninstall the drivers I got from amdgpu-install via cd /home/kawanerio/amdgpu-pro-21.30-1290604-ubuntu-20.04/ && ./amdgpu-install --uninstall (or maybe amdgpu-install --uninstall) before doing anything else, yes?

So, here's what I did.

0. Not knowing any better, I ran a `sudo apt install mesa-vulkan-drivers` and *tried* installing `vulkan-utils`, but failed due to the fact that I have `vulkan-tools` installed already.

sudo apt install mesa-vulkan-drivers

スクリーンショット_2021-12-03_18-32-17

sudo apt install vulkan-utils

スクリーンショット_2021-12-03_18-36-01

  1. Uninstall Proprietary AMDGPU Drivers that I got from AMD. Goto cd /home/kawanerio/amdgpu-pro-21.30-1290604-ubuntu-20.04/ and
1.2. run `./amdgpu-install --uninstall`

./amdgpu-install --uninstall

スクリーンショット_2021-12-03_18-53-55

スクリーンショット_2021-12-03_18-55-30

スクリーンショット_2021-12-03_18-55-54

Uninstall was completed successfully

2. As soon as I uninstalled 1154MB worth of drivers, the Ubuntu Software Application popped up to me saying that I should update my Mesa Vulkan Graphics Drivers, like, **now**. So I complied.

スクリーンショット_2021-12-03_18-56-45

スクリーンショット_2021-12-03_18-56-51

Do I want to install Mesa Vulkan Graphics Drivers? Ye. Install now.

スクリーンショット_2021-12-03_18-57-28

スクリーンショット_2021-12-03_18-57-41

スクリーンショット_2021-12-03_18-57-55

All done! My Ubuntu is Up-to-Date!

3. Although I'm certain I've already did this in the past, I enabled oibaf's *Updated Open Graphics Drivers* PPA via `add-apt-repository ppa:oibaf/graphics-drivers`

oibaf's Updated Open Graphics Drivers PPA

add-apt-repository ppa:oibaf/graphics-drivers and press Enter to continue.

スクリーンショット_2021-12-03_18-59-20

スクリーンショット_2021-12-03_18-59-29

4. `sudo apt update`; `sudo apt upgrade`; `sudo apt autoremove`

sudo apt update

スクリーンショット_2021-12-03_18-59-46

sudo apt upgrade

スクリーンショット_2021-12-03_18-59-58

sudo apt autoremove

スクリーンショット_2021-12-03_19-00-12

5. Install the Vulkan Packages: `sudo apt install libvulkan1 mesa-vulkan-drivers vulkan-utils`

スクリーンショット_2021-12-03_19-00-29

  1. reboot
7. Open SteamVR and see if it's IT'S WORKING?!

image

7.1. Nothing was projected onto the HMD. I closed SteamVR and opened it again.

 7.2. Direct Display was shown on the Desktop, but still nothing on the HMD. Restart the Headset.

image

  7.3. IT WORKED!! I HAVE FRAMES!

image

Thoughts

@ChristophHaag Thank you so much for your four words of wisdom.
The performance and especially the graphics has seen a great improvement since uninstalling the AMD Drivers and completely switching to use Vulkan. However, the choppy audio and occasional speaker muting issue is still present as soon as SteamVR is started. Perhaps the audio issue may have something to do with ALSA/Pulseaudio. I wonder if this issue can be addressed by installing pipewire... Are there anyone that has had/is having an issue with choppy audio and occasional sound clipping? Any help is tremendously appreciated.

I will now attach some system reports from this new environment.

System Info

  • Distribution: Ubuntu 20.04.3 LTS (Focal Fossa)
  • SteamVR version: Tested with [1.21.3]
  • Steam client version: Built Dec 2 2021, at 07:36:11
  • Opted into Steam client beta?: Yes
  • Graphics driver version: vulkaninfo | grep driverInfo
ERROR: [Loader Message] Code 0 : loader_get_json: Failed to open JSON file amd_icd64.json
ERROR: [Loader Message] Code 0 : loader_get_json: Failed to open JSON file amd_icd32.json
ERROR: [Loader Message] Code 0 : loader_get_json: Failed to open JSON file amd_icd64.json
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 2.  Skipping ICD.
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
	driverInfo         = Mesa 22.0.0-devel (git-5c4c8bd 2021-12-03 focal-oibaf-ppa)
	driverInfo                                           = Mesa 22.0.0-devel (git-5c4c8bd 2021-12-03 focal-oibaf-ppa)
	driverInfo         = Mesa 22.0.0-devel (git-5c4c8bd 2021-12-03 focal-oibaf-ppa) (LLVM 13.0.0)
	driverInfo                                           = Mesa 22.0.0-devel (git-5c4c8bd 2021-12-03 focal-oibaf-ppa) (LLVM 13.0.0)

wait... what now...?

Gist for SteamVR System Report

1.21.3

Performance Data

All these data were taken when I'm just sitting in my home world not doing anything [in VRChat].

sudo perf top >radv_steamvr_perftop.log

gisvis: radv_sitting_in_vrchat_home.trace

Screenshots

Folded for convenience

Me sitting in my home world, not doing anything:

スクリーンショット_2021-12-03_20-17-33

Me going to world where there's people:

スクリーンショット_2021-12-03_20-44-05

Me, interacting with 10+ people within an instance:

スクリーンショット_2021-12-03_20-35-26

(VRChat says I had 20FPS, but it felt like 10)

スクリーンショット_2021-12-03_20-21-53

gisvis:

スクリーンショット_2021-12-03_21-22-07

TL;DR

Thanks to Christoph, I have more Frames but Audio still choppy me no happy:(


Reference

https://linuxconfig.org/install-and-test-vulkan-on-linux

https://wiki.archlinux.jp/index.php/Vulkan

KKawaneRio 2021-12-03 github
KKawaneRio 2021-12-03 github

All right. This is a cable issue.
I've tested playing VRChat with my Bluetooth Earphones and had zero problems hearing everyone in instances with 30+ people. On top of that, I am starting to notice RGB crosshatch grains in the dark areas of HMD Display. Considering the symptoms I have from the audio side along with the visual imperfections, combined with the fact that OBS is picking up all the sound outputs just fine from VRChat, I have concluded that this audio crackling is a case of Bad HMD Cable.
Since the Graphics are, more or less, working fine now, I am closing this issue as all the problems has been identified: The poor performance was due to the usage of amdgpu-install drivers, which was fixed by amdgpu-install --uninstall, and installation of libvulkan1 mesa-vulkan-drivers vulkan-utils, and the audio, which turned out to be hardware fault (bad cable).

Thank you for your time reading and have a good LinuxVR life:)

CChristophHaag 2021-12-03 github

I could have been slightly less verbose.

amdvlk and amdgpu-pro's vulkan driver aren't exactly the same, but they are closely related. amdvlk is amd's open source vulkan driver and amdgpu-pro contains a variant of that driver with a few closed source extras.

radv is a vulkan driver for AMD gpus that was written by mesa developers independently. At this time it seems like it's hugely preferred by Valve. SteamVR for example will only work correctly on radv, not on amdvlk or amdgpu-pro.

image
This is a definitive sign of running SteamVR with amdvlk or amdgpu-pro. I am not 100% sure but I think what is happening is that the vulkan driver syncs to the refresh rate of the monitor SteamVR is running on, not the actual refresh rate of the VR headset's display.

image
This happens because the dashboard is rendered with OpenGL. The way it works is that the vulkan driver creates a vulkan texture with optimal tiling. Then an OpenGL texture is created in such a way that it uses the same video memory as the vulkan texture. This import into OpenGL does not work correctly when the vulkan driver in question is amdvlk/amdgpu-pro and the OpenGL driver is mesa's radeonsi. I don't know if it can work with amdgpu-pro's OpenGL driver but I suspect not. SteamVR needs to run with radv for this kind of texture sharing to work.

Generally the advise is not to use amdgpu-pro unless you need it.

I am starting to notice RGB crosshatch grains

I've seen this RGB noise on and off on older GPUs, but not on my current GPU. Try another port on the GPU maybe.

CChrisJAllan 2021-12-04 github

I use Pipewire + PULSE_LATENCY_MSEC=50 %command% launch option to fix the audio crackling and stopping. It
might not be the cable, just that the GPU audio device requires a larger buffer than other sound devices, like your headset.

Proton versions

Launch lines