Allow concurrent eglSwapBuffers() with same display but different surfaces
... by updating eglSwapBuffers() to give up the display lock before
calling surface->swap().
Bug: b/135742693
Test: built locally
Test: presubmit
Test: cts -m CtsMediaTestCases -t android.media.cts.HeifWriterTest#testInputSurface_Grid_Handler
Test: dEQP-GLES3 tests through cherry
Change-Id: I816d30e80077b40e8396bf8d6ae5bb236753e3ea
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/37769
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Jason Macnak <natsu@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/OpenGL/libEGL/libEGL.cpp b/src/OpenGL/libEGL/libEGL.cpp
index 3f7fff8..f8a8879 100644
--- a/src/OpenGL/libEGL/libEGL.cpp
+++ b/src/OpenGL/libEGL/libEGL.cpp
@@ -1136,11 +1136,13 @@
egl::Display *display = egl::Display::get(dpy);
egl::Surface *eglSurface = (egl::Surface*)surface;
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateSurface(display, eglSurface))
{
- return EGL_FALSE;
+ RecursiveLockGuard lock(egl::getDisplayLock(display));
+
+ if(!validateSurface(display, eglSurface))
+ {
+ return EGL_FALSE;
+ }
}
if(surface == EGL_NO_SURFACE)