tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs
MIT License
743 stars 73 forks source link

GPU Acceleration no longer functioning #150

Closed minego closed 5 months ago

minego commented 5 months ago

I have discussed this issue in #143 but that root issue was the build failure and that is fixed, so I figured it would be a good idea to log a new issue.

When using the latest version of this repo graphics acceleration does not function, but was working properly before that. The last generation that works properly on my machine was built on 2024-01-12, which was prior to the changes to how mesa is patched.

My current configuration can be seen here: https://github.com/minego/nixos-config/blob/apple-gpu/hosts/zaphod2/default.nix

I am seeing a number of issues since this update:

00:00:00.006 [ERROR] [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
00:00:00.006 [ERROR] [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
did not find extension DRI_Core version 1
did not find extension DRI_IMAGE_DRIVER version 1
failed to bind extensions
did not find extension DRI_Core version 1
did not find extension DRI_IMAGE_DRIVER version 1
failed to bind extensions
did not find extension DRI_Core version 1
did not find extension DRI_SWRast version 4
failed to bind extensions
00:00:00.018 [ERROR] [render/egl.c:556] Failed to create GBM device
00:00:00.018 [ERROR] [render/egl.c:572] Failed to initialize EGL context
00:00:00.018 [ERROR] [render/gles2/renderer.c:804] Could not initialize EGL
00:00:00.032 [ERROR] [backend/drm/util.c:66] Failed to parse EDID
ibEGL warning: MESA-LOADER: failed to open zink: /run/opengl-driver/lib/dri/zink_dri.so: cannot open shared object file: No such file or directory (search paths /run/opengl-driver/lib/dri, suffix _dri)

libEGL fatal: did not find extension DRI_Core version 1

The result is a system that is nearly unusable, because the GUI as a whole is very laggy. Even moving the mouse cursor is enough to see the issue.

minego commented 5 months ago

I've been looking for ways to get more debug info out, and found a few environment variables that help a bit:

❯ MESA_DEBUG=true EGL_LOG_LEVEL=debug kitty                                      1 
libEGL debug: using driver asahi for 8

libEGL debug: MESA-LOADER: device is not located on the PCI bus

libEGL debug: using driver asahi for 8

libEGL debug: MESA-LOADER: dlopen(/run/opengl-driver/lib/dri/asahi_dri.so)

libEGL fatal: did not find extension DRI_Core version 1

So, it does seem to be successfully loading asahi_dri.so at least. I'll reboot in a bit and see what the output was for the working generation to compare. Maybe that will help a bit.

minego commented 5 months ago

Okay, on the working older generation I get:

libEGL debug: using driver asahi for 8

libEGL debug: MESA-LOADER: device is not located on the PCI bus

libEGL debug: using driver asahi for 8

libEGL debug: MESA-LOADER: dlopen(/run/opengl-driver/lib/dri/asahi_dri.so)

libEGL debug: did not find extension DRI_Kopper version 1

libEGL debug: No DRI config supports native format XBGR2101010
libEGL debug: No DRI config supports native format ABGR2101010
libEGL debug: No DRI config supports native format ABGR8888
libEGL debug: No DRI config supports native format XBGR8888
libEGL debug: No DRI config supports native format XRGB1555
libEGL debug: No DRI config supports native format XRGB4444
libEGL debug: ---------------

Sadly that doesn't appear to have any really helpful info, except that it imples that DRI_Core version 1 was available in that version. That makes me wonder if there is an issue with how mesa got built in my current system.

minego commented 5 months ago

I am not sure what exactly fixed it, but about an hour ago I did a nix flake update and ran nixos-rebuild and it rebuild mesa and webkit and a ton of other stuff but it works again!