va_trace: refine the log format
authorElaine Wang <elaine.wang@intel.com>
Wed, 17 Apr 2013 16:02:10 +0000 (00:02 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Wed, 19 Jun 2013 06:33:22 +0000 (14:33 +0800)
Signed-off-by: Elaine Wang <elaine.wang@intel.com>
(cherry picked from commit 15a0fca64456d8c7de1f7aca2cb747c4929690cd)

va/va.c
va/va_trace.c
va/va_trace.h
va/x11/va_x11.c

diff --git a/va/va.c b/va/va.c
index 8031092..400273e 100644 (file)
--- a/va/va.c
+++ b/va/va.c
@@ -627,7 +627,7 @@ VAStatus vaCreateConfig (
   vaStatus = ctx->vtable->vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
 
   /* record the current entrypoint for further trace/fool determination */
-  VA_TRACE_FUNC(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
+  VA_TRACE_LOG(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
   VA_FOOL_FUNC(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
   
   return vaStatus;
@@ -895,7 +895,7 @@ VAStatus vaCreateContext (
                                       flag, render_targets, num_render_targets, context );
 
   /* keep current encode/decode resoluton */
-  VA_TRACE_FUNC(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
+  VA_TRACE_LOG(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
 
   return vaStatus;
 }
@@ -1039,7 +1039,7 @@ VAStatus vaBeginPicture (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  VA_TRACE_FUNC(va_TraceBeginPicture, dpy, context, render_target);
+  VA_TRACE_LOG(va_TraceBeginPicture, dpy, context, render_target);
   VA_FOOL_RETURN();
   
   va_status = ctx->vtable->vaBeginPicture( ctx, context, render_target );
index 2a05e02..5e2ed65 100644 (file)
@@ -931,7 +931,7 @@ static void va_TraceVAEncPictureParameterBufferMPEG4(
     va_TraceMsg(idx, "VAEncPictureParameterBufferMPEG4\n");
     va_TraceMsg(idx, "\treference_picture = 0x%08x\n", p->reference_picture);
     va_TraceMsg(idx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
-    va_TraceMsg(idx, "\tcoded_buf = %08x\n", p->coded_buf);
+    va_TraceMsg(idx, "\tcoded_buf = 0x%08x\n", p->coded_buf);
     va_TraceMsg(idx, "\tpicture_width = %d\n", p->picture_width);
     va_TraceMsg(idx, "\tpicture_height = %d\n", p->picture_height);
     va_TraceMsg(idx, "\tmodulo_time_base = %d\n", p->modulo_time_base);
@@ -1273,7 +1273,7 @@ static void va_TraceVAEncPictureParameterBufferH264(
     va_TraceMsg(idx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
     va_TraceMsg(idx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
     va_TraceMsg(idx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
-    va_TraceMsg(idx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx:\n");
+    va_TraceMsg(idx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx):\n");
     for (i = 0; i < 16; i++)
     {
         if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID) {
@@ -1372,19 +1372,33 @@ static void va_TraceVAEncSliceParameterBufferH264(
     va_TraceMsg(idx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
 
     if (p->slice_type == 0 || p->slice_type == 1) {
-        va_TraceMsg(idx, "\tRefPicList0 =");
-        for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1 && i < 32; i++) {
-            va_TraceMsg(idx, "%d-%d-0x%08x-%d\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx);
+        va_TraceMsg(idx, "\tRefPicList0 (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx):\n");
+        for (i = 0; i < 32; i++) {
+            if (p->RefPicList0[i].flags != VA_PICTURE_H264_INVALID) {
+                va_TraceMsg(idx, "\t\t%d-%d-0x%08x-%d\n",
+                            p->RefPicList0[i].TopFieldOrderCnt,
+                            p->RefPicList0[i].BottomFieldOrderCnt,
+                            p->RefPicList0[i].picture_id,
+                            p->RefPicList0[i].frame_idx);
+            } else
+                break;
         }
-        if (p->slice_type == 1) {
-            va_TraceMsg(idx, "\tRefPicList1 =");
-            for (i = 0; i < p->num_ref_idx_l1_active_minus1 + 1 && i < 32; i++)
-            {
-                va_TraceMsg(idx, "%d-%d-0x%08x-%d\n", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx);
-            }
+    }
+    
+    if (p->slice_type == 1) {
+        va_TraceMsg(idx, "\tRefPicList1 (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx):\n");
+        for (i = 0; i < 32; i++) {
+            if (p->RefPicList1[i].flags != VA_PICTURE_H264_INVALID)
+                va_TraceMsg(idx, "\t\t%d-%d-0x%08x-%d\n",
+                            p->RefPicList1[i].TopFieldOrderCnt,
+                            p->RefPicList1[i].BottomFieldOrderCnt,
+                            p->RefPicList1[i].picture_id,
+                            p->RefPicList1[i].frame_idx);
+            else
+                break;
         }
     }
-
+    
     va_TraceMsg(idx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
     va_TraceMsg(idx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
     va_TraceMsg(idx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
index a211c82..29599ea 100644 (file)
@@ -41,17 +41,13 @@ extern int trace_flag;
                                        VA_TRACE_FLAG_SURFACE_ENCODE | \
                                        VA_TRACE_FLAG_SURFACE_JPEG)
 
-#define VA_TRACE_FUNC(trace_func,...)           \
-    if (trace_flag) {                           \
-        trace_func(__VA_ARGS__);                \
-    }
 #define VA_TRACE_LOG(trace_func,...)            \
-    if (trace_flag & VA_TRACE_FLAG_LOG) {            \
+    if (trace_flag & VA_TRACE_FLAG_LOG) {       \
         trace_func(__VA_ARGS__);                \
     }
-#define VA_TRACE_SURFACE(trace_func,...)        \
-    if (trace_flag & (VA_TRACE_FLAG_SURFACE | VA_TRACE_FLAG_CODEDBUF)) {  \
-        trace_func(__VA_ARGS__);                \
+#define VA_TRACE_SURFACE(trace_func,...)                                \
+    if (trace_flag & (VA_TRACE_FLAG_SURFACE | VA_TRACE_FLAG_CODEDBUF)) { \
+        trace_func(__VA_ARGS__);                                        \
     }
 
 void va_TraceInit(VADisplay dpy);
index 625ab7e..44c3330 100644 (file)
@@ -238,9 +238,9 @@ VAStatus vaPutSurface (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
   
-  VA_TRACE_FUNC(va_TracePutSurface, dpy, surface, (void *)draw, srcx, srcy, srcw, srch,
-                destx, desty, destw, desth,
-           cliprects, number_cliprects, flags );
+  VA_TRACE_LOG(va_TracePutSurface, dpy, surface, (void *)draw, srcx, srcy, srcw, srch,
+               destx, desty, destw, desth,
+               cliprects, number_cliprects, flags );
   
   return ctx->vtable->vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
                                    destx, desty, destw, desth,