From 37708479608af877986b76302a9c92611d1e23d0 Mon Sep 17 00:00:00 2001 From: Vadim Girlin Date: Wed, 11 Jul 2012 02:19:51 +0400 Subject: r600g: improve flushed depth texture handling v2 Use r600_resource_texture::flished_depth_texture for GPU access, and allocate it in the VRAM. For transfers we'll allocate texture in the GTT and store it in the r600_transfer::staging. Improves performance when flushed depth texture is frequently used by the GPU, e.g. in Lightsmark (~30%) Signed-off-by: Vadim Girlin --- src/gallium/drivers/r600/r600_blit.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/gallium/drivers/r600/r600_blit.c') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 4c72f16b701..d85324b6fbb 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -114,13 +114,17 @@ static unsigned u_num_layers(struct pipe_resource *r, unsigned level) } } -void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture) +void r600_blit_uncompress_depth(struct pipe_context *ctx, + struct r600_resource_texture *texture, + struct r600_resource_texture *staging) { struct r600_context *rctx = (struct r600_context *)ctx; unsigned layer, level; float depth = 1.0f; + struct r600_resource_texture *flushed_depth_texture = staging ? + staging : texture->flushed_depth_texture; - if (!texture->dirty_db) + if (!staging && !texture->dirty_db) return; if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || @@ -141,10 +145,10 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t zsurf = ctx->create_surface(ctx, &texture->resource.b.b, &surf_tmpl); - surf_tmpl.format = texture->flushed_depth_texture->real_format; + surf_tmpl.format = flushed_depth_texture->real_format; surf_tmpl.usage = PIPE_BIND_RENDER_TARGET; cbsurf = ctx->create_surface(ctx, - (struct pipe_resource*)texture->flushed_depth_texture, &surf_tmpl); + (struct pipe_resource*)flushed_depth_texture, &surf_tmpl); r600_blitter_begin(ctx, R600_DECOMPRESS); util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); @@ -155,7 +159,8 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t } } - texture->dirty_db = FALSE; + if (!staging) + texture->dirty_db = FALSE; } void r600_flush_depth_textures(struct r600_context *rctx) @@ -178,7 +183,7 @@ void r600_flush_depth_textures(struct r600_context *rctx) if (tex->is_flushing_texture) continue; - r600_blit_uncompress_depth(&rctx->context, tex); + r600_blit_uncompress_depth(&rctx->context, tex, NULL); } /* also check CB here */ @@ -192,7 +197,7 @@ void r600_flush_depth_textures(struct r600_context *rctx) if (tex->is_flushing_texture) continue; - r600_blit_uncompress_depth(&rctx->context, tex); + r600_blit_uncompress_depth(&rctx->context, tex, NULL); } } @@ -324,7 +329,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx, } if (rsrc->is_depth && !rsrc->is_flushing_texture) - r600_texture_depth_flush(ctx, src); + r600_texture_depth_flush(ctx, src, NULL); restore_orig[0] = restore_orig[1] = FALSE; -- cgit v1.2.3