mesa: update to 26.0.6, add virtio + teflon (rocket / etnaviv)

Bump mesa from 25.2.4 to latest stable point release in the 26.0.x
series.

Drop 001-gallivm-support-LLVM-21.patch which has been merged
upstream. Refresh the remaining downstream patches
(100-meson-allow-using-LLVM-as-embedded-project,
200-panfrost-Enable-cross-compilation-of-precompilers-on) for
the new upstream context.

Add +libdisplay-info to the DEPENDS of every libvulkan-* package
(broadcom, imagination, intel, intel-hasvk, lvp, panfrost, radeon,
virtio): Mesa 26.0 unconditionally pulls libdisplay-info into the
WSI Vulkan path on Linux (gated only by host_machine.system() ==
'windows'), so every ICD now NEEDED-links libdisplay-info.so.3
and OpenWrt's shlibs check rejects packages without the explicit
dependency. libvulkan-nouveau is @BROKEN (needs Rust) so it does
not get touched.

The 'imagination-experimental' vulkan-drivers value got renamed to
plain 'imagination' in Mesa 26; update the VULKAN_DRIVERS entry
accordingly.

Add 'imagination' to the host build's -Dtools= list so the
PowerVR pco_clc precompiler is built and installed into
$(STAGING_DIR_HOSTPKG)/bin/ during the host-build stage. The
target vulkan variant uses -Dprecomp-compiler=system and looks
the binary up there via find_program('pco_clc', native:true);
without this, the target configure stage fails with
"Program 'pco_clc' not found or not executable" as soon as the
imagination vulkan driver enters the gallium tree.

New packages:

* libvulkan-virtio: the venus virtio-gpu Vulkan ICD, useful for
  VM/container guests forwarding Vulkan to a host GPU. Mirrors the
  libvulkan-lvp install pattern. Wired via VULKAN_DRIVERS+=virtio.

* libteflon-rocket and libteflon-etnaviv: two flavours of mesa's
  "teflon" TensorFlow Lite delegate. teflon links one or more NPU
  back-ends from gallium into a libteflon.so that TFLite loads as
  an external delegate. The two variants here cover the NPU silicon
  found on OpenWrt-supported hardware:

  - rocket: Rockchip RKNPU on RK3566 / RK3568 / RK3588(s)
    (rockchip/armv8 target).
  - etnaviv: VeriSilicon VIP9000-class NPU on NXP i.MX 8M Plus and
    i.MX 95 (imx/cortexa53 target).

  The Arm Ethos-U back-end is omitted; it targets Cortex-M55 MCUs
  which OpenWrt does not run on.

  Each variant is its own VARIANT= mesa build with
  -Dgallium-drivers=<rocket|etnaviv> -Dteflon=true; both produce
  /usr/lib/libteflon.so so the two packages declare each other as
  CONFLICTS (typical OpenWrt mesa-variant pattern).

A small downstream patch (300-teflon-conditional-npu-drivers.patch)
adjusts src/gallium/targets/teflon/meson.build so that the
driver_etnaviv / driver_rocket / driver_ethosu link_with entries
are conditional on with_gallium_<X> instead of unconditional.
Without it, building libteflon with only one back-end fails because
the other driver_X meson variables are undefined when the
corresponding gallium-driver is not selected.

Add 400-gallivm-lp-bld-misc-auto-iter-llvm22.patch to fix the
32-bit ARM build with the new LLVM 22. lp_bld_misc.cpp's
DETECT_ARCH_ARM branch (only reached on ARM-32) iterates the
feature StringMap with an explicit 'llvm::StringMapIterator<bool>'
type, which LLVM 22 renamed to 'llvm::StringMapIterBase<T, bool>'.
Use 'auto' for the iterator declaration so the code works
regardless of the LLVM major. Other targets (aarch64, x86,
x86_64, mips, ppc, riscv) are unaffected because the failing
loop is gated on DETECT_ARCH_ARM.

