diff options
author | Chad Versace <chadversary@chromium.org> | 2017-05-04 17:46:33 -0700 |
---|---|---|
committer | Andres Gomez <agomez@igalia.com> | 2017-05-12 21:54:56 +0300 |
commit | 2548f73c0d1b5fc548212b527647b8b9932096ff (patch) | |
tree | 19f3533fde53e14cd8f8904e7df876839596fb63 | |
parent | d231ed73c6b233a0ce4b525ee82918f550111955 (diff) |
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
(ANativeWindow::enqueueBuffer).
This patch is part of a series for fixing
android.hardware.camera2.cts.RobustnessTest#testAbandonRepeatingRequestSurface
on Chrome OS x86 devices.
Cc: mesa-stable@lists.freedesktop.org
Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 0212db350407e1331ff23f04136684cf2b7396cf)
-rw-r--r-- | src/egl/drivers/dri2/platform_android.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 511b696192a..3ac6098549c 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -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); + droid_window_cancel_buffer(dri2_surf); dri2_surf->window->common.decRef(&dri2_surf->window->common); } |