-
Notifications
You must be signed in to change notification settings - Fork 257
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
on Linux, search order for layers isn't consistent with Vulkan and XDG basedir spec #451
Comments
The reason I'm interested in this is that if we want it to be possible to use OpenXR in Steam Linux Runtime containers (ValveSoftware/steam-runtime#575) with OpenXR layers or runtimes that are installed system-wide from distribution packages like .deb or .rpm, we probably need to teach the Steam Linux Runtime code to locate its layers and drivers, exactly like it does already for Vulkan. I'd very much prefer to be able to reuse the Vulkan code with a few strings changed, rather than having to construct a whole different search path for OpenXR! |
yeah I based that in part on Debian 😉 I thought Vulkan was doing that intentionally based on my Debian system, but it appears that Mesa is just decorating its manifests in a similar way, and VUlkan is just trying to load them all, which sometimes fails because it's the wrong arch. OpenXR only has a single active runtime loaded by the loader, unlike vulkan which might have multiple ICD's simultaneously, so we can't necessarily do the same thing so we had to make that table. Anyway... I'm pretty confident we're searching XDG_CONFIG_HOME for runtimes, but it's entirely possible we've messed it up on the layer part. The code that does this hurts my brain a bit, it's not how I would have architected it, so I tend not to poke at it unless it's clearly broken and nobody else steps up. I'll get this synced into the gitlab and we'll see if anyone who isn't me wants to step up and do it ;) Here's the OpenXR loader doc in case you hadn't found it. https://registry.khronos.org/OpenXR/specs/1.0/loader.html |
Yes. There are basically two ways that a Vulkan driver or layer (I'll say "module" as a generic term) can work reliably:
For non-x86 or non-Debian, replace As a variation of the per-architecture manifest, the As a variation of the single shared manifest, the The per-architecture manifest is the one that can work somewhat reliably if your module might be installed into a non-default prefix like
Yes: if you want to be able to designate a single runtime (per architecture) and not even A more Vulkan-like approach to this would be to allow If I'm reading correctly, OpenXR runtimes are unique (only one loaded) unlike Vulkan, but OpenXR layers work like Vulkan drivers and layers (all loaded at once). |
Recent versions of Vulkan-Loader do have a minor optimization for this: you can declare a |
If I'm reading correctly, https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/release-1.0.33/src/loader/manifest_file.cpp#L180 has the bug that I described. In the block starting at https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/release-1.0.33/src/loader/manifest_file.cpp#L203, handling of I'm unable to test this (I don't have any XR hardware) so this is all from source code inspection. For runtimes, https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/release-1.0.33/src/loader/manifest_file.cpp#L310 looks as though it correctly searches The "stateless distro"/"empty /etc" movement (trying to make an unconfigured system have an empty /etc, so that every file in /etc represents an intentional sysadmin change) would probably want to ask you to search for an active runtime in the "data stack" if the For my future reference, is "the gitlab" somewhere that I should have opened this issue instead, or is it private to Khronos members? |
"the gitlab" is a Khronos private monorepo, yes. I imagine you should have access but it's fine to file stuff here too. Frankly, there are more people who might help here. |
An issue (number 2209) has been filed to correspond to this issue in the internal Khronos GitLab (Khronos members only: KHR:openxr/openxr#2209 ), to facilitate working group processes. This GitHub issue will continue to be the main site of discussion. |
The search order for layers (and possibly runtimes) on Linux seems to have been copied from Vulkan before KhronosGroup/Vulkan-Loader#246 and KhronosGroup/Vulkan-Loader#245 were fixed in KhronosGroup/Vulkan-Loader#655. Previous discussion of this is mostly in KhronosGroup/Vulkan-Loader#245.
It would be good if OpenXR was consistent with the Vulkan, and the XDG base directory specification that Vulkan now obeys. Concretely, I believe this would mean changing
ReadDataFilesInSearchPaths
:the single directory
$XDG_CONFIG_HOME
(defaulting to~/.config
if unset) should be searched before (higher precedence than) the first item in$XDG_CONFIG_DIRS
, but it is not currently searched at all;the single directory
$XDG_DATA_HOME
(defaulting to~/.local/share
) should be searched before (higher precedence than) the first item in$XDG_DATA_DIRS
, but it is currently searched after (lower precedence than) the last item in$XDG_DATA_DIRS
Note that
$XDG_CONFIG_HOME
is already searched foractive_runtime(.<arch>).json
inFindXDGConfigFile
, with the correct ordering/precedence relative to$XDG_CONFIG_DIRS
.The Vulkan loader has a really nice summary of how layers and drivers are located, in https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md#linux-layer-discovery and https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderDriverInterface.md#driver-discovery-on-linux (and they are consistent with each other). I'd suggest following similar conventions (but with suffixes like
vulkan/implicit_layer.d
replaced by an appropriate OpenXR equivalent) rather than having OpenXR do its own thing.If I'm reading the C++ code correctly, I believe the two changes I suggested above would mean that searching for layers and runtimes is fully consistent with searching for Vulkan layers and drivers (searching "the config stack" followed by "the data stack"), while searching for
active_runtime(.<arch>).json
would be consistent with Vulkan up until the end of the "config stack", but without proceeding into the "data stack" if it is not found in a config directory.One difference between Vulkan and OpenXR where OpenXR does have the advantage is that OpenXR describes a vocabulary of CPU architecture identifiers to look for
active_runtime.<arch>.json
.The text was updated successfully, but these errors were encountered: