mesa: update to version 25.2.4
authorDaniel Golle <[email protected]>
Mon, 13 Oct 2025 01:42:15 +0000 (02:42 +0100)
committerDaniel Golle <[email protected]>
Sun, 19 Oct 2025 13:53:15 +0000 (14:53 +0100)
Mesa 25.2 brings a bunch of new features, especially the Panfrost Vulkan
driver saw many improvements.

See https://docs.mesa3d.org/relnotes.html for details about what has
happened since Mesa 25.1.6.

Note that OSMesa as well as the old OpenCL 1.1 support has been dropped.
The new Rusticl OpenCL implementation cannot be supported yet as OpenWrt's
meson integration still lacks support for Rust at this point.

Signed-off-by: Daniel Golle <[email protected]>
libs/mesa/Makefile
libs/mesa/patches/001-gallivm-support-LLVM-21.patch [new file with mode: 0644]
libs/mesa/patches/100-meson-allow-using-LLVM-as-embedded-project.patch [new file with mode: 0644]
libs/mesa/patches/100-use-llvm-subproject-vars.patch [deleted file]
libs/mesa/patches/200-panfrost-Enable-cross-compilation-of-precompilers-on.patch [new file with mode: 0644]
libs/mesa/patches/200-panfrost-precomp.patch [deleted file]

index 095c1d4e12b6ae7187df308426778be683b2fa2a..5b1822ba3b0ba7b697f008e72165ace305dff37a 100644 (file)
@@ -1,19 +1,20 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mesa
-PKG_VERSION:=25.1.6
+PKG_VERSION:=25.2.4
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://archive.mesa3d.org/
-PKG_HASH:=9f2b69eb39d2d8717d30a9868fdda3e0c0d3708ba32778bbac8ddb044538ce84
+PKG_HASH:=a370b4c549cbfbe646b319e34d73edb50ed883978f5e95133f282f0eae39ab52
 
 PKG_MAINTAINER:=Daniel Golle <[email protected]>
 PKG_LICENSE:=BSD-3-Clause
 
 PKG_INSTALL:=1
 
-PKG_BUILD_DEPENDS:=glslang/host python3/host libva MESA_USE_LLVM:llvm MESA_USE_LLVM:mesa/host
+PKG_BUILD_DEPENDS:=glslang/host python3/host libva vulkan-headers \
+                  MESA_USE_LLVM:llvm MESA_USE_LLVM:mesa/host
 
 HOST_BUILD_DEPENDS:=python3/host spirv-tools/host llvm
 
@@ -30,10 +31,6 @@ PKG_CONFIG_DEPENDS:= \
        CONFIG_PACKAGE_libmesa-zink \
        CONFIG_PACKAGE_libmesa-softpipe \
        CONFIG_PACKAGE_libmesa-llvmpipe \
-       CONFIG_PACKAGE_libopencl-amd \
-       CONFIG_PACKAGE_libopencl-nouveau \
-       CONFIG_PACKAGE_libosmesa-softpipe \
-       CONFIG_PACKAGE_libosmesa-llvmpipe \
        CONFIG_PACKAGE_libvulkan-broadcom \
        CONFIG_PACKAGE_libvulkan-imagination \
        CONFIG_PACKAGE_libvulkan-intel \
@@ -318,36 +315,6 @@ fastest software rasterizer for Mesa.
 endef
 
 
-define Package/libopencl/Default
-$(call Package/mesa/Default)
-  TITLE+= OpenCL
-  PROVIDES:=libopencl
-  DEPENDS+=+MESA_USE_LLVM:libclang-cpp +libdrm +libelf +libexpat +libstdcpp \
-          +libzstd +zlib @MESA_USE_LLVM
-endef
-
-
-define Package/libopencl-amd
-$(call Package/libopencl/Default)
-  TITLE+= (AMD)
-  VARIANT:=amd
-endef
-
-define Package/libopencl-amd/description
-Mesa Clover OpenCL 1.1 library for AMD GPUs.
-endef
-
-
-define Package/libopencl-nouveau
-$(call Package/libopencl/Default)
-  TITLE+= (nVidia)
-  VARIANT:=nouveau
-endef
-
-define Package/libopencl-nouveau/description
-Mesa Clover OpenCL 1.1 library for nVidia GPUs.
-endef
-
 define Package/libvulkan-broadcom
 $(call Package/mesa/Default)
   DEPENDS+=+libdrm +libexpat +libstdcpp +libudev +libwayland +libzstd +zlib \
