Primary GPU

If you have more than one GPU in your system, which can frequently happen if you have both a dedicated GPU and an iGPU, you may find yourself in a situation where Xorg won’t start because it’s trying to use the wrong GPU. Unfortunately, the run-gow script is currently not smart enough to set up this configuration for you, but it is possible to manually tell Xorg which GPU to use.

The PrimaryGPU option

The PrimaryGPU option in the OutputClass section of xorg.conf can be used to specify which GPU to use based on which driver it uses.

First, create a file somewhere on your host called xorg-primary-gpu.conf. Set the contents based on what type of GPU you want to use as primary:

  • NVIDIA

  • AMD

  • Intel

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    ModulePath "/nvidia/xorg"
    Option "PrimaryGPU" "yes"
EndSection
Section "OutputClass"
    Identifier "amd"
    MatchDriver "amdgpu"
    Driver "amdgpu"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
EndSection
Section "OutputClass"
    Identifier "intel"
    MatchDriver "i915" # change this to the correct driver for your iGPU
    Driver "i915"      # change this to the correct driver for your iGPU
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
EndSection

Then, open config/platforms/headless.yml and add a line to the volumes for the xorg container to use this new configuration:

- /path/to/xorg-primary-gpu.conf:/usr/share/X11/xorg.conf.d/01-primary-gpu.conf:ro