hardware/intel/libva
Revisión | 81db15a2ef6235d3154b112698d2504ba8db0cfc (tree) |
---|---|
Tiempo | 2016-05-23 08:35:23 |
Autor | Scott D Phillips <scott.d.phillips@inte...> |
Commiter | Sean V Kelley |
trace: Add va_TracePrint, va_TraceVPrint static functions
These functions are similar to va_TraceMsg() but without emitting
a timestamp.
Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
@@ -877,10 +877,9 @@ void va_TraceEnd(VADisplay dpy) | ||
877 | 877 | ((VADisplayContextP)dpy)->vatrace = NULL; |
878 | 878 | } |
879 | 879 | |
880 | -static void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...) | |
880 | +static void va_TraceVPrint(struct trace_context *trace_ctx, const char *msg, va_list args) | |
881 | 881 | { |
882 | 882 | FILE *fp = NULL; |
883 | - va_list args; | |
884 | 883 | |
885 | 884 | if (!(trace_flag & VA_TRACE_FLAG_LOG) |
886 | 885 | || !trace_ctx->plog_file) |
@@ -888,25 +887,44 @@ static void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...) | ||
888 | 887 | |
889 | 888 | fp = trace_ctx->plog_file->fp_log; |
890 | 889 | if (msg) { |
891 | - struct timeval tv; | |
892 | - | |
893 | - if (gettimeofday(&tv, NULL) == 0) | |
894 | - fprintf(fp, "[%04d.%06d]", | |
895 | - (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec); | |
896 | - | |
897 | - if(trace_ctx->trace_context != VA_INVALID_ID) | |
898 | - fprintf(fp, | |
899 | - "[ctx 0x%08x]", trace_ctx->trace_context); | |
900 | - else | |
901 | - fprintf(fp, "[ctx none]"); | |
902 | - | |
903 | - va_start(args, msg); | |
904 | 890 | vfprintf(fp, msg, args); |
905 | - va_end(args); | |
906 | 891 | } else |
907 | 892 | fflush(fp); |
908 | 893 | } |
909 | 894 | |
895 | +static void va_TracePrint(struct trace_context *trace_ctx, const char *msg, ...) | |
896 | +{ | |
897 | + va_list args; | |
898 | + va_start(args, msg); | |
899 | + va_TraceVPrint(trace_ctx, msg, args); | |
900 | + va_end(args); | |
901 | +} | |
902 | + | |
903 | +static void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...) | |
904 | +{ | |
905 | + va_list args; | |
906 | + struct timeval tv; | |
907 | + | |
908 | + if (!msg) { | |
909 | + va_TracePrint(trace_ctx, msg); | |
910 | + return; | |
911 | + } | |
912 | + | |
913 | + if (gettimeofday(&tv, NULL) == 0) | |
914 | + va_TracePrint(trace_ctx, "[%04d.%06d]", | |
915 | + (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec); | |
916 | + | |
917 | + if(trace_ctx->trace_context != VA_INVALID_ID) | |
918 | + va_TracePrint(trace_ctx, | |
919 | + "[ctx 0x%08x]", trace_ctx->trace_context); | |
920 | + else | |
921 | + va_TracePrint(trace_ctx, "[ctx none]"); | |
922 | + | |
923 | + va_start(args, msg); | |
924 | + va_TraceVPrint(trace_ctx, msg, args); | |
925 | + va_end(args); | |
926 | +} | |
927 | + | |
910 | 928 | static void va_TraceSurface(VADisplay dpy, VAContextID context) |
911 | 929 | { |
912 | 930 | unsigned int i, j; |