diff options
author | Samuel Pitoiset <[email protected]> | 2017-06-14 13:55:11 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-18 14:10:36 +0200 |
commit | 06ed251c328ebf5c635b972b14039165077d05df (patch) | |
tree | 85bac01068de35ada2d87d486a0d40936a3615cf | |
parent | 705a6a560ee1d2433fa65078b2ae6616dee0c052 (diff) |
radeonsi: reduce overhead for resident textures which need depth decompression
This is done by introducing a separate list.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_blit.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_descriptors.c | 15 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.h | 4 |
4 files changed, 29 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index bfce5a411f1..06a99fbc8a2 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -705,12 +705,18 @@ static void si_decompress_resident_textures(struct si_context *sctx) if ((*tex_handle)->needs_color_decompress) si_decompress_color_texture(sctx, tex, view->u.tex.first_level, view->u.tex.last_level); + } - if ((*tex_handle)->needs_depth_decompress) - si_decompress_depth(sctx, tex, - sview->is_stencil_sampler ? PIPE_MASK_S : PIPE_MASK_Z, - view->u.tex.first_level, view->u.tex.last_level, - 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level)); + util_dynarray_foreach(&sctx->resident_tex_needs_depth_decompress, + struct si_texture_handle *, tex_handle) { + struct pipe_sampler_view *view = (*tex_handle)->view; + struct si_sampler_view *sview = (struct si_sampler_view *)view; + struct r600_texture *tex = (struct r600_texture *)view->texture; + + si_decompress_depth(sctx, tex, + sview->is_stencil_sampler ? PIPE_MASK_S : PIPE_MASK_Z, + view->u.tex.first_level, view->u.tex.last_level, + 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level)); } } diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index 90c4a9e5571..a8f54e0714a 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -2352,8 +2352,13 @@ static void si_make_texture_handle_resident(struct pipe_context *ctx, struct r600_texture *rtex = (struct r600_texture *)sview->base.texture; - tex_handle->needs_depth_decompress = - depth_needs_decompression(rtex, sview); + if (depth_needs_decompression(rtex, sview)) { + util_dynarray_append( + &sctx->resident_tex_needs_depth_decompress, + struct si_texture_handle *, + tex_handle); + } + tex_handle->needs_color_decompress = color_needs_decompression(rtex); @@ -2386,6 +2391,12 @@ static void si_make_texture_handle_resident(struct pipe_context *ctx, util_dynarray_delete_unordered(&sctx->resident_tex_handles, struct si_texture_handle *, tex_handle); + + if (sview->base.texture->target != PIPE_BUFFER) { + util_dynarray_delete_unordered( + &sctx->resident_tex_needs_depth_decompress, + struct si_texture_handle *, tex_handle); + } } } diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 9f6e3c26f43..fbb410746c6 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -103,6 +103,7 @@ static void si_destroy_context(struct pipe_context *context) util_dynarray_fini(&sctx->resident_tex_handles); util_dynarray_fini(&sctx->resident_img_handles); + util_dynarray_fini(&sctx->resident_tex_needs_depth_decompress); FREE(sctx); } @@ -342,6 +343,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, util_dynarray_init(&sctx->resident_tex_handles, NULL); util_dynarray_init(&sctx->resident_img_handles, NULL); + util_dynarray_init(&sctx->resident_tex_needs_depth_decompress, NULL); return &sctx->b.b; fail: diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 427ac1c83ae..3834cea893f 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -244,7 +244,6 @@ struct si_texture_handle struct si_bindless_descriptor *desc; struct pipe_sampler_view *view; bool needs_color_decompress; - bool needs_depth_decompress; }; struct si_image_handle @@ -432,6 +431,9 @@ struct si_context { struct util_dynarray resident_tex_handles; struct util_dynarray resident_img_handles; + /* Resident bindless handles which need decompression */ + struct util_dynarray resident_tex_needs_depth_decompress; + /* Bindless state */ bool uses_bindless_samplers; bool uses_bindless_images; |