[Libva] [Libva-intel-driver PATCH 5/6] Allow the batchbuffer to be submitted with override flag

Zhao, Yakui yakui.zhao at intel.com
Sun Aug 17 19:50:54 PDT 2014


From: Zhao Yakui <yakui.zhao at intel.com>

This is to specify which BSD ring is to dispatch the video command

Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
 src/intel_batchbuffer.c |   27 +++++++++++++++++++++++++++
 src/intel_batchbuffer.h |    8 ++++++++
 2 files changed, 35 insertions(+)

diff --git a/src/intel_batchbuffer.c b/src/intel_batchbuffer.c
index f76c133..ba73cb9 100644
--- a/src/intel_batchbuffer.c
+++ b/src/intel_batchbuffer.c
@@ -34,6 +34,11 @@
 #define MAX_BATCH_SIZE		0x400000
 
 
+#define LOCAL_I915_EXEC_BSD_MASK		(3<<13)
+#define LOCAL_I915_EXEC_BSD_DEFAULT		(0<<13)	/* default ping-pong mode */
+#define LOCAL_I915_EXEC_BSD_RING0		(1<<13)
+#define LOCAL_I915_EXEC_BSD_RING1		(2<<13)
+
 static void 
 intel_batchbuffer_reset(struct intel_batchbuffer *batch, int buffer_size)
 {
@@ -368,6 +373,28 @@ intel_batchbuffer_start_atomic_veb(struct intel_batchbuffer *batch, unsigned int
     intel_batchbuffer_start_atomic_helper(batch, I915_EXEC_VEBOX, size);
 }
 
+void intel_batchbuffer_start_atomic_bcs_override(struct intel_batchbuffer *batch, unsigned int size,
+                                                 bsd_ring_flag override_flag)
+{
+    uint32_t ring_flag;
+
+    switch(override_flag) {
+    case BSD_DEFAULT:
+	ring_flag = I915_EXEC_BSD + LOCAL_I915_EXEC_BSD_DEFAULT;
+	break;
+    case BSD_RING0:
+	ring_flag = I915_EXEC_BSD + LOCAL_I915_EXEC_BSD_RING0;
+	break;
+    case BSD_RING1:
+	ring_flag = I915_EXEC_BSD + LOCAL_I915_EXEC_BSD_RING1;
+    	break;
+    default:
+	ring_flag = I915_EXEC_BSD + LOCAL_I915_EXEC_BSD_DEFAULT;
+	break;
+    }
+    intel_batchbuffer_start_atomic_helper(batch, ring_flag, size);
+}
+
 
 void
 intel_batchbuffer_end_atomic(struct intel_batchbuffer *batch)
diff --git a/src/intel_batchbuffer.h b/src/intel_batchbuffer.h
index e4d0994..500e346 100644
--- a/src/intel_batchbuffer.h
+++ b/src/intel_batchbuffer.h
@@ -51,6 +51,14 @@ int intel_batchbuffer_check_free_space(struct intel_batchbuffer *batch, int size
 int intel_batchbuffer_used_size(struct intel_batchbuffer *batch);
 void intel_batchbuffer_align(struct intel_batchbuffer *batch, unsigned int alignedment);
 
+typedef enum {
+  BSD_DEFAULT,
+  BSD_RING0,
+  BSD_RING1,
+} bsd_ring_flag;
+
+void intel_batchbuffer_start_atomic_bcs_override(struct intel_batchbuffer *batch, unsigned int size,
+                                                 bsd_ring_flag override_flag);
 
 #define __BEGIN_BATCH(batch, n, f) do {                         \
         assert(f == (batch->flag & I915_EXEC_RING_MASK));                               \
-- 
1.7.10.1



More information about the Libva mailing list