Commit 2548f73c authored by chadversary's avatar chadversary Committed by Andres Gomez

egl/android: Cancel any outstanding ANativeBuffer in surface destructor

That is, call ANativeWindow::cancelBuffer in droid_destroy_surface().

This should prevent application deadlock when the app destroys the
EGLSurface after EGL has acquired a buffer from SurfaceFlinger
(ANativeWindow::dequeueBuffer) but before EGL has released it

This patch is part of a series for fixing
on Chrome OS x86 devices.

Cc: Tomasz Figa <>
Cc: Tapani Pälli <>
Reviewed-by: default avatarNicolas Boichat <>
Reviewed-by: default avatarEmil Velikov <>
(cherry picked from commit 0212db35)
parent d231ed73
......@@ -251,10 +251,15 @@ droid_window_enqueue_buffer(_EGLDisplay *disp, struct dri2_egl_surface *dri2_sur
static void
droid_window_cancel_buffer(_EGLDisplay *disp, struct dri2_egl_surface *dri2_surf)
droid_window_cancel_buffer(struct dri2_egl_surface *dri2_surf)
/* no cancel buffer? */
droid_window_enqueue_buffer(disp, dri2_surf);
int ret;
ret = dri2_surf->window->cancelBuffer(dri2_surf->window, dri2_surf->buffer, -1);
if (ret < 0) {
_eglLog(_EGL_WARNING, "ANativeWindow::cancelBuffer failed");
dri2_surf->base.Lost = true;
static __DRIbuffer *
......@@ -386,7 +391,7 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
if (dri2_surf->buffer)
droid_window_cancel_buffer(disp, dri2_surf);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment