From c4b089bdc8990ee5b5e562f6bf98985343228a65 Mon Sep 17 00:00:00 2001 From: Austin Yuan Date: Thu, 2 Aug 2012 18:32:20 +0800 Subject: 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 (cherry picked from commit 0af365de4c03c12fc20183093a944f7513a1c7be) --- 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 e331f74..6210112 100644 --- a/va/va.c +++ b/va/va.c @@ -1069,19 +1069,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 45856d7..6f2478f 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 -- cgit v1.2.3