summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r200/r200_cmdbuf.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-06-26 15:05:02 +1000
committerDave Airlie <airlied@redhat.com>2009-06-26 15:09:12 +1000
commit0952645fe04a27968565ea4d913500c23b1b11e3 (patch)
tree6e84f9610987d0ec0ddb2bd7bb8965f64e899e61 /src/mesa/drivers/dri/r200/r200_cmdbuf.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/r200/r200_cmdbuf.c')
-rw-r--r--src/mesa/drivers/dri/r200/r200_cmdbuf.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
index df9dd83344..fe173b601a 100644
--- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c
+++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
@@ -213,6 +213,9 @@ void r200FlushElts(GLcontext *ctx)
radeon_bo_unref(rmesa->radeon.tcl.elt_dma_bo);
rmesa->radeon.tcl.elt_dma_bo = NULL;
+ if (R200_ELT_BUF_SZ > elt_used)
+ radeonReturnDmaRegion(rmesa, R200_ELT_BUF_SZ - elt_used);
+
if (R200_DEBUG & DEBUG_SYNC) {
fprintf(stderr, "%s: Syncing\n", __FUNCTION__);
radeonFinish( rmesa->radeon.glCtx );
@@ -233,21 +236,13 @@ GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa,
radeonEmitState(&rmesa->radeon);
- rmesa->radeon.tcl.elt_dma_bo = radeon_bo_open(rmesa->radeon.radeonScreen->bom,
- 0, R200_ELT_BUF_SZ, 4,
- RADEON_GEM_DOMAIN_GTT, 0);
- rmesa->radeon.tcl.elt_dma_offset = 0;
+ radeonAllocDmaRegion(&rmesa->radeon, &rmesa->radeon.tcl.elt_dma_bo,
+ &rmesa->radeon.tcl.elt_dma_offset, R200_ELT_BUF_SZ, 4);
rmesa->tcl.elt_used = min_nr * 2;
- radeon_validate_bo(&rmesa->radeon, rmesa->radeon.tcl.elt_dma_bo,
- RADEON_GEM_DOMAIN_GTT, 0);
- if (radeon_revalidate_bos(rmesa->radeon.glCtx) == GL_FALSE)
- fprintf(stderr,"failure to revalidate BOs - badness\n");
-
radeon_bo_map(rmesa->radeon.tcl.elt_dma_bo, 1);
retval = rmesa->radeon.tcl.elt_dma_bo->ptr + rmesa->radeon.tcl.elt_dma_offset;
-
if (R200_DEBUG & DEBUG_PRIMS)
fprintf(stderr, "%s: header prim %x \n",
__FUNCTION__, primitive);