Module: Mesa
Branch: staging/19.3
Commit: b4c1a68af26ce9597dcd089b2b512ab4081cf7be
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4c1a68af26ce9597dcd089b2b512ab4081cf7be

Author: Marek Olšák <[email protected]>
Date:   Fri Jan 17 21:24:14 2020 -0500

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 <[email protected]>

---

 src/gallium/drivers/radeonsi/si_blit.c         |  8 ++++----
 src/gallium/drivers/radeonsi/si_compute_blit.c | 14 ++++++++++++++
 src/gallium/drivers/radeonsi/si_pipe.h         |  4 ++++
 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,

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to