From 0011617cd5ccdd49f2727e4cc77b7231d82598b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Fri, 28 Nov 2025 18:58:14 +0100 Subject: [PATCH 1/5] Revert "mesa: fix build for musl" This reverts commit cbe068324d8d11a366fb03a9697c41f392e3fd9d. --- pkgs/development/libraries/mesa/default.nix | 1 - pkgs/development/libraries/mesa/musl.patch | 39 --------------------- 2 files changed, 40 deletions(-) delete mode 100644 pkgs/development/libraries/mesa/musl.patch diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 31b284c3cc495..59e68c60de960 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -150,7 +150,6 @@ stdenv.mkDerivation { patches = [ ./opencl.patch - ./musl.patch ]; postPatch = '' diff --git a/pkgs/development/libraries/mesa/musl.patch b/pkgs/development/libraries/mesa/musl.patch deleted file mode 100644 index 07f6c9c414636..0000000000000 --- a/pkgs/development/libraries/mesa/musl.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 571dedac8881649cd94c59488413b835cbcf0498 Mon Sep 17 00:00:00 2001 -From: Alyssa Ross -Date: Thu, 20 Nov 2025 23:16:47 +0100 -Subject: [PATCH] rocket: fix building for musl - -musl follows POSIX and provides ioctl as int ioctl(int, int, ...). - -Fixes: 5b829658f74 ("rocket: Initial commit of a driver for Rockchip's NPU") -Signed-off-by: Alyssa Ross -Link: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38561 ---- - src/gallium/drivers/rocket/intercept.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/src/gallium/drivers/rocket/intercept.c b/src/gallium/drivers/rocket/intercept.c -index 6ffb8647d61f5..88e55893d9520 100644 ---- a/src/gallium/drivers/rocket/intercept.c -+++ b/src/gallium/drivers/rocket/intercept.c -@@ -294,9 +294,15 @@ handle_action(struct rknpu_action *args) - } - } - --typedef int (*real_ioctl_t)(int fd, unsigned long request, ...); -+#ifdef __GLIBC__ -+typedef unsigned long ioctl_req; -+#else -+typedef int ioctl_req; // per POSIX -+#endif -+ -+typedef int (*real_ioctl_t)(int fd, ioctl_req request, ...); - int --ioctl(int fd, unsigned long request, ...) -+ioctl(int fd, ioctl_req request, ...) - { - int ret; - uint32_t output_address = 0; --- -GitLab - From b738f753340f7d0487b596a3f87547cf998528b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Fri, 28 Nov 2025 18:58:20 +0100 Subject: [PATCH 2/5] Revert "mesa: move `pco_clc` to `cross_tools` output" This reverts commit 4264f487ee961c01ea0feb412211549e74e80e27. --- pkgs/development/libraries/mesa/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 59e68c60de960..4320ea6d6360d 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -340,7 +340,6 @@ stdenv.mkDerivation { moveToOutput bin/panfrost_compile $cross_tools moveToOutput bin/panfrost_texfeatures $cross_tools moveToOutput bin/panfrostdump $cross_tools - moveToOutput bin/pco_clc $cross_tools moveToOutput bin/vtn_bindgen2 $cross_tools moveToOutput "lib/lib*OpenCL*" $opencl From 7e2f15af8e34611dcc63d3a0aa020ab27e534d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Fri, 28 Nov 2025 18:58:22 +0100 Subject: [PATCH 3/5] Revert "mesa: fix build on Darwin after 25.3" This reverts commit d1b40fe8a2b22f2dd9d6d51777ff377d18ae8aa8. --- pkgs/development/libraries/mesa/darwin.nix | 6 +--- .../libraries/mesa/fix-darwin-build.patch | 34 ------------------- 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 pkgs/development/libraries/mesa/fix-darwin-build.patch diff --git a/pkgs/development/libraries/mesa/darwin.nix b/pkgs/development/libraries/mesa/darwin.nix index e99d86cd5489b..e19d1a0e44a43 100644 --- a/pkgs/development/libraries/mesa/darwin.nix +++ b/pkgs/development/libraries/mesa/darwin.nix @@ -25,11 +25,6 @@ stdenv.mkDerivation { meta ; - patches = [ - # Backport of https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38429 - ./fix-darwin-build.patch - ]; - outputs = [ "out" "dev" @@ -63,6 +58,7 @@ stdenv.mkDerivation { "--sysconfdir=/etc" "--datadir=${placeholder "out"}/share" (lib.mesonEnable "glvnd" false) + (lib.mesonEnable "shared-glapi" true) (lib.mesonEnable "llvm" true) ]; diff --git a/pkgs/development/libraries/mesa/fix-darwin-build.patch b/pkgs/development/libraries/mesa/fix-darwin-build.patch deleted file mode 100644 index e649bb9ccfde0..0000000000000 --- a/pkgs/development/libraries/mesa/fix-darwin-build.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/src/glx/apple/apple_cgl.c b/src/glx/apple/apple_cgl.c -index 81b6730f8e29b3920216461858b98bcd3b7a870c..9bdfe555949482ddb6153ee926967ac5c04fe7c8 100644 ---- a/src/glx/apple/apple_cgl.c -+++ b/src/glx/apple/apple_cgl.c -@@ -34,6 +34,7 @@ - - #include "apple_cgl.h" - #include "apple_glx.h" -+#include "util/os_misc.h" - - #ifndef OPENGL_FRAMEWORK_PATH - #define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL" -diff --git a/src/loader/loader.c b/src/loader/loader.c -index d06a368c1bbff180fcc9432183db66398b75f4a3..0567beb3dee569895fbb36c7e7c3df34be8b32b7 100644 ---- a/src/loader/loader.c -+++ b/src/loader/loader.c -@@ -139,6 +139,9 @@ iris_predicate(int fd, const char *driver) - bool - nouveau_zink_predicate(int fd, const char *driver) - { -+#ifndef HAVE_LIBDRM -+ return true; -+#else - /* Never load on nv proprietary driver */ - if (!drm_fd_is_nouveau(fd)) - return false; -@@ -191,6 +194,7 @@ nouveau_zink_predicate(int fd, const char *driver) - if (!use_zink && !strcmp(driver, "nouveau")) - return true; - return false; -+#endif - } - - From 6fd4679bc0ee368d9cce4dcaf7a58ce77c62f84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Fri, 28 Nov 2025 18:58:23 +0100 Subject: [PATCH 4/5] Revert "mesa: gate NPU drivers on 64-bit targets only" This reverts commit 1aa23f2e1bb86a603b397eb4a4a3b994a9dc02e5. --- pkgs/development/libraries/mesa/default.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 4320ea6d6360d..5e99a1608664b 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -51,6 +51,7 @@ "asahi" # Apple AGX "crocus" # Intel legacy "d3d12" # WSL emulated GPU (aka Dozen) + "ethosu" # ARM Ethos NPU "etnaviv" # Vivante GPU designs (mostly NXP/Marvell SoCs) "freedreno" # Qualcomm Adreno (all Qualcomm SoCs) "i915" # Intel extra legacy @@ -62,6 +63,7 @@ "r300" # very old AMD "r600" # less old AMD "radeonsi" # new AMD (GCN+) + "rocket" # Rockchip NPU "softpipe" # older software renderer "svga" # VMWare virtualized GPU "tegra" # Nvidia Tegra SoCs @@ -69,10 +71,6 @@ "vc4" # Broadcom VC4 (Raspberry Pi 0-3) "virgl" # QEMU virtualized GPU (aka VirGL) "zink" # generic OpenGL over Vulkan, experimental - ] - ++ lib.optionals stdenv.hostPlatform.is64bit [ - "ethosu" # ARM Ethos NPU, does not build on 32-bit - "rocket" # Rockchip NPU, probably horribly broken on 32-bit ], vulkanDrivers ? [ "amd" # AMD (aka RADV) From 4ad09cd8dca869e51d67487dffa007d9a16a8426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Fri, 28 Nov 2025 18:58:24 +0100 Subject: [PATCH 5/5] Revert "mesa: 25.2.6 -> 25.3.0" This reverts commit ae921d60d393bafb77901a08beaf93fef7409afc. --- pkgs/development/libraries/mesa/common.nix | 4 +- pkgs/development/libraries/mesa/default.nix | 9 ++-- .../libraries/mesa/gallivm-llvm-21.patch | 53 +++++++++++++++++++ 3 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 pkgs/development/libraries/mesa/gallivm-llvm-21.patch diff --git a/pkgs/development/libraries/mesa/common.nix b/pkgs/development/libraries/mesa/common.nix index c3d91831ad7dc..732fc979c1cb7 100644 --- a/pkgs/development/libraries/mesa/common.nix +++ b/pkgs/development/libraries/mesa/common.nix @@ -5,14 +5,14 @@ # nix build .#legacyPackages.x86_64-darwin.mesa .#legacyPackages.aarch64-darwin.mesa rec { pname = "mesa"; - version = "25.3.0"; + version = "25.2.6"; src = fetchFromGitLab { domain = "gitlab.freedesktop.org"; owner = "mesa"; repo = "mesa"; rev = "mesa-${version}"; - hash = "sha256-MviXDRAbCEXM9dIzD94/CM0bjlF4zCJUVE91Xst/uII="; + hash = "sha256-erfvNR1Yor3k8gVVClyiBJsgyaOv7BMFd1NSgieTY5I="; }; meta = { diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 5e99a1608664b..f548668644bf6 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -13,7 +13,6 @@ spirv-tools, intltool, jdupes, - libdisplay-info, libdrm, libgbm, libglvnd, @@ -51,7 +50,6 @@ "asahi" # Apple AGX "crocus" # Intel legacy "d3d12" # WSL emulated GPU (aka Dozen) - "ethosu" # ARM Ethos NPU "etnaviv" # Vivante GPU designs (mostly NXP/Marvell SoCs) "freedreno" # Qualcomm Adreno (all Qualcomm SoCs) "i915" # Intel extra legacy @@ -63,7 +61,6 @@ "r300" # very old AMD "r600" # less old AMD "radeonsi" # new AMD (GCN+) - "rocket" # Rockchip NPU "softpipe" # older software renderer "svga" # VMWare virtualized GPU "tegra" # Nvidia Tegra SoCs @@ -78,7 +75,7 @@ "broadcom" # Broadcom VC5 (Raspberry Pi 4, aka V3D) "freedreno" # Qualcomm Adreno (all Qualcomm SoCs) "gfxstream" # Android virtualized GPU - "imagination" # PowerVR Rogue (currently N/A) + "imagination-experimental" # PowerVR Rogue (currently N/A) "intel_hasvk" # Intel Haswell/Broadwell, "legacy" Vulkan driver (https://www.phoronix.com/news/Intel-HasVK-Drop-Dead-Code) "intel" # new Intel (aka ANV) "microsoft-experimental" # WSL virtualized GPU (aka DZN/Dozen) @@ -99,7 +96,6 @@ "wayland" ], vulkanLayers ? [ - "anti-lag" "device-select" "intel-nullhw" "overlay" @@ -148,6 +144,8 @@ stdenv.mkDerivation { patches = [ ./opencl.patch + # https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37027 + ./gallivm-llvm-21.patch ]; postPatch = '' @@ -258,7 +256,6 @@ stdenv.mkDerivation { elfutils expat spirv-tools - libdisplay-info libdrm libgbm libglvnd diff --git a/pkgs/development/libraries/mesa/gallivm-llvm-21.patch b/pkgs/development/libraries/mesa/gallivm-llvm-21.patch new file mode 100644 index 0000000000000..692a5c720d528 --- /dev/null +++ b/pkgs/development/libraries/mesa/gallivm-llvm-21.patch @@ -0,0 +1,53 @@ +From eca19331d94005485de5246cfa87a21621486cd8 Mon Sep 17 00:00:00 2001 +From: no92 +Date: Wed, 27 Aug 2025 16:02:31 +0200 +Subject: [PATCH] gallivm: support LLVM 21 + +LLVM PR#146819 changed the signature of `setObjectLinkingLayerCreator`, +dropping the Triple argument. The PR was first included in the LLVM 21 +series, and the new signature is gated behind a version check for that. + +`LLVMOrcThreadSafeContextGetContext` was removed in LLVM commit b18e5b6, +and the ORC examples in the LLVM tree seem to just create a context +instead, which we replicate here. + +With this commit, mesa successfully builds the llvmpipe gallium driver +on riscv64 with LLVM 21.1.0. + +Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13785 +Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13852 + +Reviewed-by: David Heidelberg +--- + src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp +index 3d2b8cf81bc0c..0be69b02b6eef 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp ++++ b/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp +@@ -340,7 +340,12 @@ LPJit::LPJit() :jit_dylib_count(0) { + .setJITTargetMachineBuilder(std::move(JTMB)) + #ifdef USE_JITLINK + .setObjectLinkingLayerCreator( ++#if LLVM_VERSION_MAJOR >= 21 ++ /* LLVM 21 removed the Triple argument */ ++ [&](ExecutionSession &ES) { ++#else + [&](ExecutionSession &ES, const llvm::Triple &TT) { ++#endif + return std::make_unique( + ES, ExitOnErr(llvm::jitlink::InProcessMemoryManager::Create())); + }) +@@ -552,7 +557,7 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name, + gallivm->cache = cache; + + gallivm->_ts_context = context->ref; +- gallivm->context = LLVMOrcThreadSafeContextGetContext(context->ref); ++ gallivm->context = LLVMContextCreate(); + + gallivm->module_name = LPJit::get_unique_name(name); + gallivm->module = LLVMModuleCreateWithNameInContext(gallivm->module_name, +-- +GitLab +