GPU Kernel Options and Firmware

#### Gaming Linux® From Scratch - Version 13.0

### Chapter 11. Graphics Drivers - Preliminaries

- Prev

  What Drivers to Install

- Next

  pciutils-3.14.0

- Up
- Home

# 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 iris:
        < /*/M> Intel Xe2 Graphics                                          [DRM_XE]
        [*]       Enable display support                            [DRM_XE_DISPLAY]
        (*)       Force probe xe for selected Intel hardware IDs
                                                           ...  [DRM_XE_FORCE_PROBE]

        # For LLVMPipe or Softpipe:
        < /*>   Virtual GEM provider                                      [DRM_VGEM]

        # For svga:
        < /*/M> DRM driver for VMware Virtual GPU                       [DRM_VMWGFX]

### Note

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

For the GPUs supported by the Iris Gallium3D driver, with `CONFIG_DRM_I915` enabled and `CONFIG_DRM_XE_FORCE_PROBE` set to the string `*`, the i915 driver will be used if it supports the GPU, and the Xe driver will be used if it supports the GPU but the i915 driver does not. If you are sure your GPU is supported by the i915 driver, you can disable the Xe driver to save some build time. If your GPU is supported by both drivers and you want to use the Xe driver, you can disable the i915 driver, or make the i915 driver deny your GPU via the `CONFIG_DRM_I915_FORCE_PROBE` option, for example setting it to `!7d55` would make i915 deny the Meteor Lake integrated GPU (of which the PCI ID is `8086:7d55`), leaving it for the Xe driver.

Selecting `CONFIG_DRM_RADEON`, `CONFIG_DRM_AMDGPU`, `CONFIG_DRM_NOUVEAU`, `CONFIG_DRM_I915`, or `CONFIG_DRM_XE` 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 with a cryptic message `Error: couldn't get an RGB, Double-buffered visual`. 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. The firmware is in linux-firmware.

In order to save space, it is recommended to use pciutils-3.14.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 /usr/lib/firmware/radeon &&
    cp -v <YOUR_BLOBS> /usr/lib/firmware/radeon

### RadeonSI Firmware

AMDGPU devices require firmware in order to be used in general. Install pciutils-3.14.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 /usr/lib/firmware/amdgpu &&
    cp -v <YOUR_BLOBS> /usr/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.

### NVIDIA Firmware

Some NVIDIA GPUs from Kepler onwards, including RTX and GTX 9xx series onwards, require firmware signed by NVIDIA to work. NVIDIA has now released firmware up to Blackwell (50xx) to linux-firmware. Read the CodeNames page of the Nouveau wiki to figure out the code name of your NVIDIA GPU (for example, the code name of the GeForce RTX 5080 is GB203). The directory for the firmware files you need is named as the result converting the code name to lowercase (`gb203` for the example). The directory (or some of its contents) may be actually a symlink to another directory (or some files in another directory).

The `WHENCE` file in the `linux-firmware` directory documents all the firmware files and potential symlinks. Once you found what you need, look it up in `WHENCE` and make the necessary symlinks. If you cannot find your GPU listed in `WHENCE`, it means your GPU either doesn't need firmware or the firmware has not been released yet. If you don't want to bother and would rather install all the firmware and symlinks, follow the instructions below in order to install the newer firmware properly automatically:

    git clone https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git  &&
    cd linux-firmware                                                                      &&
    mkdir -pv /usr/lib/firmware/nvidia                                                     &&
    mkdir -pv DESTDIR/usr/lib/firmware                                                     &&
    sed -i 's@^destdir=$@destdir=DESTDIR/usr/lib/firmware@' copy-firmware.sh               &&
    sh copy-firmware.sh                                                                    &&
    cp -vr DESTDIR/usr/lib/firmware/nvidia/* /usr/lib/firmware/nvidia                      &&
    rm -rf DESTDIR

For NVIDIA GPUs from Tesla to Kepler, the Nouveau driver requires some extra firmware to support video decoding acceleration. These firmware files are not released by NVIDIA but they can be extracted from the NVIDIA runfile:

    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 /usr/lib/firmware/nouveau                                                       &&
    cp -d nv* vuc-* /usr/lib/firmware/nouveau/

- Prev

  What Drivers to Install

- Next

  pciutils-3.14.0

- Up
- Home