Crash on Linux when starting a VR Session using SteamVR #92723
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#92723
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Linux-5.4.0-89-generic-x86_64-with-glibc2.27 64 Bits
Graphics card: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 495.44
OpenXR Runtime: SteamVR beta Version 1.20.4 (1634602223) Built Oct 19, 2021 at 02:10
HMD: Valve Index
Blender Version
Broken: version: 3.0.0 Beta, branch: master, commit date: 2021-10-31 11:08, hash:
blender/blender@a06abbac92
Worked: unknown
Addon Information
Name: VR Scene Inspection (0, 10, 0)
Author: Julian Eisel (Severin), Sebastian Koenig, Peter Kim (muxed-reality)
Short description of error
Blender crashes on Linux when trying to start a VR Session using SteamVR
Exact steps for others to reproduce the error
blender.crash.txt
Added subscriber: @Jens.Ne
#98087 was marked as duplicate of this issue
The VR Scene Inspection never worked for me on Linux.
The last time I reported about that was in this Task: https://developer.blender.org/T78267
This was closed with a fix for Windows.
Now with Blender 3.0 in Beta I wanted to check again and it still crashes for me on Linux.
Though the crash log looks different now, not showing any XR components or SteamVR.
So I decided to make a new report for this here.
Added subscriber: @mano-wii
In fact it's not #add-ons_community but it's #add-ons_bf-blender. So adding the tag.
Added subscriber: @muxed-reality
@Jens.Ne Thanks for the report, and good thinking for making a new one due to the different crash log.
Although the crash log does not show anything XR or SteamVR-related, I believe the underlying issue is still the same (using SteamVR with an NVIDIA graphics card in Blender).
To verify this, using a Windows debug build I disabled the workaround from blender/blender@cb578ca104 and got the following crash, which looks similar to the one you had on Linux:
blender-modified.crash.txt
The exact cause is difficult to pinpoint, but I'll keep investigating this and hopefully make some headway.
While it's unfortunate there's no similar workaround for Linux, as an alternative to SteamVR you can try using Monado .
It seems like Monado has some Valve Index support (although position tracking may or may not be reliable).
@muxed-reality Thank you for looking into this.
And thank you for all the work you are doing for VR! :)
I will look into Monado.
Added subscriber: @Amudtogal
I have been trying to setup the Valve Index on Linux as well (for some studio work).
While it took a bit of fiddling to get SteamVR loading the right shared libraries (is there a better way to just copying them over to /usr/lib?), I have run into the same crash.
Let me know if I can help to fix this!
@Amudtogal Thanks for offering, any help would be greatly appreciated.
I believe the problem is that SteamVR's OpenGL swapchain/context (created to submit the VR images) interferes with Blender's own OpenGL context. However, this only seems to occur on NVIDIA GPUs (not AMD) so some driver or architecture difference is probably also a factor.
Not sure if any changes to Blender alone can solve this issue (might require assistance from Valve and/or NVIDIA on their end), however you might find something if you investigate the crash with a debugger.
In the code, the VR graphics binding type is set in
GHOST_XrContext::determineGraphicsBindingTypeToUse()
, and here you can see that for SteamVR + NVIDIA on Windows, it falls back to DirectX (not available on Linux though). The swapchain image drawing is performed bywm_xr_draw_view()
, which is called byGHOST_XrSession::drawView()
.I am not entirely sure whether my SteamVR setup is complete (Steam is annoying me with missing libraries, although I am not sure whether this could be an issue with how steam is called from Blender...), but it seems to start from the Blender instance.
Blender however, crashes right away when starting the VR session (before SteamVR even starts logging/complaining).
So I have worked my way up, to see when Blender quits. This is what I got so far:
GHOST_XrSession::draw()
is not called prior crashingGHOST_XrSession::drawLayer()
is not called prior crashingGHOST_XrSession::drawView()
is not called before crashingwm_xr_draw_view()
is not called before crashingI couldn't see where
XrSession::draw()
is called, so I recompiled as debug and started gdbing...Here is the stacktrace:
As you said @muxed-reality, there is no crash in the actual XR code, but the OpenGL drawing in the window manager...
The crash dump is caused by glMapBufferRange which is returning a null pointer.
In the respective line, we are trying to map a vertex attribute buffer at offset
576
for64
needed bytes, with access flags (GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT
).About the possible sources of this error:
glGetError()
returns0
, which is listed asGL_NO_ERROR
, so I assume this is not an assignment issue inglMapBufferRange
.Unfortunately, I do not know how Blender's OpenGL context works...
I assume someone with more knowledge about the OpenGL implementation needs to look into this, I do not really know where to continue from here...
Added subscriber: @haagch
I can confirm that blender crashes immAttr2f on AMD too with SteamVR. But it works fine with Monado.
My guess is that it is due to this bug https://github.com/ValveSoftware/SteamVR-for-Linux/issues/421. Workaround to that is to make the original OpenGL context current after each OpenXR swapchain interaction.
@haagch Thanks a lot for the information!
Using your workaround, I was able to get SteamVR+OpenGL+NVIDIA working on Windows (actually SteamVR+OpenGL+AMD already worked on Windows, but it's good to know that this combination has issues on Linux).
Solution for me was to add
DRW_opengl_context_activate(false);
inwm_xr_session_create_cb()
before L72.@Amudtogal If you get the chance, can you please test this with your setup?
Added subscriber: @sebastian_k
Hey @haagch & @muxed-reality ,
indeed Blender does not crash anymore with this workaround!
However, a new problem emerges:
When starting SteamVR before activating the session in Blender I get:
ERROR (wm.xr): source/blender/windowmanager/xr/intern/wm_xr_session.c:1398 wm_xr_session_surface_offscreen_ensure: Failed to get buffer, GPUTexture: Texture allocation failed.
Unable to load 'libpangoft2-1.0.so'. [...]
) and once I close this info, Blender is full-on frozen.steamtours.sh
segfaultsI assume some of this could be a faulty setup of SteamVR on my side...
Maybe I need to do test this with a clean Linux install, I will discuss it with @sebastian_k.
A simple purge & reinstall of steam did not solve the issue...
Added subscriber: @amalon
While developing osgXR, I found the best way to debug SteamVR's GL context messing was using ltrace, i.e.:
(the
-f
makes it follow forks to child threads). That way you can see what SteamVR is doing. In the example below you can see vrclient.so messing with the context, then the workaround sets it back:For osgXR I found the following need the workaround (regardless of success/failure of the call):
xrEndFrame
*
xrCreateSwapchain
(for this, SteamVR linux_v1.14 seemed to change context without changing back, so I had to also release context if not previously set, since for me it needs calling by a non-render thread)xrAcquireSwapchainImage
xrWaitSwapchainImage
xrReleaseSwapchainImage
Hope that helps
So here is an update:
clean PopOS installation
installed Steam (from the PopOS shop)
logged into steam, installed SteamVR
started SteamVR, did the room setup
went to the SteamVR settings (https://docs.blender.org/manual/en/latest/getting_started/configuration/hardware.html#hardware-head-mounted-displays) and set SteamVR as default OpenXR
compiled Blender from newest master, with (https://developer.blender.org/D13568) applied (let me know whether that is what you had in mind @muxed-reality
starting Blender, enable the VR scene inspection plugin
try to start a VR session, Blender fails:
Failed to query OpenXR runtime information. Do you have an active runtime set up?
after some trying around, I found that it is best to test OpenXR with
hello_xr -g OpenGL
. This shows me that the SteamVR could not open becausefailed to load with message "libSDL2-2.0.so.0: cannot open shared object file: No such file or directory"
installed
libsdl2-2.0-0
, reranhello_xr
, now it seems to workTODO can we forward this error message to Blender? Alternatively, maybe we could add the
hello_xr -g OpenGL
debugging to the documentation...reopened Blender, started a VR session, this time it seems to find the OpenXR runtime, but Blender crashes with:
/tmp/blender.crash.txt
:At least I got rid of the
libpangoft
error above, but it seems still to fail at creating the GPU buffer... Any ideas?Added subscriber: @JulianEisel
Here is a more or less experimental, Linux-only fix for this: D13576: Fix #92723: Crash on Linux when starting a VR Session using SteamVR. The basic rendering seems to work now, but I see other issues, e.g.:
Thanks BTW to everybody helping out here, the conversation was quite useful.
Also good to know that others have this problem too, including Godot (https://github.com/ValveSoftware/SteamVR-for-Linux/issues/421).
Btw if you ever call xrDestroyInstance you will probably get a hang because of https://github.com/ValveSoftware/SteamVR-for-Linux/issues/422
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @slumber
Added subscriber: @jackik
Added subscriber: @s12a