summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_blit.c
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-06-10 03:03:11 +0200
committerMarek Olšák <marek.olsak@amd.com>2016-06-21 13:52:05 +0200
commit70a25478fec653673569f5fb81170207d68f5112 (patch)
tree02d1d51750f893c74f26285832118f1b0eb92fac /src/gallium/drivers/radeonsi/si_blit.c
parent5fed1122e87d5ba4bad5a777089e70f23095c668 (diff)
downloadexternal_mesa3d-70a25478fec653673569f5fb81170207d68f5112.zip
external_mesa3d-70a25478fec653673569f5fb81170207d68f5112.tar.gz
external_mesa3d-70a25478fec653673569f5fb81170207d68f5112.tar.bz2
radeonsi: use u_blitter for mipmap generation
This reduces time spend in glGenerateMipmap by a half. v2: don't decompress the levels to be overwritten Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_blit.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_blit.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index 754b478..73a72e0 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -1019,6 +1019,36 @@ static void si_blit(struct pipe_context *ctx,
si_blitter_end(ctx);
}
+static boolean si_generate_mipmap(struct pipe_context *ctx,
+ struct pipe_resource *tex,
+ enum pipe_format format,
+ unsigned base_level, unsigned last_level,
+ unsigned first_layer, unsigned last_layer)
+{
+ struct si_context *sctx = (struct si_context*)ctx;
+ struct r600_texture *rtex = (struct r600_texture *)tex;
+
+ if (!util_blitter_is_copy_supported(sctx->blitter, tex, tex))
+ return false;
+
+ /* The driver doesn't decompress resources automatically while
+ * u_blitter is rendering. */
+ si_decompress_subresource(ctx, tex, PIPE_MASK_RGBAZS,
+ base_level, first_layer, last_layer);
+
+ /* Clear dirty_level_mask for the levels that will be overwritten. */
+ assert(base_level < last_level);
+ rtex->dirty_level_mask &= ~u_bit_consecutive(base_level + 1,
+ last_level - base_level);
+
+ si_blitter_begin(ctx, SI_BLIT | SI_DISABLE_RENDER_COND);
+ util_blitter_generate_mipmap(sctx->blitter, tex, format,
+ base_level, last_level,
+ first_layer, last_layer);
+ si_blitter_end(ctx);
+ return true;
+}
+
static void si_flush_resource(struct pipe_context *ctx,
struct pipe_resource *res)
{
@@ -1112,6 +1142,7 @@ void si_init_blit_functions(struct si_context *sctx)
sctx->b.b.resource_copy_region = si_resource_copy_region;
sctx->b.b.blit = si_blit;
sctx->b.b.flush_resource = si_flush_resource;
+ sctx->b.b.generate_mipmap = si_generate_mipmap;
sctx->b.blit_decompress_depth = si_blit_decompress_depth;
sctx->b.decompress_dcc = si_decompress_dcc;
}