[Libva] [PATCH intel-driver 06/13] vebox: clean-up frame store initialization.

Gwenole Beauchesne gb.devel at gmail.com
Wed Aug 27 04:50:31 PDT 2014


Rename FRAME_STORE_SUM to FRAME_STORE_COUNT, use existing macros to
determine the number of elements in the frame store array, avoid
duplicate zero initializations.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 src/gen75_vpp_vebox.c |   10 +++-------
 src/gen75_vpp_vebox.h |    4 ++--
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/gen75_vpp_vebox.c b/src/gen75_vpp_vebox.c
index 6971077..cb96640 100644
--- a/src/gen75_vpp_vebox.c
+++ b/src/gen75_vpp_vebox.c
@@ -911,7 +911,7 @@ void hsw_veb_resource_prepare(VADriverContextP ctx,
     proc_ctx->fourcc_output = output_fourcc;
    
     /* create pipeline surfaces */
-    for(i = 0; i < FRAME_STORE_SUM; i ++) {
+    for(i = 0; i < ARRAY_ELEMS(proc_ctx->frame_store); i ++) {
         if(proc_ctx->frame_store[i].obj_surface){
             continue; //refer external surface for vebox pipeline
         }
@@ -1377,7 +1377,7 @@ void gen75_vebox_context_destroy(VADriverContextP ctx,
        proc_ctx->surface_output_scaled_object = NULL;
      }
 
-    for(i = 0; i < FRAME_STORE_SUM; i ++) {
+    for(i = 0; i < ARRAY_ELEMS(proc_ctx->frame_store); i ++) {
         if (proc_ctx->frame_store[i].is_internal_surface == 1) {
             assert(proc_ctx->frame_store[i].surface_id != VA_INVALID_ID);
 
@@ -1418,13 +1418,9 @@ struct intel_vebox_context * gen75_vebox_context_init(VADriverContextP ctx)
     int i;
 
     proc_context->batch = intel_batchbuffer_new(intel, I915_EXEC_VEBOX, 0);
-    memset(proc_context->frame_store, 0, sizeof(VEBFrameStore)*FRAME_STORE_SUM);
 
-    for (i = 0; i < FRAME_STORE_SUM; i ++) {
+    for (i = 0; i < ARRAY_ELEMS(proc_context->frame_store); i++)
         proc_context->frame_store[i].surface_id = VA_INVALID_ID;
-        proc_context->frame_store[i].is_internal_surface = 0;
-        proc_context->frame_store[i].obj_surface = NULL;
-    }
   
     proc_context->filters_mask          = 0;
     proc_context->frame_order           = -1; /* the first frame */
diff --git a/src/gen75_vpp_vebox.h b/src/gen75_vpp_vebox.h
index a0842b0..4c763e4 100644
--- a/src/gen75_vpp_vebox.h
+++ b/src/gen75_vpp_vebox.h
@@ -67,7 +67,7 @@ enum {
     FRAME_OUT_CURRENT,
     FRAME_OUT_PREVIOUS,
     FRAME_OUT_STATISTIC,
-    FRAME_STORE_SUM,
+    FRAME_STORE_COUNT,
 };
 
 enum SURFACE_FORMAT{
@@ -121,7 +121,7 @@ struct intel_vebox_context
     int width_output;
     int height_output;
 
-    VEBFrameStore frame_store[FRAME_STORE_SUM];
+    VEBFrameStore frame_store[FRAME_STORE_COUNT];
 
     VEBBuffer dndi_state_table;
     VEBBuffer iecp_state_table;
-- 
1.7.9.5



More information about the Libva mailing list