[Mesa-dev] [PATCH 2/8] r600g: use last_gfx_fence like radeonsi

Marek Olšák maraeo at gmail.com
Tue Aug 2 10:27:49 UTC 2016


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

---
 src/gallium/drivers/r600/r600_hw_context.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 1bc3bf4..113991f 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -253,9 +253,16 @@ void r600_context_gfx_flush(void *context, unsigned flags,
 {
 	struct r600_context *ctx = context;
 	struct radeon_winsys_cs *cs = ctx->b.gfx.cs;
-
-	if (!radeon_emitted(cs, ctx->b.initial_gfx_cs_size) && !fence)
+	struct radeon_winsys *ws = ctx->b.ws;
+
+	if (!radeon_emitted(cs, ctx->b.initial_gfx_cs_size) &&
+	    (!fence || ctx->b.last_gfx_fence)) {
+		if (fence)
+			ws->fence_reference(fence, ctx->b.last_gfx_fence);
+		if (!(flags & RADEON_FLUSH_ASYNC))
+			ws->cs_sync_flush(cs);
 		return;
+	}
 
 	r600_preflush_suspend_features(&ctx->b);
 
@@ -276,7 +283,9 @@ void r600_context_gfx_flush(void *context, unsigned flags,
 	}
 
 	/* Flush the CS. */
-	ctx->b.ws->cs_flush(cs, flags, fence);
+	ws->cs_flush(cs, flags, &ctx->b.last_gfx_fence);
+	if (fence)
+		ws->fence_reference(fence, ctx->b.last_gfx_fence);
 
 	r600_begin_new_cs(ctx);
 }
-- 
2.7.4



More information about the mesa-dev mailing list