[Mesa-dev] [PATCH 2/2] gallium/radeon: send the END_OF_FRAME flag to the DRM

Marek Olšák maraeo at gmail.com
Fri Dec 21 08:23:12 PST 2012


---
 src/gallium/drivers/r300/r300_flush.c         |    4 +++-
 src/gallium/drivers/r600/r600_pipe.c          |    3 ++-
 src/gallium/drivers/radeonsi/radeonsi_pipe.c  |    3 ++-
 src/gallium/winsys/radeon/drm/radeon_drm_cs.c |   10 ++++++++--
 src/gallium/winsys/radeon/drm/radeon_winsys.h |    1 +
 5 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index 978a5d9..6d51ee5 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -136,7 +136,9 @@ static void r300_flush_wrapped(struct pipe_context *pipe,
                                struct pipe_fence_handle **fence,
                                enum pipe_flush_flags flags)
 {
-    r300_flush(pipe, 0, fence);
+    r300_flush(pipe,
+               flags & PIPE_FLUSH_END_OF_FRAME ? RADEON_FLUSH_END_OF_FRAME : 0,
+               fence);
 }
 
 void r300_init_flush_functions(struct r300_context* r300)
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index ce01c4c..a571a54 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -146,7 +146,8 @@ static void r600_flush_from_st(struct pipe_context *ctx,
 			       struct pipe_fence_handle **fence,
 			       enum pipe_flush_flags flags)
 {
-	r600_flush(ctx, fence, 0);
+	r600_flush(ctx, fence,
+		   flags & PIPE_FLUSH_END_OF_FRAME ? RADEON_FLUSH_END_OF_FRAME : 0);
 }
 
 static void r600_flush_from_winsys(void *ctx, unsigned flags)
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
index f3ebe40..53edcc2 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
@@ -161,7 +161,8 @@ static void r600_flush_from_st(struct pipe_context *ctx,
 			       struct pipe_fence_handle **fence,
                                enum pipe_flush_flags flags)
 {
-	radeonsi_flush(ctx, fence, 0);
+	radeonsi_flush(ctx, fence,
+                       flags & PIPE_FLUSH_END_OF_FRAME ? RADEON_FLUSH_END_OF_FRAME : 0);
 }
 
 static void r600_flush_from_winsys(void *ctx, unsigned flags)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index c6498ef..8088fba 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -81,8 +81,6 @@
 
 /* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */
 #define RADEON_CS_KEEP_TILING_FLAGS 0x01
-
-
 #endif
 
 #ifndef RADEON_CS_USE_VM
@@ -92,6 +90,10 @@
 #define RADEON_CS_RING_COMPUTE      1
 #endif
 
+#ifndef RADEON_CS_END_OF_FRAME
+#define RADEON_CS_END_OF_FRAME      0x04
+#endif
+
 
 #define RELOC_DWORDS (sizeof(struct drm_radeon_cs_reloc) / sizeof(uint32_t))
 
@@ -470,6 +472,10 @@ static void radeon_drm_cs_flush(struct radeon_winsys_cs *rcs, unsigned flags)
             cs->cst->flags[0] |= RADEON_CS_USE_VM;
             cs->cst->cs.num_chunks = 3;
         }
+        if (flags & RADEON_FLUSH_END_OF_FRAME) {
+            cs->cst->flags[0] |= RADEON_CS_END_OF_FRAME;
+            cs->cst->cs.num_chunks = 3;
+        }
         if (flags & RADEON_FLUSH_COMPUTE) {
             cs->cst->flags[1] = RADEON_CS_RING_COMPUTE;
             cs->cst->cs.num_chunks = 3;
diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
index b7eac3c..5bcbf8d 100644
--- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -48,6 +48,7 @@
 #define RADEON_FLUSH_ASYNC		(1 << 0)
 #define RADEON_FLUSH_KEEP_TILING_FLAGS	(1 << 1) /* needs DRM 2.12.0 */
 #define RADEON_FLUSH_COMPUTE		(1 << 2)
+#define RADEON_FLUSH_END_OF_FRAME       (1 << 3)
 
 /* Tiling flags. */
 enum radeon_bo_layout {
-- 
1.7.10.4



More information about the mesa-dev mailing list