tpwrules / nixos-apple-silicon

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

Graphics acceleration not loading with NixOS 24.05 #234

Open autrimpo opened 1 week ago

autrimpo commented 1 week ago

After updating to 2024-09-03 I'm getting issues loading the mesa driver:

LIBGL_DEBUG=verbose glxinfo -B with 2024-07-31:

libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/autrimpo/.drirc: No such file or directory.
using driver asahi for 4
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/autrimpo/.drirc: No such file or directory.
MESA-LOADER: device is not located on the PCI bus
using driver asahi for 4
MESA-LOADER: dlopen(/run/opengl-driver/lib/dri/asahi_dri.so)
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/autrimpo/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/autrimpo/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/autrimpo/.drirc: No such file or directory.
Using DRI3 for screen 0
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Mesa (0xffffffff)
    Device: Apple M2 (G14G B0) (0xffffffff)
    Version: 24.2.0
    Accelerated: yes
    Video memory: 15678MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 15678 MB, largest block: 15678 MB
    VBO free aux. memory - total: 0 MB, largest block: 0 MB
    Texture free memory - total: 15678 MB, largest block: 15678 MB
    Texture free aux. memory - total: 0 MB, largest block: 0 MB
    Renderbuffer free memory - total: 15678 MB, largest block: 15678 MB
    Renderbuffer free aux. memory - total: 0 MB, largest block: 0 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 15678 MB
    Total available memory: 15678 MB
    Currently available dedicated video memory: 15678 MB
OpenGL vendor string: Mesa
OpenGL renderer string: Apple M2 (G14G B0)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.2.0-devel
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.2.0-devel
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.2.0-devel
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

LIBGL_DEBUG=verbose glxinfo -B with 2024-09-03:

MESA-LOADER: dlopen(/run/opengl-driver/lib/dri/swrast_dri.so)
did not find extension DRI_Kopper version 1
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/autrimpo/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/autrimpo/.drirc: No such file or directory.
did not find extension DRI2_Flush version 1
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Mesa (0xffffffff)
    Device: llvmpipe (LLVM 17.0.6, 128 bits) (0xffffffff)
    Version: 24.2.0
    Accelerated: no
    Video memory: 15679MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.5
    Max compat profile version: 4.5
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 0 MB, largest block: 0 MB
    VBO free aux. memory - total: 12517 MB, largest block: 12517 MB
    Texture free memory - total: 0 MB, largest block: 0 MB
    Texture free aux. memory - total: 12517 MB, largest block: 12517 MB
    Renderbuffer free memory - total: 0 MB, largest block: 0 MB
    Renderbuffer free aux. memory - total: 12517 MB, largest block: 12517 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 69379 MB
    Total available memory: 85058 MB
    Currently available dedicated video memory: 0 MB
