Fix zink crash and re-enable the automatic fallback

This commit is contained in:
Alessandro Astone 2024-01-10 19:37:18 +01:00
parent beecf70924
commit 53f97b7f12
3 changed files with 40 additions and 27 deletions

View file

@ -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
}
}

View file

@ -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

View file

@ -0,0 +1,39 @@
From a077c14f150f1c4f670dce381ac2eb548f1a4ac2 Mon Sep 17 00:00:00 2001
From: Alessandro Astone <ales.astone@gmail.com>
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 <mesa-stable>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26979>
---
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