From 9a4d766ffcc3c8554be12237c30c0c913dd853d0 Mon Sep 17 00:00:00 2001
From: Janne Grunau <janne-fdr@jannau.net>
Date: Apr 25 2025 10:48:50 +0000
Subject: [PATCH 1/8] Build only llvmpipe, not softpipe


See commit 7c185f3 ("Build only llvmpipe, not softpipe") in Fedora's
mesa (https://src.fedoraproject.org/rpms/mesa).

---

diff --git a/mesa.spec b/mesa.spec
index e0cd0d2..d1d6fc5 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -456,9 +456,9 @@ export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/"
   -Dplatforms=x11,wayland \
   -Dosmesa=true \
 %if 0%{?with_hardware}
-  -Dgallium-drivers=swrast,virgl%{?with_nouveau:,nouveau}%{?with_r300:,r300}%{?with_crocus:,crocus}%{?with_i915:,i915}%{?with_iris:,iris}%{?with_vmware:,svga}%{?with_radeonsi:,radeonsi}%{?with_r600:,r600}%{?with_freedreno:,freedreno}%{?with_etnaviv:,etnaviv}%{?with_tegra:,tegra}%{?with_vc4:,vc4}%{?with_v3d:,v3d}%{?with_lima:,lima}%{?with_panfrost:,panfrost}%{?with_vulkan_hw:,zink}%{?with_asahi:,asahi} \
+  -Dgallium-drivers=llvmpipe,virgl%{?with_nouveau:,nouveau}%{?with_r300:,r300}%{?with_crocus:,crocus}%{?with_i915:,i915}%{?with_iris:,iris}%{?with_vmware:,svga}%{?with_radeonsi:,radeonsi}%{?with_r600:,r600}%{?with_freedreno:,freedreno}%{?with_etnaviv:,etnaviv}%{?with_tegra:,tegra}%{?with_vc4:,vc4}%{?with_v3d:,v3d}%{?with_lima:,lima}%{?with_panfrost:,panfrost}%{?with_vulkan_hw:,zink}%{?with_asahi:,asahi} \
 %else
-  -Dgallium-drivers=swrast,virgl \
+  -Dgallium-drivers=llvmpipe,virgl \
 %endif
   -Dgallium-vdpau=%{?with_vdpau:enabled}%{!?with_vdpau:disabled} \
   -Dgallium-va=%{?with_va:enabled}%{!?with_va:disabled} \

From 186c5c2271c3802873b879344341ffbb43d8ebc1 Mon Sep 17 00:00:00 2001
From: Janne Grunau <janne-fdr@jannau.net>
Date: Apr 25 2025 10:48:50 +0000
Subject: [PATCH 2/8] Drop removed OSMesa


---

diff --git a/mesa.spec b/mesa.spec
index d1d6fc5..01e7c82 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -236,6 +236,7 @@ Obsoletes:      mesa-omx-drivers < %{?epoch:%{epoch}:}%{version}-%{release}
 Summary:        Mesa libGL runtime libraries
 Requires:       libglvnd-glx%{?_isa} >= 1:1.3.2
 Requires:       %{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
+Obsoletes:      mesa-libOSMesa < %{?epoch:%{epoch}:}%{version}-%{release}
 
 %description libGL
 %{summary}.
@@ -247,6 +248,7 @@ Requires:       libglvnd-devel%{?_isa} >= 1:1.3.2
 Provides:       libGL-devel
 Provides:       libGL-devel%{?_isa}
 Recommends:     gl-manpages
+Obsoletes:      mesa-libOSMesa-devel < %{?epoch:%{epoch}:}%{version}-%{release}
 
 %description libGL-devel
 %{summary}.
@@ -301,21 +303,6 @@ Requires:       %{name}-filesystem%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{rel
 %{summary}.
 %endif
 
-%package libOSMesa
-Summary:        Mesa offscreen rendering libraries
-Provides:       libOSMesa
-Provides:       libOSMesa%{?_isa}
-
-%description libOSMesa
-%{summary}.
-
-%package libOSMesa-devel
-Summary:        Mesa offscreen rendering development package
-Requires:       %{name}-libOSMesa%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
-
-%description libOSMesa-devel
-%{summary}.
-
 %package libgbm
 Summary:        Mesa gbm runtime library
 Provides:       libgbm
@@ -454,7 +441,6 @@ export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/"
 
 %meson \
   -Dplatforms=x11,wayland \
-  -Dosmesa=true \
 %if 0%{?with_hardware}
   -Dgallium-drivers=llvmpipe,virgl%{?with_nouveau:,nouveau}%{?with_r300:,r300}%{?with_crocus:,crocus}%{?with_i915:,i915}%{?with_iris:,iris}%{?with_vmware:,svga}%{?with_radeonsi:,radeonsi}%{?with_r600:,r600}%{?with_freedreno:,freedreno}%{?with_etnaviv:,etnaviv}%{?with_tegra:,tegra}%{?with_vc4:,vc4}%{?with_v3d:,v3d}%{?with_lima:,lima}%{?with_panfrost:,panfrost}%{?with_vulkan_hw:,zink}%{?with_asahi:,asahi} \
 %else
@@ -519,7 +505,7 @@ ln -s libGLX_mesa.so.0 %{buildroot}%{_libdir}/libGLX_system.so.0
 
 # this keeps breaking, check it early.  note that the exit from eu-ftr is odd.
 pushd %{buildroot}%{_libdir}
-for i in libOSMesa*.so libGL.so ; do
+for i in libGL.so ; do
     eu-findtextrel $i && exit 1
 done
 popd
@@ -624,14 +610,6 @@ install -Dpm0644 -t %{buildroot}%{_datadir}/fex-emu/overlays/ mesa-%{_arch}.erof
 %{_includedir}/EGL/eglext_angle.h
 %{_includedir}/EGL/eglmesaext.h
 
-%files libOSMesa
-%{_libdir}/libOSMesa.so.8*
-%files libOSMesa-devel
-%dir %{_includedir}/GL
-%{_includedir}/GL/osmesa.h
-%{_libdir}/libOSMesa.so
-%{_libdir}/pkgconfig/osmesa.pc
-
 %files libgbm
 %{_libdir}/libgbm.so.1
 %{_libdir}/libgbm.so.1.*

From 841f0b3bfbec9e75c3276db2ea6d63ec504e41b2 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@fedoraproject.org>
Date: Apr 25 2025 10:48:50 +0000
Subject: [PATCH 3/8] Fix versioned Obsoletes for mesa-libOSMesa subpackages


---

diff --git a/mesa.spec b/mesa.spec
index 01e7c82..f7cb044 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -236,7 +236,7 @@ Obsoletes:      mesa-omx-drivers < %{?epoch:%{epoch}:}%{version}-%{release}
 Summary:        Mesa libGL runtime libraries
 Requires:       libglvnd-glx%{?_isa} >= 1:1.3.2
 Requires:       %{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
-Obsoletes:      mesa-libOSMesa < %{?epoch:%{epoch}:}%{version}-%{release}
+Obsoletes:      %{name}-libOSMesa < 25.1.0~rc2-1
 
 %description libGL
 %{summary}.
@@ -248,7 +248,7 @@ Requires:       libglvnd-devel%{?_isa} >= 1:1.3.2
 Provides:       libGL-devel
 Provides:       libGL-devel%{?_isa}
 Recommends:     gl-manpages
-Obsoletes:      mesa-libOSMesa-devel < %{?epoch:%{epoch}:}%{version}-%{release}
+Obsoletes:      %{name}-libOSMesa-devel < 25.1.0~rc2-1
 
 %description libGL-devel
 %{summary}.

From b39b6a3486e54f19ae85f36bf5c9e4b11b347532 Mon Sep 17 00:00:00 2001
From: Janne Grunau <janne-fdr@jannau.net>
Date: Apr 25 2025 10:48:50 +0000
Subject: [PATCH 4/8] Bump to asahi-20250425


---

diff --git a/mesa.spec b/mesa.spec
index f7cb044..1463498 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -104,7 +104,7 @@
 
 %global vulkan_drivers swrast,virtio%{?base_vulkan}%{?asahi_platform_vulkan}%{?intel_platform_vulkan}%{?extra_platform_vulkan}%{?with_nvk:,nouveau}
 
-%global asahi_mesa_ver 20250221
+%global asahi_mesa_ver 20250425
 %global git_tag asahi-%{asahi_mesa_ver}
 %global basever 25.1.0
 %global ver %{basever}-asahipre%{asahi_mesa_ver}
@@ -113,7 +113,7 @@
 Name:           mesa
 Summary:        Mesa graphics libraries
 Version:        %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)}
-Release:        %autorelease -b 2
+Release:        %autorelease
 License:        MIT AND BSD-3-Clause AND SGI-B-2.0
 URL:            http://www.mesa3d.org
 
@@ -145,7 +145,7 @@ BuildRequires:  pkgconfig(zlib) >= 1.2.3
 BuildRequires:  pkgconfig(libzstd)
 BuildRequires:  pkgconfig(libselinux)
 BuildRequires:  pkgconfig(wayland-scanner)
-BuildRequires:  pkgconfig(wayland-protocols) >= 1.38
+BuildRequires:  pkgconfig(wayland-protocols) >= 1.41
 BuildRequires:  pkgconfig(wayland-client) >= 1.11
 BuildRequires:  pkgconfig(wayland-server) >= 1.11
 BuildRequires:  pkgconfig(wayland-egl-backend) >= 3
@@ -200,10 +200,10 @@ BuildRequires:  rust-packaging
 BuildRequires:  cbindgen
 BuildRequires:  rustfmt
 BuildRequires:  (crate(paste) >= 1.0.14 with crate(paste) < 2)
-BuildRequires:  (crate(proc-macro2) >= 1.0.56 with crate(proc-macro2) < 2)
-BuildRequires:  (crate(quote) >= 1.0.25 with crate(quote) < 2)
-BuildRequires:  (crate(syn/clone-impls) >= 2.0.15 with crate(syn/clone-impls) < 3)
-BuildRequires:  (crate(unicode-ident) >= 1.0.6 with crate(unicode-ident) < 2)
+BuildRequires:  (crate(proc-macro2) >= 1.0.86 with crate(proc-macro2) < 2)
+BuildRequires:  (crate(quote) >= 1.0.33 with crate(quote) < 2)
+BuildRequires:  (crate(syn/clone-impls) >= 2.0.86 with crate(syn/clone-impls) < 3)
+BuildRequires:  (crate(unicode-ident) >= 1.0.12 with crate(unicode-ident) < 2)
 %endif
 %if %{with valgrind}
 BuildRequires:  pkgconfig(valgrind)
@@ -616,6 +616,7 @@ install -Dpm0644 -t %{buildroot}%{_datadir}/fex-emu/overlays/ mesa-%{_arch}.erof
 %files libgbm-devel
 %{_libdir}/libgbm.so
 %{_includedir}/gbm.h
+%{_includedir}/gbm_backend_abi.h
 %{_libdir}/pkgconfig/gbm.pc
 
 %if 0%{?with_xa}
diff --git a/rpkg.conf b/rpkg.conf
index becf206..37b732a 100644
--- a/rpkg.conf
+++ b/rpkg.conf
@@ -1,2 +1,2 @@
 [lookaside]
-download_url = https://gitlab.freedesktop.org/asahi/mesa/-/archive/asahi-20250221/%(filename)s
+download_url = https://gitlab.freedesktop.org/asahi/mesa/-/archive/asahi-20250425/%(filename)s
diff --git a/sources b/sources
index 4a08cfe..e0f61cc 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (mesa-asahi-20250221.tar.gz) = 2d2070582a2a5be90bbc437a51106aa677c191717877150e1351f714dd140a698326149b140f25216e8071202dba7a99cbda40299e9414f40b6ae01e41289d89
+SHA512 (mesa-asahi-20250425.tar.gz) = 0017eff794de820798fedbed7874b7efde365b468472a15ace6a07bab76d50cdfd08fda7d57a59699823eb99bf5aacd37214b85dbb99d6b0135c5b69185b51b2

From 61e4d76a1f72a5a291e04c875857ed59599f315e Mon Sep 17 00:00:00 2001
From: Janne Grunau <janne-fdr@jannau.net>
Date: Apr 25 2025 10:58:55 +0000
Subject: [PATCH 5/8] Sync with upstream asahi driver enablement


---

diff --git a/mesa.spec b/mesa.spec
index 1463498..0814049 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -72,20 +72,22 @@
 %ifarch aarch64 x86_64 %{ix86}
 %global with_kmsro     1
 %if !0%{?rhel}
-%global with_asahi     1
-%ifarch x86_64 %{ix86}
-%global with_asahi_fex_emu_overlay 1
-%endif
-%global asahi_platform_vulkan %{?with_vulkan_hw:,asahi}%{!?with_vulkan_hw:%{nil}}
 %global with_lima      1
 %global with_vc4       1
 %global with_etnaviv   1
 %global with_tegra     1
 %endif
+%global with_asahi     1
 %global with_freedreno 1
 %global with_panfrost  1
 %global with_v3d       1
 %global with_xa        1
+%if 0%{?with_asahi}
+%ifarch x86_64 %{ix86}
+%global with_asahi_fex_emu_overlay 1
+%endif
+%global asahi_platform_vulkan %{?with_vulkan_hw:,asahi}%{!?with_vulkan_hw:%{nil}}
+%endif
 %global extra_platform_vulkan %{?with_vulkan_hw:,broadcom,freedreno,panfrost,imagination-experimental}%{!?with_vulkan_hw:%{nil}}
 %endif
 %endif
@@ -102,7 +104,7 @@
 %bcond_with valgrind
 %endif
 
-%global vulkan_drivers swrast,virtio%{?base_vulkan}%{?asahi_platform_vulkan}%{?intel_platform_vulkan}%{?extra_platform_vulkan}%{?with_nvk:,nouveau}
+%global vulkan_drivers swrast,virtio%{?base_vulkan}%{?intel_platform_vulkan}%{?asahi_platform_vulkan}%{?extra_platform_vulkan}%{?with_nvk:,nouveau}
 
 %global asahi_mesa_ver 20250425
 %global git_tag asahi-%{asahi_mesa_ver}
@@ -186,7 +188,7 @@ BuildRequires:  flatbuffers-devel
 BuildRequires:  flatbuffers-compiler
 BuildRequires:  xtensor-devel
 %endif
-%if 0%{?with_opencl} || 0%{?with_asahi} || 0%{?with_nvk} || 0%{?with_intel_clc}
+%if 0%{?with_opencl} || 0%{?with_nvk} || 0%{?with_intel_clc} || 0%{?with_asahi}
 BuildRequires:  clang-devel
 BuildRequires:  pkgconfig(libclc)
 BuildRequires:  pkgconfig(SPIRV-Tools)

From a7ccb73aa27bf4b572c7b7655ab54f837f39af5a Mon Sep 17 00:00:00 2001
From: José Expósito <jexposit@redhat.com>
Date: Apr 25 2025 11:01:33 +0000
Subject: [PATCH 6/8] Revert "kopper: Explicitly choose zink"


On QEMU (virtio driver), without 3D acceleration enabled and without
mesa-vulkan-drivers installed, this commit prevents Mutter to start.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2360851
Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13009

---

diff --git a/0001-Revert-kopper-Explicitly-choose-zink.patch b/0001-Revert-kopper-Explicitly-choose-zink.patch
new file mode 100644
index 0000000..954389e
--- /dev/null
+++ b/0001-Revert-kopper-Explicitly-choose-zink.patch
@@ -0,0 +1,46 @@
+From 24f85c06c28736b73c14208a0ffa6657d2aee9cd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= <jexposit@redhat.com>
+Date: Mon, 21 Apr 2025 13:52:14 +0200
+Subject: [PATCH] Revert "kopper: Explicitly choose zink"
+
+On QEMU (virtio driver), without 3D acceleration enabled and without
+mesa-vulkan-drivers installed, this commit prevents Mutter to start.
+
+This reverts commit c0bc957c5d8c7edd57626284b712dd6ea1e375fc.
+
+Related: https://bugzilla.redhat.com/show_bug.cgi?id=2360851
+Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13009
+---
+ .pick_status.json                  | 2 +-
+ src/gallium/frontends/dri/kopper.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/.pick_status.json b/.pick_status.json
+index 99df2fb30c2..cdf3965678c 100644
+--- a/.pick_status.json
++++ b/.pick_status.json
+@@ -16204,7 +16204,7 @@
+         "description": "kopper: Explicitly choose zink",
+         "nominated": false,
+         "nomination_type": 0,
+-        "resolution": 1,
++        "resolution": 4,
+         "main_sha": null,
+         "because_sha": null,
+         "notes": null
+diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c
+index a1d7dcb79b4..3bdb56022a9 100644
+--- a/src/gallium/frontends/dri/kopper.c
++++ b/src/gallium/frontends/dri/kopper.c
+@@ -73,7 +73,7 @@ kopper_init_screen(struct dri_screen *screen, bool driver_name_is_inferred)
+    bool success;
+ #ifdef HAVE_LIBDRM
+    if (screen->fd != -1)
+-      success = pipe_loader_drm_probe_fd(&screen->dev, screen->fd, true);
++      success = pipe_loader_drm_probe_fd(&screen->dev, screen->fd, false);
+    else
+       success = pipe_loader_vk_probe_dri(&screen->dev);
+ #else
+-- 
+2.49.0
+
diff --git a/mesa.spec b/mesa.spec
index 0814049..d89a872 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -128,6 +128,12 @@ Source1:        Mesa-MLAA-License-Clarification-Email.txt
 
 Patch10:        gnome-shell-glthread-disable.patch
 
+# This patch makes Fedora CI fail and causes issues in QEMU. Revert it until
+# we find a fix.
+# https://bugzilla.redhat.com/show_bug.cgi?id=2360851
+# https://gitlab.freedesktop.org/mesa/mesa/-/issues/13009
+Patch30:        0001-Revert-kopper-Explicitly-choose-zink.patch
+
 BuildRequires:  meson >= 1.3.0
 BuildRequires:  gcc
 BuildRequires:  gcc-c++

From bba913043e8241e9f3376b2edf38529f7859dd0d Mon Sep 17 00:00:00 2001
From: Janne Grunau <janne-fdr@jannau.net>
Date: Apr 25 2025 11:02:03 +0000
Subject: [PATCH 7/8] Bump release after sync to fedora


---

diff --git a/mesa.spec b/mesa.spec
index d89a872..25a09fa 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -115,7 +115,7 @@
 Name:           mesa
 Summary:        Mesa graphics libraries
 Version:        %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)}