OpenGL vendor string: Mesa
OpenGL renderer string: llvmpipe (LLVM 17.0.6, 128 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 24.2.0-devel
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.5 (Compatibility Profile) Mesa 24.2.0-devel
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.2.0-devel
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
jmastr commented 1 week ago

can confirm. same here

matteocavestri commented 1 week ago

I am experiencing the same issue. I also noticed that home-manager outputs the following warning: libEGL warning: egl: failed to create dri2 screen.

During the update, there was the following diff of packages (perhaps one of the removed packages is causing the problem):

Version changes:
[U.]  #1  asahi-audio   2.2 -> 2.3
[U*]  #2  cpupower      6.9.12-asahi -> 6.10.6-asahi
[U.]  #3  initrd-linux  6.9.12-asahi -> 6.10.6-asahi
[U.]  #4  linux         6.9.12-asahi, 6.9.12-asahi-modules, 6.9.12-asahi-modules-shrunk -> 6.10.6-asahi, 6.10.6-asahi-modules, 6.10.6-asahi-modules-shrunk
[C.]  #5  udev-rules    <none> x2 -> <none>
Removed packages:
[R.]  #1  extra-utils                   <none>
[R.]  #2  initrd-fsinfo                 <none>
[R.]  #3  initrd-kmod-blacklist-ubuntu  <none>
[R.]  #4  keymap                        <none>
[R.]  #5  link-units                    <none>
[R.]  #6  rust-lib-src                  <none>
[R.]  #7  stage                         1-init.sh
rowanG077 commented 1 week ago

I cannot reproduce this with a NixOS unstable + M2 Max + non-homemanger hyprland. Could someone post their kernel log?

jmastr commented 1 week ago

I use NixOS stable on an M1. Here is the kernel.log

matteocavestri commented 1 week ago

I believe the issue lies in the following error: apple-dcp 38bc00000.dcp: RTKit: syslog message: PPipeDCP_H13P.cpp:11109: IOMFB updateFrequencies EDT ERROR: getClockFrequency(0) (237333328) < videoClock 402278400! Giving up on frequencies. This error points to a mismatch between getClockFrequency() and videoClock, indicating that the system is unable to properly synchronize the display frequency. The system is attempting to set a clock frequency of 237.333328 MHz, while the expected video clock is 402.278400 MHz. I will also review my kernel log to check for any additional details.

matteocavestri commented 1 week ago

My kernel log is different, but I am still encountering errors related to getClockFrequency(). Specifically, I find this error: PPipeDCP_H13P.cpp:11092: IOMFB updateFrequencies: minimum-frequency property not found, using getClockFrequency(0) instead. It seems to be connected to the kernel log of @jmastr. kernel.log

autrimpo commented 1 week ago

Here's mine, I also see the frequency error. kernel.log

matteocavestri commented 1 week ago

The issue does not seem to be related to getClockFrequency() as I initially thought, because it occurs in both kernels. However, when comparing the kernel logs between versions 6.9.12 and 6.10.6, the following differences emerge:

  1. Missing initialization of the Asahi GPU in kernel 6.10.6:

    • In kernel 6.9.12, the Asahi GPU is detected and initialized correctly, with messages confirming the activation of the MMU and device tree configurations. An excerpt from the kernel log showing the GPU initialization in version 6.9.12:
      [    2.336925] asahi 206400000.gpu: MMU: initialized
      [    2.336927] asahi 206400000.gpu: GPU ID registers: 0x4021100 0x40a04 0x30808 0x40404 0x1320300 0x101311
      [    2.336931] asahi 206400000.gpu: GPU Information:
      [    2.336932] asahi 206400000.gpu:   Type: G13G
      [    2.336933] asahi 206400000.gpu:   Clusters: 1
      [    2.336934] asahi 206400000.gpu:   Cores: 8 (8)
      [    2.336934] asahi 206400000.gpu:   Frags: 8 (8)
      [    2.336935] asahi 206400000.gpu:   GPs: 4 (4)
      [    2.336936] asahi 206400000.gpu: Getting configuration from device tree...
      [    2.337151] asahi 206400000.gpu: Dynamic configuration fetched
    • In kernel 6.10.6, there are no messages related to the Asahi GPU, indicating that the driver is not being loaded or that the GPU is not being recognized.
  2. Initialization of the simpledrm framebuffer:

    • The simpledrm framebuffer is initialized correctly in both kernel versions. However, in kernel 6.10.6, it seems to be the only display-related component that is loaded, with no further initialization of the GPU.

kernel-6.9.12.log

jmastr commented 1 week ago

This is my kernel.log when switching to nixos-unstable. after that GPU is working fine, which means it is "just" a missing dependency on stable?

matteocavestri commented 1 week ago

Does anyone have an idea about how to fix this dependency issue on stable 24.05?

dxwil commented 1 day ago

Same thing happens to me, Hyprland doesn't launch

nick-disiere commented 21 hours ago

Do we know what packages are causing the issue? I can try various overlays in my flake if not.