Vulkan - ArchWiki

Jump to content

# Vulkan

5 languages

- Español
- 日本語
- Português
- Русский
- 中文（简体）

From ArchWiki

From Wikipedia:

  Vulkan is a low-overhead, cross-platform 3D graphics and compute API. First released in 2016, it is a successor to OpenGL.

Learn more on Vulkan's website.

## Installation

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

- Vulkan is not currently officially supported by Bumblebee [1] but does work with primus_vk or primus-vk-gitAUR.
- The Radeon Vulkan driver now supports PRIME [2].

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 and lib32-vulkan-driver:

- Intel: vulkan-intel (or lib32-vulkan-intel)
- NVIDIA: there are two implementations:
  - nvidia-utils (or lib32-nvidia-utils) - NVIDIA proprietary
  - vulkan-nouveau (or lib32-vulkan-nouveau) - NVK (part of Mesa project)
    Note: Enabling NVK also requires additional system configuration, see Nouveau#Using the Mesa NVK Vulkan Driver for details.
- AMD: there are three implementations, which could be installed simultaneously:
  - vulkan-radeon (or lib32-vulkan-radeon) - RADV (part of Mesa project)
  - amdvlk (or lib32-amdvlk) - AMDVLK Open (maintained by AMD)
  - vulkan-amdgpu-proAUR (or lib32-vulkan-amdgpu-proAUR) - AMDVLK Closed (maintained by AMD)

The following are software rasterizers, so that you can use it on devices that do not provide Vulkan support.

- Lavapipe: vulkan-swrast (or lib32-vulkan-swrast)
- SwiftShader: swiftshader-gitAUR

For Vulkan application development, install vulkan-headers, and optionally vulkan-validation-layers, vulkan-man-pagesAUR and vulkan-tools (you can find the vulkaninfo, and vkcube tools in there).

## 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

## Switching

### Switching between devices

On systems with multiple GPUs you may need to force the usage of a specific GPU. vulkan-mesa-layers is required for this to work. By setting `MESA_VK_DEVICE_SELECT` to `vendorID:deviceID`, you can choose the desired GPU.

To list the candidates, use:

    $ MESA_VK_DEVICE_SELECT=list vulkaninfo

Appending a `!` at the end of the specified value enforces this behavior. See Vulkan mesa device select layer environment variables for more information.

### Switching between AMD drivers

On AMD systems, it is valid to have multiple Vulkan drivers installed at once, and it may be desirable to switch between them.

#### Selecting via environment variable

Note: This method does not support selecting the AMDVLK Closed drivers.

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_DRIVER_FILES`. For example, running Steam with the RADV driver is done by

    $ VK_DRIVER_FILES=/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.

#### Selecting via AMD Vulkan Prefixes

AMD Vulkan Prefixes is a script for switching between all three Vulkan implementations. Install amd-vulkan-prefixesAUR, and prepend your application with the prefix you want. The executables provided are `vk_radv`, `vk_amdvlk`, and `vk_pro`. For example, to use the AMDVLK Closed drivers:

    $ vk_pro command

## Software rendering

You can install the software Vulkan rasterizer known as lavapipe, for example to debug hardware issues: vulkan-swrast (or lib32-vulkan-swrast for the 32-bit version).

The following example shows running vulkaninfo with the required environment variables to force a full software rendering for Vulkan and OpenGL (with `__GLX_VENDOR_LIBRARY_NAME=mesa` ensuring the command also works for PRIME users):

    $ LIBGL_ALWAYS_SOFTWARE=1 __GLX_VENDOR_LIBRARY_NAME=mesa VK_DRIVER_FILES=/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

### NVIDIA - vulkan is not working and can not initialize

#### GSP firmware

The use of the GSP firmware, enabled by default since version 555 of the nvidia driver released in June 2024, is known to cause a range of issues including Vulkan failures and system crashes. To disable it, add the following line to the `/etc/modprobe.d/nvidia.conf` file:

    options nvidia "NVreg_EnableGpuFirmware=0"

This reportedly only works with the proprietary nvidia driver, so you may have to run the following command to replace the open source driver:

    # pacman -S nvidia

Finally, you have to regenerate the initramfs, typically by running the following command:

    # mkinitcpio -P

#### Environment variables

Invalid or contradictory environment variable values might cause Vulkan to fail, and inappropriate values can result in the use of a different GPU than intended on machines with multiple GPUs. Properly setting the variables can also help keep a secondary GPU powered down when it isn't needed.

#### GPU switching

If your machine has multiple GPUs and Vulkan can't see or use one of them, make sure it isn't currently disabled by the BIOS/UEFI or in the kernel. See NVIDIA Optimus for an overview of the different methods of switching between GPUs.

Example command to check the current status with optimus-manager-gitAUR:

    $ 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_DRIVER_FILES

    export VK_DRIVER_FILES=/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]

### AMDGPU - Hangs when playing DirectX Vulkan games

Radeon-Vulkan seems to cause driver and/or GPU hangs when playing some games with usage of DirectX Vulkan.

    kernel: [drm:amdgpu_dm_atomic_commit_tail [amdgpu]] *ERROR* Waiting for fences timed out!
    kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx_0.0.0 timeout, signaled ..., emitted ...
    kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR* Process information: process ... pid ... thread dxvk-submit pid
    ...

Switching to or enabling AMDVLK seems to fix the problem as discovered in BBS#275991.

### AMDGPU - Crashes with DirectX Vulkan games

AMDVLK has been reported as causing crashes by multiple users (see BBS#284118, BBS#283008, BBS#274737): switching to or enabling the Radeon-Vulkan driver fixes the issue.

### AMDGPU - Vulkan applications launch slowly

If you install cuda, you might find Vulkan applications, for example, Chromium, launch slowly. It's because nvidia-utils provides an Vulkan driver and Vulkan would try nvidia drivers before radeon drivers. To solve it, set the environment variable `VK_DRIVER_FILES` to `/usr/share/vulkan/icd.d/radeon_icd.i686.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json`.

### AMDGPU - Found no drivers!

When encountering `Found no drivers!`:

    $ vulkaninfo

    WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 0.  Skipping ICD.
    ERROR: [Loader Message] Code 0 : terminator_CreateInstance: Found no drivers!
    Cannot create Vulkan instance.
    This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
    ERROR at /usr/src/debug/vulkan-tools/Vulkan-Tools-1.3.269/vulkaninfo/./vulkaninfo.h:688:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER

AMD has regularly dropped support for pre-Polaris and up to Vega. If your GPU support was removed from amdvlk, uninstall it and install vulkan-radeon.

### 32-bit applications fail to find drivers with Bcachefs root

Bcachefs has an incompatibility bug with 32-bit programs that prevents Vulkan ICD loader from being able to find drivers when this filesystem is used as root. (Bcachefs#32-bit programs cannot see directory contents).

This can be worked around by mounting a different filesystem at one of the paths that is searched, and copying the data there.

Warning: The mounted filesystem will overlay the directory it's on, preventing its original contents from being read or modified by you or Pacman. Don't mount over `/usr/share/vulkan`, as package changes or updates will only modify the files in the mounted filesystem, and hence may cause breakage when it is unmounted.

    # mkdir -p /usr/local/share/vulkan
    # mount -t tmpfs foo /usr/local/share/vulkan
    # cp -r /usr/share/vulkan/* /usr/local/share/vulkan

Categories:

- Graphics
- Development