From 53f97b7f1292c5cbf88d864808ff065caa65d63a Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Wed, 10 Jan 2024 19:37:18 +0100 Subject: [PATCH] Fix zink crash and re-enable the automatic fallback --- disable-zink-egl-fallback.patch | 26 ------------- mesa.spec | 2 +- zink-fix-resizable-bar-detection-logic.patch | 39 ++++++++++++++++++++ 3 files changed, 40 insertions(+), 27 deletions(-) delete mode 100644 disable-zink-egl-fallback.patch create mode 100644 zink-fix-resizable-bar-detection-logic.patch diff --git a/disable-zink-egl-fallback.patch b/disable-zink-egl-fallback.patch deleted file mode 100644 index c036ace..0000000 --- a/disable-zink-egl-fallback.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c -index d50be23e871..e3697622635 100644 ---- a/src/egl/main/eglapi.c -+++ b/src/egl/main/eglapi.c -@@ -695,17 +695,21 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) - if (disp->Options.ForceSoftware) - RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); - else { -+#if 0 - bool success = false; - if (!disp->Options.Zink && !getenv("GALLIUM_DRIVER")) { - disp->Options.Zink = EGL_TRUE; - success = _eglDriver.Initialize(disp); - } - if (!success) { -+#endif - disp->Options.Zink = EGL_FALSE; - disp->Options.ForceSoftware = EGL_TRUE; - if (!_eglDriver.Initialize(disp)) - RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); -+#if 0 - } -+#endif - } - } - diff --git a/mesa.spec b/mesa.spec index ff4f7a9..0da4e17 100644 --- a/mesa.spec +++ b/mesa.spec @@ -76,7 +76,7 @@ Source1: Mesa-MLAA-License-Clarification-Email.txt Patch10: gnome-shell-glthread-disable.patch Patch11: 0001-intel-compiler-reemit-boolean-resolve-for-inverted-i.patch Patch12: 0001-intel-compiler-fix-release-build-unused-variable.patch -Patch13: disable-zink-egl-fallback.patch +Patch13: zink-fix-resizable-bar-detection-logic.patch Patch14: mesa-meson-c99.patch BuildRequires: meson >= 1.2.0 diff --git a/zink-fix-resizable-bar-detection-logic.patch b/zink-fix-resizable-bar-detection-logic.patch new file mode 100644 index 0000000..4a5e916 --- /dev/null +++ b/zink-fix-resizable-bar-detection-logic.patch @@ -0,0 +1,39 @@ +From a077c14f150f1c4f670dce381ac2eb548f1a4ac2 Mon Sep 17 00:00:00 2001 +From: Alessandro Astone +Date: Wed, 10 Jan 2024 17:24:30 +0100 +Subject: [PATCH] zink: Fix resizable BAR detection logic + +This was broken in two ways: +* When looking for the MAX biggest_ram it was actually comparing + a candidate against biggest_vis_ram + +* mem_props.memoryTypes[] should be accessed with the memory type + index as found in heap_map + +Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10341 +Cc: 23.3 +Part-of: +--- + src/gallium/drivers/zink/zink_screen.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c +index 5a6d17cb4fa3..6697d7ab938c 100644 +--- a/src/gallium/drivers/zink/zink_screen.c ++++ b/src/gallium/drivers/zink/zink_screen.c +@@ -3258,10 +3258,10 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev + { + uint64_t biggest_vis_vram = 0; + for (unsigned i = 0; i < screen->heap_count[ZINK_HEAP_DEVICE_LOCAL_VISIBLE]; i++) +- biggest_vis_vram = MAX2(biggest_vis_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[i].heapIndex].size); ++ biggest_vis_vram = MAX2(biggest_vis_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[screen->heap_map[ZINK_HEAP_DEVICE_LOCAL_VISIBLE][i]].heapIndex].size); + uint64_t biggest_vram = 0; + for (unsigned i = 0; i < screen->heap_count[ZINK_HEAP_DEVICE_LOCAL]; i++) +- biggest_vram = MAX2(biggest_vis_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[i].heapIndex].size); ++ biggest_vram = MAX2(biggest_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[screen->heap_map[ZINK_HEAP_DEVICE_LOCAL][i]].heapIndex].size); + /* determine if vis vram is roughly equal to total vram */ + if (biggest_vis_vram > biggest_vram * 0.9) + screen->resizable_bar = true; +-- +GitLab +