ValveSoftware / SteamVR-for-Linux

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

VK_EXT_global_priority on AMD #107

Closed ChristophHaag closed 5 years ago

ChristophHaag commented 6 years ago

As I understand it the somewhat undocumented setting enableLinuxVulkanAsync in steamvr.vrsettings should enable the usage of this extension and make use of amdgpu's high priority rendering in recent linux kernels.

The last thing I heard several months back was that the SteamVR compositor needs to be changed to do reprojection on a compute queue because only those can be run asynchronously (at the moment). Also it requires root or drm master permissions, so a kernel patch or drm leases is required.

Since then we've heard nothing.

Currently it does not seem to work and does not give a proper error message:

Fri May 18 2018 00:33:27.278940 - Requesting 8 device extensions:
Fri May 18 2018 00:33:27.278945 -  - VK_KHR_swapchain
Fri May 18 2018 00:33:27.278949 -  - VK_KHR_maintenance1
Fri May 18 2018 00:33:27.278952 -  - VK_KHR_dedicated_allocation
Fri May 18 2018 00:33:27.278955 -  - VK_KHR_get_memory_requirements2
Fri May 18 2018 00:33:27.278958 -  - VK_EXT_display_control
Fri May 18 2018 00:33:27.278961 -  - VK_KHR_external_memory_fd
Fri May 18 2018 00:33:27.278964 -  - VK_KHR_external_semaphore_fd
Fri May 18 2018 00:33:27.278967 -  - VK_EXT_global_priority
Fri May 18 2018 00:33:27.278970 - Attempting to enable async support...
Fri May 18 2018 00:33:27.278973 - Enabling async support!
Fri May 18 2018 00:33:27.281566 - Failed to create VkDevice with high priority queue.
Fri May 18 2018 00:33:27.281595 - Disabling async support and retrying.

That's the current state on latest SteamVR beta https://steamcommunity.com/games/250820/announcements/detail/1656641115372590275 RX 480 with radv git + drm lease patches https://github.com/ChristophHaag/mesa-mesa/commits/fe12582fe82d8891db81d3922c6049955178756d drm-next-4.18-wip kernel

ChristophHaag commented 6 years ago

For reference, I believe the setting is in the steamvr section in ~/.local/share/Steam/config/steamvr.vrsettings like

{
   "steamvr" : {
      "enableLinuxVulkanAsync" : true
   }
}

It still doesn't work.

Kernel support is there, radv support is there, steamvr is using drm leases, so why is it failing?

drawingpixels commented 6 years ago

Able to reproduce it here with Arch using git versions of mesa and xf86-video-amdgpu.

I was able to get it working by patching the kernel, just removing the check for drm-master/cap-sys-nice.

This makes the whole experience a lot smoother, the difference is pretty drastic.

ChristophHaag commented 6 years ago

I can confirm

Wed Jul 25 2018 09:58:13.715073 - Attempting to enable async support...
Wed Jul 25 2018 09:58:13.715085 - Enabling async support!

and then no error.

The first thing I tried with it was Everspace and it crashed the compositor

