From 203629734116608494815637305dd890d8c01ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Wed, 22 Nov 2023 13:08:21 +0100 Subject: [PATCH] Backport MR #26332 to fix X11 session on VMs MR: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26332 Mesa bug: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26332 Resolves: https://issues.redhat.com/browse/RHEL-1258 --- 0001-zink-initialize-drm_fd-to-1.patch | 39 ++++++++++++++++++++++++++ mesa.spec | 6 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 0001-zink-initialize-drm_fd-to-1.patch diff --git a/0001-zink-initialize-drm_fd-to-1.patch b/0001-zink-initialize-drm_fd-to-1.patch new file mode 100644 index 0000000..1dd3252 --- /dev/null +++ b/0001-zink-initialize-drm_fd-to-1.patch @@ -0,0 +1,39 @@ +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/mesa.spec b/mesa.spec index 374927f..046e995 100644 --- a/mesa.spec +++ b/mesa.spec @@ -54,7 +54,7 @@ Name: mesa Summary: Mesa graphics libraries %global ver 23.3.0-rc2 Version: %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)} -Release: 2%{?dist} +Release: 3%{?dist} License: MIT URL: http://www.mesa3d.org @@ -69,6 +69,7 @@ Patch12: radeonsi-turn-off-glthread.patch Patch13: 0001-nir-add-deref-follower-builder-for-casts.patch Patch14: 0001-zink-Fix-crash-on-zink_create_screen-error-path.patch Patch15: 0001-zink-allow-software-rendering-only-if-selected.patch +Patch16: 0001-zink-initialize-drm_fd-to-1.patch BuildRequires: meson >= 0.45 BuildRequires: gcc @@ -609,6 +610,9 @@ popd %endif %changelog +* Wed Nov 22 2023 José Expósito - 23.3.0-rc2-3 +- Backport MR #26332 to fix X11 session on VMs + * Fri Nov 17 2023 José Expósito - 23.3.0-rc2-2 - Backport MR #26220 to fix GNOME apps crash