[Mesa-dev] [PATCH 09/10] r600g,radeonsi: share r600_flush_from_st

Marek Olšák maraeo at gmail.com
Sat Apr 12 09:34:23 PDT 2014


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

---
 src/gallium/drivers/r600/r600_pipe.c          | 17 -----------------
 src/gallium/drivers/radeon/r600_pipe_common.c | 17 +++++++++++++++++
 src/gallium/drivers/radeonsi/si_pipe.c        | 17 -----------------
 3 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 983c65a..3797b56b 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -66,22 +66,6 @@ static const struct debug_named_value r600_debug_options[] = {
  * pipe_context
  */
 
-static void r600_flush_from_st(struct pipe_context *ctx,
-			       struct pipe_fence_handle **fence,
-			       unsigned flags)
-{
-	struct r600_context *rctx = (struct r600_context *)ctx;
-	unsigned fflags;
-
-	fflags = flags & PIPE_FLUSH_END_OF_FRAME ? RADEON_FLUSH_END_OF_FRAME : 0;
-
-	/* flush gfx & dma ring, order does not matter as only one can be live */
-	if (rctx->b.rings.dma.cs) {
-		rctx->b.rings.dma.flush(rctx, fflags, NULL);
-	}
-	rctx->b.rings.gfx.flush(rctx, fflags, fence);
-}
-
 static void r600_destroy_context(struct pipe_context *context)
 {
 	struct r600_context *rctx = (struct r600_context *)context;
@@ -137,7 +121,6 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
 	rctx->b.b.screen = screen;
 	rctx->b.b.priv = priv;
 	rctx->b.b.destroy = r600_destroy_context;
-	rctx->b.b.flush = r600_flush_from_st;
 
 	if (!r600_common_context_init(&rctx->b, &rscreen->b))
 		goto fail;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index bc48388..3a0d981 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -53,6 +53,22 @@ static void r600_memory_barrier(struct pipe_context *ctx, unsigned flags)
 {
 }
 
+static void r600_flush_from_st(struct pipe_context *ctx,
+			       struct pipe_fence_handle **fence,
+			       unsigned flags)
+{
+	struct r600_common_context *rctx = (struct r600_common_context *)ctx;
+	unsigned rflags = 0;
+
+	if (flags & PIPE_FLUSH_END_OF_FRAME)
+		rflags |= RADEON_FLUSH_END_OF_FRAME;
+
+	if (rctx->rings.dma.cs) {
+		rctx->rings.dma.flush(rctx, rflags, NULL);
+	}
+	rctx->rings.gfx.flush(rctx, rflags, fence);
+}
+
 static void r600_flush_dma_ring(void *ctx, unsigned flags,
 				struct pipe_fence_handle **fence)
 {
@@ -86,6 +102,7 @@ bool r600_common_context_init(struct r600_common_context *rctx,
 	rctx->b.transfer_unmap = u_transfer_unmap_vtbl;
 	rctx->b.transfer_inline_write = u_default_transfer_inline_write;
         rctx->b.memory_barrier = r600_memory_barrier;
+	rctx->b.flush = r600_flush_from_st;
 
 	r600_init_context_texture_functions(rctx);
 	r600_streamout_init(rctx);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 7f3b0c2..a1aea7b 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -33,22 +33,6 @@
 /*
  * pipe_context
  */
-static void si_flush_from_st(struct pipe_context *ctx,
-			     struct pipe_fence_handle **fence,
-			     unsigned flags)
-{
-	struct si_context *sctx = (struct si_context *)ctx;
-	unsigned rflags = 0;
-
-	if (flags & PIPE_FLUSH_END_OF_FRAME)
-		rflags |= RADEON_FLUSH_END_OF_FRAME;
-
-	if (sctx->b.rings.dma.cs) {
-		sctx->b.rings.dma.flush(sctx, rflags, NULL);
-	}
-	sctx->b.rings.gfx.flush(sctx, rflags, fence);
-}
-
 static void si_destroy_context(struct pipe_context *context)
 {
 	struct si_context *sctx = (struct si_context *)context;
@@ -97,7 +81,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, void *
 	sctx->b.b.screen = screen; /* this must be set first */
 	sctx->b.b.priv = priv;
 	sctx->b.b.destroy = si_destroy_context;
-	sctx->b.b.flush = si_flush_from_st;
 	sctx->screen = sscreen; /* Easy accessing of screen/winsys. */
 
 	if (!r600_common_context_init(&sctx->b, &sscreen->b))
-- 
1.8.3.2



More information about the mesa-dev mailing list