[Mesa-dev] [PATCH mesa 2/6] egl: replace _egl_driver->Unload() callback with a simple free()

Eric Engestrom eric at engestrom.ch
Tue Sep 26 22:47:17 UTC 2017


Bonus: fixes a memleak on haiku when unloading the driver

Signed-off-by: Eric Engestrom <eric at engestrom.ch>
---
 src/egl/drivers/dri2/egl_dri2.c     | 9 ---------
 src/egl/drivers/haiku/egl_haiku.cpp | 9 ---------
 src/egl/main/egldriver.c            | 5 +----
 src/egl/main/egldriver.h            | 7 -------
 4 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 1f68bcdcbb..a8f47cb036 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -3168,14 +3168,6 @@ dri2_interop_export_object(_EGLDisplay *dpy, _EGLContext *ctx,
    return dri2_dpy->interop->export_object(dri2_ctx->dri_context, in, out);
 }
 
-static void
-dri2_unload(_EGLDriver *drv)
-{
-   struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
-
-   free(dri2_drv);
-}
-
 /**
  * This is the main entrypoint into the driver, called by libEGL.
  * Create a new _EGLDriver object and init its dispatch table.
@@ -3243,7 +3235,6 @@ _eglBuiltInDriverDRI2(const char *args)
    dri2_drv->base.API.DupNativeFenceFDANDROID = dri2_dup_native_fence_fd;
 
    dri2_drv->base.Name = "DRI2";
-   dri2_drv->base.Unload = dri2_unload;
 
    return &dri2_drv->base;
 }
diff --git a/src/egl/drivers/haiku/egl_haiku.cpp b/src/egl/drivers/haiku/egl_haiku.cpp
index 10f3abc070..a98470f62d 100644
--- a/src/egl/drivers/haiku/egl_haiku.cpp
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
@@ -308,14 +308,6 @@ haiku_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
 }
 
 
-extern "C"
-void
-haiku_unload(_EGLDriver* drv)
-{
-
-}
-
-
 /**
  * This is the main entrypoint into the driver, called by libEGL.
  * Create a new _EGLDriver object and init its dispatch table.
@@ -347,7 +339,6 @@ _eglBuiltInDriverHaiku(const char *args)
 	driver->base.API.SwapBuffers = haiku_swap_buffers;
 
 	driver->base.Name = "Haiku";
-	driver->base.Unload = haiku_unload;
 
 	TRACE("API Calls defined\n");
 
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 60753bb22e..70b9e782e2 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -95,10 +95,7 @@ _eglLoadModule(_EGLModule *mod)
 static void
 _eglUnloadModule(_EGLModule *mod)
 {
-   /* destroy the driver */
-   if (mod->Driver && mod->Driver->Unload)
-      mod->Driver->Unload(mod->Driver);
-
+   free(mod->Driver);
    mod->Driver = NULL;
 }
 
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 1cf6628446..3b13772210 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -80,13 +80,6 @@ struct _egl_driver
 {
    const char *Name;  /**< name of this driver */
 
-   /**
-    * Release the driver resource.
-    *
-    * It is called before dlclose().
-    */
-   void (*Unload)(_EGLDriver *drv);
-
    _EGLAPI API;  /**< EGL API dispatch table */
 };
 
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list