tpwrules / nixos-apple-silicon

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

Chromium stuck on software compositing #165

Closed pupbrained closed 4 months ago

pupbrained commented 4 months ago

When trying to run chromium or any chromium-based applications, the following lines show up a few times over:

DRI driver not from this Mesa build ('24.1.0-devel' vs '23.3.5')
failed to bind extensions

Then, when trying to open a web page (e.g. chrome://gpu), Vulkan errors out too:

Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:101)
    at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:506)
    at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:392)
    at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:314)
    at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:569)

It should be noted that I'm using "replace" mode with the experimental GPU driver option, but "overlay" mode had the same issue.

Another thing I've noticed related to Vulkan is that vkcube only runs using llvmpipe and not the hardware GPU. OpenGL on the other hand works just fine and outputs the following:

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.1.0
    Accelerated: yes
    Video memory: 15630MB
    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
OpenGL vendor string: Mesa
OpenGL renderer string: Apple M2 (G14G B0)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.1.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.1.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.1.0-devel
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
pupbrained commented 4 months ago

I also quickly tried to just spoof the mesa package version to 23.3.5 but that didn't change anything.

tpwrules commented 4 months ago

What nixpkgs version are you running? It looks like you merged the changes for OpenGL 4.6? Do you have the commit of this repo that you are using public anywhere?

The latest stuff is broken somehow, this might be a clue.

oliverbestmann commented 4 months ago

Is vulkan supposed to work? The article by Rosenzweig reads Today, we’ve finished OpenGL with the full 4.6… and we’re well on the road to Vulkan. which I understand as "we do not yet have vulkan running".

While vkinfo uses llvmpipe here too, chromium uses OpenGL: image

I start chromium for wayland liek this:

chromium \
     --enable-features=UseOzonePlatform \
     --enable-features=WaylandWindowDecorations \
     --ozone-platform-hint=wayland
pupbrained commented 4 months ago

What nixpkgs version are you running? It looks like you merged the changes for OpenGL 4.6? Do you have the commit of this repo that you are using public anywhere?

The latest stuff is broken somehow, this might be a clue.

I'm using the nixos-unstable branch of nixpkgs and I've been testing @oliverbestmann's branch (specifically https://github.com/oliverbestmann/nixos-apple-silicon/commit/31d8a82302a54c52545148e7c9d24b03645f03d9) for apple-silicon-support. I did notice that I had the same issues and same errors even when using the main branch of this repository, though.

pupbrained commented 4 months ago

Is vulkan supposed to work? The article by Rosenzweig reads Today, we’ve finished OpenGL with the full 4.6… and we’re well on the road to Vulkan. which I understand as "we do not yet have vulkan running".

While vkinfo uses llvmpipe here too, chromium uses OpenGL: image

I start chromium for wayland liek this:

chromium \
     --enable-features=UseOzonePlatform \
     --enable-features=WaylandWindowDecorations \
     --ozone-platform-hint=wayland

Running chromium with those flags still gives me the following output in the console:

DRI driver not from this Mesa build ('24.1.0-devel' vs '23.3.5')
failed to bind extensions
DRI driver not from this Mesa build ('24.1.0-devel' vs '23.3.5')
failed to bind extensions
DRI driver not from this Mesa build ('24.1.0-devel' vs '23.3.5')
failed to bind extensions
[7216:7216:0223/154251.489920:ERROR:policy_logger.cc(156)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not enabled. Please use the `--enable-chrome-b
rowser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
DRI driver not from this Mesa build ('24.1.0-devel' vs '23.3.5')
failed to bind extensions
DRI driver not from this Mesa build ('24.1.0-devel' vs '23.3.5')
failed to bind extensions
DRI driver not from this Mesa build ('24.1.0-devel' vs '23.3.5')
failed to bind extensions
[7216:7216:0223/154251.651118:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.ScreenSaver.GetActive: object_path= /org/freedesktop/ScreenSaver: org.freedesktop.DBus.Error.NotSupported: This method is not part of the idle inhibition specification: https://specifications.freedesktop.org/idle-inhibit-spec/latest/
[7216:7216:0223/154251.655216:ERROR:window_frame_provider_gtk.cc(410)] Frame thickness mismatch!  Old: [x:27,27 y:24,30], new: [x:28,25 y:24,28].  Current scale is 1.2549.  Please report to crbug.com/1240905.
Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:101)
    at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:506)
    at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:392)
    at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:314)
    at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:569)

Here's the output from chrome://gpu: image

oliverbestmann commented 4 months ago

I do get the same warning about vulkan, but i do not get the mesa errors:

oliver@m1pro ~> chromium
[292196:292196:0223/222923.475532:ERROR:policy_logger.cc(156)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not enabled. Please use the `--enable-chrome-browser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
[292196:292196:0223/222925.090570:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.ScreenSaver.GetActive: object_path= /org/freedesktop/ScreenSaver: org.freedesktop.DBus.Error.NotSupported: This method is not part of the idle inhibition specification: https://specifications.freedesktop.org/idle-inhibit-spec/latest/
[292196:292196:0223/222927.825256:ERROR:interface_endpoint_client.cc(702)] Message 1 rejected by interface blink.mojom.WidgetHost
Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:101)
    at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:506)
    at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:392)
    at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:314)
    at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:569)

