user/mesa: new aport
Some checks failed
/ lint (pull_request) Successful in 28s
/ deploy-x86_64 (pull_request) Has been cancelled
/ build-x86_64 (pull_request) Has been cancelled
/ deploy-aarch64 (pull_request) Successful in 1m40s
/ build-aarch64 (pull_request) Successful in 24m8s

This commit is contained in:
Antoine Martin 2025-01-07 00:48:57 -05:00
parent fafce64d02
commit 51859a0f35
Signed by: forge
GPG key ID: D62A472A4AA7D541
4 changed files with 646 additions and 0 deletions

181
user/mesa/32535.patch Normal file
View file

@ -0,0 +1,181 @@
From 35852799aef8efdb4516c51913f86cd7d795a8d7 Mon Sep 17 00:00:00 2001
From: Simon Ser <contact@emersion.fr>
Date: Sat, 7 Dec 2024 13:10:04 +0100
Subject: [PATCH 1/3] dri: don't fetch X11 modifiers if we don't support them
If we supply modifiers to dri_create_image_with_modifiers() and
the driver doesn't support them, the function will fail. The X11
server always supports implicit modifiers so we can always fall
back to that.
Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 4c065158927d ("dri: revert INVALID modifier special-casing")
---
src/gallium/frontends/dri/loader_dri3_helper.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gallium/frontends/dri/loader_dri3_helper.c b/src/gallium/frontends/dri/loader_dri3_helper.c
index 268ec3d86c8a3..e1f51619c5fa3 100644
--- a/src/gallium/frontends/dri/loader_dri3_helper.c
+++ b/src/gallium/frontends/dri/loader_dri3_helper.c
@@ -36,9 +36,11 @@
#include "loader_dri_helper.h"
#include "loader_dri3_helper.h"
+#include "pipe/p_screen.h"
#include "util/macros.h"
#include "util/simple_mtx.h"
#include "drm-uapi/drm_fourcc.h"
+#include "dri_screen.h"
#include "dri_util.h"
/**
@@ -1401,7 +1403,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int fourcc,
if (draw->dri_screen_render_gpu == draw->dri_screen_display_gpu) {
#ifdef HAVE_X11_DRM
- if (draw->multiplanes_available) {
+ if (draw->multiplanes_available && draw->dri_screen_render_gpu->base.screen->resource_create_with_modifiers) {
xcb_dri3_get_supported_modifiers_cookie_t mod_cookie;
xcb_dri3_get_supported_modifiers_reply_t *mod_reply;
xcb_generic_error_t *error = NULL;
--
GitLab
From 3c78ff12864e87d5a293cea55ebd1ae9ca3e6df0 Mon Sep 17 00:00:00 2001
From: Simon Ser <contact@emersion.fr>
Date: Sat, 7 Dec 2024 13:12:40 +0100
Subject: [PATCH 2/3] egl/wayland: only supply LINEAR modifier when supported
If we supply modifiers to dri_create_image_with_modifiers() and
the driver doesn't support them, the function will fail. We pass
__DRI_IMAGE_USE_LINEAR anyways so stripping the modifier is fine.
Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 4c065158927d ("dri: revert INVALID modifier special-casing")
---
src/egl/drivers/dri2/platform_wayland.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 513d2d0709b14..472665a36b0dd 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -45,11 +45,13 @@
#include "util/u_vector.h"
#include "util/format/u_formats.h"
#include "main/glconfig.h"
+#include "pipe/p_screen.h"
#include "egl_dri2.h"
#include "eglglobals.h"
#include "kopper_interface.h"
#include "loader.h"
#include "loader_dri_helper.h"
+#include "dri_screen.h"
#include "dri_util.h"
#include <loader_wayland_helper.h>
@@ -1193,14 +1195,25 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
if (dri2_dpy->fd_render_gpu != dri2_dpy->fd_display_gpu &&
dri2_surf->back->linear_copy == NULL) {
uint64_t linear_mod = DRM_FORMAT_MOD_LINEAR;
+ const uint64_t *render_modifiers = NULL, *display_modifiers = NULL;
+ unsigned int render_num_modifiers = 0, display_num_modifiers = 0;
struct dri_image *linear_copy_display_gpu_image = NULL;
+ if (dri2_dpy->dri_screen_render_gpu->base.screen->resource_create_with_modifiers) {
+ render_modifiers = &linear_mod;
+ render_num_modifiers = 1;
+ }
+ if (dri2_dpy->dri_screen_display_gpu->base.screen->resource_create_with_modifiers) {
+ display_modifiers = &linear_mod;
+ display_num_modifiers = 1;
+ }
+
if (dri2_dpy->dri_screen_display_gpu) {
linear_copy_display_gpu_image = dri_create_image_with_modifiers(
dri2_dpy->dri_screen_display_gpu,
dri2_surf->base.Width, dri2_surf->base.Height,
linear_pipe_format, use_flags | __DRI_IMAGE_USE_LINEAR,
- &linear_mod, 1, NULL);
+ display_modifiers, display_num_modifiers, NULL);
if (linear_copy_display_gpu_image) {
int i, ret = 1;
@@ -1285,7 +1298,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
dri2_dpy->dri_screen_render_gpu,
dri2_surf->base.Width, dri2_surf->base.Height,
linear_pipe_format, use_flags | __DRI_IMAGE_USE_LINEAR,
- &linear_mod, 1, NULL);
+ render_modifiers, render_num_modifiers, NULL);
}
if (dri2_surf->back->linear_copy == NULL)
--
GitLab
From bf278ee26628898b674d86d39198babe0174f8bf Mon Sep 17 00:00:00 2001
From: Simon Ser <contact@emersion.fr>
Date: Sat, 7 Dec 2024 13:15:57 +0100
Subject: [PATCH 3/3] egl/wayland: fallback to implicit modifiers if advertised
by compositor
The Wayland protocol defines INVALID as a special marker indicating
that implicit modifiers are supported. If the driver doesn't support
explicit modifiers and the compositor advertises support for implicit
modifiers, fallback to these.
This effectively restores logic removed in 4c065158927d, but only
for the specific case of Wayland instead of affecting all APIs.
(Wayland is one of the few APIs defining a special meaning for
INVALID.)
Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 4c065158927d ("dri: revert INVALID modifier special-casing")
---
src/egl/drivers/dri2/platform_wayland.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 472665a36b0dd..2406bc18b7448 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1010,6 +1010,7 @@ create_dri_image(struct dri2_egl_surface *dri2_surf,
uint64_t *modifiers;
unsigned int num_modifiers;
struct u_vector *modifiers_present;
+ bool implicit_mod_supported;
assert(visual_idx != -1);
@@ -1049,6 +1050,25 @@ create_dri_image(struct dri2_egl_surface *dri2_surf,
num_modifiers = u_vector_length(modifiers_present);
}
+ if (!dri2_dpy->dri_screen_render_gpu->base.screen->resource_create_with_modifiers) {
+ /* We don't support explicit modifiers, check if the compositor supports
+ * implicit modifiers. */
+ implicit_mod_supported = false;
+ for (unsigned int i = 0; i < num_modifiers; i++) {
+ if (modifiers[i] == DRM_FORMAT_MOD_INVALID) {
+ implicit_mod_supported = true;
+ break;
+ }
+ }
+
+ if (!implicit_mod_supported) {
+ return;
+ }
+
+ num_modifiers = 0;
+ modifiers = NULL;
+ }
+
/* For the purposes of this function, an INVALID modifier on
* its own means the modifiers aren't supported. */
if (num_modifiers == 0 ||
--
GitLab

409
user/mesa/APKBUILD Normal file
View file

@ -0,0 +1,409 @@
# Contributor: David Heidelberg <david@ixit.cz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mesa
pkgver=24.3.3
pkgrel=1
pkgdesc="Mesa DRI OpenGL library"
url="https://www.mesa3d.org"
arch="all"
license="MIT AND SGI-B-2.0 AND BSL-1.0"
subpackages="
$pkgname-dbg
$pkgname-dev
$pkgname-dri-gallium:_gallium
$pkgname-va-gallium:_va
$pkgname-vdpau-gallium:_vdpau
$pkgname-glapi
$pkgname-egl
$pkgname-gl
$pkgname-gles
$pkgname-xatracker
$pkgname-osmesa
$pkgname-gbm
$pkgname-vulkan-ati:_vulkan
$pkgname-vulkan-swrast:_vulkan
$pkgname-vulkan-layers:_vulkan_layers
$pkgname-libd3dadapter9
"
_llvmver=19
depends_dev="
libdrm-dev
libxext-dev
libxdamage-dev
libxcb-dev
libxshmfence-dev
"
makedepends="
$depends_dev
binutils
bison
eudev-dev
expat-dev
findutils
flex
gettext
elfutils-dev
glslang-dev
libtool
libxfixes-dev
libva-dev
libvdpau-dev
libx11-dev
libxml2-dev
libxrandr-dev
libxxf86vm-dev
llvm$_llvmver-dev
meson
py3-cparser
py3-mako
py3-packaging
py3-ply
py3-yaml
python3
vulkan-loader-dev
wayland-dev
wayland-protocols
xorgproto
zlib-dev
zstd-dev
"
source="
https://mesa.freedesktop.org/archive/mesa-${pkgver/_/-}.tar.xz
dri-Add-Rockchip-EBC-to-kmsro-drivers.patch
riscv64-tls.patch
"
builddir="$srcdir/mesa-${pkgver/_/-}"
_dri_driverdir=/usr/lib/dri
_gallium_drivers="r300,r600,radeonsi,nouveau,llvmpipe,virgl,zink"
_vulkan_drivers="amd,swrast"
_vulkan_layers="device-select,overlay"
# extra gallium per arch
case "$CARCH" in
x86*)
_gallium_drivers="$_gallium_drivers,svga,i915,iris,crocus"
;;
armhf|armv7|aarch64)
_gallium_drivers="$_gallium_drivers,vc4,v3d,freedreno,lima,panfrost,etnaviv,tegra"
_gallium_drivers="${_gallium_drivers//r300,}"
;;
riscv64|loongarch64)
_gallium_drivers="${_gallium_drivers//r300,}"
esac
# extra vulkan per arch
case "$CARCH" in
x86*)
_vulkan_drivers="$_vulkan_drivers,intel,intel_hasvk"
_vulkan_layers="$_vulkan_layers,intel-nullhw"
subpackages="
$subpackages
$pkgname-vulkan-intel:_vulkan
"
;;
aarch64)
_vulkan_drivers="$_vulkan_drivers,broadcom,freedreno,panfrost"
subpackages="
$subpackages
$pkgname-vulkan-broadcom:_vulkan
$pkgname-vulkan-freedreno:_vulkan
$pkgname-vulkan-panfrost:_vulkan
"
;;
esac
_intel_rt=disabled
case "$CARCH" in
x86_64) _intel_rt=enabled ;;
esac
case "$CARCH" in
x86)
# lto fails on x86 only
# mostly:
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21371
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21180
_lto=false
;;
*)
# ~5% smaller
# disable temporarily until resolved:
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/11846
_lto=false
;;
esac
case "$CARCH" in
armv7|aarch64|x86|x86_64)
_rusticl=true
makedepends="
$makedepends
clang$_llvmver-dev
libclc-dev~$_llvmver
rust
rust-bindgen
spirv-llvm-translator-dev
"
subpackages="
$subpackages
$pkgname-rusticl
"
;;
*)
_rusticl=false
;;
esac
build() {
# use -g1 to generate less debug info:
# 485 MiB -> ~80 MiB
export CFLAGS="$CFLAGS -O2 -g1"
export CXXFLAGS="$CXXFLAGS -O2 -g1"
export CPPFLAGS="$CPPFLAGS -O2 -g1"
PATH="$PATH:/usr/lib/llvm$_llvmver/bin" \
abuild-meson \
-Db_ndebug=true \
-Db_lto=$_lto \
-Dallow-kcmp=enabled \
-Dexpat=enabled \
-Dintel-rt=$_intel_rt \
-Dpower8=enabled \
-Dshader-cache=enabled \
-Dxlib-lease=enabled \
-Dxmlconfig=enabled \
-Dzstd=enabled \
-Dbackend_max_links=2 \
-Dbuild-tests=true \
-Ddri-drivers-path=$_dri_driverdir \
-Dgallium-drivers=$_gallium_drivers \
-Dvulkan-drivers=$_vulkan_drivers \
-Dvulkan-layers=$_vulkan_layers \
-Dplatforms=x11,wayland \
-Dllvm=enabled \
-Dshared-llvm=enabled \
-Dshared-glapi=enabled \
-Dgbm=enabled \
-Dglx=dri \
-Dopengl=true \
-Dosmesa=true \
-Dgles1=enabled \
-Dgles2=enabled \
-Degl=enabled \
-Dgallium-extra-hud=true \
-Dgallium-nine=true \
-Dgallium-rusticl=$_rusticl \
-Dgallium-va=enabled \
-Dgallium-vdpau=enabled \
-Dgallium-xa=enabled \
-Drust_std=2021 \
-Dvideo-codecs=all \
. output
# Print config
meson configure --no-pager output
meson compile -C output
}
# Tests workarounds
# TODO: remove --no-suite glx with 24.3 (already dropped from mesa-git)
_tests_opts="--no-suite glx"
case "$CARCH" in
armhf|armv7|riscv64|loongarch64|ppc64le)
# https://gitlab.alpinelinux.org/alpine/aports/-/issues/16525
_tests_opts="$_tests_opts --no-suite mesa:llvmpipe"
;;
s390x)
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/9507
# mesa:amd / ac_surface_modifier_test timeouts (CI perf issue I assume)
_tests_opts="$_tests_opts --no-suite mesa:gallium --no-suite mesa:llvmpipe --no-suite mesa:amd"
;;
esac
check() {
LC_ALL=C.UTF=8 meson test --no-rebuild --print-errorlogs $_tests_opts -C output
}
package() {
provider_priority=100
DESTDIR="$pkgdir" meson install --no-rebuild -C output
}
egl() {
pkgdesc="Mesa libEGL runtime libraries"
depends="mesa=$pkgver-r$pkgrel"
provider_priority=100
amove usr/lib/libEGL.so*
}
gl() {
pkgdesc="Mesa libGL runtime libraries"
depends="mesa=$pkgver-r$pkgrel"
provider_priority=100
amove usr/lib/libGL.so*
}
glapi() {
pkgdesc="Mesa shared glapi"
replaces="$pkgname-gles=$pkgver-r$pkgrel"
provider_priority=100
amove usr/lib/libglapi.so.*
}
gles() {
pkgdesc="Mesa libGLESv2 runtime libraries"
depends="mesa=$pkgver-r$pkgrel"
provider_priority=100
amove usr/lib/libGLES*.so*
}
xatracker() {
pkgdesc="Mesa XA state tracker for vmware"
depends="mesa=$pkgver-r$pkgrel"
provider_priority=100
amove usr/lib/libxatracker*.so.*
}
osmesa() {
pkgdesc="Mesa offscreen rendering libraries"
depends="mesa=$pkgver-r$pkgrel"
provider_priority=100
amove usr/lib/libOSMesa.so.*
}
gbm() {
pkgdesc="Mesa gbm library"
depends="mesa=$pkgver-r$pkgrel"
provider_priority=100
amove usr/lib/libgbm.so.*
}
libd3dadapter9() {
pkgdesc="Mesa directx9 adapter"
depends="mesa=$pkgver-r$pkgrel"
provider_priority=100
amove usr/lib/d3d/d3dadapter9.so*
}
rusticl() {
pkgdesc="Mesa OpenCL driver"
depends="mesa=$pkgver-r$pkgrel clang$_llvmver-headers libclc~$_llvmver"
provider_priority=100
amove usr/lib/libRusticlOpenCL.so.*
amove etc/OpenCL/vendors/
}
# Move links referencing the same file to the subpackage.
# Usage: _mv_links <base directory> <example>
# where <example> is one of the libraries covered by the megadriver.
# The example is used to find other links that point to the same file.
_mv_links() {
install -d "$subpkgdir"/$1
find -L "$pkgdir"/$1 -samefile "$pkgdir"/$1/$2 -print0 \
| xargs -0 -I{} mv {} "$subpkgdir"/$1/
}
_mv_vulkan() {
local i
for i in "$@"; do
amove usr/lib/libvulkan_$i*.so
amove usr/share/vulkan/icd.d/${i}_*.*
done
}
# Mesa uses "megadrivers" where multiple drivers are linked into one shared
# library. This library is then hard-linked to separate files (one for each driver).
# Each subpackage contains one megadriver so that all the hard-links are preserved.
_gallium() {
pkgdesc="Mesa gallium DRI drivers"
depends="mesa=$pkgver-r$pkgrel"
provider_priority=100
# libgallium_dri.so
_mv_links $_dri_driverdir swrast_dri.so
}
_va() {
local n=${subpkgname##*-va-}
pkgdesc="Mesa $n VAAPI drivers"
depends="mesa=$pkgver-r$pkgrel libva"
provider_priority=100
case $n in
gallium)
# libgallium_drv_video.so
_mv_links /usr/lib/dri radeonsi_drv_video.so ;;
esac
}
_vdpau() {
local n=${subpkgname##*-vdpau-}
pkgdesc="Mesa $n VDPAU drivers"
depends="mesa=$pkgver-r$pkgrel libvdpau"
provider_priority=100
case $n in
gallium)
# libvdpau_gallium.so.1.0.0
_mv_links /usr/lib/vdpau libvdpau_radeonsi.so.1.0.0 ;;
esac
}
_vulkan() {
local n=${subpkgname##*-vulkan-}
pkgdesc="Mesa Vulkan API driver for $n"
depends="mesa=$pkgver-r$pkgrel"
provider_priority=100
case $n in
ati)
_mv_vulkan radeon ;;
intel)
_mv_vulkan intel ;;
broadcom)
_mv_vulkan broadcom ;;
freedreno)
_mv_vulkan freedreno ;;
panfrost)
_mv_vulkan panfrost ;;
swrast)
_mv_vulkan lvp ;;
esac
}
_vulkan_layers() {
pkgdesc="collection of vulkan layers from mesa"
depends="python3"
provider_priority=100
# Remove this after the release of the next stable (3.14)
# it originally was claed layer as it only packaged the
# overlay one but now it also packages device-select and
# intel-nullhw (on x86*)
provides="$pkgname-vulkan-layer=$pkgver-r$pkgrel"
provider_priority=100
replaces="$pkgname-vulkan-layer=$pkgver-r$pkgrel"
amove usr/share/vulkan/explicit_layer.d
amove usr/share/vulkan/implicit_layer.d
amove usr/lib/libVkLayer_*.so
amove usr/bin/mesa-overlay-control.py
}
sha512sums="
280d7a6dd64503ec398d449430270c78b5558c03bfeed3a42346573fd2db1aa3f96f5a212e49288718a7fe27447ee40235b066517622d68b0dfdd7b251a4e85f mesa-24.3.3.tar.xz
4cfd6532a96103589efd885240ce12414b473aed05956507e0b78a46e44216974adac1a8dc22db0d185e6c8a98988ebaed79ac0e83156c75a41199591f52f944 dri-Add-Rockchip-EBC-to-kmsro-drivers.patch
ce1887fb7d425b94c375a0547bee40c308809c01f5ce1bcddabcc69a7fcb445efb9d5f5c7bac49b2778ab40687c7bce204d278b0bf028d124c75e59083107fba riscv64-tls.patch
"

