[Libva] [PATCH]va_trace_surface: dump surface content after vaEndPicture call

Yuan, Shengquan shengquan.yuan at gmail.com
Tue Aug 7 20:55:18 PDT 2012


>From 0af365de4c03c12fc20183093a944f7513a1c7be Mon Sep 17 00:00:00 2001
From: Austin Yuan <shengquan.yuan at intel.com>
Date: Thu, 2 Aug 2012 18:32:20 +0800
Subject: [PATCH 3/4] va_trace_surface: dumpe surface content after
 vaEndPicture call

vaEndPicture will kick HW decode/encode, and at this time use CPU
to dump surface content can keep GPU/CPU in parallel.

Also for encode trace, don't need to wait current frame completions
but for decode, we must wait decode till it is completed

Signed-off-by: Austin Yuan <shengquan.yuan at intel.com>
---
 va/va.c       |   13 +++++--------
 va/va_trace.c |   24 +++++++++++-------------
 2 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/va/va.c b/va/va.c
index 66e0549..02c8b22 100644
--- a/va/va.c
+++ b/va/va.c
@@ -934,19 +934,16 @@ VAStatus vaEndPicture (
     VAContextID context
 )
 {
-  VAStatus va_status;
+  VAStatus va_status = VA_STATUS_SUCCESS;
   VADriverContextP ctx;

   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);

-  /* dump encode source surface */
-  VA_TRACE_SURFACE(va_TraceEndPicture, dpy, context, 0);
-  /* return directly if do dummy operation */
-  VA_FOOL_RETURN();
-
-  va_status = ctx->vtable->vaEndPicture( ctx, context );
-  /* dump decode dest surface */
+  if (fool_codec == 0)
+      va_status = ctx->vtable->vaEndPicture( ctx, context );
+
+  /* dump surface content */
   VA_TRACE_SURFACE(va_TraceEndPicture, dpy, context, 1);

   return va_status;
diff --git a/va/va_trace.c b/va/va_trace.c
index e6fd2b2..893a3fa 100644
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -2175,10 +2175,8 @@ void va_TraceEndPicture(

     TRACE_FUNCNAME(idx);

-    if (endpic_done == 0) {
-        va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
-        va_TraceMsg(idx, "\trender_targets = 0x%08x\n",
trace_context[idx].trace_rendertarget);
-    }
+    va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
+    va_TraceMsg(idx, "\trender_targets = 0x%08x\n",
trace_context[idx].trace_rendertarget);

     encode = (trace_context[idx].trace_entrypoint == VAEntrypointEncSlice) &&
         (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE);
@@ -2186,27 +2184,27 @@ void va_TraceEndPicture(
         (trace_flag & VA_TRACE_FLAG_SURFACE_DECODE);
     jpeg = (trace_context[idx].trace_entrypoint == VAEntrypointEncPicture) &&
         (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG);
-
-    /* want to trace encode source surface, do it before vaEndPicture */
-    if ((encode || jpeg) && (endpic_done == 0))
+
+    /* trace encode source surface, can do it before HW completes rendering */
+    if (encode || jpeg)
         va_TraceSurface(dpy);

-    /* want to trace encoode codedbuf, do it after vaEndPicture */
-    if ((encode || jpeg) && (endpic_done == 1)) {
-        /* force the pipleline finish rendering */
+    /* trace coded buffer, do it after HW completes rendering */
+    if ((encode || jpeg) && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
         vaSyncSurface(dpy, trace_context[idx].trace_rendertarget);
         va_TraceCodedBuf(dpy);
     }

-    /* want to trace decode dest surface, do it after vaEndPicture */
-    if (decode && (endpic_done == 1)) {
-        /* force the pipleline finish rendering */
+    /* trace decoded surface, do it after HW completes rendering */
+    if (decode) {
         vaSyncSurface(dpy, trace_context[idx].trace_rendertarget);
         va_TraceSurface(dpy);
     }
+
     va_TraceMsg(idx, NULL);
 }

+
 void va_TraceSyncSurface(
     VADisplay dpy,
     VASurfaceID render_target
-- 
1.7.9.5



-- 
Thanks
-Austin


More information about the Libva mailing list