egl: drop unreachable BAD_NATIVE_WINDOW conditions
authorEmil Velikov <emil.velikov@collabora.com>
Fri, 4 Aug 2017 23:25:47 +0000 (00:25 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 10 Aug 2017 18:27:03 +0000 (19:27 +0100)
The code in _eglCreateWindowSurfaceCommon() already has a NULL check
which handles the condition. There's no point in checking again further
down the stack.

v2: Split the WINDOW vs PIXMAP into separate patches
v3: Resolve typos, s/EGL_PIXMAP_BIT_BIT/EGL_PIXMAP_BIT/

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c

index 50a82486956ee5131f74bfd1035ea53b215bee7a..beb474025f777e35c18a2fe39ea2a8dba54bcd00 100644 (file)
@@ -329,7 +329,7 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
    if (type == EGL_WINDOW_BIT) {
       int format;
 
-      if (!window || window->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
+      if (window->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
          _eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface");
          goto cleanup_surface;
       }
index a952aa545607811153e8175580813826b1acf883..7ea43e620105d125126c703c8a9672e133ca96e3 100644 (file)
@@ -115,11 +115,6 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
 
    switch (type) {
    case EGL_WINDOW_BIT:
-      if (!window) {
-         _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
-         goto cleanup_surf;
-      }
-
       surf = gbm_dri_surface(window);
       dri2_surf->gbm_surf = surf;
       dri2_surf->base.Width =  surf->base.width;
index e0febf8c4cb9e54cea0ebf25010568369fecdaf6..3535c4bef08730581515f96713104fa716e8e5c2 100644 (file)
@@ -162,11 +162,6 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
          dri2_surf->format = WL_SHM_FORMAT_ARGB8888;
    }
 
-   if (!window) {
-      _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
-      goto cleanup_surf;
-   }
-
    dri2_surf->wl_win = window;
    dri2_surf->wl_queue = wl_display_create_queue(dri2_dpy->wl_dpy);
    if (!dri2_surf->wl_queue) {
index f9aaf47e7d1821f62133e590ab05a74263e0683b..ec38e8123d8996a669904c1b03a8ce5cdb31f2d3 100644 (file)
@@ -247,10 +247,8 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
                        dri2_surf->base.Width, dri2_surf->base.Height);
    } else {
       if (!drawable) {
-         if (type == EGL_WINDOW_BIT)
-            _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
-         else
-            _eglError(EGL_BAD_NATIVE_PIXMAP, "dri2_create_surface");
+         assert(type == EGL_PIXMAP_BIT)
+         _eglError(EGL_BAD_NATIVE_PIXMAP, "dri2_create_surface");
          goto cleanup_surf;
       }
       dri2_surf->drawable = drawable;