Disable -Dllvm and -Ddraw-use-llvm in the per-variant MESON_ARGS
for the gallium drivers where the aux 'draw' module is *dead
code*: softpipe, broadcom (vc4/v3d), lima, etnaviv,
teflon-rocket and teflon-etnaviv. Confirmed by inspecting
26.0.6 source: each of v3d, vc4, lima, etnaviv, panfrost (and
the NPU-only rocket/etnaviv teflon paths) registers its own
pipe_context->draw_vbo and never calls any draw_* aux-module
function (0 draw_create, 0 draw_set_so_targets, 0
draw_set_indirect_buffer, 0 draw_*_geometry, 0 src includes of
draw/*.h apart from one unused header in pan_screen.c).
Transform feedback, geometry shaders and indirect draws are
handled either in hardware or via the driver's own compute path,
never through the aux-draw module. softpipe and llvmpipe are the
only consumers of the aux-draw module; mesa.meson.build also
forces draw-use-llvm=true for llvmpipe/lavapipe/i915/r300-x86.

Net effect on libgallium-26.0.6.so, measured on
arm_cortex-a7+neon-vfpv4 (mediatek/mt7623):

  variant   libgallium before    libgallium after    .apk after
  ----------------------------------------------------------------
  softpipe        57.7 MB             16 MB           2.9 MB
  broadcom        57.7 MB             16 MB           3.2 MB
  lima            57.7 MB             16 MB           3.0 MB
  etnaviv         57.7 MB             16 MB           2.9 MB
  teflon-rocket   ~57 MB             ~16 MB           varies
  teflon-etnaviv  ~57 MB             ~16 MB           varies
  llvmpipe        57.9 MB             55-56 MB        15 MB    (unchanged - keeps LLVM)

LLVM-related strings in the LLVM-disabled variants drop from
208/220 to 5 (just stub strings that survive in the no-LLVM
draw path). The 41 MB removed from each was statically-linked
LLVM JIT that no code path in those drivers ever executed.

Relax the build-time dependency on llvm-mesa: a user who
selects only LLVM-free Mesa variants (softpipe/broadcom/lima/
etnaviv/teflon-*) no longer needs to build the entire llvm-mesa
package (which can take 30+ minutes from source). MESA_USE_LLVM
remains a user-visible toggle (defaults y for backward compat).
With CONFIG_MESA_USE_LLVM=n:

 * HOST_BUILD_DEPENDS drops the unconditional 'llvm' (now
   MESA_USE_LLVM:llvm), matching PKG_BUILD_DEPENDS.
 * MESON_HOST_ARGS skips -Dllvm/-Dmesa-clc/-Dprecomp-compiler/
   -Dstatic-libclc/-Dinstall-mesa-clc/-Dinstall-precomp-compiler
   and trims -Dtools to just 'nir'.
 * Host/Configure factors its LLVM-subproject linkage into a
   Host/Configure/LLVMMesa hook, mirroring the existing
   Build/Configure/LLVMMesa pattern.

Tested locally on arm_cortex-a7+neon-vfpv4 (mediatek/mt7623):

 * MESA_USE_LLVM=y, libmesa-softpipe + libmesa-llvmpipe: builds
   llvm-mesa, then mesa softpipe (38s, no-LLVM libgallium) and
   llvmpipe (42s, LLVM-linked libgallium 56 MB). All correct.

 * MESA_USE_LLVM=n, libmesa-softpipe only: 0 llvm/compile
   invocations, 0 mesa/host-compile invocations, total mesa
   build time 38s. libmesa-softpipe .apk identical (2.9 MB) to
   the MESA_USE_LLVM=y case.

Link: https://docs.mesa3d.org/relnotes/26.0.6.html
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle
2026-05-09 01:37:16 +01:00
parent 26e03d11a0
commit 9e78fb7a91
6 changed files with 211 additions and 85 deletions
+140 -24
View File
@@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mesa
PKG_VERSION:=25.2.4
PKG_RELEASE:=3
PKG_VERSION:=26.0.6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://archive.mesa3d.org/
PKG_HASH:=a370b4c549cbfbe646b319e34d73edb50ed883978f5e95133f282f0eae39ab52
PKG_HASH:=1d3c3b8a8363b8cc354175bb4a684ad8b035211cc1d6fa17aeb9b9623c513f89
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
PKG_LICENSE:=BSD-3-Clause
@@ -16,7 +16,7 @@ PKG_INSTALL:=1
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
HOST_BUILD_DEPENDS:=python3/host spirv-tools/host MESA_USE_LLVM:llvm
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_libmesa-amd \
@@ -38,7 +38,10 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_libvulkan-lvp \
CONFIG_PACKAGE_libvulkan-nouveau \
CONFIG_PACKAGE_libvulkan-panfrost \
CONFIG_PACKAGE_libvulkan-radeon
CONFIG_PACKAGE_libvulkan-radeon \
CONFIG_PACKAGE_libvulkan-virtio \
CONFIG_PACKAGE_libteflon-rocket \
CONFIG_PACKAGE_libteflon-etnaviv
TARGET_CPPFLAGS+=-Wno-format -Wno-format-security
@@ -80,6 +83,14 @@ config MESA_USE_LLVM
bool "Use LLVM to build MESA"
depends on aarch64||arm||i386||i686||loongarch64||mips||mipsel||mips64||mips64el||riscv64||x86_64
default y
help
Build LLVM (the heavy 'llvm-mesa' static archive) and link it
into the LLVM-using Mesa variants (amd, intel, tegra, nouveau,
panfrost, virgl, zink, llvmpipe and all libvulkan-*). When
disabled, only the LLVM-free variants (softpipe, broadcom,
lima, etnaviv, libteflon-*) are buildable, but the llvm-mesa
build is skipped entirely - much faster source builds at the
cost of losing the LLVM-using variants.
endef
define Package/libmesa/Default
@@ -317,7 +328,7 @@ endef
define Package/libvulkan-broadcom
$(call Package/mesa/Default)
DEPENDS+=+libdrm +libexpat +libstdcpp +libudev +libwayland +libzstd +zlib \
DEPENDS+=+libdisplay-info +libdrm +libexpat +libstdcpp +libudev +libwayland +libzstd +zlib \
@(arm||aarch64) @HAS_FPU
TITLE+= Broadcom Vulkan driver
VARIANT:=vulkan
@@ -330,7 +341,7 @@ endef
define Package/libvulkan-imagination
$(call Package/mesa/Default)
DEPENDS+=+libatomic +libdrm +libexpat +libstdcpp +libudev +libwayland +libzstd \
DEPENDS+=+libatomic +libdisplay-info +libdrm +libexpat +libstdcpp +libudev +libwayland +libzstd \
+zlib @(aarch64||arm||mips||mips64||mipsel||mips64el||riscv64)
TITLE+= Imagination PowerVR driver (EXPERIMENTAL)
VARIANT:=vulkan
@@ -354,7 +365,7 @@ endef
define Package/libvulkan-intel
$(call Package/mesa/Default)
DEPENDS+=+libdrm-intel +libexpat +libstdcpp +libudev +libwayland +libzstd +zlib \
DEPENDS+=+libdisplay-info +libdrm-intel +libexpat +libstdcpp +libudev +libwayland +libzstd +zlib \
@(i386||i686||x86_64) @MESA_USE_LLVM
TITLE+= Intel Gen9+ Vulkan driver
VARIANT:=vulkan
@@ -367,7 +378,7 @@ endef
define Package/libvulkan-intel-hasvk
$(call Package/mesa/Default)
DEPENDS+=+libdrm-intel +libexpat +libstdcpp +libudev +libwayland +libzstd +zlib \
DEPENDS+=+libdisplay-info +libdrm-intel +libexpat +libstdcpp +libudev +libwayland +libzstd +zlib \
@(i386||i686||x86_64) @MESA_USE_LLVM
TITLE+= Intel Gen7/Gen8 Vulkan driver
VARIANT:=vulkan
@@ -380,7 +391,7 @@ endef
define Package/libvulkan-lvp
$(call Package/mesa/Default)
DEPENDS+=+libatomic +libdrm +libstdcpp +libudev +libwayland +libzstd +zlib @MESA_USE_LLVM
DEPENDS+=+libatomic +libdisplay-info +libdrm +libstdcpp +libudev +libwayland +libzstd +zlib @MESA_USE_LLVM
TITLE+= LLVM JIT CPU rendering Vulkan driver
VARIANT:=vulkan
endef
@@ -409,7 +420,7 @@ endef
define Package/libvulkan-panfrost
$(call Package/mesa/Default)
DEPENDS+=+libdrm +libexpat +libstdcpp +libudev +libwayland +libzstd +zlib \
DEPENDS+=+libdisplay-info +libdrm +libexpat +libstdcpp +libudev +libwayland +libzstd +zlib \
@(arm||aarch64) @MESA_USE_LLVM
TITLE+= ARM Mali Midgard/Bifrost/Valhall Vulkan driver
VARIANT:=vulkan
@@ -423,7 +434,7 @@ endef
define Package/libvulkan-radeon
$(call Package/mesa/Default)
TITLE+= AMD Radeon Vulkan driver
DEPENDS+=+libdrm-amdgpu +libelf +libexpat +libstdcpp +libudev +libwayland \
DEPENDS+=+libdisplay-info +libdrm-amdgpu +libelf +libexpat +libstdcpp +libudev +libwayland \
+libzstd +zlib @MESA_USE_LLVM
VARIANT:=vulkan
endef
@@ -432,12 +443,53 @@ define Package/libvulkan-radeon/description
RADV is a Vulkan driver for AMD GCN/RDNA GPUs.
endef
define Package/libvulkan-virtio
$(call Package/mesa/Default)
TITLE+= virtio-gpu Vulkan driver (venus)
DEPENDS+=+libdisplay-info +libdrm +libstdcpp +libudev +libwayland +libzstd +zlib
VARIANT:=vulkan
endef
define Package/libvulkan-virtio/description
Venus is a Vulkan driver for virtio-gpu, used inside virtual machines
to forward Vulkan API calls to a Vulkan-capable GPU on the host via
the virtio-gpu transport.
endef
define Package/libteflon-rocket
$(call Package/mesa/Default)
TITLE+= TFLite delegate for Rockchip RKNPU (rocket)
DEPENDS+=+libdrm +libexpat @aarch64
VARIANT:=teflon-rocket
CONFLICTS:=libteflon-etnaviv
endef
define Package/libteflon-rocket/description
Mesa's "teflon" TensorFlow Lite delegate, built with the Rockchip
RKNPU (rocket) backend. Provides hardware-accelerated TFLite
inference on Rockchip RK3566 / RK3568 / RK3588(s) NPUs.
endef
define Package/libteflon-etnaviv
$(call Package/mesa/Default)
TITLE+= TFLite delegate for VeriSilicon NPU (etnaviv)
DEPENDS+=+libdrm-etnaviv +libexpat +libzstd +zlib @aarch64
VARIANT:=teflon-etnaviv
CONFLICTS:=libteflon-rocket
endef
define Package/libteflon-etnaviv/description
Mesa's "teflon" TensorFlow Lite delegate, built with the etnaviv
backend for VeriSilicon VIP9000-class NPUs (e.g. NXP i.MX 8M Plus,
i.MX 95).
endef
ifneq ($(CONFIG_PACKAGE_libvulkan-broadcom),)
VULKAN_DRIVERS+=broadcom
endif
ifneq ($(CONFIG_PACKAGE_libvulkan-imagination),)
VULKAN_DRIVERS+=imagination-experimental
VULKAN_DRIVERS+=imagination
endif
ifneq ($(CONFIG_PACKAGE_libvulkan-intel),)
@@ -464,6 +516,10 @@ ifneq ($(CONFIG_PACKAGE_libvulkan-radeon),)
VULKAN_DRIVERS+=amd
endif
ifneq ($(CONFIG_PACKAGE_libvulkan-virtio),)
VULKAN_DRIVERS+=virtio
endif
MESON_HOST_ARGS += \
-Dplatforms= \
-Dglx=disabled \
@@ -478,16 +534,26 @@ MESON_HOST_ARGS += \
-Dvalgrind=disabled \
-Dgallium-drivers= \
-Dvulkan-drivers= \
-Dtools=nir \
-Dshared-llvm=disabled \
-Ddraw-use-llvm=false \
-Dintel-elk=true
ifneq ($(CONFIG_MESA_USE_LLVM),)
MESON_HOST_ARGS += \
-Dtools=nir,imagination \
-Dllvm=enabled \
-Dmesa-clc=enabled \
-Dprecomp-compiler=enabled \
-Dshared-llvm=disabled \
-Ddraw-use-llvm=false \
-Dintel-elk=true \
-Dstatic-libclc=all \
-Dinstall-mesa-clc=true \
-Dinstall-precomp-compiler=true
else
MESON_HOST_ARGS += \
-Dtools=nir \
-Dllvm=disabled \
-Dmesa-clc=disabled \
-Dprecomp-compiler=disabled
endif
MESON_ARGS += \
-Dplatforms=wayland \
@@ -526,12 +592,16 @@ endif
ifeq ($(BUILD_VARIANT),etnaviv)
MESON_ARGS += \
-Dgallium-drivers=etnaviv
-Dgallium-drivers=etnaviv \
-Dllvm=disabled \
-Ddraw-use-llvm=false
endif
ifeq ($(BUILD_VARIANT),broadcom)
MESON_ARGS += \
-Dgallium-drivers=vc4,v3d
-Dgallium-drivers=vc4,v3d \
-Dllvm=disabled \
-Ddraw-use-llvm=false
endif
ifeq ($(BUILD_VARIANT),nouveau)
@@ -541,7 +611,9 @@ endif
ifeq ($(BUILD_VARIANT),lima)
MESON_ARGS += \
-Dgallium-drivers=lima
-Dgallium-drivers=lima \
-Dllvm=disabled \
-Ddraw-use-llvm=false
endif
ifeq ($(BUILD_VARIANT),panfrost)
@@ -561,7 +633,25 @@ endif
ifeq ($(BUILD_VARIANT),softpipe)
MESON_ARGS += \
-Dgallium-drivers=softpipe
-Dgallium-drivers=softpipe \
-Dllvm=disabled \
-Ddraw-use-llvm=false
endif
ifeq ($(BUILD_VARIANT),teflon-rocket)
MESON_ARGS += \
-Dgallium-drivers=rocket \
-Dteflon=true \
-Dllvm=disabled \
-Ddraw-use-llvm=false
endif
ifeq ($(BUILD_VARIANT),teflon-etnaviv)
MESON_ARGS += \
-Dgallium-drivers=etnaviv \
-Dteflon=true \
-Dllvm=disabled \
-Ddraw-use-llvm=false
endif
ifeq ($(BUILD_VARIANT),vulkan)
@@ -581,8 +671,8 @@ endif
TARGET_CFLAGS += -I$(MESON_BUILD_DIR)/src/broadcom/
define Host/Configure
$(call Py3Build/InstallBuildDepends)
ifneq ($(CONFIG_MESA_USE_LLVM),)
define Host/Configure/LLVMMesa
$(INSTALL_DIR) $(HOST_BUILD_DIR)/subprojects/llvm
$(LN) $(STAGING_DIR_HOST)/llvm-mesa/bin $(HOST_BUILD_DIR)/subprojects/llvm
$(LN) $(STAGING_DIR_HOST)/llvm-mesa/include $(HOST_BUILD_DIR)/subprojects/llvm
@@ -601,6 +691,15 @@ define Host/Configure
$(STAGING_DIR_HOST)/llvm-mesa/lib/clang/*/include/opencl-c.h \
$(STAGING_DIR_HOST)/llvm-mesa/lib/clang/*/include/opencl-c-base.h \
$(HOST_BUILD_DIR)/src/compiler/clc
endef
else
define Host/Configure/LLVMMesa
endef
endif
define Host/Configure
$(call Py3Build/InstallBuildDepends)
$(call Host/Configure/LLVMMesa)
$(call Host/Configure/Meson)
endef
@@ -676,7 +775,6 @@ endef
define Package/libvulkan-imagination/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libvulkan_powervr_mesa.so $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpowervr_rogue.so $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/share/vulkan/icd.d
$(CP) $(PKG_INSTALL_DIR)/usr/share/vulkan/icd.d/powervr_mesa_icd.*.json $(1)/usr/share/vulkan/icd.d
endef
@@ -716,6 +814,21 @@ define Package/libvulkan-panfrost/install
$(CP) $(PKG_INSTALL_DIR)/usr/share/vulkan/icd.d/panfrost_icd.*.json $(1)/usr/share/vulkan/icd.d
endef
define Package/libvulkan-virtio/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libvulkan_virtio.so $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/share/vulkan/icd.d
$(CP) $(PKG_INSTALL_DIR)/usr/share/vulkan/icd.d/virtio_icd.*.json $(1)/usr/share/vulkan/icd.d
endef
define Package/libteflon/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libteflon.so $(1)/usr/lib
endef
Package/libteflon-rocket/install = $(Package/libteflon/install)
Package/libteflon-etnaviv/install = $(Package/libteflon/install)
Package/libmesa-intel/install = $(Package/libmesa/install)
Package/libmesa-amd/install = $(Package/libmesa/install)
Package/libmesa-tegra/install = $(Package/libmesa/install)
@@ -750,4 +863,7 @@ $(eval $(call BuildPackage,libvulkan-lvp))
$(eval $(call BuildPackage,libvulkan-nouveau))
$(eval $(call BuildPackage,libvulkan-panfrost))
$(eval $(call BuildPackage,libvulkan-radeon))
$(eval $(call BuildPackage,libvulkan-virtio))
$(eval $(call BuildPackage,libteflon-rocket))
$(eval $(call BuildPackage,libteflon-etnaviv))
$(eval $(call HostBuild))
@@ -1,49 +0,0 @@
From cd129dbf8af2d16b1243f2ce287ff69c6a5dc557 Mon Sep 17 00:00:00 2001
From: no92 <no92.mail@gmail.com>
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 <david@ixit.cz>
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,
@@ -10,7 +10,7 @@ Subject: [PATCH 1/2] meson: allow using LLVM as embedded project
--- a/meson.build
+++ b/meson.build
@@ -1748,17 +1748,29 @@ _shared_llvm = get_option('shared-llvm')
@@ -1841,17 +1841,29 @@ _shared_llvm = get_option('shared-llvm')
.disable_auto_if(host_machine.system() == 'windows') \
.allowed()
@@ -51,7 +51,7 @@ Subject: [PATCH 1/2] meson: allow using LLVM as embedded project
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
@@ -1938,7 +1950,11 @@ endif
dep_clang = null_dep
if with_clc
@@ -45,8 +45,8 @@ while maintaining full backward compatibility for regular driver builds.
--- a/src/meson.build
+++ b/src/meson.build
@@ -93,7 +93,7 @@ endif
if with_imagination_vk
@@ -92,7 +92,7 @@ endif
if with_imagination_vk or with_tools.contains('imagination')
subdir('imagination')
endif
-if with_gallium_panfrost or with_gallium_lima or with_panfrost_vk or with_tools.contains('panfrost')
@@ -56,7 +56,7 @@ while maintaining full backward compatibility for regular driver builds.
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 @@
@@ -0,0 +1,29 @@
+/*
+ * Copyright © 2025 Collabora, Ltd.
+ *
@@ -74,8 +74,10 @@ while maintaining full backward compatibility for regular driver builds.
+extern "C" {
+#endif
+
+/* Minimal stub for pan_kmod_dev_props used by pan_desc.h inline functions */
+/* Minimal stub for pan_kmod_dev_props used by pan_desc.h and pan_image.h
+ * inline functions */
+struct pan_kmod_dev_props {
+ uint32_t gpu_id;
+ uint32_t max_threads_per_core;
+ uint32_t max_tasks_per_core;
+ uint32_t max_threads_per_wg;
@@ -129,7 +131,7 @@ while maintaining full backward compatibility for regular driver builds.
gnu_symbol_visibility : 'hidden',
dependencies : [deps_for_libpanfrost, idep_nir],
)
@@ -49,26 +56,44 @@ libpanfrost_lib_files = files(
@@ -48,26 +55,44 @@ libpanfrost_lib_files = files(
'pan_tiler.c',
'pan_layout.c',
'pan_scratch.c',
@@ -159,7 +161,7 @@ while maintaining full backward compatibility for regular driver builds.
- c_args : [no_override_init_args],
+ c_args : libpanfrost_lib_c_args,
gnu_symbol_visibility : 'hidden',
dependencies: [dep_libdrm, idep_nir, idep_mesautil],
dependencies: [dep_libdrm, idep_nir, idep_mesautil, libpanfrost_model_dep],
build_by_default : false,
- link_with: [libpanfrost_pixel_format, libpanfrost_per_arch, libpankmod_lib],
+ link_with: libpanfrost_link_with,
@@ -171,7 +173,7 @@ while maintaining full backward compatibility for regular driver builds.
+endif
+
libpanfrost_dep = declare_dependency(
link_with: [libpanfrost_lib, libpanfrost_decode, libpanfrost_midgard, libpanfrost_bifrost, libpanfrost_pixel_format, libpanfrost_per_arch],
link_with: [libpanfrost_lib, libpanfrost_decode, libpanfrost_compiler, 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,
@@ -180,7 +182,7 @@ while maintaining full backward compatibility for regular driver builds.
if with_tests
--- a/src/panfrost/lib/pan_desc.h
+++ b/src/panfrost/lib/pan_desc.h
@@ -30,7 +30,11 @@
@@ -8,7 +8,11 @@
#include "genxml/gen_macros.h"
@@ -194,8 +196,8 @@ while maintaining full backward compatibility for regular driver builds.
--- a/src/panfrost/meson.build
+++ b/src/panfrost/meson.build
@@ -15,7 +15,7 @@ subdir('util')
subdir('midgard')
@@ -14,7 +14,7 @@ subdir('shared')
subdir('model')
subdir('compiler')
-if with_gallium_panfrost or with_panfrost_vk or with_tools.contains('panfrost')
@@ -203,3 +205,17 @@ while maintaining full backward compatibility for regular driver builds.
subdir('genxml')
subdir('lib')
subdir('clc')
--- a/src/panfrost/lib/pan_image.h
+++ b/src/panfrost/lib/pan_image.h
@@ -18,7 +18,11 @@
#include "pan_mod.h"
#include "pan_props.h"
+#if defined(PAN_KMOD_STUB)
+#include "kmod/pan_kmod_stub.h"
+#else
#include "kmod/pan_kmod.h"
+#endif
#include "util/log.h"
@@ -0,0 +1,32 @@
--- a/src/gallium/targets/teflon/meson.build
+++ b/src/gallium/targets/teflon/meson.build
@@ -1,3 +1,14 @@
+teflon_deps = [idep_nir, idep_mesautil]
+if with_gallium_etnaviv
+ teflon_deps += driver_etnaviv
+endif
+if with_gallium_rocket
+ teflon_deps += driver_rocket
+endif
+if with_gallium_ethosu
+ teflon_deps += driver_ethosu
+endif
+
libteflon = shared_library(
'teflon',
[ 'teflon_target.c' ],
@@ -6,13 +17,7 @@ libteflon = shared_library(
link_with : [libpipe_loader_static, libws_null, libwsw, libswdri, libswkmsdri, libgallium ],
gnu_symbol_visibility : 'hidden',
link_args : ld_args_build_id,
- dependencies : [
- driver_etnaviv,
- driver_rocket,
- driver_ethosu,
- idep_nir,
- idep_mesautil,
- ],
+ dependencies : teflon_deps,
install : true,
)
@@ -0,0 +1,11 @@
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -331,7 +331,7 @@ lp_build_fill_mattrs(std::vector<std::st
llvm::sys::getHostCPUFeatures(features);
#endif
- for (llvm::StringMapIterator<bool> f = features.begin();
+ for (auto f = features.begin();
f != features.end();
++f) {
MAttrs.push_back(((*f).second ? "+" : "-") + (*f).first().str());