Mesa (master): egl: Do not unload drivers.

Chia-I Wu olv at kemper.freedesktop.org
Sun Dec 12 10:32:54 UTC 2010


Module: Mesa
Branch: master
Commit: d6b1478ff0499059661df145efe469e7b28ff7bf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d6b1478ff0499059661df145efe469e7b28ff7bf

Author: Chia-I Wu <olv at lunarg.com>
Date:   Sun Dec 12 18:13:27 2010 +0800

egl: Do not unload drivers.

When the driver is the last reference to libEGL.so, unloading it will
cause libEGL.so to be unmapped and give problems.  Disable the unloading
for now.  Still have to figure out the right timing to unload drivers.

---

 src/egl/main/egldriver.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index ff0011c..e5d8a39 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -186,11 +186,22 @@ _eglLoadModule(_EGLModule *mod)
 static void
 _eglUnloadModule(_EGLModule *mod)
 {
+#if defined(_EGL_OS_UNIX)
    /* destroy the driver */
    if (mod->Driver && mod->Driver->Unload)
       mod->Driver->Unload(mod->Driver);
+
+   /*
+    * XXX At this point (atexit), the module might be the last reference to
+    * libEGL.  Closing the module might unmap libEGL and give problems.
+    */
+#if 0
    if (mod->Handle)
       close_library(mod->Handle);
+#endif
+#elif defined(_EGL_OS_WINDOWS)
+   /* XXX Windows unloads DLLs before atexit */
+#endif
 
    mod->Driver = NULL;
    mod->Handle = NULL;
@@ -670,12 +681,7 @@ _eglUnloadDrivers(void)
 {
    /* this is called at atexit time */
    if (_eglModules) {
-#if defined(_EGL_OS_UNIX)
       _eglDestroyArray(_eglModules, _eglFreeModule);
-#elif defined(_EGL_OS_WINDOWS)
-      /* XXX Windows unloads DLLs before atexit */
-      _eglDestroyArray(_eglModules, NULL);
-#endif
       _eglModules = NULL;
    }
 }




More information about the mesa-commit mailing list