Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Using VIVE Pro 2, SteamVR fails to setup direct display mode using the Nvidia proprietary driver #450

Open
noboomu opened this issue Jun 18, 2021 · 33 comments
Labels

Comments

@noboomu
Copy link

noboomu commented Jun 18, 2021

Describe the bug
Using VIVE Pro 2, SteamVR fails to setup direct display mode using the Nvidia proprietary driver.

To Reproduce
Launch SteamVR with Vive Pro 2 HMD.

Expected behavior
VR compositor rendering to Vive Pro 2 using direct mode.

System Information (please complete the following information):

Additional context
Given the recent release of the Vive Pro 2, all of the existing setup documentation is based on the original Vive Pro.
The methods described in the existing documentation did not assist in getting the HMD to work.

On a vanilla SteamVR install, the system reported error 214 for "Missing Driver".

Installing Vive Console from the Steam store was required in order to detect the HMD, base stations and controllers.

After installing the Vive Console application, SteamVR functions properly but the compositor renders to the desktop and the HMD stays dark.

The logs report that SteamVR is attempting to use the driver installed with the Vive Console application, which only includes a win64 driver.

There is no linux64 driver in the package, though I am unsure if this is required.

The vrcompositor logs indicate that the Vulkan WSI can detect the following direct displays:

Fri Jun 18 2021 08:36:05.526535 - Looking for direct display through Vulkan WSI
Fri Jun 18 2021 08:36:05.534073 -  - Vulkan output 0: 3680x1836 resolution, 0x0 dimensions - HTC Corporation VIVE Pro 2 (DP-0)
Fri Jun 18 2021 08:36:05.534122 -  - Vulkan output 1: 3840x1080 resolution, 1200x340 dimensions - Dell U4919DW (DP-2)

However, the above do not seem sufficient:

Fri Jun 18 2021 08:36:05.534139 - Tried to find direct display through Vulkan WSI: (nil)
Fri Jun 18 2021 08:36:05.534153 - CHmdWindowSDL: Failed to create direct mode surface

The vrserver logs report the following as well:

Fri Jun 18 2021 08:36:02.075001 - Unable to load driver viveVR. Primary driver shared library not found on filesystem (for this architecture): /data/Steam/steam/steamapps/common/VIVEDriver/App/ViveVRRuntime/ViveVR_openvr_driver/ViveVR/bin/linux64/driver_viveVR.so.
Fri Jun 18 2021 08:36:02.075040 - Unable to load driver viveVR because of error VRInitError_Init_FileNotFound(103). Skipping.
@noboomu noboomu added the bug label Jun 18, 2021
@ethanfowler
Copy link

I am seeing the exact same behaviour: needed to install Vive Console, then just get a "SteamVR Compositor" window instead of video to the headset. Since this is an industry-focused product and there are a lot of Linux-based applications, how this is this not getting any attention?

@noboomu have you had any luck?

@noboomu
Copy link
Author

noboomu commented Aug 1, 2021

Unfortunately not @ethanfowler. The issue comes down to lack of a Linux port of the drivers contained in the Vive Console app. It’s definitely a matter of time but like you I am surprised by the lack of support. My development environment has expanded to include a Windows box for the time being and dev work has become much more frustrating.

@ethanfowler
Copy link

Thanks @noboomu. Do we have any contacts or active users here representing HTC? Our company situation will require a rough ETA from them, or we drop Vives and move to alternatives.

@huertes
Copy link

huertes commented Aug 28, 2021

i have the same issue, but with a radeon rx 6700 xt. My vive pro work perfect on linux, but vive pro 2 shows the 214 error.

@Gleethos
Copy link

I also have this issue solely with the Vive pro 2 on Ubuntu 20 with the latest
VIVE Console 2.1.18.5 running in compatibility mode on top of a RX 6900 XT with the latest drivers installed.
So I am guessing the Vive Pro 2 can not be used on Linux-SteamVR at all
until HTC releases the VIVE Console with Linux support?!?

@kainz
Copy link

kainz commented Oct 13, 2021

I also have this issue on radeon hardware, but....