Excerpt from my config:

  hardware.asahi = {
    withRust = true;
    addEdgeKernelConfig = true;
    useExperimentalGPUDriver = true;
  };

  environment.systemPackages = [
     ...
     pkgs.mesa-asahi-edge
  ];

I am also using a recent nixos-unstable, updated last a few days ago.

pupbrained commented 4 months ago

I do get the same warning about vulkan, but i do not get the mesa errors:

oliver@m1pro ~> chromium
[292196:292196:0223/222923.475532:ERROR:policy_logger.cc(156)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not enabled. Please use the `--enable-chrome-browser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
[292196:292196:0223/222925.090570:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.ScreenSaver.GetActive: object_path= /org/freedesktop/ScreenSaver: org.freedesktop.DBus.Error.NotSupported: This method is not part of the idle inhibition specification: https://specifications.freedesktop.org/idle-inhibit-spec/latest/
[292196:292196:0223/222927.825256:ERROR:interface_endpoint_client.cc(702)] Message 1 rejected by interface blink.mojom.WidgetHost
Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:101)
    at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:506)
    at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:392)
    at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:314)
    at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:569)

Excerpt from my config:

  hardware.asahi = {
    withRust = true;
    addEdgeKernelConfig = true;
    useExperimentalGPUDriver = true;
  };

  environment.systemPackages = [
     ...
     pkgs.mesa-asahi-edge
  ];

I am also using a recent nixos-unstable, updated last a few days ago.

My config looked just about the same as yours, minus the mesa-asahi-edge in environment.systemPackages - after adding that, rebuilding, and rebooting, the issue persists (right before rebuilding I also made sure to update my flake to the latest nixpkgs).

Could it be an issue with a difference in chips? I was thinking it could be but I've tried Asahi Fedora Remix on this same laptop and chromium worked just fine w/ hardware accel.

diegobfernandez commented 4 months ago
DRI driver not from this Mesa build ('24.1.0-devel' vs '23.3.5')
failed to bind extensions

I see this same message when running an electron app from source in a flake. I wonder if it has to do with how mesa drivers are configured, replace vs overlay... I don't have access right now to my config so I can't really tell you what I am using.

tpwrules commented 4 months ago

How are you installing Chromium? Essentially, you must have it in environment.systemPackages for the replace/overlay to work. If I do this (Plasma desktop) then I don't get any software only messages (except for "Video Encode") and there is no warning about DRI driver version mismatch.

Even if I run without the replace/overlay (e.g. just built from a nixpkgs checkout) then the acceleration still says it works, but I get that warning. If I pass the flags @oliverbestmann mentions then it breaks acceleration in this case. However, this solution is not advised and might break on different nixpkgs versions.

pupbrained commented 4 months ago

How are you installing Chromium? Essentially, you must have it in environment.systemPackages for the replace/overlay to work. If I do this (Plasma desktop) then I don't get any software only messages (except for "Video Encode") and there is no warning about DRI driver version mismatch.

Even if I run without the replace/overlay (e.g. just built from a nixpkgs checkout) then the acceleration still says it works, but I get that warning. If I pass the flags @oliverbestmann mentions then it breaks acceleration in this case. However, this solution is not advised and might break on different nixpkgs versions.

Seems like that was the problem - adding chromium to systemPackages works perfectly. Is there any way to get it working using home manager though? That would be more convenient, but it's not too big of a deal if not.

tpwrules commented 4 months ago

I don't think so, home manager does not respect system.replaceRuntimeDependencies. It might work if you use the overlay mode and enable useGlobalPkgs in your home manager config but I haven't tested, and then you will have to suffer building Chromium from source.

You should be able to put Chromium in your user's packages in your system configuration though without problems.