I've encountered problem when debugging rotation with DRI enabled.
I965 dri driver only checks sarea->ctxOwner when holding heavy lock,
but I think we also need to check it in light lock case, as ctxOwner
is used by video driver to tell others it's smashing the state. With
below patch, rotation can work fine with DRI on G965. 

Is it ok to push? Thanks. 

---
diff --git a/src/mesa/drivers/dri/i965/intel_context.c 
b/src/mesa/drivers/dri/i965/intel_context.c
index 10eb9a2..1170dba 100644
--- a/src/mesa/drivers/dri/i965/intel_context.c
+++ b/src/mesa/drivers/dri/i965/intel_context.c
@@ -594,7 +594,6 @@ static void intelContendedLock( struct i
    __DRIdrawablePrivate *dPriv = intel->driDrawable;
    __DRIscreenPrivate *sPriv = intel->driScreen;
    volatile drmI830Sarea * sarea = intel->sarea;
-   int me = intel->hHWContext;
    int my_bufmgr = bmCtxId(intel);
 
    drmGetLock(intel->driFd, intel->hHWContext, flags);
@@ -611,14 +610,6 @@ static void intelContendedLock( struct i
    intel->locked = 1;
    intel->need_flush = 1;
 
-   /* Lost context?
-    */
-   if (sarea->ctxOwner != me) {
-      DBG("Lost Context: sarea->ctxOwner %x me %x\n", sarea->ctxOwner, me);
-      sarea->ctxOwner = me;
-      intel->vtbl.lost_hardware( intel );
-   }
-
    /* As above, but don't evict the texture data on transitions
     * between contexts which all share a local buffer manager.
     */
@@ -643,6 +634,10 @@ _glthread_DECLARE_STATIC_MUTEX(lockMutex
 void LOCK_HARDWARE( struct intel_context *intel )
 {
     char __ret=0;
+   __DRIdrawablePrivate *dPriv = intel->driDrawable;
+   __DRIscreenPrivate *sPriv = intel->driScreen;
+   volatile drmI830Sarea * sarea = intel->sarea;
+   int me = intel->hHWContext;
 
     _glthread_LOCK_MUTEX(lockMutex);
     assert(!intel->locked);
@@ -685,6 +680,14 @@ void LOCK_HARDWARE( struct intel_context
         assert(0);
       }
    }
+
+   /* Lost context?
+    */
+   if (sarea->ctxOwner != me) {
+      DBG("Lost Context: sarea->ctxOwner %x me %x\n", sarea->ctxOwner, me);
+      sarea->ctxOwner = me;
+      intel->vtbl.lost_hardware( intel );
+   }
 }
  
---   

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to