GPU Kernel Options and Firmware

The Linux kernel has multiple drivers for all sorts of hardware, including GPUs, and most open source drivers are in the kernel. This includes AMD, i915, and Nouveau. There are other drivers as well that can be useful for certain users. Firmware is also necessary for many drivers.

Kernel Configuration

The kernel options below enable GPU and virtual GPU drivers. Enable the ones you need and recompile the kernel if necessary.

Device Drivers --->
  Graphics support --->
    <*/M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
                                                                      ...  [DRM]
      # For r300 or r600:
      < /*/M> ATI Radeon                                            [DRM_RADEON]
      # For radeonsi:
      < /*/M> AMD GPU                                               [DRM_AMDGPU]
      [*]       Enable amdgpu support for SI parts               [DRM_AMDGPU_SI]
      [*]       Enable amdgpu support for CIK parts             [DRM_AMDGPU_CIK]
        Display Engine Configuration --->
        [*]   AMD DC - Enable new display engine                    [DRM_AMD_DC]
      # For nouveau:
      < /*/M> Nouveau (NVIDIA) cards                               [DRM_NOUVEAU]
      # For i915, crocus, or iris:
      < /*/M> Intel 8xx/9xx/G3x/G4x/HD Graphics                       [DRM_I915]
      # For LLVMPipe or Softpipe:
      < /*>   Virtual GEM provider                                    [DRM_VGEM]
      # For svga:
      < /*/M> DRM driver for VMware Virtual GPU                     [DRM_VMWGFX]
[Note]

Note

There are comments for the options above, corresponding with Mesa's Gallium3D dri driver names.

Selecting CONFIG_DRM_RADEON, CONFIG_DRM_AMDGPU, or CONFIG_DRM_NOUVEAU as y is not recommended. If it is, any required firmware must be built as a part of the kernel image or the initramfs for the driver to function correctly.

The sub-entries under CONFIG_DRM_AMDGPU are used to ensure the AMDGPU kernel driver supports all GPUs using the radeonsi driver. They are not needed if you won't need CONFIG_DRM_AMDGPU itself. They may be unneeded for some GPU models.

For LLVMPipe or LLVMPipe, CONFIG_DRM_VGEM is required or Xorg clients will probably fail. While this can be compiled as a module, it is more convenient to just build it into the kernel, otherwise the module will not be loaded automatically.

Firmware

ATI Firmware

ATI Radeon GPUs require firmware to be able to use KMS (kernel modesetting - the preferred option) as well as for Xorg. For older Radeon chips before r600, the firmware is in the kernel source. Later GPUs have their firmware in linux-firmware.

In order to save space, it is recommended to use pciutils-3.13.0 and it's packaged binary lspci to identify what the VGA controller is. After you find out that, check the RadeonFeature page of the Xorg wiki for Decoder ring for engineering vs marketing names to identify the family (you may need to know this for the Xorg driver — Southern Islands and Sea Islands use the radeonsi driver) and the specific model.

Now that you know which controller you are using, consult the Radeon Firmware page of the Gentoo wiki which has a table listing the required firmware blobs for the various chipsets. Note that Southern Islands and Sea Islands chips use different firmware for kernel 3.17 and later compared to earlier kernels. Identify and download the required blobs then install them:

mkdir -pv /lib/firmware/radeon
cp -v <YOUR_BLOBS> /lib/firmware/radeon

RadeonSI Firmware

AMDGPU devices require firmware in order to be used in general. Install pciutils-3.13.0 to check the model name of your card, and look for 'VGA compatible controller:'. If you have an APU (Accelerated Processing Unit, i.e. CPU and video on the same chip) that will probably tell you the name. If you have a separate amdgpu video card you will need to search to determine which name it uses (e.g. a card described as Advanced Micro Devices, Inc. [AMD/ATI] Baffin [Radeon RX 550 640SP / RX 560/560X] need Polaris11 firmware. There is a table of "Family, Chipset name, Product name and Firmware" at the end of the Kernel sections in AMDGPU page of the Gentoo wiki.

Once you have identified the firmware name, install all the relevant files for it. For example, the Baffin card mentioned above has 21 different polaris11* files, APUs such as renoir and picasso have at least 12 files and might gain more in future updates (e.g. the raven APU now has a 13th file, raven_ta.bin).

mkdir -pv /lib/firmware/amdgpu
cp -v <YOUR_BLOBS> /lib/firmware/amdgpu

If disk space is not a problem, you could install all the current amdgpu firmware files and not worry about exactly which chipset is installed.

i915 Firmware

Intel integrated GPUs from Skylake onwards can use firmware for GuC (the Graphics microcontroller), and also for the HuC (HEVC/H265 microcontroller which offloads to the GPU) and the DMC (Display Microcontroller) to provide additional low-power states. The GuC and HuC have had a chequered history in the kernel and updated firmware may be disabled by default, depending on your kernel version.Further details may be found at https://01.org/linuxgraphics/downloads/firmware/ and https://wiki.archlinux.org/index.php/intel_graphics.

Nouveau Firmware

Nvidia GPUs from Kepler onwards require signed firmware, otherwise the nouveau driver is unable to provide hardware acceleration. Nvidia has now released firmware up to Ampere (GeForce30 series) to linux-firmware. Note that faster clocks than the default are not enabled by the released firmware.

For older chips, it might be necessary to extract firmware from the NVIDIA runfile directly:

wget https://anduin.linuxfromscratch.org/BLFS/nvidia-firmware/extract_firmware.py
wget https://us.download.nvidia.com/XFree86/Linux-x86/340.32/NVIDIA-Linux-x86-340.32.run
sh NVIDIA-Linux-x86-340.32.run --extract-only
python3 extract_firmware.py
mkdir -p /lib/firmware/nouveau
cp -d nv* vuc-* /lib/firmware/nouveau/

For newer chips, the nouveau driver searches in multiple paths, and simply grabbing firmware you find in the linux-firmware repository won't do any good probably. There are plenty of symlinks that need to be made. Follow the instructions below in order to install the newer firmware properly:

git clone https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/
cd linux-firmware
mkdir -pv /lib/firmware/nvidia
mkdir -pv DESTDIR/lib/firmware
sh copy-firmware.sh --ignore-duplicates DESTDIR/lib/firmware
cp -vr DESTDIR/lib/firmware/nvidia/* /lib/firmware/nvidia
rm -rf DESTDIR