diff options
author | Austin Yuan <shengquan.yuan@gmail.com> | 2010-10-26 10:18:11 -0700 |
---|---|---|
committer | Austin Yuan <shengquan.yuan@gmail.com> | 2010-10-26 10:18:11 -0700 |
commit | 866360c82ea76182bfa601a074c87d4c83325419 (patch) | |
tree | bcdf75eea76d17a67707625cccdc9d3803cd98cb | |
parent | fe9ee747b973118f21a9b838dd02972b96924c1e (diff) | |
download | libva-866360c82ea76182bfa601a074c87d4c83325419.tar.gz |
more trace for displayattribute/vaPutSurface
Signed-off-by: Austin Yuan <shengquan.yuan@gmail.com>
-rw-r--r-- | va/android/va_android.cpp | 33 | ||||
-rw-r--r-- | va/va.c | 29 | ||||
-rw-r--r-- | va/va_fool.c | 14 | ||||
-rw-r--r-- | va/va_trace.c | 96 | ||||
-rw-r--r-- | va/va_trace.h | 38 | ||||
-rw-r--r-- | va/x11/va_x11.c | 34 |
6 files changed, 233 insertions, 11 deletions
diff --git a/va/android/va_android.cpp b/va/android/va_android.cpp index 2da16b6..77341bc 100644 --- a/va/android/va_android.cpp +++ b/va/android/va_android.cpp @@ -272,6 +272,31 @@ VADisplay vaGetDisplay ( #ifdef ANDROID +extern int fool_postp; /* do nothing for vaPutSurface if set */ +extern int trace_flag; /* trace vaPutSurface parameters */ +#define VA_TRACE(trace_func,...) \ + if (trace_flag) { \ + trace_func(__VA_ARGS__); \ + } + +void va_TracePutSurface ( + VADisplay dpy, + VASurfaceID surface, + void *draw, /* the target Drawable */ + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + VARectangle *cliprects, /* client supplied clip list */ + unsigned int number_cliprects, /* number of clip rects in the clip list */ + unsigned int flags /* de-interlacing flags */ +); + + VAStatus vaPutSurface ( VADisplay dpy, VASurfaceID surface, @@ -291,8 +316,16 @@ VAStatus vaPutSurface ( { VADriverContextP ctx; + if (fool_postp) + return VA_STATUS_SUCCESS; + CHECK_DISPLAY(dpy); ctx = CTX(dpy); + + VA_TRACE(va_TracePutSurface, dpy, surface, (void *)draw, srcx, srcy, srcw, srch, + destx, desty, destw, desth, + cliprects, number_cliprects, flags ); + return ctx->vtable.vaPutSurface( ctx, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch, destx, desty, destw, desth, cliprects, number_cliprects, flags ); @@ -823,6 +823,7 @@ VAStatus vaSyncSurface ( if (va_FoolSyncSurface( dpy, render_target)) return VA_STATUS_SUCCESS; + return ctx->vtable.vaSyncSurface( ctx, render_target ); } @@ -1179,10 +1180,16 @@ int vaMaxNumDisplayAttributes ( VADisplay dpy ) { + int tmp; + if( !vaDisplayIsValid(dpy) ) return 0; - return CTX(dpy)->max_display_attributes; + tmp = CTX(dpy)->max_display_attributes; + + VA_TRACE(va_MaxNumDisplayAttributes, dpy, tmp); + + return tmp; } /* @@ -1201,7 +1208,14 @@ VAStatus vaQueryDisplayAttributes ( CHECK_DISPLAY(dpy); ctx = CTX(dpy); - return ctx->vtable.vaQueryDisplayAttributes ( ctx, attr_list, num_attributes ); + VAStatus va_status; + + va_status = ctx->vtable.vaQueryDisplayAttributes ( ctx, attr_list, num_attributes ); + + VA_TRACE(va_QueryDisplayAttributes, dpy, attr_list, num_attributes); + + return va_status; + } /* @@ -1220,7 +1234,13 @@ VAStatus vaGetDisplayAttributes ( CHECK_DISPLAY(dpy); ctx = CTX(dpy); - return ctx->vtable.vaGetDisplayAttributes ( ctx, attr_list, num_attributes ); + VAStatus va_status; + + va_status = ctx->vtable.vaGetDisplayAttributes ( ctx, attr_list, num_attributes ); + + VA_TRACE(va_SetDisplayAttributes, dpy, attr_list, num_attributes); + + return va_status; } /* @@ -1239,6 +1259,9 @@ VAStatus vaSetDisplayAttributes ( CHECK_DISPLAY(dpy); ctx = CTX(dpy); + VA_TRACE(va_SetDisplayAttributes, dpy, attr_list, num_attributes); + + return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes ); } diff --git a/va/va_fool.c b/va/va_fool.c index f4d866f..bdb2fb9 100644 --- a/va/va_fool.c +++ b/va/va_fool.c @@ -52,28 +52,31 @@ * . if set, encode does nothing, but fill in a hard-coded 720P clip into coded buffer. * . VA CONTEXT/CONFIG/SURFACE will call into drivers, but VA Buffer creation is done in here * . Bypass all ~SvaBeginPic/vaRenderPic/vaEndPic~T + * LIBVA_FOOL_POSTP: + * . if set, do nothing for vaPutSurface */ /* global settings */ -/* LIBVA_FOOL_DECODE/LIBVA_FOOL_ENCODE */ +/* LIBVA_FOOL_DECODE/LIBVA_FOOL_ENCODE/LIBVA_FOOL_POSTP */ static int fool_decode = 0; static int fool_encode = 0; +int fool_postp = 0; #define FOOL_CONTEXT_MAX 4 /* per context settings */ static struct _fool_context { - VADisplay dpy; + VADisplay dpy; /* should use context as the key */ VAProfile fool_profile; /* current profile for buffers */ VAEntrypoint fool_entrypoint; /* current entrypoint */ FILE *fool_fp_codedclip; /* load a clip from disk for fooling encode*/ - /* all buffers with same type share one memory + /* all buffers with same type share one malloc-ed memory * bufferID = (buffer numbers with the same type << 8) || type - * the buffer memory can be find by fool_buf[bufferID & 0xff] + * the malloc-ed memory can be find by fool_buf[bufferID & 0xff] * the size is ignored here */ char *fool_buf[VABufferTypeMax]; /* memory of fool buffers */ @@ -146,6 +149,9 @@ void va_FoolInit(VADisplay dpy) if (fool_index == FOOL_CONTEXT_MAX) return; + if (va_parseConfig("LIBVA_FOOL_POSTP", NULL) == 0) + fool_postp = 1; + if (va_parseConfig("LIBVA_FOOL_DECODE", NULL) == 0) fool_decode = 1; diff --git a/va/va_trace.c b/va/va_trace.c index dd1181f..9163588 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -39,7 +39,7 @@ #include <unistd.h> /* - * Export env "VA_TRACE" to debug some corruptions issues + * Env. to debug some issue, e.g. the decode/encode issue in a video conference scenerio: * .LIBVA_TRACE=log_file: general VA parameters saved into log_file * .LIBVA_TRACE_BUFDATA: dump VA buffer data into log_file (if not set, just calculate a checksum) * .LIBVA_TRACE_CODEDBUF=coded_clip_file: save the coded clip into file coded_clip_file @@ -63,7 +63,7 @@ static unsigned int trace_buffer_data; /* dump buffer data or not */ #define TRACE_CONTEXT_MAX 4 /* per context settings */ static struct _trace_context { - VADisplay dpy; + VADisplay dpy; /* should use context as the key */ /* LIBVA_TRACE */ FILE *trace_fp_log; /* save the log into a file */ @@ -338,7 +338,7 @@ void va_TraceSurface(VADisplay dpy) va_TraceMsg(idx, "\tchroma_u_offset = %d\n", chroma_u_offset); va_TraceMsg(idx, "\tchroma_v_offset = %d\n", chroma_v_offset); - if (*(unsigned int *)buffer == NULL) { + if (*(unsigned int *)buffer == 0) { va_TraceMsg(idx, "Error:vaLockSurface return NULL buffer\n"); vaUnlockSurface(dpy, trace_context[idx].trace_rendertarget); @@ -1449,3 +1449,93 @@ void va_TraceEndPicture( va_TraceSurface(dpy); } } + + +void va_TraceMaxNumDisplayAttributes ( + VADisplay dpy, + int number +) +{ + DPY2INDEX(dpy); + + va_TraceMsg(idx, "\t>max_display_attributes = %d\n", number); +} + +void va_TraceQueryDisplayAttributes ( + VADisplay dpy, + VADisplayAttribute *attr_list, /* out */ + int *num_attributes /* out */ +) +{ + int i; + + DPY2INDEX(dpy); + + va_TraceMsg(idx, "\tnum_attributes = %d\n", *num_attributes); + + for (i=0; i<*num_attributes; i++) { + va_TraceMsg(idx, "\tattr_list[%d] =\n"); + va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type); + va_TraceMsg(idx, "\t min_value = %d\n", attr_list[i].min_value); + va_TraceMsg(idx, "\t max_value = %d\n", attr_list[i].max_value); + va_TraceMsg(idx, "\t value = %d\n", attr_list[i].value); + va_TraceMsg(idx, "\t flags = %d\n", attr_list[i].flags); + } +} + + +void va_TraceSetDisplayAttributes ( + VADisplay dpy, + VADisplayAttribute *attr_list, + int num_attributes +) +{ + int i; + + DPY2INDEX(dpy); + + va_TraceMsg(idx, "\tnum_attributes = %d\n", num_attributes); + for (i=0; i<num_attributes; i++) { + va_TraceMsg(idx, "\tattr_list[%d] =\n"); + va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type); + va_TraceMsg(idx, "\t min_value = %d\n", attr_list[i].min_value); + va_TraceMsg(idx, "\t max_value = %d\n", attr_list[i].max_value); + va_TraceMsg(idx, "\t value = %d\n", attr_list[i].value); + va_TraceMsg(idx, "\t flags = %d\n", attr_list[i].flags); + } +} + + +void va_TracePutSurface ( + VADisplay dpy, + VASurfaceID surface, + void *draw, /* the target Drawable */ + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + VARectangle *cliprects, /* client supplied clip list */ + unsigned int number_cliprects, /* number of clip rects in the clip list */ + unsigned int flags /* de-interlacing flags */ +) +{ + DPY2INDEX(dpy); + + va_TraceMsg(idx, "\tsurface = 0x%08x\n", surface); + va_TraceMsg(idx, "\tdraw = 0x%08x\n", draw); + va_TraceMsg(idx, "\tsrcx = %d\n", surface); + va_TraceMsg(idx, "\tsrcy = %d\n", surface); + va_TraceMsg(idx, "\tsrcw = %d\n", surface); + va_TraceMsg(idx, "\tsrch = %d\n", surface); + va_TraceMsg(idx, "\tdestx = %d\n", surface); + va_TraceMsg(idx, "\tdesty = %d\n", surface); + va_TraceMsg(idx, "\tdestw = %d\n", destw); + va_TraceMsg(idx, "\tdesth = %d\n", desth); + va_TraceMsg(idx, "\tcliprects = 0x%08x\n", cliprects); + va_TraceMsg(idx, "\tnumber_cliprects = %d\n", number_cliprects); + va_TraceMsg(idx, "\tflags = 0x%08x\n", flags); +} diff --git a/va/va_trace.h b/va/va_trace.h index cae6099..579b8a8 100644 --- a/va/va_trace.h +++ b/va/va_trace.h @@ -77,4 +77,42 @@ void va_TraceEndPicture( VAContextID context ); + +void va_TraceMaxNumDisplayAttributes ( + VADisplay dpy, + int number +); + +void va_TraceQueryDisplayAttributes ( + VADisplay dpy, + VADisplayAttribute *attr_list, /* out */ + int *num_attributes /* out */ +); + +void va_TraceSetDisplayAttributes ( + VADisplay dpy, + VADisplayAttribute *attr_list, + int num_attributes +); + +/* extern function called by display side */ +void va_TracePutSurface ( + VADisplay dpy, + VASurfaceID surface, + void *draw, /* the target Drawable */ + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + VARectangle *cliprects, /* client supplied clip list */ + unsigned int number_cliprects, /* number of clip rects in the clip list */ + unsigned int flags /* de-interlacing flags */ +); + + + #endif /* VA_TRACE_H */ diff --git a/va/x11/va_x11.c b/va/x11/va_x11.c index cbd2614..70cea30 100644 --- a/va/x11/va_x11.c +++ b/va/x11/va_x11.c @@ -231,6 +231,31 @@ VADisplay vaGetDisplay ( #define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext) #define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; } +extern int fool_postp; /* do nothing for vaPutSurface if set */ +extern int trace_flag; /* trace vaPutSurface parameters */ +#define VA_TRACE(trace_func,...) \ + if (trace_flag) { \ + trace_func(__VA_ARGS__); \ + } + +void va_TracePutSurface ( + VADisplay dpy, + VASurfaceID surface, + void *draw, /* the target Drawable */ + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + VARectangle *cliprects, /* client supplied clip list */ + unsigned int number_cliprects, /* number of clip rects in the clip list */ + unsigned int flags /* de-interlacing flags */ +); + + VAStatus vaPutSurface ( VADisplay dpy, VASurfaceID surface, @@ -250,9 +275,16 @@ VAStatus vaPutSurface ( { VADriverContextP ctx; + if (fool_postp) + return VA_STATUS_SUCCESS; + CHECK_DISPLAY(dpy); ctx = CTX(dpy); - + + VA_TRACE(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, cliprects, number_cliprects, flags ); |