sway 1.6 + egl error (optimus laptop amdgpu + nvidia)
I just updated to sway 1.6 and after reboot sway doesnt start, 1.5 had no problems, the error in the logs :
00:00:00.079 [ERROR] [wlr] [EGL] command: eglGetPlatformDisplay, error: EGL_BAD_PARAMETER (0x300c), message: "EGL_BAD_PARAMETER error: In internal function: Additional INFO may be available
"
00:00:00.399 [ERROR] [wlr] [EGL] command: eglQueryDevicesEXT, error: EGL_BAD_ALLOC (0x3003), message: "EGL_BAD_ALLOC error: In eglQueryDevicesEXT: Failed to allocate device list.
"
00:00:00.399 [ERROR] [wlr] [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_DISPLAY (0x3008), message: "(null)"
00:00:00.399 [ERROR] [wlr] [render/egl.c:280] eglQueryDeviceStringEXT(EGL_EXTENSIONS) failed
00:00:00.399 [ERROR] [wlr] [EGL] command: eglMakeCurrent, error: EGL_BAD_DISPLAY (0x3008), message: "Invalid display (nil)"
00:00:00.400 [ERROR] [wlr] [render/wlr_renderer.c:263] Could not initialize EGL
00:00:00.400 [ERROR] [wlr] [backend/drm/renderer.c:34] Failed to create EGL/WLR renderer
00:00:00.402 [ERROR] [wlr] [backend/drm/backend.c:201] Failed to initialize renderer
00:00:00.403 [ERROR] [wlr] [backend/backend.c:174] Failed to create DRM backend
00:00:00.403 [ERROR] [wlr] [backend/backend.c:312] Failed to open any DRM device
00:00:00.440 [ERROR] [sway/server.c:55] Unable to create backend
My setup: nvidia driver blacklisted (and not loaded) and nvidia card pci suspended (power/control auto) for my everyday work so I can have better temps/battery, I enable it when needed. Sway configured to run with the igpu amdgpu card WLR_DRM_DEVICES=/dev/dri/card0 exec sway --my-next-gpu-wont-be-nvidia
The error appears with or without the flag(s) --unsupported-gpu, --my-next-gpu-wont-be-nvidia
If I load the nvidia driver at boot sway works but the card stays in active state consuming power and increase temps, testing I noticed that if I install the aur packages libglvnd-git lib32-libglvnd-git Sway 1.6 works normally with my setup as in 1.5.
So the temporaily fix is to use the aur packages, or, I dont know if is possible, a way to tell sway to use only the mesa egl amdgpu?
Posted Apr 16, 2021, 3:22 PM UTC
It's a bug in libglvnd that is merged (I think but not released yet).
When Sway checks for available devices with the GBM extension (at least I think it's the extension it's looking for) libglvnd return no device as soon as one installed driver fails to provide this extension (even if the driver is not loaded).
The merged patch yet to be released changes this logic so that it would return any device with a driver that provides the extension.
That's why the git version of libglvnd does work properly. You can either keep it until there's a new release of libglvnd or remove the nvidia driver from your system.
The failure is totally unrelated to gbm, libglvnd just gets confused when trying to dispatch egl. It's fixed in ligblvnd now at least, but they haven't cut a release in a while so the arch package doesn't have the fix. OP should just use libglvnd-git until arch patches libglvnd or a new release is made.