NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.35k stars 13.59k forks source link

opt-hardware.opengl.driSupport Does Not Set Vulkan ICD Filenames #276021

Open mcmah309 opened 8 months ago

mcmah309 commented 8 months ago

Describe the bug

opt-hardware.opengl.driSupport, or related, does not set VK_ICD_FILENAMES as mentioned here https://github.com/NixOS/nixpkgs/blob/a31f1521f0b989e5f8eabaf4d237836d23a04706/nixos/doc/manual/configuration/gpu-accel.chapter.md?plain=1#L101 . This causes a warning and possible downstream issues

vulkaninfo --summary
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 5.  Skipping ICD.
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 6.  Skipping ICD.
==========
VULKANINFO
==========

Vulkan Instance Version: 1.3.268

Instance Extensions: count = 23
...

Setting this variable manually removes this warning.

vulkaninfo --summary
==========
VULKANINFO
==========
glvkspirv.so.535.146.02
Vulkan Instance Version: 1.3.268
glsi.so.1
/nix/store/0piil24qf6xkwi6qnydc14dqkwnigc9s-nvidia-x11-535.146.02-6.5.13-lib32/lib/libnvidia-
Instance Extensions: count = 23

...

Steps To Reproduce

Turn on opt-hardware.opengl.driSupport on.

Expected behavior

VK_ICD_FILENAMES is set and Vulkan functions normally.

Possibly related issue to Chromium apps on Nvidia failing. Chrome log entry even though everything else looks good in vulkaninfo --summary:

Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:101)
    at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:493)
    at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:379)
    at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:301)
    at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:556)

Notify maintainers

Sorry if I tag the wrong person. @xaverdh @Kiskae @Madouura @abbradar

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 6.5.13, NixOS, 24.05 (Uakari), 24.05.20231219.54aac08`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos-23.11, nixos-unstable"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

Kiskae commented 8 months ago

The warning is harmless, that is simply the result of having multiple Vulkan drivers on a system. This is also why setting that variable globally doesn't work, because some systems have more than 1 Vulkan driver that is dynamically selected at runtime.

The chromium issue is related to the fact that chromium ships its own non-patched vulkan-loader, and since we don't have configuration files in their standard locations this does not work. I believe that it should be possible to substitute that library directly with our own version since it appears to just be an unmodified release.