diff -Nraup mesa/src/mesa/drivers/dri/i965/bufmgr_fake.c mesa-fix/src/mesa/drivers/dri/i965/bufmgr_fake.c --- mesa/src/mesa/drivers/dri/i965/bufmgr_fake.c 2006-12-19 11:33:33.000000000 +0800 +++ mesa-fix/src/mesa/drivers/dri/i965/bufmgr_fake.c 2006-12-19 11:40:33.000000000 +0800 @@ -1328,11 +1328,20 @@ unsigned bmSetFence( struct intel_contex return intel->bm->last_fence; } +unsigned bmSetFenceLock( struct intel_context *intel ) +{ + unsigned ret; + LOCK(intel->bm); + ret = bmSetFence(intel); + UNLOCK(intel->bm); + return ret; +} + unsigned bmLockAndFence( struct intel_context *intel ) { if (intel->bm->need_fence) { LOCK_HARDWARE(intel); - bmSetFence(intel); + bmSetFenceLock(intel); UNLOCK_HARDWARE(intel); } @@ -1351,6 +1360,12 @@ void bmFinishFence( struct intel_context } +void bmFinishFenceLock( struct intel_context *intel, unsigned fence ) +{ + LOCK(intel->bm); + bmFinishFence(intel, fence); + UNLOCK(intel->bm); +} /* Specifically ignore texture memory sharing. diff -Nraup mesa/src/mesa/drivers/dri/i965/bufmgr.h mesa-fix/src/mesa/drivers/dri/i965/bufmgr.h --- mesa/src/mesa/drivers/dri/i965/bufmgr.h 2006-12-19 11:33:33.000000000 +0800 +++ mesa-fix/src/mesa/drivers/dri/i965/bufmgr.h 2006-12-19 11:36:36.000000000 +0800 @@ -199,9 +199,11 @@ void *bmFindVirtual( struct intel_contex * For now they can stay, but will likely change/move before final: */ unsigned bmSetFence( struct intel_context * ); +unsigned bmSetFenceLock( struct intel_context * ); unsigned bmLockAndFence( struct intel_context *intel ); int bmTestFence( struct intel_context *, unsigned fence ); void bmFinishFence( struct intel_context *, unsigned fence ); +void bmFinishFenceLock( struct intel_context *, unsigned fence ); void bm_fake_NotifyContendedLockTake( struct intel_context * ); diff -Nraup mesa/src/mesa/drivers/dri/i965/intel_blit.c mesa-fix/src/mesa/drivers/dri/i965/intel_blit.c --- mesa/src/mesa/drivers/dri/i965/intel_blit.c 2006-12-19 11:33:33.000000000 +0800 +++ mesa-fix/src/mesa/drivers/dri/i965/intel_blit.c 2006-12-19 11:35:53.000000000 +0800 @@ -66,7 +66,7 @@ void intelCopyBuffer( const __DRIdrawabl intelFlush( &intel->ctx ); - bmFinishFence(intel, intel->last_swap_fence); + bmFinishFenceLock(intel, intel->last_swap_fence); /* The LOCK_HARDWARE is required for the cliprects. Buffer offsets * should work regardless. @@ -155,7 +155,7 @@ void intelCopyBuffer( const __DRIdrawabl intel_batchbuffer_flush( intel->batch ); intel->second_last_swap_fence = intel->last_swap_fence; - intel->last_swap_fence = bmSetFence( intel ); + intel->last_swap_fence = bmSetFenceLock( intel ); UNLOCK_HARDWARE( intel ); if (!rect)