diff options
author | Alex Deucher <[email protected]> | 2009-08-23 13:41:43 -0400 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2009-08-23 13:41:43 -0400 |
commit | 7a05a4c65cdb109ed43ee4587492f4637d3707b3 (patch) | |
tree | 2b30c07dc9bbd8b0405a6101c4e4f05e67feac29 /src/mesa/drivers/dri/r600 | |
parent | 41934be2544ac47a308719c08ee1bba344fed78d (diff) |
r600: use persistent bos for shaders
Diffstat (limited to 'src/mesa/drivers/dri/r600')
-rw-r--r-- | src/mesa/drivers/dri/r600/r600_emit.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c index b0c7294682a..be86de170f9 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.c +++ b/src/mesa/drivers/dri/r600/r600_emit.c @@ -51,53 +51,55 @@ void r600EmitCacheFlush(context_t *rmesa) { } -GLboolean r600EmitShader(GLcontext * ctx, +GLboolean r600EmitShader(GLcontext * ctx, void ** shaderbo, - GLvoid * data, + GLvoid * data, int sizeinDWORD, - char * szShaderUsage) + char * szShaderUsage) { - radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); - - struct radeon_bo * pbo; - uint32_t *out; + radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); + struct radeon_bo * pbo; + uint32_t *out; shader_again_alloc: - pbo = radeon_bo_open(radeonctx->radeonScreen->bom, - 0, - sizeinDWORD * 4, - 256, - RADEON_GEM_DOMAIN_GTT, - 0); + pbo = radeon_bo_open(radeonctx->radeonScreen->bom, + 0, + sizeinDWORD * 4, + 256, + RADEON_GEM_DOMAIN_GTT, + 0); if (!pbo) { rcommonFlushCmdBuf(radeonctx, __FUNCTION__); goto shader_again_alloc; } + radeon_cs_space_add_persistent_bo(radeonctx->cmdbuf.cs, + pbo, + RADEON_GEM_DOMAIN_GTT, 0); + if (radeon_cs_space_check_with_bo(radeonctx->cmdbuf.cs, pbo, - RADEON_GEM_DOMAIN_GTT, 0)) + RADEON_GEM_DOMAIN_GTT, 0)) { fprintf(stderr,"failure to revalidate BOs - badness\n"); - + return GL_FALSE; + } radeon_bo_map(pbo, 1); - radeon_bo_ref(pbo); - - out = (uint32_t*)(pbo->ptr); + out = (uint32_t*)(pbo->ptr); - memcpy(out, data, sizeinDWORD * 4); + memcpy(out, data, sizeinDWORD * 4); - radeon_bo_unmap(pbo); + radeon_bo_unmap(pbo); - *shaderbo = (void*)pbo; + *shaderbo = (void*)pbo; - return GL_TRUE; + return GL_TRUE; } -GLboolean r600DeleteShader(GLcontext * ctx, - void * shaderbo) +GLboolean r600DeleteShader(GLcontext * ctx, + void * shaderbo) { struct radeon_bo * pbo = (struct radeon_bo *)shaderbo; |