summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad@kiwitree.net>2017-05-02 18:13:11 -0700
committerChad Versace <chadversary@chromium.org>2017-05-03 16:46:03 -0700
commit202ef9b8eb0be27377cf77f3a6821c44ec2eb929 (patch)
tree3d6c571dd2d98f480dcfcaafadd44b625b358800
parent58bfeb4ef25512ef89487bb97de0960711ba7bad (diff)
egl/android: Mark surface as lost when dequeueBuffer failschadv/review/fix-lost-android-window-v01
This ensures that future calls to eglSwapBuffers and eglMakeCurrent emit an error. This patch is part of a series for fixing android.hardware.camera2.cts.RobustnessTest#testAbandonRepeatingRequestSurface on Chrome OS x86 devices. Cc: Tomasz Figa <tfiga@chromium.org> Cc: Nicolas Boichat <drinkcat@chromium.org> Cc: Tapani Pälli <tapani.palli@intel.com>
-rw-r--r--src/egl/drivers/dri2/platform_android.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index f45fcdf4ff7..2450d9de476 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -431,12 +431,16 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
static int
update_buffers(struct dri2_egl_surface *dri2_surf)
{
+ if (dri2_surf->base.Lost)
+ return -1;
+
if (dri2_surf->base.Type != EGL_WINDOW_BIT)
return 0;
/* try to dequeue the next back buffer */
if (!dri2_surf->buffer && !droid_window_dequeue_buffer(dri2_surf)) {
_eglLog(_EGL_WARNING, "Could not dequeue buffer from native window");
+ dri2_surf->base.Lost = true;
return -1;
}
@@ -628,6 +632,12 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
dri2_flush_drawable_for_swapbuffers(disp, draw);
+ /* dri2_surf->buffer can be null even when no error has occured. For
+ * example, if the user has called no GL rendering commands since the
+ * previous eglSwapBuffers, then the driver may have not triggered
+ * a callback to ANativeWindow::dequeueBuffer, in which case
+ * dri2_surf->buffer remains null.
+ */
if (dri2_surf->buffer)
droid_window_enqueue_buffer(disp, dri2_surf);