@@ -517,10 +484,8 @@ MESON_HOST_ARGS += \
        -Dprecomp-compiler=enabled \
        -Dshared-llvm=disabled \
        -Ddraw-use-llvm=false \
-       -Dintel-clc=enabled \
        -Dintel-elk=true \
        -Dstatic-libclc=all \
-       -Dinstall-intel-clc=true \
        -Dinstall-mesa-clc=true \
        -Dinstall-precomp-compiler=true
 
@@ -538,11 +503,10 @@ MESON_ARGS += \
        -Dvalgrind=disabled \
        -Dtools= \
        -Dllvm=$(if $(CONFIG_MESA_USE_LLVM),en,dis)abled \
-       -Dgallium-opencl=$(if $(CONFIG_MESA_USE_LLVM),standalone,disabled) \
        -Ddraw-use-llvm=$(if $(CONFIG_MESA_USE_LLVM),true,false) \
-       -Dintel-clc=system \
        -Dmesa-clc=$(if $(CONFIG_MESA_USE_LLVM),system,auto) \
-       -Dprecomp-compiler=system
+       -Dprecomp-compiler=system \
+       -Dlegacy-wayland=bind-wayland-display
 
 ifeq ($(BUILD_VARIANT),amd)
 MESON_ARGS += \
@@ -592,14 +556,12 @@ endif
 
 ifeq ($(BUILD_VARIANT),llvmpipe)
 MESON_ARGS += \
-       -Dgallium-drivers=llvmpipe \
-       -Dosmesa=$(if $(CONFIG_PACKAGE_libosmesa-llvmpipe),true,false)
+       -Dgallium-drivers=llvmpipe
 endif
 
 ifeq ($(BUILD_VARIANT),softpipe)
 MESON_ARGS += \
-       -Dgallium-drivers=softpipe \
-       -Dosmesa=$(if $(CONFIG_PACKAGE_libosmesa-softpipe),true,false)
+       -Dgallium-drivers=softpipe
 endif
 
 ifeq ($(BUILD_VARIANT),vulkan)
@@ -642,8 +604,9 @@ define Host/Configure
        $(call Host/Configure/Meson)
 endef
 
-define Build/Configure
-       $(call Py3Build/InstallBuildDepends)
+
+ifneq ($(CONFIG_MESA_USE_LLVM),)
+define Build/Configure/LLVMMesa
        $(INSTALL_DIR) $(PKG_BUILD_DIR)/subprojects/llvm
        $(LN) $(STAGING_DIR)/usr/bin $(PKG_BUILD_DIR)/subprojects/llvm
        $(LN) $(STAGING_DIR)/usr/include $(PKG_BUILD_DIR)/subprojects/llvm
@@ -659,6 +622,16 @@ define Build/Configure
                echo -n "$$$${next_comma}'$$$${lib}'" ; \
                next_comma=', ' ; \
        done ) ; $(SED) "s%@LLVM_LIBS@%$$$${LLVM_LIBS}%" $(PKG_BUILD_DIR)/subprojects/llvm/meson.build
+endef
+else
+define Build/Configure/LLVMMesa
+endef
+endif
+
+
+define Build/Configure
+       $(call Build/Configure/LLVMMesa)
+       $(call Py3Build/InstallBuildDepends)
        $(call Build/Configure/Meson)
 endef
 
