summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2006-03-27 18:31:27 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2006-03-27 18:31:27 +0000
commitd6ddc33f072a49c5745eec65cf5b4ec25936986f (patch)
treef2e598525d558ec8ff631ecdc859d1be2b187eb8
parentec32d129b79fdf2d4cb47a9f2077787857a64116 (diff)
Protect the DRI __driUtilUpdateDrawable code and other "complex" code
inside intelGetLock() with a mutex. Fixes problems with multithreaded applications dying when moving windows, etc. There seem to be multiple traps for threaded apps in that code, this is a bandaid on those.
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c9
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index 3061f72996..4e7e5b82eb 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -542,6 +542,8 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
return GL_TRUE;
}
+_glthread_DECLARE_STATIC_MUTEX(lockMutex);
+
void intelGetLock( struct intel_context *intel, GLuint flags )
{
__DRIdrawablePrivate *dPriv = intel->driDrawable;
@@ -549,8 +551,11 @@ void intelGetLock( struct intel_context *intel, GLuint flags )
drmI830Sarea * sarea = intel->sarea;
int me = intel->hHWContext;
+ _glthread_LOCK_MUTEX(lockMutex);
+
drmGetLock(intel->driFd, intel->hHWContext, flags);
+
/* If the window moved, may need to set a new cliprect now.
*
* NOTE: This releases and regains the hw lock, so all state
@@ -559,6 +564,10 @@ void intelGetLock( struct intel_context *intel, GLuint flags )
if (dPriv)
DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
+
+ _glthread_UNLOCK_MUTEX(lockMutex);
+
+
/* Lost context?
*/
if (sarea->ctxOwner != me) {
diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h
index 687a14d100..ce6d9fa360 100644
--- a/src/mesa/drivers/dri/i915/intel_context.h
+++ b/src/mesa/drivers/dri/i915/intel_context.h
@@ -265,7 +265,7 @@ struct intel_context
};
-#define DEBUG_LOCKING 1
+#define DEBUG_LOCKING 0
#if DEBUG_LOCKING