r300: make dma buffer reuse much more sensible
authorDave Airlie <airlied@redhat.com>
Wed, 4 Feb 2009 03:16:03 +0000 (13:16 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 4 Feb 2009 03:16:03 +0000 (13:16 +1000)
src/mesa/drivers/dri/r300/r300_emit.c
src/mesa/drivers/dri/radeon/common_misc.c

index c47f19ea11e749c68a2ab9c7984ae027412606b9..a8592440da5f1922dd59a69fe938b02f05a2e2ba 100644 (file)
@@ -337,8 +337,6 @@ int r300EmitArrays(GLcontext * ctx)
 
        rmesa->state.aos_count = nr;
 
-       radeon_bo_unmap(rmesa->radeon.dma.current);
-
        return R300_FALLBACK_NONE;
 }
 
@@ -357,7 +355,6 @@ void r300ReleaseArrays(GLcontext * ctx)
                        rmesa->state.aos[i].bo = NULL;
                }
        }
-       radeonReleaseDmaRegion(&rmesa->radeon);
 }
 
 void r300EmitCacheFlush(r300ContextPtr rmesa)
index 0779feea97fe71dd0de901a459096a7d4703d058..62650e28929b1cd3b470fea5359f51f746aab773 100644 (file)
@@ -621,6 +621,8 @@ int rcommonFlushCmdBuf(radeonContextPtr rmesa, const char *caller)
 {
        int ret;
 
+       radeonReleaseDmaRegion(rmesa);
+       
        LOCK_HARDWARE(rmesa);
        ret = rcommonFlushCmdBufLocked(rmesa, caller);
        UNLOCK_HARDWARE(rmesa);
@@ -2418,7 +2420,6 @@ void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size)
                fprintf(stderr, "%s\n", __FUNCTION__);
 
        if (rmesa->dma.flush) {
-               radeon_bo_unmap(rmesa->dma.current);
                rmesa->dma.flush(rmesa->glCtx);
        }
 
@@ -2504,9 +2505,12 @@ void radeonAllocDmaRegion(radeonContextPtr rmesa,
 
 void radeonReleaseDmaRegion(radeonContextPtr rmesa)
 {
+       if (RADEON_DEBUG & DEBUG_IOCTL)
+               fprintf(stderr, "%s %p\n", __FUNCTION__, rmesa->dma.current);
        if (rmesa->dma.current) {
                rmesa->dma.nr_released_bufs++;
-               radeon_bo_unref(rmesa->dma.current);
+               radeon_bo_unmap(rmesa->dma.current);
+               radeon_bo_unref(rmesa->dma.current);
        }
        rmesa->dma.current = NULL;
 }