FS#65118 - nvidia_layers.json missing from nvidia-utils (breaks prime-run for vulkan)
Attached to Project:
Arch Linux
Opened by Scott Mansell (phire) - Saturday, 11 January 2020, 22:30 GMT
Last edited by Giancarlo Razzolini (grazzolini) - Tuesday, 21 January 2020, 01:24 GMT
Opened by Scott Mansell (phire) - Saturday, 11 January 2020, 22:30 GMT
Last edited by Giancarlo Razzolini (grazzolini) - Tuesday, 21 January 2020, 01:24 GMT
|
Details
Vulkan Prime offload support for Nvidia relies on an
implicitly loaded vulkan layer VK_LAYER_NV_optimus, that
re-orders and hides physical devices depending on selected
GPU.
In the current version of the nvidia-utils (440.44-2), this layer is not installed, so vulkan applications always default to the same GPU, independent of Prime environment variables. In my case, it defaults to integrated graphics. The fix is simple, /usr/share/vulkan/implicit_layer.d/nvidia_layers.json needs to be included in the nvidia-utils package. The nvidia-full-beta AUR package already installs this file and works as expected. |
This task depends upon
Closed by Giancarlo Razzolini (grazzolini)
Tuesday, 21 January 2020, 01:24 GMT
Reason for closing: Implemented
Tuesday, 21 January 2020, 01:24 GMT
Reason for closing: Implemented
I have prime-run running vulkan applications just fine without this file. Can you paste the output of vulkaninfo both without and with prime-run? Also, do you have vulkan-intel installed?
I have attached four outputs from vulkan info.
The first is `vulkaninfo` without nvidia_layers.json; Notice that both GPUs are available (yes, vulkan-intel is installed)
The second is `prime-run vulkaninfo`. Notice that the output is identical to the previous file, prime-run has done nothing.
The third is `vulkaninfo` with nividia_layers.json; The output is almost identical to the previous outputs, except an extra layer has been loaded.
The fourth is `prime-run vulkaninfo` with nvidia_layers.json; Notice how there is now only one GPU available to pick, the intel GPU has been hidden.
2-no-file-prime-run-vulkaninfo (73.3 KiB)
3-nvidia_layers_json-vulkanin... (73.6 KiB)
4-nvidia_layers_json-prime-ru... (39.2 KiB)
If you look at prime-run, it already forces only the nvidia card to show up for vuklan applications. It has:
__VK_LAYER_NV_optimus=NVIDIA_only
As per the nvidia official prime render offload documentation, which is used for finer grained control over vulkan. I'm not entirely sure your issue is with prime-run per se, but it can be an issue with your vulkan installation. I can look into adding the nvidia_layers file into the official nvidia-utils package, but let's first make sure your issue is not related to anything else you might have installed.
Uninstall any nvidia package you might have from the AUR, including nvidia-utils-beta and make sure you have neither a /etc/X11/xorg.conf nor any nvidia or intel related /etc/X11/xorg.conf.d snippet. Start your X and paste your full X log. As a comparison with vulkan, paste the output of both glxinfo and prime-run glxinfo. And, please make sure you have no vulkan environment variables, specially VK_ICD_FILENAMES.
What's important is whatever code reads those environment variables and acts accordingly. According to Nvidia's documentation (https://download.nvidia.com/XFree86/Linux-x86_64/435.17/README/primerenderoffload.html), this control is done by the special "VK_LAYER_NV_optimus" layer.
In my initial testing, I found that the VK_LAYER_NV_optimus layer was simply not loaded, both with and without the __NV_PRIME_RENDER_OFFLOAD=1 and __VK_LAYER_NV_optimus=NVIDIA_only environment set.
I traced who was responsible for loading the VK_LAYER_NV_optimus layer, and was pointed to /usr/share/vulkan/implicit_layer.d/nvidia_layers.json
I've since reverted to the stock nvidia and nvidia-utils packages with just the nvidia_layers.json manually added to my filesystem (the vulkan info results from above were done with the stock nvidia/nvidia-utils package, with and without nvidia_layers.json).
With nvidia_layers.json added, the VK_LAYER_NV_optimus layer is loaded (all the time, independent of any environment variables), and responds to the __VK_LAYER_NV_optimus=NVIDIA_only and __VK_LAYER_NV_optimus=non_NVIDIA_only environment variables as expected.
To satisfy your paranoia, I have verified the lack of vulkan environment variables or any /etc/xorg.conf* modifications (this arch install is just two weeks old) and attached the requested logs.
6-glxinfo (43 KiB)
7-prime-run-glxinfo (49.6 KiB)
p.s.: The next time I see you telling anyone that is *helping* you for free that they are *paranoid* or being disrespectful with anyone else on the official Arch channels for support, I'll ban you. Consider this a warning. Also, please read the CoC
The nvidia-utils-440.44-3 package adds this layer. Can you please test this on your side and let me know if this works? The package is on [testing].
Thanks for fixing this.