From aa57ea1b03a4dc517327af82e9384e08c4e4d27a Mon Sep 17 00:00:00 2001 From: "taifu.gc" Date: Thu, 9 May 2024 02:44:49 +0000 Subject: [PATCH] Fix bug --- 26184.patch | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ mesa.spec | 6 ++++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 26184.patch diff --git a/26184.patch b/26184.patch new file mode 100644 index 0000000..16ad22f --- /dev/null +++ b/26184.patch @@ -0,0 +1,68 @@ +From d913927fe9201f0fea71ef0e614b9c400c122d49 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= +Date: Tue, 14 Nov 2023 09:23:23 +0100 +Subject: [PATCH] egl/glx: fallback to software when Zink is forced and fails +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When `MESA_LOADER_DRIVER_OVERRIDE` is set to `zink` and the display +initialization fails, fallback to software rendering. + +The error was reported in #10123 and it can be reproduced with: + + $ MESA_LOADER_DRIVER_OVERRIDE=zink eglinfo + +`eglinfo` would crash in `dri2_display_release()` because of +`assert(dri2_dpy->ref_count > 0)`. + +After bisecting the error to commit 8cd44b884387 ("egl/glx: add +autoloading for zink"), I found out that, before this change, the +display was set to initialized even when `_eglDriver.Initialize(disp)` +failed: + + disp->Options.Zink = env && !strcmp(env, "zink"); + // disp->Options.Zink is true + + if (!_eglDriver.Initialize(disp)) { + [...] + // Zink initialization has failed at this point + // However, success is set to true: + bool success = disp->Options.Zink; + if (!disp->Options.Zink && !getenv("GALLIUM_DRIVER")) { + [...] + } + // Software initialization is ignored because success is true + if (!success) { + [...] + } + } + + // The display is set as initialized even though it shouldn't + disp->Initialized = EGL_TRUE; + +Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10123 +Fixes: 8cd44b884387 ("egl/glx: add autoloading for zink") +Signed-off-by: José Expósito +Part-of: +--- + src/egl/main/eglapi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c +index 88aa6c2ceba06..d37d61d624660 100644 +--- a/src/egl/main/eglapi.c ++++ b/src/egl/main/eglapi.c +@@ -695,7 +695,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) + if (disp->Options.ForceSoftware) + RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); + else { +- bool success = disp->Options.Zink; ++ bool success = false; + if (!disp->Options.Zink && !getenv("GALLIUM_DRIVER")) { + disp->Options.Zink = EGL_TRUE; + success = _eglDriver.Initialize(disp); +-- +GitLab + + diff --git a/mesa.spec b/mesa.spec index 4deac08..3a6c5bb 100644 --- a/mesa.spec +++ b/mesa.spec @@ -1,4 +1,4 @@ -%define anolis_release 2 +%define anolis_release 3 %global with_hardware 1 %global with_vulkan_hw 1 @@ -47,6 +47,7 @@ Source1: Mesa-MLAA-License-Clarification-Email.txt Patch10: gnome-shell-glthread-disable.patch Patch11: 0001-zink-initialize-drm_fd-to-1.patch +Patch12: 26184.patch BuildRequires: meson BuildRequires: gcc @@ -634,6 +635,9 @@ popd %endif %changelog +* Thu May 9 2024 Chang Gao - 23.3.0-3 +- Fix driver error + * Mon Mar 25 2024 Bo Ren - 23.3.0-2 - Rebuild with python3.11 -- Gitee