radeonsi: don't invoke decompression inside internal launch_grid
authorMarek Olšák <marek.olsak@amd.com>
Sat, 18 Jan 2020 02:24:14 +0000 (21:24 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 20 Jan 2020 20:40:08 +0000 (15:40 -0500)
Decompress resources properly but don't do it inside launch_grid
to prevent recursion.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Cc: 19.3 <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/radeonsi/si_blit.c
src/gallium/drivers/radeonsi/si_compute_blit.c
src/gallium/drivers/radeonsi/si_pipe.h

index 5ac68406f7fb467f717a2d322f5de3e69b523866..e662de1612745a769c3ec044a70fd400c1b99af9 100644 (file)
@@ -825,10 +825,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;
index ce25c3e4d8f7e83e9c4a477782e3d34c1f83efbe..3e544d68500111c55d462db468a559a9aa7dc2a2 100644 (file)
@@ -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_clear_12bytes_buffer(struct si_context *sctx,
@@ -398,6 +401,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.*/
@@ -676,6 +685,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++)
index c75b131f8c6b98a95a36a245e03f8a0c6cb6c0d5..563a201ec3344fb4f473a764781ec54cf9b5de7f 100644 (file)
@@ -1257,6 +1257,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,