[Mesa-dev] [PATCH 08/13] egl/surfaceless: make use of the dri2_display_destroy() helper

Gurchetan Singh gurchetansingh at google.com
Thu May 11 21:13:17 UTC 2017


Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>


On Thu, May 11, 2017 at 11:57 AM, Emil Velikov <emil.l.velikov at gmail.com>
wrote:

> From: Emil Velikov <emil.velikov at collabora.com>
>
> Cc: Chad Versace <chadversary at chromium.org>
> Cc: Gurchetan Singh <gurchetansingh at chromium.org>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  src/egl/drivers/dri2/platform_surfaceless.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_surfaceless.c
> b/src/egl/drivers/dri2/platform_surfaceless.c
> index 7e887de09da..f001eda369c 100644
> --- a/src/egl/drivers/dri2/platform_surfaceless.c
> +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> @@ -279,6 +279,7 @@ dri2_initialize_surfaceless(_EGLDriver *drv,
> _EGLDisplay *disp)
>     if (!dri2_dpy)
>        return _eglError(EGL_BAD_ALLOC, "eglInitialize");
>
> +   dri2_dpy->fd = -1;
>     disp->DriverData = (void *) dri2_dpy;
>
>     const int limit = 64;
> @@ -301,25 +302,27 @@ dri2_initialize_surfaceless(_EGLDriver *drv,
> _EGLDisplay *disp)
>              break;
>           }
>           free(dri2_dpy->driver_name);
> +         dri2_dpy->driver_name = NULL;
>        }
>        close(dri2_dpy->fd);
> +      dri2_dpy->fd = -1;
>     }
>
>     if (!driver_loaded) {
>        err = "DRI2: failed to load driver";
> -      goto cleanup_display;
> +      goto cleanup;
>     }
>
>     dri2_dpy->loader_extensions = image_loader_extensions;
>
>     if (!dri2_create_screen(disp)) {
>        err = "DRI2: failed to create screen";
> -      goto cleanup_driver;
> +      goto cleanup;
>     }
>
>     if (!surfaceless_add_configs_for_visuals(drv, disp)) {
>        err = "DRI2: failed to add configs";
> -      goto cleanup_screen;
> +      goto cleanup;
>     }
>
>     /* Fill vtbl last to prevent accidentally calling virtual function
> during
> @@ -329,16 +332,7 @@ dri2_initialize_surfaceless(_EGLDriver *drv,
> _EGLDisplay *disp)
>
>     return EGL_TRUE;
>
> -cleanup_screen:
> -   dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
> -
> -cleanup_driver:
> -   dlclose(dri2_dpy->driver);
> -   free(dri2_dpy->driver_name);
> -   close(dri2_dpy->fd);
> -cleanup_display:
> -   free(dri2_dpy);
> -   disp->DriverData = NULL;
> -
> +cleanup:
> +   dri2_display_destroy(disp);
>     return _eglError(EGL_NOT_INITIALIZED, err);
>  }
> --
> 2.12.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170511/0faaf4ce/attachment.html>


More information about the mesa-dev mailing list