From c583ea650615a927d9e3768519251a2dd2ed763f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Wed, 17 Jan 2024 13:26:12 +0100 Subject: [PATCH] Update to mesa 23.3.3 --- .mesa.metadata | 1 + ...utomatic-zink-fallback-loading-betwe.patch | 40 +++++++ 0001-zink-initialize-drm_fd-to-1.patch | 39 ------- ...utomatic-zink-fallback-loading-betwe.patch | 103 ++++++++++++++++++ mesa-meson-c99.patch | 42 +++++++ mesa.spec | 13 ++- sources | 2 +- zink-fix-resizable-bar-detection-logic.patch | 39 +++++++ 8 files changed, 237 insertions(+), 42 deletions(-) create mode 100644 .mesa.metadata create mode 100644 0001-Revert-egl-add-automatic-zink-fallback-loading-betwe.patch delete mode 100644 0001-zink-initialize-drm_fd-to-1.patch create mode 100644 0002-Revert-glx-add-automatic-zink-fallback-loading-betwe.patch create mode 100644 mesa-meson-c99.patch create mode 100644 zink-fix-resizable-bar-detection-logic.patch diff --git a/.mesa.metadata b/.mesa.metadata new file mode 100644 index 0000000..4567376 --- /dev/null +++ b/.mesa.metadata @@ -0,0 +1 @@ +13b0767105f93a5b2d3c2b620e2f3cd7ce67c0f5 mesa-23.3.3.tar.xz diff --git a/0001-Revert-egl-add-automatic-zink-fallback-loading-betwe.patch b/0001-Revert-egl-add-automatic-zink-fallback-loading-betwe.patch new file mode 100644 index 0000000..e6217ad --- /dev/null +++ b/0001-Revert-egl-add-automatic-zink-fallback-loading-betwe.patch @@ -0,0 +1,40 @@ +From b673271710047acb1976002e4b84d06b7cefd3d7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= +Date: Wed, 17 Jan 2024 13:20:49 +0100 +Subject: [PATCH 1/2] Revert "egl: add automatic zink fallback loading between + hw and sw drivers" + +This reverts commit 8cd44b8843877a2f7d559d123eb3694841f16fdc. +--- + src/egl/main/eglapi.c | 15 ++++----------- + 1 file changed, 4 insertions(+), 11 deletions(-) + +diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c +index d50be23e871..b1a48668b76 100644 +--- a/src/egl/main/eglapi.c ++++ b/src/egl/main/eglapi.c +@@ -695,17 +695,10 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) + if (disp->Options.ForceSoftware) + RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); + else { +- bool success = false; +- if (!disp->Options.Zink && !getenv("GALLIUM_DRIVER")) { +- disp->Options.Zink = EGL_TRUE; +- success = _eglDriver.Initialize(disp); +- } +- if (!success) { +- disp->Options.Zink = EGL_FALSE; +- disp->Options.ForceSoftware = EGL_TRUE; +- if (!_eglDriver.Initialize(disp)) +- RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); +- } ++ disp->Options.Zink = EGL_FALSE; ++ disp->Options.ForceSoftware = EGL_TRUE; ++ if (!_eglDriver.Initialize(disp)) ++ RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); + } + } + +-- +2.43.0 + diff --git a/0001-zink-initialize-drm_fd-to-1.patch b/0001-zink-initialize-drm_fd-to-1.patch deleted file mode 100644 index 1dd3252..0000000 --- a/0001-zink-initialize-drm_fd-to-1.patch +++ /dev/null @@ -1,39 +0,0 @@ -From a89bf9e86a83005befcdcef47a94fff167bdc47b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= -Date: Wed, 22 Nov 2023 12:48:47 +0100 -Subject: [PATCH] zink: initialize drm_fd to -1 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The `zink_internal_create_screen()` function initializes -`screen->drm_fd` to 0, a valid file descriptor value, via `rzalloc`. - -If an error is found during initialization, the `zink_destroy_screen()` -function is invoked in the `fail` label and the `screen->drm_fd` is -closed because its value is 0 and `screen->drm_fd != -1` is checked. - -Initialize `screen->drm_fd` to -1 to avoid this issue. - -Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10191 -Signed-off-by: José Expósito ---- - src/gallium/drivers/zink/zink_screen.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c -index 50168d8daa1..f42f340657b 100644 ---- a/src/gallium/drivers/zink/zink_screen.c -+++ b/src/gallium/drivers/zink/zink_screen.c -@@ -3126,6 +3126,8 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev - return NULL; - } - -+ screen->drm_fd = -1; -+ - glsl_type_singleton_init_or_ref(); - zink_debug = debug_get_option_zink_debug(); - if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_AUTO) --- -2.42.0 - diff --git a/0002-Revert-glx-add-automatic-zink-fallback-loading-betwe.patch b/0002-Revert-glx-add-automatic-zink-fallback-loading-betwe.patch new file mode 100644 index 0000000..dc8452d --- /dev/null +++ b/0002-Revert-glx-add-automatic-zink-fallback-loading-betwe.patch @@ -0,0 +1,103 @@ +From 9b9d225931b69532aa1b43abdaf29c826bc47b26 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= +Date: Wed, 17 Jan 2024 13:21:08 +0100 +Subject: [PATCH 2/2] Revert "glx: add automatic zink fallback loading between + hw and sw drivers" + +This reverts commit 7d9ea77b4598e23d4415b529924f1cbdca6e33bd. +--- + src/glx/glxext.c | 33 ++++++++------------------------- + 1 file changed, 8 insertions(+), 25 deletions(-) + +diff --git a/src/glx/glxext.c b/src/glx/glxext.c +index 39d5f08bdcf..5036fd137c1 100644 +--- a/src/glx/glxext.c ++++ b/src/glx/glxext.c +@@ -763,11 +763,10 @@ glx_screen_cleanup(struct glx_screen *psc) + ** If that works then fetch the per screen configs data. + */ + static Bool +-AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv, Bool zink) ++AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv) + { + struct glx_screen *psc; + GLint i, screens; +- unsigned screen_count = 0; + + /* + ** First allocate memory for the array of per screen configs. +@@ -804,21 +803,17 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv, Bool zink) + if (psc == NULL) + psc = applegl_create_screen(i, priv); + #else +- if (psc == NULL && !zink) ++ if (psc == NULL) + { + psc = indirect_create_screen(i, priv); + indirect = true; + } + #endif + priv->screens[i] = psc; +- if (psc) +- screen_count++; + + if(indirect) /* Load extensions required only for indirect glx */ + glxSendClientInfo(priv, i); + } +- if (zink && !screen_count) +- return GL_FALSE; + SyncHandle(); + return GL_TRUE; + } +@@ -880,9 +875,9 @@ __glXInitialize(Display * dpy) + #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) + Bool glx_direct = !debug_get_bool_option("LIBGL_ALWAYS_INDIRECT", false); + Bool glx_accel = !debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false); ++ Bool zink; + const char *env = getenv("MESA_LOADER_DRIVER_OVERRIDE"); +- Bool zink = env && !strcmp(env, "zink"); +- Bool try_zink = False; ++ zink = env && !strcmp(env, "zink"); + + dpyPriv->drawHash = __glxHashCreate(); + +@@ -904,13 +899,10 @@ __glXInitialize(Display * dpy) + #endif /* HAVE_DRI3 */ + if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false)) + dpyPriv->dri2Display = dri2CreateDisplay(dpy); +- if (!dpyPriv->dri3Display && !dpyPriv->dri2Display) +- try_zink = !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false) && +- !getenv("GALLIUM_DRIVER"); + } + #endif /* GLX_USE_DRM */ + if (glx_direct) +- dpyPriv->driswDisplay = driswCreateDisplay(dpy, zink | try_zink); ++ dpyPriv->driswDisplay = driswCreateDisplay(dpy, zink); + + #ifdef GLX_USE_WINDOWSGL + if (glx_direct && glx_accel) +@@ -925,18 +917,9 @@ __glXInitialize(Display * dpy) + } + #endif + +- if (!AllocAndFetchScreenConfigs(dpy, dpyPriv, zink | try_zink)) { +- Bool fail = True; +- if (try_zink) { +- free(dpyPriv->screens); +- dpyPriv->driswDisplay->destroyDisplay(dpyPriv->driswDisplay); +- dpyPriv->driswDisplay = driswCreateDisplay(dpy, false); +- fail = !AllocAndFetchScreenConfigs(dpy, dpyPriv, False); +- } +- if (fail) { +- free(dpyPriv); +- return NULL; +- } ++ if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) { ++ free(dpyPriv); ++ return NULL; + } + + glxSendClientInfo(dpyPriv, -1); +-- +2.43.0 + diff --git a/mesa-meson-c99.patch b/mesa-meson-c99.patch new file mode 100644 index 0000000..6cbb053 --- /dev/null +++ b/mesa-meson-c99.patch @@ -0,0 +1,42 @@ +meson: C type error in strtod_l/strtof_l probe + +Future compilers will fail compilation due to the C type error: + +…/testfile.c: In function 'main': +…/testfile.c:12:30: error: passing argument 2 of 'strtod_l' from incompatible pointer type + 12 | double d = strtod_l(s, end, loc); + | ^~~ + | | + | char * +/usr/include/stdlib.h:416:43: note: expected 'char ** restrict' but argument is of type 'char *' + 416 | char **__restrict __endptr, locale_t __loc) + | ~~~~~~~~~~~~~~~~~~^~~~~~~~ +…/testfile.c:13:29: error: passing argument 2 of 'strtof_l' from incompatible pointer type + 13 | float f = strtof_l(s, end, loc); + | ^~~ + | | + | char * +/usr/include/stdlib.h:420:42: note: expected 'char ** restrict' but argument is of type 'char *' + 420 | char **__restrict __endptr, locale_t __loc) + | ~~~~~~~~~~~~~~~~~~^~~~~~~~ + +This means that the probe no longer tests is objective and always +fails. + +Submitted upstream: + +diff --git a/meson.build b/meson.build +index 35cc5f1cd5fd9079..1a5d2ba492be0b31 100644 +--- a/meson.build ++++ b/meson.build +@@ -1425,8 +1425,8 @@ if cc.links(''' + locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL); + const char *s = "1.0"; + char *end; +- double d = strtod_l(s, end, loc); +- float f = strtof_l(s, end, loc); ++ double d = strtod_l(s, &end, loc); ++ float f = strtof_l(s, &end, loc); + freelocale(loc); + return 0; + }''', diff --git a/mesa.spec b/mesa.spec index 4d92806..0ce4d6d 100644 --- a/mesa.spec +++ b/mesa.spec @@ -52,7 +52,7 @@ Name: mesa Summary: Mesa graphics libraries -%global ver 23.3.0 +%global ver 23.3.3 Version: %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)} Release: 1%{?dist} License: MIT @@ -66,7 +66,13 @@ Source1: Mesa-MLAA-License-Clarification-Email.txt Patch10: gnome-shell-glthread-disable.patch Patch12: radeonsi-turn-off-glthread.patch -Patch13: 0001-zink-initialize-drm_fd-to-1.patch +Patch13: zink-fix-resizable-bar-detection-logic.patch +Patch14: mesa-meson-c99.patch +# Temporary disabling Zink as a fallback between HW and SW drivers due to +# multiple regression caused by this change during the 23.3.X development cycle. +# Remove these 2 patches if updating to 24.X.X: +Patch15: 0001-Revert-egl-add-automatic-zink-fallback-loading-betwe.patch +Patch16: 0002-Revert-glx-add-automatic-zink-fallback-loading-betwe.patch BuildRequires: meson >= 0.45 BuildRequires: gcc @@ -610,6 +616,9 @@ popd %endif %changelog +* Wed Jan 17 2024 José Expósito - 23.3.3-1 +- Update to mesa 23.3.3 + * Thu Nov 30 2023 José Expósito - 23.3.0-1 - Update to mesa 23.3.0 diff --git a/sources b/sources index af8892d..8e37cea 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (mesa-23.3.0.tar.xz) = 3568b571974a2c6c0c3a4cc614c851729962e39926f0af906ba91604f9d43c0618db7df004cbec5d9e5dbade2d6bde818608c9aa1686183994d68ad3e6ac4521 +SHA512 (mesa-23.3.3.tar.xz) = bed23e8324b026edd5d2b16a381ec563cf2fa9be9c8fbe8d9fb907cab9d87eef91f493fb9d4e3973d4b679e271d2a85ce48af491585638ab97f087532fc63c30 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 +