[Mesa-dev] [PATCH] platform_android: prevent deadlock in droid_swap_buffers

Emil Velikov emil.l.velikov at gmail.com
Fri May 27 16:00:59 UTC 2016


Hi Haixia Shi,

On 26 May 2016 at 00:02, Haixia Shi <hshi at chromium.org> wrote:

> @@ -434,8 +434,15 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
>
>     dri2_flush_drawable_for_swapbuffers(disp, draw);
>
> -   if (dri2_surf->buffer)
> +   if (dri2_surf->buffer) {
> +      /* To avoid blocking other EGL calls, release the display mutex before
> +       * we enter droid_window_enqueue_buffer() and re-acquire the mutex upon
> +       * return.
> +       */
> +      mtx_unlock(&disp->Mutex);
>        droid_window_enqueue_buffer(dri2_surf);
> +      mtx_lock(&disp->Mutex);
> +   }
>
Shouldn't this be moved to droid_window_enqueue_buffer() ? This way
destroy_surface will also benefit from the non-blocking behaviour.

Related: if the Android API has a method to cancel/discard the actual
buffer we can use that instead for
destroy_surface/droid_window_cancel_buffer.

Regards,
Emil


More information about the mesa-dev mailing list