commit e015e579be0973603c6b54410ebe185e49c25126 Author: Kristian Høgsberg Date: Wed Feb 6 15:41:54 2013 -0500 egl-wayland: Make sure we allocate a back buffer even if nothing was rendered At eglSwapBuffer time, we blindly assume we have a back buffer, but the back buffer only gets allocated when somebody tries to render something. https://bugs.freedesktop.org/show_bug.cgi?id=60086 diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 8d77a71..2ea68b4 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -499,6 +499,7 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); + __DRIbuffer buffer; int i, ret = 0; while (dri2_surf->frame_callback && ret != -1) @@ -516,6 +517,13 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) if (dri2_surf->color_buffers[i].age > 0) dri2_surf->color_buffers[i].age++; + /* Make sure we have a back buffer in case we're swapping without ever + * rendering. */ + if (get_back_bo(dri2_surf, &buffer) < 0) { + _eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age"); + return EGL_FALSE; + } + dri2_surf->back->age = 1; dri2_surf->current = dri2_surf->back; dri2_surf->back = NULL;