Blame SOURCES/9558ec02d0f7bbf30dc1f9ee4c0b06c9b0c49afe.patch

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