libnvidia-egl-wayland/0007-egl-wayland-fix-device-name-case-where-only-wl_drm-e.patch

44 lines
1.6 KiB
Diff
Raw Normal View History

From 845568c64b69b462918ed89760abb21039e55368 Mon Sep 17 00:00:00 2001
From: Austin Shafer <ashafer@badland.io>
Date: Tue, 17 Sep 2024 10:39:26 -0400
Subject: [PATCH 7/9] egl-wayland: fix device name case where only wl_drm
exists
This fixes a problem in commit 6355c16 where we do not properly wait
for a roundtrip to get the wl_drm name, which can lead to failing to
initialize and falling back to another ICD. This fix also properly
prioritizes the device provided by dmabuf feedback over the wl_drm
name, only using wl_drm if dmabuf did not provide anything.
---
src/wayland-egldisplay.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/wayland-egldisplay.c b/src/wayland-egldisplay.c
index 0128dbd..3921ede 100644
--- a/src/wayland-egldisplay.c
+++ b/src/wayland-egldisplay.c
@@ -634,7 +634,6 @@ registry_handle_global_check_protocols(
if ((strcmp(interface, "wl_drm") == 0) && (version >= 2)) {
protocols->wlDrm = wl_registry_bind(registry, name, &wl_drm_interface, 2);
- wl_drm_add_listener(protocols->wlDrm, &drmListener, protocols);
}
}
@@ -833,6 +832,12 @@ static bool getServerProtocolsInfo(struct wl_display *nativeDpy,
}
}
+ /* If we didn't get a name through linux_dmabuf then fall back to wl_drm */
+ if (!protocols->drm_name && protocols->wlDrm) {
+ wl_drm_add_listener(protocols->wlDrm, &drmListener, protocols);
+ wl_display_roundtrip_queue(nativeDpy, queue);
+ }
+
/* Check that one of our two protocols provided the device name */
result = protocols->drm_name != NULL;
--
2.43.0