-Release:        %autorelease
+Release:        %autorelease -b 2
 License:        MIT AND BSD-3-Clause AND SGI-B-2.0
 URL:            http://www.mesa3d.org
 

From 4b38285d92f4215a463bee1a74173bc021f942da Mon Sep 17 00:00:00 2001
From: Janne Grunau <janne-fdr@jannau.net>
Date: Apr 25 2025 11:05:46 +0000
Subject: [PATCH 8/8] Reapply "kopper: Explicitly choose zink"


This reverts commit a7ccb73aa27bf4b572c7b7655ab54f837f39af5a.

As it does not apply cleanly.

---

diff --git a/0001-Revert-kopper-Explicitly-choose-zink.patch b/0001-Revert-kopper-Explicitly-choose-zink.patch
deleted file mode 100644
index 954389e..0000000
--- a/0001-Revert-kopper-Explicitly-choose-zink.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 24f85c06c28736b73c14208a0ffa6657d2aee9cd Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= <jexposit@redhat.com>
-Date: Mon, 21 Apr 2025 13:52:14 +0200
-Subject: [PATCH] Revert "kopper: Explicitly choose zink"
-
-On QEMU (virtio driver), without 3D acceleration enabled and without
-mesa-vulkan-drivers installed, this commit prevents Mutter to start.
-
-This reverts commit c0bc957c5d8c7edd57626284b712dd6ea1e375fc.
-
-Related: https://bugzilla.redhat.com/show_bug.cgi?id=2360851
-Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13009
----
- .pick_status.json                  | 2 +-
- src/gallium/frontends/dri/kopper.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/.pick_status.json b/.pick_status.json
-index 99df2fb30c2..cdf3965678c 100644
---- a/.pick_status.json
-+++ b/.pick_status.json
-@@ -16204,7 +16204,7 @@
-         "description": "kopper: Explicitly choose zink",
-         "nominated": false,
-         "nomination_type": 0,
--        "resolution": 1,
-+        "resolution": 4,
-         "main_sha": null,
-         "because_sha": null,
-         "notes": null
-diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c
-index a1d7dcb79b4..3bdb56022a9 100644
---- a/src/gallium/frontends/dri/kopper.c
-+++ b/src/gallium/frontends/dri/kopper.c
-@@ -73,7 +73,7 @@ kopper_init_screen(struct dri_screen *screen, bool driver_name_is_inferred)
-    bool success;
- #ifdef HAVE_LIBDRM
-    if (screen->fd != -1)
--      success = pipe_loader_drm_probe_fd(&screen->dev, screen->fd, true);
-+      success = pipe_loader_drm_probe_fd(&screen->dev, screen->fd, false);
-    else
-       success = pipe_loader_vk_probe_dri(&screen->dev);
- #else
--- 
-2.49.0
-
diff --git a/mesa.spec b/mesa.spec
index 25a09fa..7e5624d 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -128,12 +128,6 @@ Source1:        Mesa-MLAA-License-Clarification-Email.txt
 
 Patch10:        gnome-shell-glthread-disable.patch
 
-# This patch makes Fedora CI fail and causes issues in QEMU. Revert it until
-# we find a fix.
-# https://bugzilla.redhat.com/show_bug.cgi?id=2360851
-# https://gitlab.freedesktop.org/mesa/mesa/-/issues/13009
-Patch30:        0001-Revert-kopper-Explicitly-choose-zink.patch
-
 BuildRequires:  meson >= 1.3.0
 BuildRequires:  gcc
 BuildRequires:  gcc-c++

