egl: handle BAD_NATIVE_PIXMAP further up the stack
authorEmil Velikov <emil.velikov@collabora.com>
Fri, 4 Aug 2017 23:25:48 +0000 (00:25 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 10 Aug 2017 18:28:04 +0000 (19:28 +0100)
The basic (null) check is identical across all backends.
Just move it to the top.

v2:
 - Split the WINDOW vs PIXMAP into separate patches
 - Move check after the dpy and config - dEQP expects so

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/egl/drivers/dri2/platform_x11.c
src/egl/main/eglapi.c

index ec38e8123d8996a669904c1b03a8ce5cdb31f2d3..87efa016be9df3dd00fceba6ae7697ed09941a63 100644 (file)
@@ -246,11 +246,6 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
                        dri2_surf->drawable, dri2_dpy->screen->root,
                        dri2_surf->base.Width, dri2_surf->base.Height);
    } else {
-      if (!drawable) {
-         assert(type == EGL_PIXMAP_BIT)
-         _eglError(EGL_BAD_NATIVE_PIXMAP, "dri2_create_surface");
-         goto cleanup_surf;
-      }
       dri2_surf->drawable = drawable;
    }
 
index 7f042181040ffbb96415d810740d71e80bbee13b..b3bcb1bac7d5012382468475868baa5c62f3913e 100644 (file)
@@ -1021,6 +1021,9 @@ _eglCreatePixmapSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
    if ((conf->SurfaceType & EGL_PIXMAP_BIT) == 0)
       RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SURFACE);
 
+   if (native_pixmap == NULL)
+      RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);
+
    surf = drv->API.CreatePixmapSurface(drv, disp, conf, native_pixmap,
                                        attrib_list);
    ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;