summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/radeon/radeon_dma.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2009-06-26 15:05:02 +1000
committerDave Airlie <[email protected]>2009-06-26 15:09:12 +1000
commit0952645fe04a27968565ea4d913500c23b1b11e3 (patch)
tree6e84f9610987d0ec0ddb2bd7bb8965f64e899e61 /src/mesa/drivers/dri/radeon/radeon_dma.c
parentdb545796289abe4b771b3ee23a4559674bebe37a (diff)
r200: make use of DMA buffers for Elts a lot better.
This allows us to return the unused portion of the dma buffer to the allocator instead of wasting nearly 16k a pop.
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_dma.c')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_dma.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c
index 48b0d638183..0b91434b2ba 100644
--- a/src/mesa/drivers/dri/radeon/radeon_dma.c
+++ b/src/mesa/drivers/dri/radeon/radeon_dma.c
@@ -167,7 +167,7 @@ void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size)
size = MAX2(size, MAX_DMA_BUF_SZ);
if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA))
- fprintf(stderr, "%s\n", __FUNCTION__);
+ fprintf(stderr, "%s %d\n", __FUNCTION__, rmesa->dma.nr_released_bufs);
if (rmesa->dma.flush) {
rmesa->dma.flush(rmesa->glCtx);
@@ -178,11 +178,7 @@ void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size)
rmesa->dma.nr_released_bufs = 0;
}
- if (rmesa->dma.current) {
- radeon_bo_unmap(rmesa->dma.current);
- radeon_bo_unref(rmesa->dma.current);
- rmesa->dma.current = 0;
- }
+ radeonReleaseDmaRegion(rmesa);
again_alloc:
rmesa->dma.current = radeon_bo_open(rmesa->radeonScreen->bom,
@@ -244,6 +240,17 @@ void radeonAllocDmaRegion(radeonContextPtr rmesa,
assert(rmesa->dma.current_used <= rmesa->dma.current->size);
}
+void radeonReturnDmaRegion(radeonContextPtr rmesa, int return_bytes)
+{
+ if (!rmesa->dma.current)
+ return;
+
+ if (RADEON_DEBUG & DEBUG_IOCTL)
+ fprintf(stderr, "%s %d\n", __FUNCTION__, return_bytes);
+ rmesa->dma.current_used -= return_bytes;
+ rmesa->dma.current_vertexptr = rmesa->dma.current_used;
+}
+
void radeonReleaseDmaRegion(radeonContextPtr rmesa)
{
if (RADEON_DEBUG & DEBUG_IOCTL)