[Mesa-dev] [PATCH 2/2] radeonsi: handle render_condition_enable in si_compute_clear_render_target

Marek Olšák maraeo at gmail.com
Wed Jan 23 23:28:11 UTC 2019


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_clear.c        | 3 ++-
 src/gallium/drivers/radeonsi/si_compute_blit.c | 5 ++++-
 src/gallium/drivers/radeonsi/si_pipe.h         | 3 ++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_clear.c b/src/gallium/drivers/radeonsi/si_clear.c
index 8afc01f2ccc..9a00bb73b94 100644
--- a/src/gallium/drivers/radeonsi/si_clear.c
+++ b/src/gallium/drivers/radeonsi/si_clear.c
@@ -667,21 +667,22 @@ static void si_clear_render_target(struct pipe_context *ctx,
 				   struct pipe_surface *dst,
 				   const union pipe_color_union *color,
 				   unsigned dstx, unsigned dsty,
 				   unsigned width, unsigned height,
 				   bool render_condition_enabled)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_texture *sdst = (struct si_texture*)dst->texture;
 
 	if (dst->texture->nr_samples <= 1 && !sdst->dcc_offset) {
-		si_compute_clear_render_target(ctx, dst, color, dstx, dsty, width, height);
+		si_compute_clear_render_target(ctx, dst, color, dstx, dsty, width,
+					       height, render_condition_enabled);
 		return;
 	}
 
 	si_blitter_begin(sctx, SI_CLEAR_SURFACE |
 			 (render_condition_enabled ? 0 : SI_DISABLE_RENDER_COND));
 	util_blitter_clear_render_target(sctx->blitter, dst, color,
 					 dstx, dsty, width, height);
 	si_blitter_end(sctx);
 }
 
diff --git a/src/gallium/drivers/radeonsi/si_compute_blit.c b/src/gallium/drivers/radeonsi/si_compute_blit.c
index f06497f4dac..1ea0d7517df 100644
--- a/src/gallium/drivers/radeonsi/si_compute_blit.c
+++ b/src/gallium/drivers/radeonsi/si_compute_blit.c
@@ -425,40 +425,43 @@ void si_compute_copy_image(struct si_context *sctx,
 void si_init_compute_blit_functions(struct si_context *sctx)
 {
 	sctx->b.clear_buffer = si_pipe_clear_buffer;
 }
 
 /* Clear a region of a color surface to a constant value. */
 void si_compute_clear_render_target(struct pipe_context *ctx,
 				    struct pipe_surface *dstsurf,
 				    const union pipe_color_union *color,
 				    unsigned dstx, unsigned dsty,
-				    unsigned width, unsigned height)
+				    unsigned width, unsigned height,
+				    bool render_condition_enabled)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	unsigned num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
 	unsigned data[4 + sizeof(color->ui)] = {dstx, dsty, dstsurf->u.tex.first_layer, 0};
 
 	if (width == 0 || height == 0)
 		return;
 
 	if (util_format_is_srgb(dstsurf->format)) {
 		union pipe_color_union color_srgb;
 		for (int i = 0; i < 3; i++)
 			color_srgb.f[i] = util_format_linear_to_srgb_float(color->f[i]);
 		color_srgb.f[3] = color->f[3];
 		memcpy(data + 4, color_srgb.ui, sizeof(color->ui));
 	} else {
 		memcpy(data + 4, color->ui, sizeof(color->ui));
 	}
 
 	si_compute_internal_begin(sctx);
+	sctx->render_cond_force_off = !render_condition_enabled;
+
 	sctx->flags |= SI_CONTEXT_CS_PARTIAL_FLUSH |
 		       si_get_flush_flags(sctx, SI_COHERENCY_SHADER, L2_STREAM);
 	si_make_CB_shader_coherent(sctx, dstsurf->texture->nr_samples, true);
 
 	struct pipe_constant_buffer saved_cb = {};
 	si_get_pipe_constant_buffer(sctx, PIPE_SHADER_COMPUTE, 0, &saved_cb);
 
 	struct si_images *images = &sctx->images[PIPE_SHADER_COMPUTE];
 	struct pipe_image_view saved_image = {0};
 	util_copy_image_view(&saved_image, &images->views[0]);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 437144316d0..1af3c5ff9b7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1188,21 +1188,22 @@ void si_compute_copy_image(struct si_context *sctx,
 			   struct pipe_resource *dst,
 			   unsigned dst_level,
 			   struct pipe_resource *src,
 			   unsigned src_level,
 			   unsigned dstx, unsigned dsty, unsigned dstz,
 			   const struct pipe_box *src_box);
 void si_compute_clear_render_target(struct pipe_context *ctx,
                                     struct pipe_surface *dstsurf,
                                     const union pipe_color_union *color,
                                     unsigned dstx, unsigned dsty,
-                                    unsigned width, unsigned height);
+                                    unsigned width, unsigned height,
+				    bool render_condition_enabled);
 void si_init_compute_blit_functions(struct si_context *sctx);
 
 /* si_cp_dma.c */
 #define SI_CPDMA_SKIP_CHECK_CS_SPACE	(1 << 0) /* don't call need_cs_space */
 #define SI_CPDMA_SKIP_SYNC_AFTER	(1 << 1) /* don't wait for DMA after the copy */
 #define SI_CPDMA_SKIP_SYNC_BEFORE	(1 << 2) /* don't wait for DMA before the copy (RAW hazards) */
 #define SI_CPDMA_SKIP_GFX_SYNC		(1 << 3) /* don't flush caches and don't wait for PS/CS */
 #define SI_CPDMA_SKIP_BO_LIST_UPDATE	(1 << 4) /* don't update the BO list */
 #define SI_CPDMA_SKIP_ALL (SI_CPDMA_SKIP_CHECK_CS_SPACE | \
 			   SI_CPDMA_SKIP_SYNC_AFTER | \
-- 
2.17.1



More information about the mesa-dev mailing list