From 350f1d64af88964d4a1739cb450e2910ca6dd5c9 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Tue, 21 Jul 2020 14:12:28 +0200 Subject: [PATCH] nixos/manual: add a section about Vulkan drivers - Add a general block about how to configure and test Vulkan - Add a section about switching between mesa/radv and amdvlk on AMD GPUs. --- nixos/doc/manual/configuration/gpu-accel.xml | 91 +++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/configuration/gpu-accel.xml b/nixos/doc/manual/configuration/gpu-accel.xml index 61229390d07..0aa629cce98 100644 --- a/nixos/doc/manual/configuration/gpu-accel.xml +++ b/nixos/doc/manual/configuration/gpu-accel.xml @@ -52,7 +52,7 @@ The proper installation of OpenCL drivers can be verified through the clinfo command of the clinfo - package. This command will report the number of hardware devides + package. This command will report the number of hardware devices that is found and give detailed information for each device: @@ -101,4 +101,93 @@ ROCR_EXT_DIR=`nix-build '<nixpkgs>' --no-out-link -A rocm-runtime-ext`/lib + +
+ Vulkan + + + Vulkan is a + graphics and compute API for GPUs. It is used directly by games or indirectly though + compatibility layers like DXVK. + + + + By default, if is enabled, + mesa is installed and provides Vulkan for supported hardware. + + + + Similar to OpenCL, Vulkan drivers are loaded through the Installable Client + Driver (ICD) mechanism. ICD files for Vulkan are JSON files that specify + the path to the driver library and the supported Vulkan version. All successfully + loaded drivers are exposed to the application as different GPUs. + In NixOS, there are two ways to make ICD files visible to Vulkan applications: an + environment variable and a module option. + + + + The first option is through the VK_ICD_FILENAMES + environment variable. This variable can contain multiple JSON files, separated by + :. For example: + + $ export \ + VK_ICD_FILENAMES=`nix-build '<nixpkgs>' --no-out-link -A amdvlk`/share/vulkan/icd.d/amd_icd64.json + + + + The second mechanism is to add the Vulkan driver package to + . This links the + ICD file under /run/opengl-driver, where it will + be visible to the ICD loader. + + + + The proper installation of Vulkan drivers can be verified through + the vulkaninfo command of the vulkan-tools + package. This command will report the hardware devices and drivers found, + in this example output amdvlk and radv: + + + $ vulkaninfo | grep GPU + GPU id : 0 (Unknown AMD GPU) + GPU id : 1 (AMD RADV NAVI10 (LLVM 9.0.1)) + ... +GPU0: + deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU + deviceName = Unknown AMD GPU +GPU1: + deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU + + + A simple graphical application that uses Vulkan is vkcube + from the vulkan-tools package. + + +
+ AMD + + + Modern AMD Graphics + Core Next (GCN) GPUs are supported through either radv, which is + part of mesa, or the amdvlk package. + Adding the amdvlk package to + makes both drivers + available for applications and lets them choose. A specific driver can + be forced as follows: + + = [ + amdvlk +]; + +# For amdvlk +.VK_ICD_FILENAMES = + "/run/opengl-driver/share/vulkan/icd.d/amd_icd64.json"; +# For radv +.VK_ICD_FILENAMES = + "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json"; + + +
+