Vulkan

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

From wikipedia:Vulkan (API):

Vulkan is a low-overhead, cross-platform 3D graphics and compute API.

Learn more at Khronos.

Installation

Note: On hybrid graphics (NVIDIA Optimus/AMD Dynamic Switchable Graphics):

To run a Vulkan application, you will need to install the vulkan-icd-loader package (and lib32-vulkan-icd-loader if you also want to run 32-bit applications), as well as Vulkan drivers for your graphics card(s). There are several packages providing a vulkan-driver:

Other drivers may be installed manually instead:

For Vulkan application development, install vulkan-headers, and optionally vulkan-validation-layers and vulkan-tools (you can find the vulkaninfo tool in here).

Verification

To see which Vulkan implementations are currently installed on your system, use the following command:

$ ls /usr/share/vulkan/icd.d/

To ensure that Vulkan is working with your hardware, install vulkan-tools and use the vulkaninfo command to pull up relevant information about your system. If you get info about your graphics card, you will know that Vulkan is working.

$ vulkaninfo

You can see https://linuxconfig.org/install-and-test-vulkan-on-linux[dead link 2021-11-19 ⓘ] for more information.

Selecting Vulkan driver

In some cases, multiple vulkan driver are installed (for example RADV and AMDVLK). As of amdvlk 2021.Q3.4, a new switching logic was implemented which enforces AMDVLK as the default and mandates you either

  • set AMD_VULKAN_ICD=RADV to switch from the AMDVLK default,
  • or globally set DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1 to re-enable the ICD loader method below.

When DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1, you can choose your preferred driver by setting the environment variable VK_ICD_FILENAMES. For example, running Steam with the RADV driver is done by

$ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.i686.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json steam

To avoid crashes with 32-bit games, it is possible to assign the 32-bit variant and the 64-bit variant to the environment variable.

Software Vulkan: lavapipe

You can also install the software Vulkan rasterizer known as lavapipe: vulkan-swrast. There is no 32-bit vulkan-swrast package for now (even in AUR).

Warning: "lavapipe is not a conformant Vulkan implementation, testing use only." (quoted from the driver itself)
$ LIBGL_ALWAYS_SOFTWARE=1 __GLX_VENDOR_LIBRARY_NAME=mesa VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.i686.json:/usr/share/vulkan/icd.d/lvp_icd.x86_64.json vulkaninfo

Vulkan hardware database

The Vulkan Hardware Database provides user reported GPU/driver combinations. Supplying own information is possible by using vulkan-caps-viewer-waylandAUR or vulkan-caps-viewer-x11AUR.

Troubleshooting

Error - vulkan: No DRI3 support

If you get the message above and using Intel graphics, you may need to force DRI3 and restart Xorg:

/etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
   Option      "DRI"    "3"
EndSection

Nvidia - vulkan is not working and can not initialize

Check if you have any other vulkan driver installed, it may prevent Nvidia's vulkan driver from being detected.

Alternatively set the environment variable VK_ICD_FILENAMES to /usr/share/vulkan/icd.d/nvidia_icd.json.

If you have a dual-graphics system, like NVIDIA Optimus, ensure that your system is using the graphics card that you installed Vulkan drivers for.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: optimus-manager is just one of several utilities for NVIDIA Optimus. (Discuss in Talk:Vulkan)

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Command in code block requires a prompt symbol. (Discuss in Talk:Vulkan)
optimus-manager --status
Optimus Manager (Client) version 1.4

Current GPU mode : nvidia
GPU mode requested for next login : no change
GPU at startup : integrated
Temporary config path: no

No device for the display GPU found. Are the intel-mesa drivers installed?

Try to list both the intel_icd and primus_vk_wrapper configurations in VK_ICD_FILENAMES

export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json:/usr/share/vulkan/icd.d/nv_vulkan_wrapper.json

AMDGPU - ERROR_INITIALIZATION_FAILED after vulkaninfo

If after running vulkaninfo on AMD card from GCN1 or GCN2 family you got error message like:

ERROR at /build/vulkan-tools/src/Vulkan-Tools-1.2.135/vulkaninfo/vulkaninfo.h:240:vkEnumerateInstanceExtensionProperties failed with ERROR_INITIALIZATION_FAILED

Then check if you have correctly enable support for this models of graphics cards (AMDGPU#Enable Southern Islands (SI) and Sea Islands (CIK) support).

One of possibility to check if gpu drivers are correctly loaded is lspci -k, after running this command check kernel driver of your gpu. It should be amdgpu.

$ lspci -k
...
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Curacao PRO [Radeon R7 370 / R9 270/370 OEM]
	Subsystem: Gigabyte Technology Co., Ltd Device 226c
	Kernel driver in use: amdgpu
	Kernel modules: radeon, amdgpu
...

Some forum threads about this problem: [3] [4]