AMD GPU: Difference between revisions

From NixOS Wiki
imported>Artturin
No edit summary
imported>Artturin
clarify amdvlk
Line 34: Line 34:
== Vulkan ==
== Vulkan ==


To enable vulkan
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
hardware.opengl.driSupport = true;
hardware.opengl.driSupport = true;
Line 40: Line 41:
</syntaxhighlight>
</syntaxhighlight>


{{Note|amdvlk is not needed for vulkan}}
Starting from 20.09, the amdvlk drivers can be used in addition to the mesa radv drivers, the program will choose which one to use:
Starting from 20.09, the amdvlk drivers can be used in addition to the mesa radv drivers, the program will choose which one to use:


Line 46: Line 49:
   amdvlk
   amdvlk
];
];
# For 32 bit applications
# For 32 bit applications  
# Only available on unstable
hardware.opengl.extraPackages32 = with pkgs; [
hardware.opengl.extraPackages32 = with pkgs; [
   driversi686Linux.amdvlk
   driversi686Linux.amdvlk

Revision as of 13:32, 22 November 2020

This guide is about setting up NixOS to correctly use your Amd Graphics card if it is relatively new (aka, after the GCN architecture).

Make the kernel use the correct driver early

The kernel can load the correct driver right away (in hardware-configuration.nix):

boot.initrd.kernelModules = [ "amdgpu" ];

XServer

Make sure Xserver uses the `amdgpu` driver in your configuration.nix:

services.xserver.enable = true;
services.xserver.videoDrivers = [ "amdgpu" ];


OpenCL

From 20.09, add this to your hardware-configuration.nix:

hardware.opengl.extraPackages = with pkgs; [
   rocm-opencl-icd
   rocm-opencl-runtime
];

You should also install the clinfo package to verify that Open CL is correctly setup (or check in the program you use to see if it is now available, such as in Darktable).

Vulkan

To enable vulkan

hardware.opengl.driSupport = true;
# For 32 bit applications
hardware.opengl.driSupport32Bit = true;


Note: amdvlk is not needed for vulkan

Starting from 20.09, the amdvlk drivers can be used in addition to the mesa radv drivers, the program will choose which one to use:

hardware.opengl.extraPackages = with pkgs; [
   amdvlk
];
# For 32 bit applications 
# Only available on unstable
hardware.opengl.extraPackages32 = with pkgs; [
  driversi686Linux.amdvlk
];

more information can be found here https://nixos.org/manual/nixos/unstable/index.html#sec-gpu-accel-vulkan