NVIDIA eglinfo issues with drm and GBM

Hi there, I’m getting a bit overwhelmed and confused with how to solve this.

TLDR

eglinfo keeps segfaulting on my NVIDIA GeForce 1650 SUPER, failing to create dri2 screen.
I can explicitly set the EGL vendor, but that messes up GBM. It also affects using WebGpu in Wezterm. It seems like it might be related to a conflict between my dedicated and integrated GPU drivers. I cannot figure out how to fix this, and reinstalling the drivers makes no difference. This is using the latest NVIDIA proprietary drivers (570.124.04-1).

eglinfo

I’ve been running into an issue when I run eglinfo, and also occasionally in other places. Whenever I run eglinfo -B, it segfaults on Device #2, with failed to create dri2 screen.

eglinfo -B (shortened)
Device #2:

Platform Device platform:
libEGL warning: egl: failed to create dri2 screen
libEGL warning: egl: failed to create dri2 screen
fish: Job 1, 'eglinfo -B' terminated by signal SIGSEGV (Address boundary error)

Doing a full eglinfo, it shows this before the above:

eglinfo (shortened)
EGL device extensions string:
EGL_EXT_device_drm, EGL_EXT_device_drm_render_node

I can resolve this by explicitly setting __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/10_nvidia.json eglinfo -B. That doesn’t show the segfault anymore.

GBM

With the above set, EGL doesn’t initialise for GBM. In the normal eglinfo, it shows that my integrated GPU (on the Ryzen 5 7600X) is being used for GBM:

eglinfo GBM platform (no vendor library)
GBM platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: AMD
OpenGL core profile renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 19.1.7, DRM 3.61, 6.13.6-arch1-1)
OpenGL core profile version: 4.6 (Core Profile) Mesa 24.3.4-arch1.1
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: AMD
OpenGL compatibility profile renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 19.1.7, DRM 3.61, 6.13.6-arch1-1)
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 24.3.4-arch1.1
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: AMD
OpenGL ES profile renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 19.1.7, DRM 3.61, 6.13.6-arch1-1)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 24.3.4-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

With the above, for GBM platform I get:

eglinfo (NVIDIA vendor library)
GBM platform:
eglinfo: eglInitialize failed

I’d like to use the dedicated GPU for GBM as well. The main reason is because there is Kodi GBM, which has HDR support, whereas the versions on Wayland and X11 do not. At the moment, when I try and launch Kodi GBM from SDDM, I get a black screen and then get the SDDM login screen again.

System Stats

inxi -Fxxc0z

cat /sys/module/nvidia_drm/parameters/modeset
Y

cat /sys/module/nvidia_drm/parameters/fbdev
Y

Wezterm

The issue with Device #2 above in eglinfo also seems to have a direct impact on Wezterm.
When I try and run Wezterm with the backend set to use WebGpu, it crashes with

importing the supplied dmabufs failed

Switching the backend to OpenGL resolved this, but I don’t know if this error is related or not.

Question

Why is it defaulting to using the integrated GPU for GBM, instead of the dGPU?
Is there a setting I forgot to set, or a package I forgot to install?
Could it be messing up because I have the AMD GPU drivers installed as well as the NVIDIA ones?

Is there something related to drm that’s messing that up?
I don’t really understand what that is, but I know there’s something called simpledrm, which is used by the open source drivers, but not by NVIDIA (as far as I know)?
I did see once or twice in journalctl that there were complaints from kwin_wayland about drm, especially when my computer is waking up from suspend.
I do have modeset and fbdev set, which is all that I could see needed to be done in the Arch Wiki.

If there is any extra information needed, please tell me.

To add on to this, I’m getting ocassional full system freezes. It’s only happened twice, and in each case, it was dragging an image into GIMP from Dolphin. Checking journalctl after the freeze has around 10000 lines saying

kwin_wayland[975]: kwin_wayland_drm: Failed to create a framebuffer: Invalid argument

The only way to solve this was to use REISUB.