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;
}
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);