I've gotten this sort-of working on Ubuntu 20.04.3 with the http://ppa.launchpad.net/kisak/kisak-mesa/ubuntu PPA, on a radeon VII, but I had to do the following:

  1. grab raw EDID from `/sys/class/drm/cardRADEONCARD-DP-displayportnumforheadset/edid
  2. use edid-decode -X from edid-decode-0.1~git20191209.e719d04-1build1 to generate X modelines. (xserver-xorg-video-amdgpu 19.1.0 does not seem to parse the edid from the vive pro 2 headset properly)
  3. use xrandr with newmode and addmode invocations to register the desired modelines with the X server. I use the following:
#!/bin/sh
# DO NOT USE AS-IS, VALIDATE WITH edid-decode -X WITH YOUR HARDWARE.
ANCHOROFCHOICE="probably put your rightmost xrandr output here"
for i in "2448x1224_90.03" "2448x1224_120.05" "3264x1632_90.00" "3680x1836_90.02"
do
    xrandr --rmmode $i
done
xrandr --newmode "2448x1224_90.03" 432.201  2448 2498 2502 2548  1224 1864 1866 1884  +HSync +VSync
xrandr --newmode "2448x1224_120.05" 431.901  2448 2498 2502 2548  1224 1392 1394 1412  +HSync +VSync
xrandr --newmode "3264x1632_90.00" 517.143  3264 3324 3328 3384  1632 1678 1680 1698  +HSync +VSync
xrandr --newmode "3680x1836_90.02" 632.251  3680 3730 3734 3780  1836 1848 1850 1858  +HSync +VSync
for i in "2448x1224_90.03" "2448x1224_120.05" "3264x1632_90.00" "3680x1836_90.02"
do
    xrandr --addmode "DisplayPort-0" "$i"
done
xrandr --output DisplayPort-0 --mode "3264x1632_90.00" --rotate normal --reflect y --right-of $ANCHOROFCHOICE
  1. I may have had firmware issues with the headset, I run steam in a windows VM in which I installed the vive console app via steam-on-windows to flash HMD firmware.
  2. When steamVR starts, you'll get a SteamVR compositor borderless window rendering somewhere, probably at 0x0. You'll need to move the window to the proper location with xdotool or a manual window move. You'll also need to tweak the render resolution in the SteamVR advanced settings manually. I find aiming to match whatever vertical resolution the HMD is set to works best, and you may need to tweak the window move to center the displays.

@lllsondowlll
Copy link

Distribution: Manjaro Linux; Build ID: rolling
SteamVR version: 1.19.7
Graphics driver version: Nvidia 470.63.01
Steam client version: October 6, 2021
Opted into Steam client beta?: No

Same issue, Vive Pro 2 is completely unusable on Linux. Vanilla error is missing driver unless Vive Console is downloaded which executes under Proton and shows a distorted screen followed by a loop of enabling direct mode.

@Patola
Copy link

Patola commented Oct 14, 2021

@kainz how do you get the /sys/card directory? Mine doesn't have it.

@kainz
Copy link

kainz commented Oct 14, 2021

@kainz how do you get the /sys/card directory? Mine doesn't have it.

typo. meant subdirectories under /sys/class/drm

@thern743
Copy link

thern743 commented Oct 17, 2021

Same issue here. First get HMD 214 missing driver error. Required VIVE Console to setup. Doesn't go to direct mode but does render in desktop mode. HMD is not detected running xrandr.

Ubuntu 20.04
NVIDIA RTX 3080
Driver version 470.63.01

@towc
Copy link

towc commented Nov 19, 2021

Same here, still unsolved: 214 error on SteamVR (natively on linux), until Vive Console is installed, then I get the white binoculars window on the desktop, and nothing on the HMD. SteamVR does prompt me to put the HMD on to wake it, and asks to enable direct mode, but nothing changes, except the prompts are gone, and I can't quit SteamVR unless I kill -9.

$ lsb_release -a 2> /dev/null | grep Description # pop_os is practically ubuntu
Description:    Pop!_OS 21.04
$ nvidia-smi | grep Version
| NVIDIA-SMI 470.86       Driver Version: 470.86       CUDA Version: 11.4     |
$ sudo lspci -v | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation TU106M [GeForce RTX 2060 Mobile] (rev a1) (prog-if 00 [VGA controller])
        Kernel driver in use: nvidia
        Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
01:00.1 Audio device: NVIDIA Corporation TU106 High Definition Audio Controller (rev a1)
01:00.2 USB controller: NVIDIA Corporation TU106 USB 3.1 Host Controller (rev a1) (prog-if 30 [XHCI])
        Subsystem: NVIDIA Corporation TU106 USB 3.1 Host Controller
01:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU106 USB Type-C UCSI Controller (rev a1)
        Subsystem: NVIDIA Corporation TU106 USB Type-C UCSI Controller
        Kernel modules: i2c_nvidia_gpu

@junelva
Copy link

junelva commented Dec 22, 2021

Encountered this behavior on Arch some months ago and am now encountering the same on Debian. Seems like it's the headset? (Vive Pro 2.)

If I wanted to try to debug this, where would I start? Driver work might be a steep learning curve for me, but I'm curious if anyone has ideas.

@GabrielHare
Copy link

Not sure if this will help, but after reading this thread, and another I just wanted to share what worked for me:

In NVIDIA X Server Settings for "PRIME Profiles" select "Performance Mode" and then restart.

Full post is here.

@CertainLach
Copy link

Almost got it working, some of this headset problem causes in kernel

VIVE Pro 2 doesn't work at all when connected, but it should at least work as second display

It may be fixed with this @kainz's workaround: #450 (comment)

But underlying reason is linux not supporting EDID DisplayID Type VI timings, so modes aren't detected

edid-decode -X /sys/class/drm/cardX-DP-Y/edid # Will show all modes
cat /sys/class/drm/cardX-DP-Y/modes # Will show only small resolutions

Patch: https://lore.kernel.org/linux-kernel/[email protected]/T/#u

VIVE Pro 2 works as second display, but it should be hidden in all xorg/wayland wms

EDID NO_DESKTOP quirk is missing

Patch: https://lore.kernel.org/linux-kernel/[email protected]/T/#u

After this, extended mode works out of the box, except created window is not covering entire screen...

Well, it is harder, and direct mode doesn't work because of same reason

After applying two patches, Direct Mode still can't be enabled

There is lines in logs:

 Looking for direct display through RandR
  - Root 0x6bd
    - Output 0x57 - 15 modes, 1 preferred
      - Mode 0 0x72f 2448x1224 (looking for 2880x1600)
 Tried to find direct display through RandR: (nil)

SteamVR sees vive as display (Output 0x57), and searching for suitable mode (2880x1600),
but there is no such mode in VIVE Pro 2, so it bails out and writes that no display is found (nil), proceeding
by not using direct mode

To make it work, we should replace mode searched by SteamVR (2880x1600) with something supported by
VIVE (I.e 2448x1224)

I see no such configuration option in driver_viveVR, so idk where this mode is coming from, so for this
we better need to find some value developer, or reverse vrcompositor binary and force needed mode via
patching/hooking

For last option - hooking _ZN2vr13CHmdWindowSDL23CreateDirectModeSurfaceEjjfPP14VkSurfaceKHR_TPP14VkDisplayKHR_T(unsigned int width, unsigned int height, float rate, void* vk_surface, void* vk_display) from vrcompositor and overriding width/height before passing control to original function will work, but SteamVR still renders on display in 2880x1600 resolution, which will look awful

@ChristophHaag
Copy link
Contributor

Very interesting. Of course SteamVR devs should fix it, but meanwhile where you should probably hook functions is not in vrcompositor, but in ~/.steam/steam/steamapps/common/SteamVR/drivers/lighthouse/bin/linux64/driver_lighthouse.so

The resolution returned by IVRDisplayComponent::GetWindowBounds is used by vrcompositor to determine which display to use for direct mode. Most likely this is where 2880x1600 is coming from.

IVRDisplayComponent::GetEyeOutputViewport returns the dimensions and positions of the eye, based on the resolution returned by IVRDisplayComponent::GetWindowBounds earlier.

@CertainLach
Copy link

CertainLach commented Jan 19, 2022

Patched GetWindowBounds of driver_lighthouse - and returned value isn't used by steamvr (Still trying to search for 2880x1600)

I may try other drivers, but i don't know which, i dont think actual driver_viveVR is used, as it is windows version

image

Edit: nevermind, it worked, thanks!

@CertainLach
Copy link

Well, it works for me now, i had issue with radv mesa driver (I know this issue is about Nvidia driver, but i think problems with VIVE Pro 2 is relevant for any GPU): https://gitlab.freedesktop.org/mesa/mesa/-/issues/5898

I getting image in direct mode on my headset now

Photo of base station visible in ocular

index

However this image is filpped vertically, and seems to be not quite bit centered

When wearing it and looking at base station, i see two of them, eyes can't merge them into one

When I look alternately with my left or right eye, i see this (Sorry for paint):

oculars

Red lines are middle of fov

Left and right eye are swapped?

Or there is combo of inverted orientation plus right-left flip?

Can't guess, difficulty orientating in space, need to test

So i need to somehow transform output image, likely with another driver_lighthouse.so patch

Performance is awesome however, both in X11 and Wayland environment

@ChristophHaag
Copy link
Contributor

However this image is filpped vertically, and seems to be not quite bit centered

Some HMDs have the displays physically installed in a rotated position. The OSVR HDK2 had the entire display upside down too.

In SteamVR drivers the only way I know of to rotate the image is by changing IVRDisplayComponent::ComputeDistortion. It gets input coordinates on the image in NDC and returns coordinates in NDC where the image should be sampled to counter the distortion of the lenses (or the other way around, can't quite remember), and you can abuse this to easily rotate the entire image.

For example the else branch here: https://github.com/ChristophHaag/SteamVR-OpenHMD/blob/cb88d2c420c0eaefb72e55dfc74e87beaf211750/driver_openhmd.cpp#L955-L969

It may also require switching the position of the eye viewports on the display something like so https://github.com/ChristophHaag/SteamVR-OpenHMD/blob/cb88d2c420c0eaefb72e55dfc74e87beaf211750/driver_openhmd.cpp#L757-L800

(ps: Wouldn't it be easier to implement hooks in C++ and LD_PRELOAD it, instead of patching the binary?)

@CertainLach
Copy link

I do it like that, but patching is easier in some cases than PLT hooking :D
I think i should write proxy library instead

@CertainLach
Copy link

Well, better steal per-eye transforms from Windows driver impl
Using this proxy i am able to launch anything, and it will work, but long use may break eyes
https://github.com/CertainLach/SteamVR-Proxy-Driver

No instructions so far, after make enable it might just work (kernel patches from above is still required)

@CertainLach
Copy link

Copied GetEyeOutputViewport, GetProjectionRaw, and ComputeDistortion implementation from driver_viveVR: CertainLach/VivePro2-Linux-Driver@664fd51

Now it looks better, somewhat usable (After flipping image), however image is still flipped upside down, and there is fish eye effect for some reason

I think there is something more, but i don't see any other method which can distort image

Also, ComputeDistortion isn't being called in driver_viveVR on windows, and i still can't understand relation between driver_lighthouse and driver_viveVR

@CertainLach
Copy link

It appears VIVE PRO 2 uses yet another driver: driver_vive_lh

Which in turn uses LibLensDistortion.dll to configure lenses (GetProjectionRaw/ComputeDistortion/Lens center set via property)

So i think valve can't fix this themselves, unless HTC releases LibLensProjection.dll for linux, or someone rewrites/decompiles it (i dont see anything hard in this operation, this library only parses json config and then performs calculations on numbers from it)

Meanwhile, i wrote a binary, which proxy driver executes via wine to perform all of those computations:
CertainLach/VivePro2-Linux-Driver@9f32b91

Using this library i got same image as i getting on windows, and everything is finally fully usable

@annewagner
Copy link

annewagner commented Feb 20, 2022

Thank you so much for sharing your work!
I am trying to get my Pro2 running on ubuntu 22.04 with kernel 5.16.10, and I've done the first kernel-patches. SteamVR works as long as direct mode isn't enabled, with the Pro2-screen remaining inactive.
While trying to follow the guide given above, I couldn't find how to compile the lensServer as mentioned in the README. Could someone send me the link/info how to do that?

@CertainLach
Copy link

lensServer is required for using direct mode, but i am too lazy to write any docs :D

Basically, for build you need to have rust toolchain with mingw target installed, run cargo build --release in lensServer directory, then copy lensServer/target/x86_64-pc-windows-gnu/lens-server.exeto lensServer/dist (this path will be hardcoded in library build via make enable)

Or, if you trust me for some reason, here i prebuilt it
lens-server.zip

To make it work, you need to have wine command available (steam installed proton isn't used)

@annewagner
Copy link

First of all thank you again!
ok. so, I couldn't get it to work. I compiled the lensServer(though I changed the 3 files from the asset folder over to dist as they couldn't be found otherwise?) on itself it seems to be working(reports lensServer ready when started with wine in terminal). But I didn't manage to get SteamVR working in direct mode.
It will start the same as with the driver_lighthouse_real.so but it doesn't restart into direct mode when clicking on the enable botton(it also crashes upon starting HOME).

I have installed the vesa kernel-Patch, since I have a nvidia GPU I didn't see a reason to do the gpuamd one, and I was also wondering, the vivectl folder seems to be something that is supposed to be compiled, but I haven't found where the exe's supposed to be copied to and used...

Would you mind charing what kind of software versions you used to get it working?

@CertainLach
Copy link

Try to launch steam from terminal, my driver logs are written here, still possible something is broken on its side, i doubt this is version issue, i think your vive has not the same default mode current version of driver expects (i have in progress version, which reconfigures it), can you share output of xrandr? Driver runs in 2448x1224 mode by default, this resolution is hardcoded

Enable direct mode button doesn't do anything on linux, its just restarts steamvr

Or, if you're brave enough, here i have upgraded version of driver, which reconfigures HMD itself, which probally will fix it for you (Also it solves some lens-server configuration related issues)
https://github.com/CertainLach/VivePro2-Linux-Driver/releases/tag/v0.2.0-rust.1

Kernel patch is required to support max resolution of vive pro 2, and i think nvidia driver doesn't support this too, and something like this patch is required from nvidia

vivectl allows reconfiguration of headset, in beta version of driver this is handled by driver itself

@Alexandre-Frantz
Copy link

Hi everyone, I have been scouring the internet looking for a similar solution for the HTC Vive Cosmos Elite on Ubuntu 18.04. I've tried the recommendations from this thread, the original instructions by Christhoph Haag here and from this blog too. Sadly I am still getting the error code 214 (HMD not detected) when launching steamVR with the "beta update".

I did notice however that if I try to launch steamVR with the "Linux_v1.14" beta, it detects the headset but as soon as I pick it up (I guess to "wake up" steamVR) it crashes.

I am starting to think that for the Cosmos Elite it is a complete lost cause. I've only found solutions for Vive Pro 2 and the OG vive, but nothing related to the Cosmos. Any ideas?

Any guidance on this matter would be HIGHLY appreciated !

@CertainLach
Copy link

CertainLach commented Jul 4, 2022

HTC Vive Cosmos

Can you dump edid and lsusb output from your vive, and specify which resolutions (modes) is allowed to be chosen in Vive console ui? I think it may work with mine driver (https://github.com/CertainLach/VivePro2-Linux-Driver) after some modifications

As I have seen during RE, Vive Cosmos should have same linux compatibility issues as Vive Pro 2

SteamVR doesn't support Vive Pro/Vive Cosmos out of the box, and there was several issues in linux kernel, most of them should be fixed in 5.18

@huertes
Copy link

huertes commented Aug 2, 2022

hello! I have the same problem with cosmos. I'll try your controller, but how can I know what resolutions to put instead of the vive pro 2's?
Thanks for your effort and dedication to solve this issue.
regards

i tried to install with this result:

./install.sh: 3: set: Illegal option -o pipefail

(ubuntu 22.04, kernel 5.19, mesa 22.1.4)

and other error with nix installation:
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

@JJones780
Copy link

JJones780 commented Aug 9, 2022

I'm making progress getting the Vive Cosmos Elite working...
A few notes:
@azkanel modify the install.sh's first line to read #!/bin/bash. My sh didn't like the pipefail option either but bash recognizes it.
@CertainLach Thanks for all your hard work!

re: Kernel Patch: Product ID for Cosmos is aa03 ( according to https://github.com/linuxhw/EDID).
I have yet to put aa03 in the kernel but hope that will get it working.
Without the aa03 kernel patch It renders to the desktop but can't go direct as the HMD isn't detected via RANDR nor Vulkan WSI (as reported in the ~/.steam/debian-installation/logs/vrcompositor.txt).
update: with aa03 added to kernel patch the log file indicates that Vulkan WSI finds the headset display ( although randr does not).

@h8rt3rmin8r
Copy link

h8rt3rmin8r commented Aug 21, 2022

...
and other error with nix installation:
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

I've submitted an issue related to this here

@Supermagnum
Copy link

I hope that someone eventually gets HTC Vive Cosmos to work without any issues.

@JJones780
Copy link

@Alexandre-Frantz @Supermagnum @huertes

Cosmos Elite is sooo close... it might just be a problem with getting the headset display to turn on?
see CertainLach/VivePro2-Linux-Driver#18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests