protonscr

[BUG] vrcompositor assumes displayName returned by vkGetPhysicalDeviceDisplayPropertiesKHR is != NULL

steamvrclosed bug
ValveSoftware/SteamVR-for-Linux#510 · opened 2022-04-17 by depau · updated 2024-06-08 · 8 comments · github
Ddepau 2022-04-17 github

Describe the bug

Sun Apr 17 2022 14:33:49.872257 - HMD deviceUUID is 2500000000
Sun Apr 17 2022 14:33:49.872307 - Looking for direct display through RandR
Sun Apr 17 2022 14:33:49.872337 -  - Root 0x6e1
Sun Apr 17 2022 14:33:49.873633 -    - Output 0x54 - 25 modes, 1 preferred
Sun Apr 17 2022 14:33:49.873654 -      - Mode 0 0x59 1920x1080 (looking for 3648x1920)
Sun Apr 17 2022 14:33:49.873676 -    - Output 0x55 - 0 modes, 0 preferred
Sun Apr 17 2022 14:33:49.873696 -    - Output 0x56 - 0 modes, 0 preferred
Sun Apr 17 2022 14:33:49.873716 -    - Output 0x57 - 52 modes, 1 preferred
Sun Apr 17 2022 14:33:49.873727 -      - Mode 0 0x72 3840x2160 (looking for 3648x1920)
Sun Apr 17 2022 14:33:49.873739 - Tried to find direct display through RandR: (nil)
Sun Apr 17 2022 14:33:49.873749 - Looking for direct display through Vulkan WSI
Sun Apr 17 2022 14:33:49.873763 -  - Vulkan output 0: 1920x1080 resolution, 520x290 dimensions - (null)

Thread 1 "vrcompositor.re" received signal SIGSEGV, Segmentation fault.

0x00007ffff751ea71 in __strncmp_avx2 () from /usr/lib/libc.so.6
#0  0x00007ffff751ea71 in __strncmp_avx2 () from /usr/lib/libc.so.6
#1  0x00005555555f253c in vr::CHmdWindowSDL::FindDirectDisplayVulkan(unsigned int, unsigned int) ()
#2  0x00005555555f5a89 in vr::CHmdWindowSDL::CreateDirectModeSurface(unsigned int, unsigned int, float, VkSurfaceKHR_T**, VkDisplayKHR_T**) ()
#3  0x00005555555f604a in vr::CHmdWindowSDL::CHmdWindowSDL(vr::CHmdDistort*, int, int, unsigned int, unsigned int, float) ()
#4  0x00005555555c2940 in vr::CHmdDistort::Initialize(TVRSharedState<VRCompositorState_t, false>*, vr::IVRIPCResourceManagerClient*, bool) ()
#5  0x0000555555649e4a in CVRCompositor::Init() ()
#6  0x000055555564aa8d in RealMain(unsigned int, ParsedArguments_t&) ()
#7  0x00005555555bca66 in main ()

vrcompositor.real crashes with ALVR since it assumes the vkdisplay returned by vkGetPhysicalDeviceDisplayPropertiesKHR has a name. The vulkan docs clearly say otherwise: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkDisplayPropertiesKHR.html

The stacktrace has been obtained by replacing vrcompositor.real with a bash script that launches gdb instead:

#!/bin/bash
exec gdb -ex 'r' -ex 'bt' --args /home/depau/Beans-Unencrypted/.steam/steamapps/common/SteamVR/bin/linux64/vrcompositor.real.real "$@"

To Reproduce
Steps to reproduce the behavior:

  1. Launch SteamVR using alvr_launcher
  2. See this and cry:
    image

Expected behavior
A clear and concise description of what you expected to happen.