View file

@ -0,0 +1,41 @@
From: Diederik de Haas <didi.debian@cknow.org>
Date: Sun, 22 Sep 2024 10:48:22 +0200
Subject: [PATCH] dri: Add Rockchip EBC to kmsro drivers
Forwarded: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23575
The Rockchip EBC driver is used in the Pine64 PineNote.
Link: https://lore.kernel.org/linux-arm-kernel/20220413221916.50995-1-samuel@sholland.org/
---
src/gallium/targets/dri/dri_target.c | 3 +++
src/gallium/targets/dril/dril_target.c | 1 +
src/gallium/targets/dril/meson.build | 1 +
3 files changed, 5 insertions(+)
diff --git a/src/gallium/targets/dril/dril_target.c b/src/gallium/targets/dril/dril_target.c
index a94ab09858f..2e628ae1c02 100644
--- a/src/gallium/targets/dril/dril_target.c
+++ b/src/gallium/targets/dril/dril_target.c
@@ -599,6 +599,7 @@ DEFINE_LOADER_DRM_ENTRYPOINT(pl111)
DEFINE_LOADER_DRM_ENTRYPOINT(rcar_du)
DEFINE_LOADER_DRM_ENTRYPOINT(repaper)
DEFINE_LOADER_DRM_ENTRYPOINT(rockchip)
+DEFINE_LOADER_DRM_ENTRYPOINT(rockchip_ebc)
DEFINE_LOADER_DRM_ENTRYPOINT(rzg2l_du)
DEFINE_LOADER_DRM_ENTRYPOINT(ssd130x)
DEFINE_LOADER_DRM_ENTRYPOINT(st7586)
diff --git a/src/gallium/targets/dril/meson.build b/src/gallium/targets/dril/meson.build
index 3adf97b24a7..df802194bc5 100644
--- a/src/gallium/targets/dril/meson.build
+++ b/src/gallium/targets/dril/meson.build
@@ -89,6 +89,7 @@ foreach d : [[with_gallium_kmsro, [
'rcar-du_dri.so',
'repaper_dri.so',
'rockchip_dri.so',
+ 'rockchip-ebc_dri.so',
'rzg2l-du_dri.so',
'ssd130x_dri.so',
'st7586_dri.so',
--
2.45.2

View file

@ -0,0 +1,15 @@
upstream: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11729
diff --git a/meson.build b/meson.build
index 3d72bb56f25..5161c97af11 100644
--- a/meson.build
+++ b/meson.build
@@ -496,7 +496,7 @@ foreach c_arg : get_option('c_args')
break
endif
endforeach
-if not have_mtls_dialect
+if not have_mtls_dialect and host_machine.cpu_family() != 'riscv64'
# need .run to check libc support. meson aborts when calling .run when
# cross-compiling, but because this is just an optimization we can skip it
if meson.is_cross_build() and not meson.can_run_host_binaries()