OSDN Git Service

vebox: clean-up frame store initialization.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 11 Aug 2014 09:44:12 +0000 (11:44 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Tue, 28 Oct 2014 10:37:37 +0000 (11:37 +0100)
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@intel.com>
src/gen75_vpp_vebox.c
src/gen75_vpp_vebox.h

index 6312608..08398e6 100644 (file)
@@ -910,7 +910,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
         }
@@ -1376,7 +1376,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);
 
@@ -1417,13 +1417,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 */
index a0842b0..4c763e4 100644 (file)
@@ -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;