Closed MasterMind2k closed 1 year ago
We have the firmware bits, but we also need newer Mesa. 22.3 is in staging now which should be usable with RDNA3, but I wouldn't expect a good experience until 23.x early next year.
Then, we wait for mesa 22.3 :).
Thanks.
You can try cherry-picking https://github.com/NixOS/nixpkgs/pull/204125 if you're OK with rebuilding the world.
Alternatively, you can get https://github.com/NixOS/nixpkgs/pull/204125 's mesa an stuff its drivers
output into hardware.opengl.package
That works just fine for me and doesn't require any builds other than mesa.
You'll still need to compile mesa with LLVM 15 for any RX7000 series cards, though llvmPackages_git
will suffice. (or alternatively you could use #194634)
I think it should still work with ACO?
On llvm14, the Vulkan side it's 100% fine, on the opengl/egl side not so much, OpenGL doesn't have ACO yet, so it uses llvm for the backend, so the newer GPUs require llvm15 for OpenGL support
Does Zink work instead of the old opengl stuff without llvm 15?
Zink isn't enabled by default and is much less compliant even when it is.
LLVM 15 PR: #194634
Maybe we should try to land it before the next staging cycle then? So we can get Mesa and Rust on 15.
Alternatively, you can get #204125 's mesa an stuff its
drivers
output intohardware.opengl.package
That works just fine for me and doesn't require any builds other than mesa.
How do I do this without recompiling the world? By importing the staging branch tarball and picking out it's Mesa derivation, I have to compile everything, starting from perl and bison.
Don't overlay Mesa, just set hardware.opengl.package = stagingNext.mesa.drivers
K900 @.***> writes:
Don't overlay Mesa, just set
hardware.opengl.package = stagingNext.mesa.drivers
That's what I think I am doing. I have
let staging = import (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/staging") { config = config.nixpkgs.config; };
(I know I should pin this; just playing around now.)
Then I do
hardware.opengl.package = staging.mesa.drivers;
I don't use 'staging' for anything else. When I initiate a nixos-rebuild I am told it has to build 493 derivations, cindlug things like 'bison', 'bash', 'texinfo', 'gcc', 'llvm', 'ed', etc. This might be as expected, but I think it will take me all night to see whether it works.
Use staging-next, not staging.
K900 @.***> writes:
Use staging-next, not staging.
Ah, thanks! I did not realise there were two staging branches. Much more reasonable now.
Well, it's partially working now. From what I can see the drivers in /var/run/opengl now come from mesa 22.3, Wayland still doesn't work - as expected, it complains that LLVM doesn't support the GPU. The other posts here suggests I need to use LLVM 15 to get it working. I tried this:
hardware.opengl.package = (staging.mesa.override { llvmPackages = pkgs.llvmPackages_git; }).drivers;
(Where pkgs is nixos-unstable.)
But building fails with this error:
these 11 derivations will be built:
/nix/store/djg7hqgiwinnk5m7s2ll9zxvgdxnvccj-clang-unstable-2022-26-07.drv
/nix/store/lzn83jsmycjbakly6ndfsgqflga1p2g2-compiler-rt-libc-unstable-2022-26-07.drv
/nix/store/k6gm4ljvgqiffr90phj7drq5lwlk0zr8-clang-wrapper-unstable-2022-26-07.drv
/nix/store/ybqcsb70vzsa0xklw4bjz00q6csxcf7k-rust-bindgen-unwrapped-0.61.0.drv
/nix/store/fhq1ii4qm170pldfgn7garsc5sq3xk7v-rust-bindgen-0.61.0.drv
/nix/store/pwmsh8mljyjzv1ql8zwfpb4qg39lp06w-mesa-22.3.2.drv
/nix/store/21rimxydc53lsfpn7x9pac33cg4rq4hx-opengl-drivers.drv
/nix/store/i8xxc0k75igxwhkbhfzdwfa03bqncnvg-nixos-tmpfiles.d.drv
/nix/store/dxz7pap3w9fblq3hygjd1412dxzr3car-tmpfiles.d.drv
/nix/store/ywzi0jqcvd4gh1mvrqrhcyj61x9102fb-etc.drv
/nix/store/lja802dl57v324cbp4hsycjajcnla1np-nixos-system-uhyret-23.05pre440928.aa1d74709f5.drv
these 3 paths will be fetched (4.23 MiB download, 16.56 MiB unpacked):
/nix/store/6giqp5sv3cd5x7kvn5fbqszzfvx6dd0a-cargo-check-hook.sh
/nix/store/lwk776563z5jn5drkzrksnwnkbckzi68-cargo-1.66.0
/nix/store/nbp4j2ri302pmkijnv9zppkd0db76cdc-cargo-build-hook.sh
building '/nix/store/djg7hqgiwinnk5m7s2ll9zxvgdxnvccj-clang-unstable-2022-26-07.drv'...
building '/nix/store/lzn83jsmycjbakly6ndfsgqflga1p2g2-compiler-rt-libc-unstable-2022-26-07.drv'...
copying path '/nix/store/lwk776563z5jn5drkzrksnwnkbckzi68-cargo-1.66.0' from 'https://cache.nixos.org'...
unpacking sources
unpacking source archive /nix/store/pzkmqhmvdxc21sspyz94fnw6119129k5-clang-src-unstable-2022-26-07
unpacking sources
unpacking source archive /nix/store/7xx9aiq0ykjvdap0hcb9rj142zhfl05g-compiler-rt-src-unstable-2022-26-07
source root is compiler-rt-src-unstable-2022-26-07/compiler-rt
patching sources
applying patch /nix/store/qvyl9jgm1a1mlix44qbsgrd1ipwciamk-X86-support-extension.patch
patching file lib/builtins/CMakeLists.txt
Hunk #2 succeeded at 727 with fuzz 2.
applying patch /nix/store/8z4wq03gvjdyvpldnrl7x1sy14qfk1pk-gnu-install-dirs.patch
patching file cmake/base-config-ix.cmake
applying patch /nix/store/x0137mdpq76zfp2xvn3ncawys2g4c93i-normalize-var.patch
patching file cmake/Modules/CompilerRTUtils.cmake
Hunk #1 succeeded at 392 with fuzz 2 (offset 90 lines).
applying patch /nix/store/dbapbg570sx4xsbp50s52azwh6agj40m-darwin-targetconditionals.patch
patching file lib/sanitizer_common/sanitizer_mac.cpp
Hunk #1 succeeded at 628 (offset 15 lines).
Hunk #2 succeeded at 648 (offset 15 lines).
Hunk #3 succeeded at 702 (offset 15 lines).
Hunk #4 succeeded at 717 (offset 15 lines).
applying patch /nix/store/j9lspxnlbkrcskxpxg7q6nb74wnn6v2b-darwin-plistbuddy-workaround.patch
patching file cmake/builtin-config-ix.cmake
Hunk #1 succeeded at 100 (offset 3 lines).
applying patch /nix/store/jd7mnr62kxgks1rwnrrfg22vwnggkpxf-armv7l.patch
patching file cmake/builtin-config-ix.cmake
Hunk #1 FAILED at 24.
1 out of 1 hunk FAILED -- saving rejects to file cmake/builtin-config-ix.cmake.rej
patching file lib/builtins/CMakeLists.txt
Hunk #1 succeeded at 562 with fuzz 2 (offset 88 lines).
Hunk #2 FAILED at 596.
1 out of 2 hunks FAILED -- saving rejects to file lib/builtins/CMakeLists.txt.rej
error: builder for '/nix/store/lzn83jsmycjbakly6ndfsgqflga1p2g2-compiler-rt-libc-unstable-2022-26-07.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/k6gm4ljvgqiffr90phj7drq5lwlk0zr8-clang-wrapper-unstable-2022-26-07.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-clang-unstable-2022-26-07.drv-3': Directory not empty
error: 1 dependencies of derivation '/nix/store/pwmsh8mljyjzv1ql8zwfpb4qg39lp06w-mesa-22.3.2.drv' failed to build
error: 1 dependencies of derivation '/nix/store/21rimxydc53lsfpn7x9pac33cg4rq4hx-opengl-drivers.drv' failed to build
error: 1 dependencies of derivation '/nix/store/i8xxc0k75igxwhkbhfzdwfa03bqncnvg-nixos-tmpfiles.d.drv' failed to build
error: 1 dependencies of derivation '/nix/store/dxz7pap3w9fblq3hygjd1412dxzr3car-tmpfiles.d.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ywzi0jqcvd4gh1mvrqrhcyj61x9102fb-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/lja802dl57v324cbp4hsycjajcnla1np-nixos-system-uhyret-23.05pre440928.aa1d74709f5.drv' failed to build
I will try playing with it a bit more.
LLVM 15 is being worked on in https://github.com/NixOS/nixpkgs/pull/194634
You'll need to use https://github.com/NixOS/nixpkgs/pull/194634
Some of the patches on llvmPackages_git are completely borked
Some progress. With
let
staging = import (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/staging-next") { config = config.nixpkgs.config; };
llvm15 = import (builtins.fetchTarball
"https://github.com/rrbutani/nixpkgs/tarball/feature/llvm-15") {
config = config.nixpkgs.config; };
in
...
and
hardware.opengl.package = (staging.mesa.override { llvmPackages = llvm15.llvmPackages_15; }).drivers;
it compiles the LLVM parts correctly. Mesa itself fails:
Dependency LLVMSPIRVLib found: NO found 14.0.0.0 but need: '>= 15.0' ; matched: '>= 8.0.1.3', '< 15.1'
Run-time dependency llvmspirvlib found: NO
meson.build:1895:2: ERROR: Dependency lookup for LLVMSPIRVLib with
method 'pkgconfig' failed: Invalid version, need 'LLVMSPIRVLib' ['>= 15.0'] found '14.0.0.0'.
I probably need to override a few more things, but I feel that I am on the right track.
That error is related to the OpenCL support, which I don't need for now. Oh, and now that I can use a browser instead of a terminal email client, I can provide my final notes on what worked for me, in a properly formatted way. I use this at the beginning of my config to get Nixpkgs variants from branches I need:
let
staging = import (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/staging-next") { config = config.nixpkgs.config; };
llvm15 = import (builtins.fetchTarball "https://github.com/rrbutani/nixpkgs/tarball/feature/llvm-15") { config = config.nixpkgs.config; };
in
...
And then I patch in Mesa like this:
hardware.opengl.package = (staging.mesa.override { llvmPackages = llvm15.llvmPackages_15; enableOpenCL = false; }).drivers;
You'll end up compiling LLVM, clang, and mesa, which takes a little while, but it's not too bad.
All this information is already elsewhere in the thread, but summarising it in this post might help some people. Hopefully this will all be obsolete information before too long.
@athas perhaps you could also try using Zink via Vulkan without LLVM_15; would love to know whether that's an option that works for RX 7000.
How would I do that? I don't have that much experience with tweaking Mesa.
Also, it should be noted that despite the above functionally working (even for GPGPU, to my great surprise), it's a little unstable for games, with a crash maybe every hour. That is par for the course for new AMD GPUs and will probably resolve itself when the components become more well supported.
@athas put "zink"
in our mesa's galliumDrivers
and set MESA_LOADER_DRIVER_OVERRIDE=zink
globally.
I'm sorry if it's the wrong place to ask. but i have 7900 xtx and able to compile mesa from next staging. But my cursor suddenly gone from x11 server. Do i need to specify some xorg config? thanks
You don't need to do that, Mesa 22.3 is in the current unstable now. Make sure you're not using the amdgpu
driver and using the modesetting
one.
Hm, I'm not even getting sddm to show up with nixos-unstable and the llvm15 override shown here. With amdgpu
in services.xserver.videoDrivers
I get a frozen black screen with a non-blinking console cursor in the top left corner. With modesetting
I don't even get that. Also switching to a different vt does not seem to work...
If I set services.xserver.enabled = false
I get a usable console and mpv with --vo=gpu-next --gpu-context=drm
does work fine, though.
FWIW dmesg logs a couple of errors during boot and when trying to start Xorg.
Also the console is weirdly janky, like it completely stops rendering for a bit every few seconds.
I don't know about Xorg (I use Wayland), but the console jankyness was fixed by adding this kernel boot parameter: amdgpu.ppfeaturemask=0xfffd3fff
.
Could try using the modesetting driver with xorg.
@jansol kernel bugs should be reported to https://gitlab.freedesktop.org/drm/amd/-/issues/.
@athas omg thank you for your effort you put into your dotfiles .. i've managed to run my 7900 xt now @rrbutani thank your for working on llvm15 ... this made running my new 7900xt possible !!
I tried using what @athas wrote above, but I get a 404 on downloading the llvm15 tarball. Is this still the recommended way to get hardware acceleration working or can someone please help me out what to do?
@SeineEloquenz that's due to @rrbutani having deleted their branch because #194634 was merged. It should be in nixos-unstable soon-ish https://nixpk.gs/pr-tracker.html?pr=194634
Thank you very much for the quick reply! For anyone reading this till the newer nixos-unstable drops I got it working now via:
let
staging = import (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/staging-next") { config = config.nixpkgs.config; };
in
hardware.opengl.package = (pkgs.mesa.override { llvmPackages = staging.llvmPackages_15; enableOpenCL = false; }).drivers;
Also, with https://github.com/NixOS/nixpkgs/pull/213158, you should have 7000-series support in mesa by default.
You could try building your system with staging-next which already has the PR inside it: https://github.com/NixOS/nixpkgs/pull/211923 https://nixpk.gs/pr-tracker.html?pr=213158
(staging-next will become the next master/unstable, it's not as scary as it sounds.)
(sorry! totally forgot people were using the branch directly, I've restored it and I'll leave it up until the PR hits nixos-unstable)
In case someone (with flakes) wants bleeding-edge mesa (from git), with llvm15+mesa from staging-next, and with a fallback entry:
1) add these flakes inputs:
staging-next.url = "github:NixOS/nixpkgs/staging-next";
mesa-git-src = {
url = "github:chaotic-aur/mesa-mirror/main";
flake = false;
};
2) forward them through specialArgs
;
3) add this module to your output:
{ pkgs, lib, mesa-git-src, staging-next, ... }:
let
future = staging-next.legacyPackages.${pkgs.system};
mesaGitApplier = base: base.mesa.overrideAttrs (fa: {
version = "23.0.99";
src = mesa-git-src;
buildInputs = fa.buildInputs ++ [ base.zstd base.libunwind base.lm_sensors ];
mesonFlags = lib.lists.remove "-Dgallium-rusticl=true" fa.mesonFlags; # fails to find "valgrind.h" with 23.0+ codebase
});
mesa-bleeding = mesaGitApplier future;
lib32-mesa-bleeding = mesaGitApplier future.pkgsi686Linux;
in {
# Apply latest mesa in the system
hardware.opengl.package = mesa-bleeding.drivers;
hardware.opengl.package32 = lib32-mesa-bleeding.drivers;
hardware.opengl.extraPackages = [ mesa-bleeding.opencl ];
# Creates a second boot entry without latest drivers
specialisation.stable-mesa.configuration = {
system.nixos.tags = [ "stable-mesa" ];
hardware.opengl.package = lib.mkForce pkgs.mesa.drivers;
hardware.opengl.package32 = lib.mkForce pkgs.pkgsi686Linux.mesa.drivers;
};
}
It may also be a good idea to bump your kernel to linuxPackages_testing
. I could not get to the desktop at all with 6.1.x, had to update to 6.2-rc5. With that and bleeding edge mesa it has finally been somewhat usable.
In case someone (with flakes) wants bleeding-edge mesa (from git), with llvm15+mesa from staging-next, and with a fallback entry:
1. add these flakes inputs:
staging-next.url = "github:NixOS/nixpkgs/staging-next"; mesa-git-src = { url = "github:chaotic-aur/mesa-mirror/main"; flake = false; };
2. forward them through `specialArgs`; 3. add this module to your output:
{ pkgs, lib, mesa-git-src, staging-next, ... }: let future = staging-next.legacyPackages.${pkgs.system}; mesaGitApplier = base: base.mesa.overrideAttrs (fa: { version = "23.0.99"; src = mesa-git-src; buildInputs = fa.buildInputs ++ [ base.zstd base.libunwind base.lm_sensors ]; mesonFlags = lib.lists.remove "-Dgallium-rusticl=true" fa.mesonFlags; # fails to find "valgrind.h" with 23.0+ codebase }); mesa-bleeding = mesaGitApplier future; lib32-mesa-bleeding = mesaGitApplier future.pkgsi686Linux; in { # Apply latest mesa in the system hardware.opengl.package = mesa-bleeding.drivers; hardware.opengl.package32 = lib32-mesa-bleeding.drivers; hardware.opengl.extraPackages = [ mesa-bleeding.opencl ]; # Creates a second boot entry without latest drivers specialisation.stable-mesa.configuration = { system.nixos.tags = [ "stable-mesa" ]; hardware.opengl.package = lib.mkForce pkgs.mesa.drivers; hardware.opengl.package32 = lib.mkForce pkgs.pkgsi686Linux.mesa.drivers; }; }
Thanks for this, implemented in my config and is working.
It may also be a good idea to bump your kernel to
linuxPackages_testing
. I could not get to the desktop at all with 6.1.x, had to update to 6.2-rc5. With that and bleeding edge mesa it has finally been somewhat usable.
seems like GDM isnt working with kernel 6.1.8 and mesa 23 ... anyways i am using hyprland, and if i start it with greetd it is working fine.
how did you change to kernel 6.2-rc5 ?
i've done
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_testing.override {
argsOverride = rec {
src = pkgs.fetchurl {
url = "https://git.kernel.org/torvalds/t/linux-6.2-rc6.tar.gz";
hash = "sha256-rEpJYw5O6OHSwNY8LxlCsw0p9+u9BUjTQ8FsB6+fLbc=";
};
version = "6.2-rc6";
modDirVersion = "6.2-rc6";
};
});
but it isnt building for me ... getting
building the system configuration...
error: builder for '/nix/store/pca29a7igrpavi6cxvch6qxmg9wvbsb6-linux-config-6.2-rc6.drv' failed with exit code 255;
last 10 log lines:
> GOT: #
> GOT: make[1]: Leaving directory '/build/linux-6.2-rc6/build'
> GOT: make: Leaving directory '/build/linux-6.2-rc6'
> warning: unused option: ANDROID
> error: unused option: DRM_VMWGFX_FBCON
> error: unused option: EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER
> error: unused option: NFSD_V2_ACL
> error: unused option: RANDOM_TRUST_BOOTLOADER
> error: unused option: RANDOM_TRUST_CPU
> error: unused option: SQUASHFS_DECOMP_MULTI_PERCPU
For full logs, run 'nix log /nix/store/pca29a7igrpavi6cxvch6qxmg9wvbsb6-linux-config-6.2-rc6.drv'.
error: 1 dependencies of derivation '/nix/store/1gs6f2iq6qvp44l7fjqhj304w29m0lx2-linux-6.2-rc6.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bm7s535ga5nqvdavnik069cwmr8n0w3i-nixos-system-nixos-23.05.20230130.2caf4ef.drv' failed to build
also tried rc2 and rc5
only thing i have found so far, that it could be an issue with AMD processors !?
@edel-km oh right, I also went through pkgs/os-specific/linux/kernel/common-config.nix
and simply commented out the options listed in the error message. (I was building from a local nixpkgs checkout anyway, not sure how to do it with an override)
@jansol thanks for pointing me the right direction
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_testing.override {
argsOverride = rec {
src = pkgs.fetchurl {
url = "https://git.kernel.org/torvalds/t/linux-6.2-rc6.tar.gz";
hash = "sha256-rEpJYw5O6OHSwNY8LxlCsw0p9+u9BUjTQ8FsB6+fLbc=";
};
version = "6.2-rc6";
modDirVersion = "6.2.0-rc6";
};
ignoreConfigErrors = true;
});
this is the way ...
Out of curiosity, has anyone here been able to get the USB-C port on these cards to work on NixOS? If so, are there any other changes required to get it to function properly?
amdgpu seems to drop the card into a weird state on shutdown sometimes @Slabity, I've got it to work (when it stops working) by turning off my computer, flipping the power supply off (or removing the cord) and pressing the power button a few times to drain the motherboard caps of power, then turning everything back on
@cidkidnix - Wow. I could not find anything about this issue in upstream discussions or anywhere else. Glad to know I'm not the only one with this is affecting. Flipping the PSU after shutdown seems to have fixed it, so you saved me quite a bit of time trying to debug what the problem was.
As far as other PSU-related issues are concerned, I also found out that you should not be using the normal daisy-chained PCIe cables for high-wattage graphics cards. Use separate cables going to separate PSU rails for each 8-pin PCIe connector on your card :upside_down_face:
Hi Guys
No matter what I try at the moment I am getting an issue rebuilding my flake:
error: builder for '/nix/store/hcj1gisgq0wy52ksw1pgyyb93a2wc4hv-mesa-22.3.4.drv' failed with exit code 1;
last 10 log lines:
> Run-time dependency libtizonia found: NO (tried pkgconfig and cmake)
> Run-time dependency libtizplatform found: NO (tried pkgconfig and cmake)
> Run-time dependency tizilheaders found: NO (tried pkgconfig and cmake)
> Run-time dependency libva found: YES 1.17.0
> Header "va/va.h" has symbol "VASurfaceAttribDRMFormatModifiers" with dependency libva: YES
> Run-time dependency libclc found: NO (tried pkgconfig)
>
> meson.build:945:2: **ERROR: Dependency "libclc" not found, tried pkgconfig**
>
> A full log can be found at /build/mesa-22.3.4/build/meson-logs/meson-log.txt
For full logs, run 'nix log /nix/store/hcj1gisgq0wy52ksw1pgyyb93a2wc4hv-mesa-22.3.4.drv'.
error: 1 dependencies of derivation '/nix/store/97z3hzz11jadd7148q6l4s13w9wbhfxr-opengl-drivers.drv' failed to build
error: 1 dependencies of derivation '/nix/store/gq9nc4iybn1w81nqqy3kd9n37278h4cf-nixos-tmpfiles.d.drv' failed to build
error: 1 dependencies of derivation '/nix/store/islwydymqfgf1gp7isq357q0881lagf7-tmpfiles.d.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4q2ds98haq8rlhxrhwvwqmz9njqqhc4d-etc.drv' failed to build
I tried to add libclc to the system packages without any success.
Also I found out that llvmPackages_15 hit unstable, so no need to put staging anymore:
hardware.opengl.package = (pkgs.mesa.override {
llvmPackages = pkgs.llvmPackages_15;
enableOpenCL = false;
}).drivers;
This is no longer necessary. Just use the latest nixos-unstable.
What do I put in hardware.opengl.package
then? Something like pkgs.mesa_latest
?
Nothing. The default is fine.
Can I remove the featuremask?
"amdgpu.ppfeaturemask=0xffd3fff" # Specific for the AMD Radeon RX 7900 XTX
Describe the bug
Booting into system with Radeon RX 7900 XTX does not show cursor nor has hardware acceleration.
Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
A shown hardware cursor and hardware acceleration.
Screenshots
N/A
Additional context
Issue for tracking addition of new support.
Notify maintainers
@K900 @LunNova (gathered from linux-firmware git blame)
Metadata