[Mesa-dev] [PATCH 2/3] gallium/radeon: handle render_condition_enable for clear_rt/ds

Marek Olšák maraeo at gmail.com
Mon Aug 8 22:59:40 UTC 2016


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

---
 src/gallium/drivers/r300/r300_blit.c   | 6 ++++--
 src/gallium/drivers/r600/r600_blit.c   | 6 ++++--
 src/gallium/drivers/radeonsi/si_blit.c | 6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index cfb3f6d..b5c3ae5 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -428,21 +428,22 @@ static void r300_clear(struct pipe_context* pipe,
 /* Clear a region of a color surface to a constant value. */
 static void r300_clear_render_target(struct pipe_context *pipe,
                                      struct pipe_surface *dst,
                                      const union pipe_color_union *color,
                                      unsigned dstx, unsigned dsty,
                                      unsigned width, unsigned height,
                                      bool render_condition_enabled)
 {
     struct r300_context *r300 = r300_context(pipe);
 
-    r300_blitter_begin(r300, R300_CLEAR_SURFACE);
+    r300_blitter_begin(r300, R300_CLEAR_SURFACE |
+                       (render_condition_enabled ? 0 : R300_IGNORE_RENDER_COND));
     util_blitter_clear_render_target(r300->blitter, dst, color,
                                      dstx, dsty, width, height);
     r300_blitter_end(r300);
 }
 
 /* Clear a region of a depth stencil surface. */
 static void r300_clear_depth_stencil(struct pipe_context *pipe,
                                      struct pipe_surface *dst,
                                      unsigned clear_flags,
                                      double depth,
@@ -455,21 +456,22 @@ static void r300_clear_depth_stencil(struct pipe_context *pipe,
     struct pipe_framebuffer_state *fb =
         (struct pipe_framebuffer_state*)r300->fb_state.state;
 
     if (r300->zmask_in_use && !r300->locked_zbuffer) {
         if (fb->zsbuf->texture == dst->texture) {
             r300_decompress_zmask(r300);
         }
     }
 
     /* XXX Do not decompress ZMask of the currently-set zbuffer. */
-    r300_blitter_begin(r300, R300_CLEAR_SURFACE);
+    r300_blitter_begin(r300, R300_CLEAR_SURFACE |
+                       (render_condition_enabled ? 0 : R300_IGNORE_RENDER_COND));
     util_blitter_clear_depth_stencil(r300->blitter, dst, clear_flags, depth, stencil,
                                      dstx, dsty, width, height);
     r300_blitter_end(r300);
 }
 
 void r300_decompress_zmask(struct r300_context *r300)
 {
     struct pipe_framebuffer_state *fb =
         (struct pipe_framebuffer_state*)r300->fb_state.state;
 
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 327efc2..adf616e 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -471,38 +471,40 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers,
 
 static void r600_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 r600_context *rctx = (struct r600_context *)ctx;
 
-	r600_blitter_begin(ctx, R600_CLEAR_SURFACE);
+	r600_blitter_begin(ctx, R600_CLEAR_SURFACE |
+			   (render_condition_enabled ? 0 : R600_DISABLE_RENDER_COND));
 	util_blitter_clear_render_target(rctx->blitter, dst, color,
 					 dstx, dsty, width, height);
 	r600_blitter_end(ctx);
 }
 
 static void r600_clear_depth_stencil(struct pipe_context *ctx,
 				     struct pipe_surface *dst,
 				     unsigned clear_flags,
 				     double depth,
 				     unsigned stencil,
 				     unsigned dstx, unsigned dsty,
 				     unsigned width, unsigned height,
 				     bool render_condition_enabled)
 {
 	struct r600_context *rctx = (struct r600_context *)ctx;
 
-	r600_blitter_begin(ctx, R600_CLEAR_SURFACE);
+	r600_blitter_begin(ctx, R600_CLEAR_SURFACE |
+			   (render_condition_enabled ? 0 : R600_DISABLE_RENDER_COND));
 	util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil,
 					 dstx, dsty, width, height);
 	r600_blitter_end(ctx);
 }
 
 static void r600_copy_buffer(struct pipe_context *ctx, struct pipe_resource *dst, unsigned dstx,
 			     struct pipe_resource *src, const struct pipe_box *src_box)
 {
 	struct r600_context *rctx = (struct r600_context*)ctx;
 
diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index ce13e97..f4bff6b 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -757,38 +757,40 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
 
 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;
 
-	si_blitter_begin(ctx, SI_CLEAR_SURFACE);
+	si_blitter_begin(ctx, 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(ctx);
 }
 
 static void si_clear_depth_stencil(struct pipe_context *ctx,
 				   struct pipe_surface *dst,
 				   unsigned clear_flags,
 				   double depth,
 				   unsigned stencil,
 				   unsigned dstx, unsigned dsty,
 				   unsigned width, unsigned height,
 				   bool render_condition_enabled)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 
-	si_blitter_begin(ctx, SI_CLEAR_SURFACE);
+	si_blitter_begin(ctx, SI_CLEAR_SURFACE |
+			 (render_condition_enabled ? 0 : SI_DISABLE_RENDER_COND));
 	util_blitter_clear_depth_stencil(sctx->blitter, dst, clear_flags, depth, stencil,
 					 dstx, dsty, width, height);
 	si_blitter_end(ctx);
 }
 
 /* Helper for decompressing a portion of a color or depth resource before
  * 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,
-- 
2.7.4



More information about the mesa-dev mailing list