@@ -686,11 +659,6 @@ define Package/libmesa/install
        $(CP) $(PKG_INSTALL_DIR)/usr/share/drirc.d/* $(1)/usr/share/drirc.d
 endef
 
-define Package/libopencl/install
-       $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libOpenCL.so* $(1)/usr/lib
-endef
-
 define Package/libvulkan-radeon/install
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libvulkan_radeon.so $(1)/usr/lib
@@ -761,9 +729,6 @@ Package/libmesa-zink/install = $(Package/libmesa/install)
 Package/libmesa-softpipe/install = $(Package/libmesa/install)
 Package/libmesa-llvmpipe/install = $(Package/libmesa/install)
 
-Package/libopencl-amd/install = $(Package/libopencl/install)
-Package/libopencl-nouveau/install = $(Package/libopencl/install)
-
 $(eval $(call BuildPackage,mesa3d))
 $(eval $(call BuildPackage,libmesa-amd))
 $(eval $(call BuildPackage,libmesa-intel))
@@ -777,8 +742,6 @@ $(eval $(call BuildPackage,libmesa-virgl))
 $(eval $(call BuildPackage,libmesa-zink))
 $(eval $(call BuildPackage,libmesa-softpipe))
 $(eval $(call BuildPackage,libmesa-llvmpipe))
-$(eval $(call BuildPackage,libopencl-amd))
-$(eval $(call BuildPackage,libopencl-nouveau))
 $(eval $(call BuildPackage,libvulkan-broadcom))
 $(eval $(call BuildPackage,libvulkan-imagination))
 $(eval $(call BuildPackage,libvulkan-intel))
diff --git a/libs/mesa/patches/001-gallivm-support-LLVM-21.patch b/libs/mesa/patches/001-gallivm-support-LLVM-21.patch
new file mode 100644 (file)
index 0000000..48e6747
--- /dev/null
@@ -0,0 +1,49 @@
+From cd129dbf8af2d16b1243f2ce287ff69c6a5dc557 Mon Sep 17 00:00:00 2001
+From: no92 <[email protected]>
+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 <[email protected]>
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37027>
+---
+ src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- 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<ObjectLinkingLayer>(
+                   ES, ExitOnErr(llvm::jitlink::InProcessMemoryManager::Create()));
+             })
+@@ -552,7 +557,7 @@ init_gallivm_state(struct gallivm_state
+    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,
diff --git a/libs/mesa/patches/100-meson-allow-using-LLVM-as-embedded-project.patch b/libs/mesa/patches/100-meson-allow-using-LLVM-as-embedded-project.patch
new file mode 100644 (file)
index 0000000..eaeda86
--- /dev/null
@@ -0,0 +1,85 @@
+From 6334f0f57472410f9363f5b5d6bc6c68601f14d7 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <[email protected]>
+Date: Mon, 13 Oct 2025 01:19:44 +0100
+Subject: [PATCH 1/2] meson: allow using LLVM as embedded project
+
+---
+ meson.build                  | 33 +++++++++++++++++++++------------
+ src/compiler/clc/meson.build |  4 ++--
+ 2 files changed, 23 insertions(+), 14 deletions(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -1748,17 +1748,29 @@ _shared_llvm = get_option('shared-llvm')
+   .disable_auto_if(host_machine.system() == 'windows') \
+   .allowed()
+-dep_llvm = dependency(
+-  'llvm',
+-  method : host_machine.system() == 'windows' ? 'auto' : 'config-tool',
+-  version : _llvm_version,
+-  modules : llvm_modules,
+-  optional_modules : llvm_optional_modules,
+-  required : with_llvm,
+-  static : not _shared_llvm,
+-  fallback : ['llvm', 'dep_llvm'],
+-  include_type : 'system',
+-)
++_llvm_subproject_dir = meson.project_source_root() / 'subprojects' / 'llvm'
++_has_llvm_subproject = import('fs').is_dir(_llvm_subproject_dir)
++if _has_llvm_subproject
++  llvm_proj = subproject('llvm', required : false)
++else
++  llvm_proj = disabler()
++endif
++
++if _has_llvm_subproject and llvm_proj.found()
++  dep_llvm = llvm_proj.get_variable('dep_llvm')
++else
++  dep_llvm = dependency(
++    'llvm',
++    method : host_machine.system() == 'windows' ? 'auto' : 'config-tool',
++    version : _llvm_version,
++    modules : llvm_modules,
++    optional_modules : llvm_optional_modules,
++    required : with_llvm,
++    static : not _shared_llvm,
++    fallback : ['llvm', 'dep_llvm'],
++    include_type : 'system',
++  )
++endif
+ if dep_llvm.found()
+   pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version())
+   pre_args += '-DLLVM_IS_SHARED=@0@'.format(_shared_llvm.to_int())
+@@ -1842,7 +1854,11 @@ endif
+ dep_clang = null_dep
+ if with_clc
+-  llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
++  if dep_llvm.type_name() == 'internal'
++    llvm_libdir = subproject('llvm').get_variable('libdir')
++  else
++    llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
++  endif
+   dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
+--- a/src/compiler/clc/meson.build
++++ b/src/compiler/clc/meson.build
+@@ -25,14 +25,14 @@ if not _shared_llvm or \
+   opencl_c_base_h = custom_target(
+     'opencl-c-base.h',
+-    input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c-base.h')],
++    input : [files_xxd, 'opencl-c-base.h'],
+     output : 'opencl-c-base.h.h',
+     command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'opencl_c_base_source'],
+   )
+   opencl_c_h = custom_target(
+     'opencl-c.h',
+-    input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c.h')],
++    input : [files_xxd, 'opencl-c.h'],
+     output : 'opencl-c.h.h',
+     command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'opencl_c_source'],
+   )
diff --git a/libs/mesa/patches/100-use-llvm-subproject-vars.patch b/libs/mesa/patches/100-use-llvm-subproject-vars.patch
deleted file mode 100644 (file)
index cdff7e1..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
---- a/meson.build
-+++ b/meson.build
-@@ -1785,21 +1785,26 @@ _llvm = get_option('llvm')
- dep_llvm = null_dep
- with_llvm = false
- if _llvm.allowed()
--  dep_llvm = dependency(
--    'llvm',
--    method : host_machine.system() == 'windows' ? 'auto' : 'config-tool',
--    version : _llvm_version,
--    modules : llvm_modules,
--    optional_modules : llvm_optional_modules,
--    required : (
--      with_amd_vk or with_gallium_radeonsi or with_gallium_clover or with_clc
--      or _llvm.enabled()
--    ),
--    static : not _shared_llvm,
--    fallback : ['llvm', 'dep_llvm'],
--    include_type : 'system',
--  )
--  with_llvm = dep_llvm.found()
-+  llvm_proj = subproject('llvm')
-+  if llvm_proj.found()
-+    dep_llvm = llvm_proj.get_variable('dep_llvm')
-+    with_llvm = true
-+  else
-+    dep_llvm = dependency(
-+      'llvm',
-+      method : host_machine.system() == 'windows' ? 'auto' : 'config-tool',
-+      version : _llvm_version,
-+      modules : llvm_modules,
-+      optional_modules : llvm_optional_modules,
-+      required : (
-+        with_amd_vk or with_gallium_radeonsi or with_gallium_clover or with_clc
-+        or _llvm.enabled()
-+      ),
-+      static : not _shared_llvm,
-+      fallback : ['llvm', 'dep_llvm'],
-+      include_type : 'system',
-+    )
-+  endif
- endif
- if with_llvm
-   pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version())
-@@ -1898,7 +1903,11 @@ endif
- dep_clang = null_dep
- if with_clc or with_gallium_clover
--  llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
-+  if dep_llvm.type_name() == 'internal'
-+    llvm_libdir = subproject('llvm').get_variable('libdir')
-+  else
-+    llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
-+  endif
-   dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
---- a/src/compiler/clc/meson.build
-+++ b/src/compiler/clc/meson.build
-@@ -25,14 +25,14 @@ if not _shared_llvm or \
-   opencl_c_base_h = custom_target(
-     'opencl-c-base.h',
--    input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c-base.h')],
-+    input : [files_xxd, 'opencl-c-base.h'],
-     output : 'opencl-c-base.h.h',
-     command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'opencl_c_base_source'],
-   )
-   opencl_c_h = custom_target(
-     'opencl-c.h',
--    input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c.h')],
-+    input : [files_xxd, 'opencl-c.h'],
-     output : 'opencl-c.h.h',
-     command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'opencl_c_source'],
-   )
---- a/src/gallium/frontends/clover/meson.build
-+++ b/src/gallium/frontends/clover/meson.build
-@@ -25,6 +25,12 @@ if with_opencl_icd
-   clover_cpp_args += '-DHAVE_CLOVER_ICD'
- endif
-+if dep_llvm.type_name() == 'internal'
-+  llvm_libdir = subproject('llvm').get_variable('libdir')
-+else
-+  llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
-+endif
-+
- libclllvm = static_library(
-   'clllvm',
-   files(
-@@ -43,7 +49,7 @@ libclllvm = static_library(
-     clover_cpp_args,
-     clover_opencl_cpp_args,
-     '-DFALLBACK_CLANG_RESOURCE_DIR="@0@"'.format(join_paths(
--      dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir'), 'clang',
-+      llvm_libdir, 'clang',
-       dep_llvm.version()
-     )),
-   ],
---- a/src/gallium/targets/opencl/meson.build
-+++ b/src/gallium/targets/opencl/meson.build
-@@ -12,7 +12,12 @@ if with_ld_version_script
-   opencl_link_deps += files('opencl.sym')
- endif
--llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
-+if dep_llvm.type_name() == 'internal'
-+  llvm_libdir = subproject('llvm').get_variable('libdir')
-+else
-+  llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
-+endif
-+
- opencl_libname = with_opencl_icd ? 'MesaOpenCL' : 'OpenCL'
- polly_dep = null_dep
diff --git a/libs/mesa/patches/200-panfrost-Enable-cross-compilation-of-precompilers-on.patch b/libs/mesa/patches/200-panfrost-Enable-cross-compilation-of-precompilers-on.patch
new file mode 100644 (file)
index 0000000..7b85c78
--- /dev/null
@@ -0,0 +1,205 @@
+From ed8b98238061e6260ffaf507597e114a5a80ca4f Mon Sep 17 00:00:00 2001
+From: Daniel Golle <[email protected]>
+Date: Mon, 13 Oct 2025 01:32:22 +0100
+Subject: [PATCH 2/2] panfrost: Enable cross-compilation of precompilers on
+ non-Linux hosts
+
+This patch enables building Mesa's Panfrost precompilers on non-Linux
+hosts (macOS, Windows, etc.) by introducing a stub kernel mode driver
+interface when building without full driver support.
+
+The main issue was that pan_texture.c now requires pan_desc.h, which
+includes kmod/pan_kmod.h that depends on Linux-specific DRM headers
+(drm.h, xf86drm.h). These headers are not available on non-Linux hosts,
+preventing cross-compilation of the Panfrost shader precompilers.
+
+Changes:
+
+1. Created kmod/pan_kmod_stub.h with minimal type definitions needed
+   by pan_desc.h inline functions (pan_kmod_dev_props)
+
+2. Modified pan_desc.h to conditionally include either the full kmod
+   header or the stub version based on PAN_KMOD_STUB define
+
+3. Updated build system to:
+   - Skip building kmod/ subdirectory when not needed
+   - Exclude pan_desc.c, pan_mod.c, pan_props.c from builds without
+     driver support
+   - Add -DPAN_KMOD_STUB define for precompiler-only builds
+   - Conditionally link kmod library only when building full driver
+
+4. Extended panfrost build to support with_drivers_clc for CLC
+   precompiler requirements
+
+This allows building Panfrost precompilers for cross-compilation
+scenarios without requiring a Linux host or DRM development headers,
+while maintaining full backward compatibility for regular driver builds.
+---
+ src/meson.build                       |  2 +-
+ src/panfrost/lib/kmod/pan_kmod_stub.h | 27 ++++++++++++++
+ src/panfrost/lib/meson.build          | 51 ++++++++++++++++++++-------
+ src/panfrost/lib/pan_desc.h           |  4 +++
+ src/panfrost/meson.build              |  2 +-
+ 5 files changed, 71 insertions(+), 15 deletions(-)
+ create mode 100644 src/panfrost/lib/kmod/pan_kmod_stub.h
+
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -93,7 +93,7 @@ endif
+ if with_imagination_vk
+   subdir('imagination')
+ endif
+-if with_gallium_panfrost or with_gallium_lima or with_panfrost_vk or with_tools.contains('panfrost')
++if with_drivers_clc or with_gallium_panfrost or with_gallium_lima or with_panfrost_vk or with_tools.contains('panfrost')
+   subdir('panfrost')
+ endif
+ if with_microsoft_clc or with_gallium_d3d12 or with_spirv_to_dxil or with_microsoft_vk
+--- /dev/null
++++ b/src/panfrost/lib/kmod/pan_kmod_stub.h
+@@ -0,0 +1,27 @@
++/*
++ * Copyright © 2025 Collabora, Ltd.
++ *
++ * SPDX-License-Identifier: MIT
++ *
++ * Stub definitions for pan_kmod types when building without full DRM support.
++ * This allows building the panfrost precompilers on non-Linux hosts.
++ */
++
++#pragma once
++
++#include <stdint.h>
++
++#if defined(__cplusplus)
++extern "C" {
++#endif
++
++/* Minimal stub for pan_kmod_dev_props used by pan_desc.h inline functions */
++struct pan_kmod_dev_props {
++   uint32_t max_threads_per_core;
++   uint32_t max_tasks_per_core;
++   uint32_t max_threads_per_wg;
++};
++
++#if defined(__cplusplus)
++} /* extern C */
++#endif
+--- a/src/panfrost/lib/meson.build
++++ b/src/panfrost/lib/meson.build
+@@ -2,7 +2,9 @@
+ # Copyright © 2019 Collabora
+ # SPDX-License-Identifier: MIT
+-subdir('kmod')
++if with_gallium_panfrost or with_panfrost_vk
++  subdir('kmod')
++endif
+ pixel_format_versions = ['5', '6', '7', '9', '10', '12', '13']
+ libpanfrost_pixel_format = []
+@@ -21,18 +23,23 @@ foreach ver : pixel_format_versions
+ endforeach
+ libpanfrost_per_arch = []
++libpanfrost_per_arch_files = [ 'pan_blend.c', 'pan_texture.c' ]
++libpanfrost_per_arch_c_args = []
++
++if with_gallium_panfrost or with_panfrost_vk
++  libpanfrost_per_arch_files += 'pan_desc.c'
++  libpanfrost_per_arch_files += 'pan_mod.c'
++else
++  # Building without full driver support (e.g., for precompilers only)
++  # Use stub kmod definitions to avoid requiring DRM headers
++  libpanfrost_per_arch_c_args += '-DPAN_KMOD_STUB'
++endif
+ foreach ver : ['4', '5', '6', '7', '9', '10', '12', '13']
+   libpanfrost_per_arch += static_library(
+-    'pan-arch-v' + ver,
+-    [
+-      'pan_blend.c',
+-      'pan_desc.c',
+-      'pan_mod.c',
+-      'pan_texture.c',
+-    ],
++    'pan-arch-v' + ver, libpanfrost_per_arch_files,
+     include_directories : [inc_include, inc_src, inc_panfrost],
+-    c_args : ['-DPAN_ARCH=' + ver],
++    c_args : ['-DPAN_ARCH=' + ver] + libpanfrost_per_arch_c_args,
+     gnu_symbol_visibility : 'hidden',
+     dependencies : [deps_for_libpanfrost, idep_nir],
+   )
+@@ -49,26 +56,44 @@ libpanfrost_lib_files = files(
+   'pan_tiler.c',
+   'pan_layout.c',
+   'pan_scratch.c',
+-  'pan_props.c',
+   'pan_util.c',
+   'pan_afbc.c',
+ )
++if with_gallium_panfrost or with_panfrost_vk
++  libpanfrost_lib_files += files('pan_props.c')
++endif
++
++libpanfrost_link_with = [libpanfrost_pixel_format, libpanfrost_per_arch]
++if with_gallium_panfrost or with_panfrost_vk
++  libpanfrost_link_with += libpankmod_lib
++endif
++
++libpanfrost_lib_c_args = [no_override_init_args]
++if not (with_gallium_panfrost or with_panfrost_vk)
++  libpanfrost_lib_c_args += '-DPAN_KMOD_STUB'
++endif
++
+ libpanfrost_lib = static_library(
+   'panfrost_lib',
+   [libpanfrost_lib_files, pan_packers],
+   include_directories : [inc_include, inc_src, inc_panfrost],
+-  c_args : [no_override_init_args],
++  c_args : libpanfrost_lib_c_args,
+   gnu_symbol_visibility : 'hidden',
+   dependencies: [dep_libdrm, idep_nir, idep_mesautil],
+   build_by_default : false,
+-  link_with: [libpanfrost_pixel_format, libpanfrost_per_arch, libpankmod_lib],
++  link_with: libpanfrost_link_with,
+ )
++libpanfrost_dependencies = [deps_for_libpanfrost, idep_nir]
++if with_gallium_panfrost or with_panfrost_vk
++  libpanfrost_dependencies = libpankmod_dep
++endif
++
+ libpanfrost_dep = declare_dependency(
+   link_with: [libpanfrost_lib, libpanfrost_decode, libpanfrost_midgard, libpanfrost_bifrost, libpanfrost_pixel_format, libpanfrost_per_arch],
+   include_directories: [inc_include, inc_src, inc_panfrost],
+-  dependencies: [deps_for_libpanfrost, libpankmod_dep, idep_nir],
++  dependencies: libpanfrost_dependencies,
+ )
+ if with_tests
+--- a/src/panfrost/lib/pan_desc.h
++++ b/src/panfrost/lib/pan_desc.h
+@@ -30,7 +30,11 @@
+ #include "genxml/gen_macros.h"
++#if defined(PAN_KMOD_STUB)
++#include "kmod/pan_kmod_stub.h"
++#else
+ #include "kmod/pan_kmod.h"
++#endif
+ #include "pan_image.h"
+ #include "pan_pool.h"
+--- a/src/panfrost/meson.build
++++ b/src/panfrost/meson.build
+@@ -15,7 +15,7 @@ subdir('util')
+ subdir('midgard')
+ subdir('compiler')
+-if with_gallium_panfrost or with_panfrost_vk or with_tools.contains('panfrost')
++if with_drivers_clc or with_gallium_panfrost or with_panfrost_vk or with_tools.contains('panfrost')
+    subdir('genxml')
+    subdir('lib')
+    subdir('clc')
diff --git a/libs/mesa/patches/200-panfrost-precomp.patch b/libs/mesa/patches/200-panfrost-precomp.patch
deleted file mode 100644 (file)
index 3054a97..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
---- a/src/meson.build
-+++ b/src/meson.build
-@@ -91,7 +91,7 @@ endif
- if with_imagination_vk
-   subdir('imagination')
- endif
--if with_gallium_panfrost or with_gallium_lima or with_panfrost_vk or with_tools.contains('panfrost')
-+if with_drivers_clc or with_gallium_panfrost or with_gallium_lima or with_panfrost_vk or with_tools.contains('panfrost')
-   subdir('panfrost')
- endif
- if with_microsoft_clc or with_gallium_d3d12 or with_spirv_to_dxil or with_microsoft_vk
---- a/src/panfrost/lib/meson.build
-+++ b/src/panfrost/lib/meson.build
-@@ -3,7 +3,9 @@
- # SPDX-License-Identifier: MIT
- subdir('genxml')
--subdir('kmod')
-+if with_gallium_panfrost or with_panfrost_vk
-+  subdir('kmod')
-+endif
- pixel_format_versions = ['5', '6', '7', '9', '10', '12', '13']
- libpanfrost_pixel_format = []
-@@ -22,16 +24,14 @@ foreach ver : pixel_format_versions
- endforeach
- libpanfrost_per_arch = []
-+libpanfrost_per_arch_files = [ 'pan_blend.c', 'pan_shader.c', 'pan_texture.c' ]
-+if with_gallium_panfrost or with_panfrost_vk
-+  libpanfrost_per_arch_files += 'pan_desc.c'
-+endif
- foreach ver : ['4', '5', '6', '7', '9', '10', '12', '13']
-   libpanfrost_per_arch += static_library(
--    'pan-arch-v' + ver,
--    [
--      'pan_blend.c',
--      'pan_desc.c',
--      'pan_shader.c',
--      'pan_texture.c',
--    ],
-+    'pan-arch-v' + ver, libpanfrost_per_arch_files,
-     include_directories : [inc_include, inc_src],
-     c_args : ['-DPAN_ARCH=' + ver],
-     gnu_symbol_visibility : 'hidden',
-@@ -63,10 +63,18 @@ libpanfrost_lib_files = files(
-   'pan_tiler.c',
-   'pan_layout.c',
-   'pan_scratch.c',
--  'pan_props.c',
-   'pan_util.c',
- )
-+if with_gallium_panfrost or with_panfrost_vk
-+  libpanfrost_lib_files += files('pan_props.c')
-+endif
-+
-+libpanfrost_link_with = [libpanfrost_pixel_format, libpanfrost_per_arch]
-+if with_gallium_panfrost or with_panfrost_vk
-+  libpanfrost_link_with += libpankmod_lib
-+endif
-+
- libpanfrost_lib = static_library(
-   'panfrost_lib',
-   [libpanfrost_lib_files, pan_packers],
-@@ -75,13 +83,18 @@ libpanfrost_lib = static_library(
-   gnu_symbol_visibility : 'hidden',
-   dependencies: [dep_libdrm, idep_nir, idep_mesautil],
-   build_by_default : false,
--  link_with: [libpanfrost_pixel_format, libpanfrost_per_arch, libpankmod_lib],
-+  link_with: libpanfrost_link_with,
- )
-+libpanfrost_dependencies = [deps_for_libpanfrost, idep_nir]
-+if with_gallium_panfrost or with_panfrost_vk
-+  libpanfrost_dependencies = libpankmod_dep
-+endif
-+
- libpanfrost_dep = declare_dependency(
-   link_with: [libpanfrost_lib, libpanfrost_decode, libpanfrost_midgard, libpanfrost_bifrost, libpanfrost_pixel_format, libpanfrost_per_arch],
-   include_directories: [inc_include, inc_src, inc_panfrost],
--  dependencies: [deps_for_libpanfrost, libpankmod_dep, idep_nir],
-+  dependencies: libpanfrost_dependencies,
- )
- if with_tests
---- a/src/panfrost/meson.build
-+++ b/src/panfrost/meson.build
-@@ -15,7 +15,7 @@ subdir('util')
- subdir('midgard')
- subdir('compiler')
--if with_gallium_panfrost or with_panfrost_vk or with_tools.contains('panfrost')
-+if with_drivers_clc or with_gallium_panfrost or with_panfrost_vk or with_tools.contains('panfrost')
-    subdir('lib')
-    subdir('clc')
- endif