diff --git a/packages/graphics/mesa/package.mk b/packages/graphics/mesa/package.mk index 7e334fa639..2dc9c56a32 100644 --- a/packages/graphics/mesa/package.mk +++ b/packages/graphics/mesa/package.mk @@ -13,6 +13,12 @@ PKG_LONGDESC="Mesa is a 3-D graphics library with an API." PKG_TOOLCHAIN="meson" PKG_BUILD_FLAGS="+lto" +if listcontains "${GRAPHIC_DRIVERS}" "(lima|panfrost)"; then + PKG_VERSION="659aa3dd6519f64379e91ca97fe184434fd7fdee" # master-19.2 + PKG_SHA256="7152dd8c780e47c4e5e18ebaa47fd4f8fe116b43012affda2f964ae23b324d34" + PKG_URL="https://gitlab.freedesktop.org/mesa/mesa/-/archive/$PKG_VERSION/mesa-$PKG_VERSION.tar.gz" +fi + get_graphicdrivers PKG_MESON_OPTS_TARGET="-Ddri-drivers=${DRI_DRIVERS// /,} \ @@ -90,6 +96,21 @@ pre_configure_target() { if [ "$DISPLAYSERVER" = "x11" ]; then export LIBS="-lxcb-dri3 -lxcb-dri2 -lxcb-xfixes -lxcb-present -lxcb-sync -lxshmfence -lz" fi + + # Temporary hack (until panfrost evolves) to use 64-bit pointers in structs passed to GPU + # even if userspace is 32-bit. This is required for Mali-T8xx to work with mesa built for + # arm userspace. The hack does not affect building for aarch64. + if [[ "${MALI_FAMILY}" = *t8* ]]; then + ( + cd "$PKG_BUILD/src/gallium/drivers/panfrost" + sed -i 's/uintptr_t/uint64_t/g' include/panfrost-job.h \ + include/panfrost-misc.h \ + pan_context.c \ + pandecode/decode.c + + find -type f -exec sed -i 's/ndef __LP64__/ 0/g; s/def __LP64__/ 1/g' {} +; + ) + fi } post_makeinstall_target() {