egl_dri2: set correct error code if swapbuffers fails
authorDaniel Czarnowski <daniel.czarnowski@intel.com>
Mon, 15 Feb 2016 07:31:09 +0000 (09:31 +0200)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 19 Feb 2016 18:23:19 +0000 (18:23 +0000)
A return value of '-1' means that there was error during swap with a
window drawable, in this case we set error as EGL_BAD_NATIVE_WINDOW.

v2: coding style cleanup, better commit message

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/drivers/dri2/platform_x11.c

index 931ee511f155c8cf999d9edbac515e5a00b63c0a..420f567651cb45464c678481023c4c37ee8b348e 100644 (file)
@@ -872,7 +872,12 @@ dri2_x11_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
    struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
 
    if (dri2_dpy->dri2) {
-      return dri2_x11_swap_buffers_msc(drv, disp, draw, 0, 0, 0) != -1;
+      if (dri2_x11_swap_buffers_msc(drv, disp, draw, 0, 0, 0) != -1) {
+          return EGL_TRUE;
+      }
+      /* Swap failed with a window drawable. */
+      _eglError(EGL_BAD_NATIVE_WINDOW, __FUNCTION__);
+      return EGL_FALSE;
    } else {
       assert(dri2_dpy->swrast);