Blame SOURCES/9558ec02d0f7bbf30dc1f9ee4c0b06c9b0c49afe.patch

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