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. Cherry picked and ported to new code by Pauli.
This commit is contained in:
parent
ae290fd93e
commit
1279cdcb1f
|
@ -219,6 +219,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->radeon, R200_ELT_BUF_SZ - elt_used);
|
||||
|
||||
if (R200_DEBUG & DEBUG_SYNC) {
|
||||
fprintf(stderr, "%s: Syncing\n", __FUNCTION__);
|
||||
radeonFinish( rmesa->radeon.glCtx );
|
||||
|
@ -240,22 +243,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;
|
||||
|
||||
ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, rmesa->radeon.tcl.elt_dma_bo,
|
||||
RADEON_GEM_DOMAIN_GTT, 0);
|
||||
if (ret) {
|
||||
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);
|
||||
|
|
|
@ -271,6 +271,17 @@ void radeonFreeDmaRegions(radeonContextPtr rmesa)
|
|||
}
|
||||
}
|
||||
|
||||
void radeonReturnDmaRegion(radeonContextPtr rmesa, int return_bytes)
|
||||
{
|
||||
if (is_empty_list(&rmesa->dma.reserved))
|
||||
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 radeonReleaseDmaRegions(radeonContextPtr rmesa)
|
||||
{
|
||||
struct radeon_dma_bo *dma_bo;
|
||||
|
|
|
@ -41,8 +41,10 @@ void radeonEmitVec16(uint32_t *out, const GLvoid * data, int stride, int count);
|
|||
void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos,
|
||||
const GLvoid * data, int size, int stride, int count);
|
||||
|
||||
void radeonReturnDmaRegion(radeonContextPtr rmesa, int return_bytes);
|
||||
void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size);
|
||||
void radeon_init_dma(radeonContextPtr rmesa);
|
||||
void radeonReturnDmaRegion(radeonContextPtr rmesa, int return_bytes);
|
||||
void radeonAllocDmaRegion(radeonContextPtr rmesa,
|
||||
struct radeon_bo **pbo, int *poffset,
|
||||
int bytes, int alignment);
|
||||
|
|
Loading…
Reference in New Issue