System Information (please complete the following information):

  • Distribution: Arch, using alvr-git r1966.bbba0430-1
  • SteamVR version: 1.21.12
  • Steam client version: Mar 14 2022 19:49:17
  • Opted into Steam client beta?: Nope
  • Graphics driver version: [run nvidia-settings or vulkaninfo | grep driverInfo:
WARNING: [Loader Message] Code 0 : loader_scanned_icd_add: Driver /usr/lib/amdvlk64.so says it supports interface version 6 but still exports core entrypoints (Policy #LDP_DRIVER_6)
	driverInfo         = 2022.Q1.3
	driverInfo                                           = 2022.Q1.3


glxinfo | grep OpenGL
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon RX 5700 XT (navi10, LLVM 13.0.1, DRM 3.44, 5.17.1-arch1-1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 22.0.0
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 22.0.0
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 22.0.0
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

Screenshots
If applicable, add screenshots to help explain your problem.

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" section in their replies.

Ddepau 2022-04-18 github

Since, as mentioned, I was trying to use ALVR, and since ALVR does implement the API in question, I was able to work around it by patching it like this:

From ceff061f9ea5875c3323b2fc7750cc58a781837c Mon Sep 17 00:00:00 2001
From: Davide Depau <[email protected]>
Date: Mon, 18 Apr 2022 22:06:26 +0200
Subject: [PATCH] Workaround SteamVR issue

---
 alvr/vulkan_layer/build.rs             | 2 ++
 alvr/vulkan_layer/layer/device_api.cpp | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/alvr/vulkan_layer/build.rs b/alvr/vulkan_layer/build.rs
index 7d305395..7b1baf4f 100644
--- a/alvr/vulkan_layer/build.rs
+++ b/alvr/vulkan_layer/build.rs
@@ -26,6 +26,8 @@ fn main() {
         .cpp(true)
         .files(source_files_paths)
         .flag("-std=c++17")
+        .flag("-g")
+        .flag("-O0")
         .flag_if_supported("-Wno-unused-parameter")
         .define("VK_USE_PLATFORM_XLIB_XRANDR_EXT", None)
         .include(cpp_dir)
diff --git a/alvr/vulkan_layer/layer/device_api.cpp b/alvr/vulkan_layer/layer/device_api.cpp
index e3fde103..b0a61353 100644
--- a/alvr/vulkan_layer/layer/device_api.cpp
+++ b/alvr/vulkan_layer/layer/device_api.cpp
@@ -6,6 +6,7 @@
 #include <vector>
 
 static const char *alvr_display_name = "ALVR display";
+static const char *steamvr_lol = "Valve plzfix";
 
 const struct {
 } alvr_display;
@@ -38,6 +39,13 @@ VKAPI_ATTR VkResult VKAPI_CALL wsi_layer_vkGetPhysicalDeviceDisplayPropertiesKHR
         properties.planeReorderPossible = VK_FALSE;
         properties.persistentContent = VK_TRUE;
     }
+    if (pProperties != nullptr) {
+        for (auto *prop = pProperties; prop < (pProperties + *pPropertyCount); prop++) {
+            if (prop->displayName == nullptr) {
+                prop->displayName = steamvr_lol;
+            }
+        }
+    }
     return result;
 }
 
-- 
2.35.3

This does stop SteamVR from showing the "Something is wrong" window.

Unfortunately after a few seconds it crashes the GPU and the system freezes completely (SSH included). This is another issue, though, I think.

image

Ggolanmogilner 2022-07-21 github
Ddepau 2022-07-22 github

Replying to [#510 (comment)](https://github.com/ValveSoftware/SteamVR-for-Linux/issues/510#issuecomment-1101725890)

where do i put this patch?

The patch is for ALVR, not vrcompositor.

Iicejix 2024-05-02 github

I'm very late, but same issue here. ALVR + Steam + error 303 + same logs

Things worked fine up until I moved my computer. Could it be a hardware failure?

TTTimo 2024-05-03 github

Thank you, this will be fixed in an upcoming update.

Iicejix 2024-05-03 github

Thank you, this will be fixed in an upcoming update.

Thank you for responding so quickly!

For anyone else, I did resolve my issue. I reinstalled SteamVR, and reseated my GPU. I don't exactly know which one did it, since both things happened at the same time, but it all seemed to be fixed afterwards.

Edit: It seems I have to install SteamVR very often now. Excited for this new update, which will hopefully solve the issue.

TTTimo 2024-05-07 github

Fixed in SteamVR beta 2.5.4

Kkisak-valve maintainer 2024-06-08 github

Closing per the last comment.

Nothing extracted yet.