summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2020-01-17 21:24:14 -0500
committerDylan Baker <dylan@pnwbakers.com>2020-01-28 08:54:25 -0800
commit0623b9f833318b91c96cf2c8c9c5474072083101 (patch)
tree9a860863ec8ead0a8569e6fff5b6dbb8ff9f9339
parentcb1f1ac0b488d8354de4844e0bf76d972b018446 (diff)
radeonsi: don't invoke decompression inside internal launch_grid
Decompress resources properly but don't do it inside launch_grid to prevent recursion. (cherry-picked from df34fa14bb872447fed9076e06ffc504d85e2d1c) Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/gallium/drivers/radeonsi/si_blit.c8
-rw-r--r--src/gallium/drivers/radeonsi/si_compute_blit.c14
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h4
3 files changed, 22 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index 608183aa1f1..c58c98aaf01 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -824,10 +824,10 @@ void si_decompress_textures(struct si_context *sctx, unsigned shader_mask)
* blitting if any decompression is needed.
* The driver doesn't decompress resources automatically while u_blitter is
* rendering. */
-static void si_decompress_subresource(struct pipe_context *ctx,
- struct pipe_resource *tex,
- unsigned planes, unsigned level,
- unsigned first_layer, unsigned last_layer)
+void si_decompress_subresource(struct pipe_context *ctx,
+ struct pipe_resource *tex,
+ unsigned planes, unsigned level,
+ unsigned first_layer, unsigned last_layer)
{
struct si_context *sctx = (struct si_context *)ctx;
struct si_texture *stex = (struct si_texture*)tex;
diff --git a/src/gallium/drivers/radeonsi/si_compute_blit.c b/src/gallium/drivers/radeonsi/si_compute_blit.c
index fff9fca8cf0..7dba65029ed 100644
--- a/src/gallium/drivers/radeonsi/si_compute_blit.c
+++ b/src/gallium/drivers/radeonsi/si_compute_blit.c
@@ -66,6 +66,8 @@ static void si_launch_grid_internal(struct si_context *sctx,
sctx->flags &= ~SI_CONTEXT_START_PIPELINE_STATS;
sctx->flags |= SI_CONTEXT_STOP_PIPELINE_STATS;
sctx->render_cond_force_off = true;
+ /* Skip decompression to prevent infinite recursion. */
+ sctx->blitter->running = true;
/* Dispatch compute. */
sctx->b.launch_grid(&sctx->b, info);
@@ -74,6 +76,7 @@ static void si_launch_grid_internal(struct si_context *sctx,
sctx->flags &= ~SI_CONTEXT_STOP_PIPELINE_STATS;
sctx->flags |= SI_CONTEXT_START_PIPELINE_STATS;
sctx->render_cond_force_off = false;
+ sctx->blitter->running = false;
}
static void si_compute_do_clear_or_copy(struct si_context *sctx,
@@ -338,6 +341,12 @@ void si_compute_copy_image(struct si_context *sctx,
sctx->flags |= SI_CONTEXT_CS_PARTIAL_FLUSH |
si_get_flush_flags(sctx, SI_COHERENCY_SHADER, L2_STREAM);
+ /* The driver doesn't decompress resources automatically here. */
+ si_decompress_subresource(ctx, dst, PIPE_MASK_RGBAZS, dst_level,
+ dstz, dstz + src_box->depth - 1);
+ si_decompress_subresource(ctx, src, PIPE_MASK_RGBAZS, src_level,
+ src_box->z, src_box->z + src_box->depth - 1);
+
/* src and dst have the same number of samples. */
si_make_CB_shader_coherent(sctx, src->nr_samples, true,
/* Only src can have DCC.*/
@@ -616,6 +625,11 @@ void si_compute_clear_render_target(struct pipe_context *ctx,
if (width == 0 || height == 0)
return;
+ /* The driver doesn't decompress resources automatically here. */
+ si_decompress_subresource(ctx, dstsurf->texture, PIPE_MASK_RGBA,
+ dstsurf->u.tex.level, dstsurf->u.tex.first_layer,
+ dstsurf->u.tex.last_layer);
+
if (util_format_is_srgb(dstsurf->format)) {
union pipe_color_union color_srgb;
for (int i = 0; i < 3; i++)
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 62183834416..dcd9a289465 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1240,6 +1240,10 @@ void si_blitter_begin(struct si_context *sctx, enum si_blitter_op op);
void si_blitter_end(struct si_context *sctx);
void si_init_blit_functions(struct si_context *sctx);
void si_decompress_textures(struct si_context *sctx, unsigned shader_mask);
+void si_decompress_subresource(struct pipe_context *ctx,
+ struct pipe_resource *tex,
+ unsigned planes, unsigned level,
+ unsigned first_layer, unsigned last_layer);
void si_resource_copy_region(struct pipe_context *ctx,
struct pipe_resource *dst,
unsigned dst_level,