diff options
author | Kristian Høgsberg <[email protected]> | 2013-02-06 15:41:54 -0500 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-02-17 14:08:41 -0800 |
commit | 60f05f0eef85b2d4cad96ab36e79d980dafcfafc (patch) | |
tree | ec8887b29a5045cb0aba1e435103ceb6b7d4913f /src | |
parent | 714d8b3f8cdfdd1a37cc017b05f469edacc58ffb (diff) |
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.
NOTE: This is a candidate for the 9.0 and 9.1 branches.
https://bugs.freedesktop.org/show_bug.cgi?id=60086
(cherry picked from commit 1fe007399c1ed28b8cef9d4f040164480423f2c9)
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/drivers/dri2/platform_wayland.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index e9a66afb6ed..99d8729cfc1 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -446,6 +446,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) @@ -463,6 +464,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_swap_buffers"); + return EGL_FALSE; + } + dri2_surf->back->age = 1; dri2_surf->current = dri2_surf->back; dri2_surf->back = NULL; |