| From dc8b4cce41268c7c82534d88c047acde1123d97c Mon Sep 17 00:00:00 2001 |
| From: Chia-I Wu <olvaffe@gmail.com> |
| Date: Thu, 7 Feb 2019 15:14:19 -0800 |
| Subject: [PATCH] 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. |
| |
| Change-Id: I86b07c71a88dd13a130a94def362eb35600d9274 |
| Signed-off-by: Chia-I Wu <olvaffe@gmail.com> |
| --- |
| src/egl/drivers/dri2/platform_android.c | 10 +++++++++- |
| 1 file changed, 9 insertions(+), 1 deletion(-) |
| |
| diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c |
| index dda38d672653..dd8c4bff278e 100644 |
| --- a/src/egl/drivers/dri2/platform_android.c |
| +++ b/src/egl/drivers/dri2/platform_android.c |
| @@ -1606,7 +1606,15 @@ 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; |
| + } |
| + |
| disp->Extensions.KHR_image = EGL_TRUE; |
| #if ANDROID_API_LEVEL >= 24 |
| if (dri2_dpy->mutable_render_buffer && |
| -- |
| 2.21.0 |
| |