My main workstation has an recent AMD GPU (RX 6800 XT) which I’ve set up to work with Nix and it seems to have worked perfectly fine until I encountered some OpenGL issues today.
While compiling an application that uses OpenGL, I noticed it instantly segfaulted upon starting:
Failed to initialize OpenGL loader!
Segmentation fault (core dumped)
The very first thing I did was check what glxinfo
had to say. Unfortunately, it didn’t tell me much at all:
[nix-shell:~]$ glxinfo
name of display: :0
Error: couldn't find RGB GLX visual or fbconfig
[nix-shell:~]$ eglinfo
EGL client extensions string:
Default display:
eglinfo: eglInitialize failed
[nix-shell:~]$ glxgears
Error: couldn't get an RGB, Double-buffered visual
I checked the wiki to see if I had set up everything currently, and stumbled upon the following line on the OpenGL article:
glxinfo
Use
glxinfo
to load 3D acceleration debug information.If
glxinfo
returnsError: couldn't find RGB GLX visual or fbconfig
, ensure you haveextraPackages = [ pkgs.mesa.drivers ];
set.
I assume that the extraPackages
here refers to hardware.opengl.extraPackages
? If so, this did not fix the problem.
I’m on Gnome-Shell Wayland. Here are some of the important parts of my configuration.
boot.kernelModules = [ "kvm-amd" "amdgpu" ];
services.xserver.videoDrivers = [ "amdgpu" ];
services.xserver.enable = true;
services.xserver.autorun = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.displayManager.gdm.wayland = true;
services.xserver.desktopManager.gnome.enable = true;
# Enable Vulkan support
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
# The `pkgs.mesa.drivers` is here because of the wiki article
hardware.opengl.extraPackages = [ pkgs.mesa.drivers pkgs.amdvlk ];
hardware.opengl.extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
From what I can tell though, my system has indeed loaded everything correctly:
(Apologies for the incoming wall of text, I included all I could think of)
𝝺 echo $XDG_SESSION_TYPE
wayland
𝝺 echo $WAYLAND_DISPLAY
wayland-0
𝝺 modinfo amdgpu
filename: /run/booted-system/kernel-modules/lib/modules/5.19.4/kernel/drivers/gpu/drm/amd/amdgpu/amdgpu.ko.xz
license: GPL and additional rights
description: AMD GPU
author: AMD linux driver team
𝝺 cat /proc/modules | grep amdgpu
amdgpu 8491008 25 - Live 0x0000000000000000
iommu_v2 24576 1 amdgpu, Live 0x0000000000000000
gpu_sched 49152 1 amdgpu, Live 0x0000000000000000
drm_ttm_helper 16384 1 amdgpu, Live 0x0000000000000000
ttm 86016 2 amdgpu,drm_ttm_helper, Live 0x0000000000000000
drm_display_helper 163840 1 amdgpu, Live 0x0000000000000000
drm_kms_helper 180224 4 amdgpu,drm_display_helper, Live 0x0000000000000000
i2c_algo_bit 16384 1 amdgpu, Live 0x0000000000000000
drm 630784 16 amdgpu,gpu_sched,drm_ttm_helper,ttm,drm_display_helper,drm_kms_helper, Live 0x0000000000000000
backlight 24576 5 amdgpu,asus_wmi,drm_display_helper,video,drm, Live 0x0000000000000000
i2c_core 106496 10 ucsi_ccg,amdgpu,drm_display_helper,drm_kms_helper,i2c_algo_bit,i2c_designware_pci,i2c_designware_core,i2c_piix4,i2c_ccgx_ucsi,drm, Live 0x0000000000000000
𝝺 lsmod | grep amd
amdgpu 8491008 25
iommu_v2 24576 1 amdgpu
gpu_sched 49152 1 amdgpu
drm_ttm_helper 16384 1 amdgpu
edac_mce_amd 40960 0
ttm 86016 2 amdgpu,drm_ttm_helper
drm_display_helper 163840 1 amdgpu
drm_kms_helper 180224 4 drm_display_helper,amdgpu
i2c_algo_bit 16384 1 amdgpu
gpio_amdpt 20480 0
gpio_generic 20480 1 gpio_amdpt
drm 630784 16 gpu_sched,drm_kms_helper,drm_display_helper,amdgpu,drm_ttm_helper,ttm
backlight 24576 5 video,drm_display_helper,asus_wmi,amdgpu,drm
i2c_core 106496 10 ucsi_ccg,i2c_designware_core,drm_kms_helper,i2c_ccgx_ucsi,i2c_algo_bit,drm_display_helper,amdgpu,i2c_piix4,i2c_designware_pci,drm
𝝺 lspci -v
0a:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] (rev c1) (prog-if 00 [VGA controller])
Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Device 0e3a
Flags: bus master, fast devsel, latency 0, IRQ 114, IOMMU group 18
Memory at d0000000 (64-bit, prefetchable) [size=256M]
Memory at e0000000 (64-bit, prefetchable) [size=2M]
I/O ports at f000 [size=256]
Memory at fc500000 (32-bit, non-prefetchable) [size=1M]
Expansion ROM at 000c0000 [disabled] [size=128K]
Capabilities: <access denied>
Kernel driver in use: amdgpu
Kernel modules: amdgpu
And finally, the only additional info I could find was in Firefox’s about:support
section:
WebGL 2 Driver
--------------
WebGL 2 Driver Renderer: AMD -- AMD Radeon RX 6800 XT (sienna_cichlid, LLVM 13.0.1, DRM 3.47, 5.19.4)
WebGL 2 Driver Version: 4.6 (Core Profile) Mesa 22.0.4
GPU #1
------
Active Yes
Description AMD Radeon RX 6800 XT (sienna_cichlid, LLVM 13.0.1, DRM 3.47, 5.19.4)
Vendor ID 0x1002
Device ID 0x73bf
Driver Vendor mesa/radeonsi
Driver Version 22.0.4.0
RAM 0
The only issue I can see there is that no VRAM is listed, but I don’t think it’s a big deal. dmesg
certainly seems to indicate that the amdgpu
driver has been successfully loaded and lists the correct amount of VRAM, so I don’t think there’s any issue there either.
𝝺 dmesg
[ 12.364121] [drm] amdgpu: 16368M of VRAM memory ready
[ 12.364122] [drm] amdgpu: 15996M of GTT memory ready.
[ 15.133907] amdgpu 0000:0a:00.0: amdgpu: Using BACO for runtime pm
[ 15.134186] [drm] Initialized amdgpu 3.47.0 20150101 for 0000:0a:00.0 on minor 0
[ 15.145433] fbcon: amdgpudrmfb (fb0) is primary device
[ 15.416701] amdgpu 0000:0a:00.0: [drm] fb0: amdgpudrmfb frame buffer device
Any ideas anyone?