tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GPU Acceleration no longer functioning

minego opened this issue · comments

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 system is a macbook Pro 16" M2 Max.
  • I have verified that all firmware is up to date by doing a full fresh install.
  • When running the last working generation, this is my renderer string: OpenGL renderer string: Apple M2 Max (G14C B1)

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:

  • When running xorg with xfce glxinfo reports a strange error, and no other info: Error: couldn't find RGB GLX visual or fbconfig
  • When running wayland (sway or dwl) XWayland doesn't function, and it did before these updates. Trying to run glxinfo reports glxinfo I get Error: unable to open display :0
  • Both sway and dwl print errors related to GLX during startup:
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
  • Trying to start other apps such as kitty reports similar errors:
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.

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.

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.

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!