Blame SOURCES/9558ec02d0f7bbf30dc1f9ee4c0b06c9b0c49afe.patch

5a0ca5
From 9558ec02d0f7bbf30dc1f9ee4c0b06c9b0c49afe Mon Sep 17 00:00:00 2001
5a0ca5
From: Erik Kurzinger <ekurzinger@nvidia.com>
5a0ca5
Date: Fri, 14 Aug 2020 07:27:58 -0700
5a0ca5
Subject: [PATCH] suspend lock in eglBindWaylandDisplayWL
5a0ca5
5a0ca5
When binding an external EGL display to a Wayland display, core EGL will
5a0ca5
need to translate the external handle to an internal handle before
5a0ca5
performing any API calls. This may occur, for example, when running a
5a0ca5
nested Wayland compositor where the EGL display will be using
5a0ca5
EGL_PLATFORM_WAYLAND as opposed to EGL_PLATFORM_DEVICE. Translating this
5a0ca5
handle involves calling wlEglGetInternalHandleExport, which attempts to
5a0ca5
acquire the external API lock. However, during eglBindWaylandDisplayWL this
5a0ca5
lock is already held.  As a result, when wl_eglstream_display_bind calls
5a0ca5
eglQueryString to retrieve the extension string, this lock acquisition will
5a0ca5
fail causing a crash.
5a0ca5
5a0ca5
To fix this, wl_eglstream_display_bind should temporarily suspend the API
5a0ca5
lock before calling eglQueryString.
5a0ca5
---
5a0ca5
 src/wayland-eglstream-server.c | 2 ++
5a0ca5
 1 file changed, 2 insertions(+)
5a0ca5
5a0ca5
diff --git a/src/wayland-eglstream-server.c b/src/wayland-eglstream-server.c
5a0ca5
index c37f8e6..331ad32 100644
5a0ca5
--- a/src/wayland-eglstream-server.c
5a0ca5
+++ b/src/wayland-eglstream-server.c
5a0ca5
@@ -308,7 +308,9 @@ wl_eglstream_display_bind(WlEglPlatformData *data,
5a0ca5
     wlStreamDpy->eglDisplay    = eglDisplay;
5a0ca5
     wlStreamDpy->caps_override = 0;
5a0ca5
 
5a0ca5
+    wlExternalApiUnlock();
5a0ca5
     exts = data->egl.queryString(eglDisplay, EGL_EXTENSIONS);
5a0ca5
+    wlExternalApiLock();
5a0ca5
 
5a0ca5
 #define CACHE_EXT(_PREFIX_, _NAME_)                                      \
5a0ca5
         wlStreamDpy->exts._NAME_ =                                       \