}
static EGLBoolean
-droid_window_enqueue_buffer(struct dri2_egl_surface *dri2_surf)
+droid_window_enqueue_buffer(_EGLDisplay *disp, struct dri2_egl_surface *dri2_surf)
{
+ /* 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);
+
#if ANDROID_VERSION >= 0x0402
/* Queue the buffer without a sync fence. This informs the ANativeWindow
* that it may access the buffer immediately.
dri2_surf->buffer->common.decRef(&dri2_surf->buffer->common);
dri2_surf->buffer = NULL;
+ mtx_lock(&disp->Mutex);
return EGL_TRUE;
}
static void
-droid_window_cancel_buffer(struct dri2_egl_surface *dri2_surf)
+droid_window_cancel_buffer(_EGLDisplay *disp, struct dri2_egl_surface *dri2_surf)
{
/* no cancel buffer? */
- droid_window_enqueue_buffer(dri2_surf);
+ droid_window_enqueue_buffer(disp, dri2_surf);
}
static __DRIbuffer *
if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
if (dri2_surf->buffer)
- droid_window_cancel_buffer(dri2_surf);
+ droid_window_cancel_buffer(disp, dri2_surf);
dri2_surf->window->common.decRef(&dri2_surf->window->common);
}
dri2_flush_drawable_for_swapbuffers(disp, draw);
if (dri2_surf->buffer)
- droid_window_enqueue_buffer(dri2_surf);
+ droid_window_enqueue_buffer(disp, dri2_surf);
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);