aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-02-07 15:14:19 -0800
committerMarge Bot <[email protected]>2020-03-09 18:27:11 +0000
commitf3728816afbbe39a563ec02ba65f3b1516d79881 (patch)
tree0ea9c5f9f60f90763c252f2cf9ad8b2a8283a4d1 /src
parentc7976ed43a7faa8a987b7b90e8f05471fde70620 (diff)
egl/android: require ANDROID_native_fence_sync for buffer age
Querying buffer age requires a buffer to be dequeued. But dequeuing without ANDROID_native_fence_sync might imply eglClientWaitSync, which results in a deadlock as the display lock is already held by eglQuerySurface. Signed-off-by: Chia-I Wu <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/221> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/221>
Diffstat (limited to 'src')
-rw-r--r--src/egl/drivers/dri2/platform_android.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index da90c44d601..8973017324b 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -1645,7 +1645,18 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
disp->Extensions.ANDROID_framebuffer_target = EGL_TRUE;
disp->Extensions.ANDROID_image_native_buffer = EGL_TRUE;
disp->Extensions.ANDROID_recordable = EGL_TRUE;
- disp->Extensions.EXT_buffer_age = EGL_TRUE;
+
+ /* Querying buffer age requires a buffer to be dequeued. Without
+ * EGL_ANDROID_native_fence_sync, dequeue might call eglClientWaitSync and
+ * result in a deadlock (the lock is already held by eglQuerySurface).
+ */
+ if (disp->Extensions.ANDROID_native_fence_sync) {
+ disp->Extensions.EXT_buffer_age = EGL_TRUE;
+#if ANDROID_API_LEVEL >= 23
+ disp->Extensions.KHR_partial_update = EGL_TRUE;
+#endif
+ }
+
disp->Extensions.KHR_image = EGL_TRUE;
#if ANDROID_API_LEVEL >= 24
if (dri2_dpy->mutable_render_buffer &&