|
1328f2f3
|
2023-04-17T16:43:12
|
|
Vulkan: Destroy the surface without holding the EGL lock
This change defers surface destruction to the end of the entry point
that causes it so that it is done without holding the EGL lock. This
works around a specific deadlock in Android. On this platform:
- For EGL applications, parts of surface creation and destruction are
handled by the platform, and parts of it are done by the native EGL
driver. Namely, on surface destruction, native_window_api_disconnect
is called outside the EGL driver.
- For Vulkan applications, vkDestroySurfaceKHR takes full responsibility
for destroying the surface, including calling
native_window_api_disconnect.
Unfortunately, native_window_api_disconnect may use EGL sync objects and
can lead to calling into the EGL driver. For ANGLE, this is
particularly problematic because it is simultaneously a Vulkan
application and the EGL driver, causing `vkDestroySurfaceKHR` to call
back into ANGLE and attempt to reacquire the EGL lock.
Since there are no users of the surface when calling
vkDestroySurfaceKHR, it is safe for ANGLE to destroy it without holding
the EGL lock.
Note that only eglDestroySurface and eglMakeCurrent may lead to the
destruction of a window surface.
Bug: b/275176234
Bug: angleproject:8127
Change-Id: I02dc52e53e150943457e3f503e7ef30469f96b05
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4428754
Reviewed-by: Charlie Lao <cclao@google.com>
Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
|