vatrace: simplify coded buffer trace
authorAustin Yuan <shengquan.yuan@intel.com>
Fri, 21 Feb 2014 05:57:30 +0000 (13:57 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 17 Mar 2014 03:11:55 +0000 (11:11 +0800)
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
(cherry picked from commit d46a3d927ce66e0f7b61c8c184cf80b6d926327e)

Conflicts:

va/va_trace.c

va/va_trace.c

index 1bd869c..24f4759 100644 (file)
@@ -80,7 +80,6 @@ struct trace_context {
     VASurfaceID  trace_rendertarget; /* current render target */
     VAProfile trace_profile; /* current profile for buffers */
     VAEntrypoint trace_entrypoint; /* current entrypoint */
-    VABufferID trace_codedbuf;
     
     unsigned int trace_frame_no; /* current frame NO */
     unsigned int trace_slice_no; /* current slice NO */
@@ -279,30 +278,6 @@ void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...)
         fflush(trace_ctx->trace_fp_log);
 }
 
-void va_TraceCodedBuf(VADisplay dpy)
-{
-    VACodedBufferSegment *buf_list = NULL;
-    VAStatus va_status;
-    int i = 0;
-    
-    DPY2TRACECTX(dpy);
-    
-    va_status = vaMapBuffer(dpy, trace_ctx->trace_codedbuf, (void **)(&buf_list));
-    if (va_status != VA_STATUS_SUCCESS)
-        return;
-
-    va_TraceMsg(trace_ctx, "==========dump codedbuf into file %s\n", trace_ctx->trace_codedbuf_fn);
-    
-    while (buf_list != NULL) {
-        va_TraceMsg(trace_ctx, "\tVACodedBufferSegment[%d].size = %d\n", i++, buf_list->size);
-        if (trace_ctx->trace_fp_codedbuf)
-            fwrite(buf_list->buf, buf_list->size, 1, trace_ctx->trace_fp_codedbuf);
-        buf_list = buf_list->next;
-    }
-    vaUnmapBuffer(dpy,trace_ctx->trace_codedbuf);
-    va_TraceMsg(trace_ctx, NULL);
-}
-
 
 void va_TraceSurface(VADisplay dpy)
 {
@@ -759,6 +734,11 @@ void va_TraceMapBuffer (
         va_TraceMsg(trace_ctx, "\t   reserved = 0x%08x\n", buf_list->reserved);
         va_TraceMsg(trace_ctx, "\t   buf = 0x%08x\n", buf_list->buf);
 
+        if (trace_ctx->trace_fp_codedbuf) {
+            va_TraceMsg(trace_ctx, "\tDump the content to file\n");
+            fwrite(buf_list->buf, buf_list->size, 1, trace_ctx->trace_fp_codedbuf);
+        }
+        
         buf_list = buf_list->next;
     }
     va_TraceMsg(trace_ctx, NULL);
@@ -1169,8 +1149,6 @@ static void va_TraceVAEncPictureParameterBufferMPEG4(
     va_TraceMsg(trace_ctx, "\tpicture_type = %d\n", p->picture_type);
     va_TraceMsg(trace_ctx, NULL);
 
-    trace_ctx->trace_codedbuf =  p->coded_buf;
-    
     return;
 }
 
@@ -1550,8 +1528,6 @@ static void va_TraceVAEncPictureParameterBufferH264(
 
     va_TraceMsg(trace_ctx, NULL);
 
-    trace_ctx->trace_codedbuf =  p->coded_buf;
-
     return;
 }
 
@@ -2221,8 +2197,6 @@ static void va_TraceVAEncPictureParameterBufferH263(
     va_TraceMsg(trace_ctx, "\tpicture_type = 0x%08x\n", p->picture_type);
     va_TraceMsg(trace_ctx, NULL);
 
-    trace_ctx->trace_codedbuf =  p->coded_buf;
-    
     return;
 }
 
@@ -2248,8 +2222,6 @@ static void va_TraceVAEncPictureParameterBufferJPEG(
 
     va_TraceMsg(trace_ctx, NULL);
 
-    trace_ctx->trace_codedbuf =  p->coded_buf;
-    
     return;
 }
 
@@ -3014,12 +2986,6 @@ void va_TraceEndPicture(
            (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG)))
         va_TraceSurface(dpy);
     
-    /* trace coded buffer, do it after HW completes rendering */
-    if ((encode || jpeg) && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
-        vaSyncSurface(dpy, trace_ctx->trace_rendertarget);
-        va_TraceCodedBuf(dpy);
-    }
-
     /* trace decoded surface, do it after HW completes rendering */
     if (decode && ((trace_flag & VA_TRACE_FLAG_SURFACE_DECODE))) {
         vaSyncSurface(dpy, trace_ctx->trace_rendertarget);