Mesa (master): egl: Do not call drv->Initialize with global mutex locked.

Chia-I Wu olv at kemper.freedesktop.org
Tue Jun 29 02:17:25 PDT 2010


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

Author: Chia-I Wu <olv at lunarg.com>
Date:   Thu Jun 24 16:49:40 2010 +0800

egl: Do not call drv->Initialize with global mutex locked.

---

 src/egl/main/egldriver.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 71d2ba0..f3a6940 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -460,6 +460,7 @@ _EGLDriver *
 _eglLoadDefaultDriver(EGLDisplay dpy, EGLint *major, EGLint *minor)
 {
    _EGLDriver *drv = NULL;
+   EGLBoolean ok;
    int i;
 
    _eglLockMutex(_eglGlobal.Mutex);
@@ -470,10 +471,15 @@ _eglLoadDefaultDriver(EGLDisplay dpy, EGLint *major, EGLint *minor)
       if (_eglGlobal.NumDrivers == 0)
 	 continue;
       drv = _eglGlobal.Drivers[0];
-      if (drv->API.Initialize(drv, dpy, major, minor))
-	 break;
+
+      _eglUnlockMutex(_eglGlobal.Mutex);
+      ok = drv->API.Initialize(drv, dpy, major, minor);
+      _eglLockMutex(_eglGlobal.Mutex);
+      if (ok)
+         break;
+
       _eglUnloadDrivers();
-   }      
+   }
 
    _eglUnlockMutex(_eglGlobal.Mutex);
 



More information about the mesa-commit mailing list