[Libva] [PATCH libva-intel-driver 11/18] Encoding: Dynamically select one mechanism to construct encoding command buffer for each frame on Gen7/Gen6

Zhao, Yakui yakui.zhao at intel.com
Mon Jan 12 05:01:34 PST 2015


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

Currently it uses the fixed policy to construct encoding command buffer.
(Use CPU or GPU). And it is statically compiled.
But sometimes it needs to choose the different mechanism on the fly instead
of statically compiled mode.

Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
 src/gen6_mfc.c |   12 ++++--------
 src/gen6_mfc.h |    1 -
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/gen6_mfc.c b/src/gen6_mfc.c
index 455721f..a474182 100644
--- a/src/gen6_mfc.c
+++ b/src/gen6_mfc.c
@@ -676,7 +676,6 @@ gen6_mfc_stop(VADriverContextP ctx,
     return VA_STATUS_SUCCESS;
 }
 
-#if __SOFTWARE__
 
 static int
 gen6_mfc_avc_pak_object_intra(VADriverContextP ctx, int x, int y, int end_mb, int qp,unsigned int *msg,
@@ -900,7 +899,6 @@ gen6_mfc_avc_software_batchbuffer(VADriverContextP ctx,
     return batch_bo;
 }
 
-#else
 
 static void
 gen6_mfc_batchbuffer_surfaces_input(VADriverContextP ctx,
@@ -1300,7 +1298,6 @@ gen6_mfc_avc_hardware_batchbuffer(VADriverContextP ctx,
     return mfc_context->mfc_batchbuffer_surface.bo;
 }
 
-#endif
 
 
 static void
@@ -1317,11 +1314,10 @@ gen6_mfc_avc_pipeline_programing(VADriverContextP ctx,
         return; 
     }
 
-#if __SOFTWARE__
-    slice_batch_bo = gen6_mfc_avc_software_batchbuffer(ctx, encode_state, encoder_context);
-#else
-    slice_batch_bo = gen6_mfc_avc_hardware_batchbuffer(ctx, encode_state, encoder_context);
-#endif
+    if (encoder_context->soft_batch_force)
+        slice_batch_bo = gen6_mfc_avc_software_batchbuffer(ctx, encode_state, encoder_context);
+    else
+        slice_batch_bo = gen6_mfc_avc_hardware_batchbuffer(ctx, encode_state, encoder_context);
 
     // begin programing
     intel_batchbuffer_start_atomic_bcs(batch, 0x4000); 
diff --git a/src/gen6_mfc.h b/src/gen6_mfc.h
index c079863..beb9401 100644
--- a/src/gen6_mfc.h
+++ b/src/gen6_mfc.h
@@ -49,7 +49,6 @@ struct encode_state;
 /* the space required for slice tail. */
 #define SLICE_TAIL			16
 
-#define __SOFTWARE__    0
 
 #define MFC_BATCHBUFFER_AVC_INTRA       0
 #define MFC_BATCHBUFFER_AVC_INTER       1
-- 
1.7.10.1



More information about the Libva mailing list