[Mesa-dev] [PATCH 3/8] egl: handle BAD_NATIVE_PIXMAP further up the stack

Emil Velikov emil.l.velikov at gmail.com
Fri Aug 4 23:25:48 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

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

Cc: Eric Engestrom <eric.engestrom at imgtec.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/egl/drivers/dri2/platform_x11.c | 5 -----
 src/egl/main/eglapi.c               | 3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 00cab577b77..e2007a0313e 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -234,11 +234,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_BIT)
-         _eglError(EGL_BAD_NATIVE_PIXMAP, "dri2_create_surface");
-         goto cleanup_surf;
-      }
       dri2_surf->drawable = drawable;
    }
 
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index c5e3955c48c..3ca3dd4c7c1 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -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;
-- 
2.13.3



More information about the mesa-dev mailing list