Core was generated by `/home/chris/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcomposito'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000435bac in CGenericResources::Update(vr::IGraphicsDevice::UpdateParams_t const&) ()
[Current thread is 1 (Thread 0x7f9054377700 (LWP 5291))]
(gdb) bt
#0  0x0000000000435bac in CGenericResources::Update(vr::IGraphicsDevice::UpdateParams_t const&) ()
#1  0x000000000041c1cf in vr::CHmdDistort::Update(vr::EVREye, vr::CHmdDistort::UpdateParams_t const*, vr::TrackedDevicePose_t const*, vr::ETrackingUniverseOrigin, unsigned long) ()
#2  0x0000000000454f43 in CRenderThread::UpdateAsync() ()
#3  0x0000000000459cb2 in CRenderThread::Run() ()
#4  0x0000000000512170 in SteamThreadTools::CThread::ThreadProc(void*) ()
#5  0x00007f908093f075 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f908067453f in clone () from /usr/lib/libc.so.6
Zamundaaa commented 6 years ago

The same happens for me, too. Haven't had any crashes due to it... I think

Thu Aug 16 2018 21:40:16.068790 - Attempting to enable async support... Thu Aug 16 2018 21:40:16.068793 - Enabling async support! Thu Aug 16 2018 21:40:16.069016 - Failed to create VkDevice with high priority queue. Thu Aug 16 2018 21:40:16.069024 - Disabling async support and retrying.

ChristophHaag commented 6 years ago

The crash was only with the kernel patch and async support enabled.

When I tried again it worked without the crash. I think

NOTE: This beta has been updated with the following changes Crash fix

from https://steamcommunity.com/games/250820/announcements/detail/1707314220616643268 might have been a fix for this crash but I don't really know.

Zamundaaa commented 5 years ago

So is there a reason that this still doesn't work without patching the kernel? It's been a while. Especially in some less performing Proton games this would be very very useful to have working

ChristophHaag commented 5 years ago

https://www.phoronix.com/scan.php?page=news_item&px=AMDGPU-Linux-5.1-Initial-Fixes Sounds like progress.

lostgoat commented 5 years ago

This was fixed with the introduction of vrcompositor-launcher a few versions ago.

feilen commented 4 years ago

Just a note, I'm still seeing the same warning on ubuntu 19.10:

Wed Apr 01 2020 18:10:55.277967 - Attempting to enable async support...
Wed Apr 01 2020 18:10:55.277977 - Enabling async support!
Wed Apr 01 2020 18:10:55.278262 - Failed to create VkDevice with high priority queue.
Wed Apr 01 2020 18:10:55.278285 - Disabling async support and retrying.

Radeon 5700XT, open source driver.

feilen commented 4 years ago

For anyone finding this, I just noticed the SteamVR Linux kernel has the above hack/patch: https://launchpad.net/~kisak/+archive/ubuntu/steamvr/+packages (see linux changelog). If you're on a compatible distro and can install that, do so. 19.10 (what I'm on) isn't supported, so I'll try adding it in myself / wait for 20.04 (in a couple weeks)

kisak-valve commented 4 years ago

Hello @feilen, the hack isn't required for regular use, but could be useful for unknown HMDs, and otherwise does no harm, which is why it has stuck around.

feilen commented 4 years ago

Ah, odd. Not sure why async reproj wouldn't be working for me then. I'm also using your 'mesa' repository, if that matters. I have the liquorix kernel installed (well, until a few minutes ago) but launching without it produced the same issues. Can you think of any other reason it may not be working?

feilen commented 4 years ago

Purging the kisak-mesa repository (and liquorix) didn't help.

Probably unrelated issue, SteamVR sometimes also starts up with no ability to change settings, and no overlay.

feilen commented 4 years ago

Quite possible that it's actually working and the warning is bogus, too...

feilen commented 4 years ago

Any news on this? I'm still getting the warnings on 20.04.

feilen commented 4 years ago

I should mention that forcibly installing the steamvr kernel removes these warnings, though I get pretty crazy double-vision in No Man's Sky.

Zamundaaa commented 4 years ago

though I get pretty crazy double-vision in No Man's Sky.

Then it's probably working for you now... I have async reprojection working and I always get that double vision in NMS as well as in a lot of other games when they don't perform completely perfectly (Boneworks, luckily only when walking sideways, Blade&Sorcery and a few others).

feilen commented 4 years ago

Interesting. I'll give it a shot with more (and more performant) games. I guess this would point to there still being something needed before it works out of the box on my system.

feilen commented 4 years ago

SteamVR Home and VRChat both work better with the new changes, so it has genuinely made an impact (previously, on some maps use of a mirror would cause judder, no longer a problem). With NMS, enabling legacy reprojection mode for it fixed the double-vision. So there's still something going on where on the default kernel I'm not able to get it to work, but the hack seems to fix it. I did check, and setcap on the steamvr-launcher binary is as expected.

kisak-valve commented 4 years ago

Hello @feilen, your issue really should be tracked in its own issue report. Please open a new issue report.

feilen commented 4 years ago

Certainly, thanks