diff options
author | Lionel Landwerlin <[email protected]> | 2014-10-14 10:39:47 +0100 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2014-10-27 10:36:21 -0700 |
commit | d175e7c16b4de1a4231b806dad3e400be9611121 (patch) | |
tree | 5a93f8ca1730b614c8b692c7b6cc0151bbef7f17 /src | |
parent | 1a170980a09d82201b88e3fe20684a0df2cfea80 (diff) |
egl/drm: do not crash when swapping buffers without any rendering
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/drivers/dri2/platform_drm.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index ab71f4b242a..753c60f1426 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -418,6 +418,14 @@ dri2_drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) 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) < 0) { + _eglError(EGL_BAD_ALLOC, "dri2_swap_buffers"); + return EGL_FALSE; + } + dri2_surf->current = dri2_surf->back; dri2_surf->current->age = 1; dri2_surf->back = NULL; |