As discussed offline, this is similar to commit 1ea233c. LGTM;

Reviewed-by: Tapani Pälli <[email protected]>

On 04/27/2018 05:17 AM, Min He wrote:
To avoid blocking other EGL calls, release the display mutex before
calling update_buffers(), which will call droid_window_dequeue_buffer().
The lock appears like below:
1. Consumer thread: updateTexImage() -> updateAndReleaseLocked() ->
syncForReleaseLocked() -> eglDupNativeFenceFDANDROID() ->
_eglLockDisplay() -> waiting for the dpy lock.

2. Producer thread: eglQuerySurface() (acquired dpy lock) ->
droid_query_buffer_age() -> update_buffers() ->
android::Surface::dequeueBuffer() ->
android::BufferQueueProducer::waitForFreeSlotThenRelock()

This patch fixes some failure cases in android graphics cts test.

Signed-off-by: Min He <[email protected]>
Signed-off-by: Chenglei Ren <[email protected]>
Tested-by: Chenglei Ren <[email protected]>
---
  src/egl/drivers/dri2/platform_android.c | 7 +++++++
  1 file changed, 7 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 7f1a496..c6f895a 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -610,11 +610,18 @@ droid_query_buffer_age(_EGLDriver *drv,
  {
     struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
+ /* To avoid blocking other EGL calls, release the display mutex before
+    * we enter droid_window_dequeue_buffer() and re-acquire the mutex upon
+    * return.
+    */
+   mtx_unlock(&disp->Mutex);
     if (update_buffers(dri2_surf) < 0) {
        _eglError(EGL_BAD_ALLOC, "droid_query_buffer_age");
+      mtx_lock(&disp->Mutex);
        return -1;
     }
+ mtx_lock(&disp->Mutex);
     return dri2_surf->back ? dri2_surf->back->age : 0;
  }
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to