diff --git a/mesa/.footprint b/mesa/.footprint index f76e0c9..e3ea3d9 100644 --- a/mesa/.footprint +++ b/mesa/.footprint @@ -68,7 +68,7 @@ lrwxrwxrwx root/root usr/lib/libGLX_mesa.so.0 -> libGLX_mesa.so.0.0.0 lrwxrwxrwx root/root usr/lib/libOSMesa.so -> libOSMesa.so.8 lrwxrwxrwx root/root usr/lib/libOSMesa.so.8 -> libOSMesa.so.8.0.0 -rwxr-xr-x root/root usr/lib/libOSMesa.so.8.0.0 --rwxr-xr-x root/root usr/lib/libgallium-24.3.1.so +-rwxr-xr-x root/root usr/lib/libgallium-24.3.1-2.so lrwxrwxrwx root/root usr/lib/libgbm.so -> libgbm.so.1 lrwxrwxrwx root/root usr/lib/libgbm.so.1 -> libgbm.so.1.0.0 -rwxr-xr-x root/root usr/lib/libgbm.so.1.0.0 diff --git a/mesa/.signature b/mesa/.signature index ac45cc6..cdb5106 100644 --- a/mesa/.signature +++ b/mesa/.signature @@ -1,5 +1,8 @@ untrusted comment: verify with /etc/ports/xorg-arm.pub -RWSYHFoJug2wQlExOramHiVfvnkW9Q2vb/GrkPh3XYST5fq2ScH8lb9Jwua+rjyyAoroqzsWL6otBlJfxVRPVw3z3NILjR15fw4= -SHA256 (Pkgfile) = 0e6b5db09c71f7e02cf010705aae1483b53c98afe6494cc304a0ab19c56255e1 -SHA256 (.footprint) = 579316fde2f3e75118cdd71b49c378d99daf21b423e181414e4615a22183f66e +RWSYHFoJug2wQqfhkIr0vFpmNhhULhzzHKl+bZWg0p/a+dFJEBJdUq2PsDwa2N5tG3NRPYweX5uhIiOQZmMUHcuTsD8EDDuSeQ8= +SHA256 (Pkgfile) = 9d13ff91d3df7ec26a3807c9587823cb2266cd7e1627f3476eb487341bc80a03 +SHA256 (.footprint) = a9774c049dd69c28e2f031179b77bcc83e31018ae0c83cd18f0b8701106ba6f4 SHA256 (mesa-24.3.1.tar.xz) = 9c795900449ce5bc7c526ba0ab3532a22c3c951cab7e0dd9de5fcac41b0843af +SHA256 (0001-dri-don-t-fetch-X11-modifiers-if-we-don-t-support-th.patch) = 2c20fee505be9a1f08546b63457b8378b0f1fcff58e60c03378b7de0a87a1e81 +SHA256 (0002-egl-wayland-only-supply-LINEAR-modifier-when-support.patch) = a58e6d0631da6dd077530136bb44f0233cd279fc75e3b65b495ec90be16db91a +SHA256 (0003-egl-wayland-fallback-to-implicit-modifiers-if-advert.patch) = 606acb4073f46c7ca7edec96b6af06619642f3bbcd6afab2c57bff26266b917f diff --git a/mesa/0001-dri-don-t-fetch-X11-modifiers-if-we-don-t-support-th.patch b/mesa/0001-dri-don-t-fetch-X11-modifiers-if-we-don-t-support-th.patch new file mode 100644 index 0000000..a580035 --- /dev/null +++ b/mesa/0001-dri-don-t-fetch-X11-modifiers-if-we-don-t-support-th.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Simon Ser +Date: Sat, 7 Dec 2024 13:10:04 +0100 +Subject: [PATCH] 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 +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 268ec3d86c8a..e1f51619c5fa 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; diff --git a/mesa/0002-egl-wayland-only-supply-LINEAR-modifier-when-support.patch b/mesa/0002-egl-wayland-only-supply-LINEAR-modifier-when-support.patch new file mode 100644 index 0000000..526c634 --- /dev/null +++ b/mesa/0002-egl-wayland-only-supply-LINEAR-modifier-when-support.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Simon Ser +Date: Sat, 7 Dec 2024 13:12:40 +0100 +Subject: [PATCH] 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 +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 513d2d0709b1..472665a36b0d 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 + +@@ -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) diff --git a/mesa/0003-egl-wayland-fallback-to-implicit-modifiers-if-advert.patch b/mesa/0003-egl-wayland-fallback-to-implicit-modifiers-if-advert.patch new file mode 100644 index 0000000..72a7908 --- /dev/null +++ b/mesa/0003-egl-wayland-fallback-to-implicit-modifiers-if-advert.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Simon Ser +Date: Sat, 7 Dec 2024 13:15:57 +0100 +Subject: [PATCH] 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 +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 472665a36b0d..2406bc18b744 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 || diff --git a/mesa/Pkgfile b/mesa/Pkgfile index fa5ae2c..c07a2d0 100644 --- a/mesa/Pkgfile +++ b/mesa/Pkgfile @@ -7,8 +7,11 @@ name=mesa version=24.3.1 -release=1 -source=(https://archive.mesa3d.org/$name-$version.tar.xz) +release=2 +source=(https://archive.mesa3d.org/$name-$version.tar.xz + 0001-dri-don-t-fetch-X11-modifiers-if-we-don-t-support-th.patch + 0002-egl-wayland-only-supply-LINEAR-modifier-when-support.patch + 0003-egl-wayland-fallback-to-implicit-modifiers-if-advert.patch) build() { prt-get isinst directx-headers && PKGMK_MESA_GALLIUM+='d3d12,' @@ -26,6 +29,12 @@ prt-get isinst directx-headers && PKGMK_MESA_GALLIUM+='d3d12,' #prt-get isinst xorg-libxdamage xorg-libxrandr xorg-libxshmfence xorg-libxvmc xorg-libxxf86vm && PKGMK_MESA_PLATFORMS+=',x11' PKGMK_MESA_PLATFORMS+=',x11' + printf '%s' "$version-$release" > $name-$version/VERSION + + patch -Np1 -d $name-$version -i $SRC/0001-dri-don-t-fetch-X11-modifiers-if-we-don-t-support-th.patch + patch -Np1 -d $name-$version -i $SRC/0002-egl-wayland-only-supply-LINEAR-modifier-when-support.patch + patch -Np1 -d $name-$version -i $SRC/0003-egl-wayland-fallback-to-implicit-modifiers-if-advert.patch + meson setup build mesa-$version $PKGMK_MESA \ --prefix=/usr \ --sysconfdir=/etc \