summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Yuan <shengquan.yuan@gmail.com>2010-10-28 07:18:18 +0800
committerAustin Yuan <shengquan.yuan@gmail.com>2010-10-28 07:18:18 +0800
commit881b49c5f154ee6603eee4aebb8becae6097a4bd (patch)
tree0df6ffc997871a8675636c522ab47b35a2fe961c
parent6c372035373e531d2bb5608861adab3f6b2ff471 (diff)
libva-1.0.6
1) Refinement for VA_TRACE, new LIBVA_FOOL, see the description in va_trace.c/va_fool.c 2) vaPutSurface flag VA_ENABLE_BLEND to blend the surface with a color 3) libva.spec for RPM package 4) Update VAAPI for dynamic bit rate control/AIR/maximum slice size ctrl 5) Added VA_STATUS_ERROR_DECODING/ENCODING_ERROR to report decode/encode error 6) Add config.h/va_vesion.h for Android 7) Update "vainfo.c" for Android Signed-off-by: Austin Yuan <shengquan.yuan@gmail.com> Signed-off-by: Binglin Chen <binglin.chen@intel.com> Signed-off-by: Fei Jiang <fei.jiang@intel.com> Signed-off-by: Elaine Wang <elaine.wang@intel.com> Signed-off-by: Ren Zhaohan <zhaohan.ren@intel.com> Signed-off-by: Jerry Dong <jerry.dong@intel.com> Signed-off-by: Austin Yuan <shengquan.yuan@gmail.com>
-rw-r--r--Android.mk2
-rw-r--r--COPYING4
-rw-r--r--configure.ac6
-rw-r--r--dummy_drv_video/dummy_drv_video.c2
-rw-r--r--test/vainfo.c9
-rw-r--r--va/Android.mk1
-rw-r--r--va/Makefile.am2
-rw-r--r--va/android/va_android.cpp37
-rw-r--r--va/va.c135
-rw-r--r--va/va.h124
-rw-r--r--va/va_android.h4
-rw-r--r--va/va_trace.c1487
-rw-r--r--va/va_trace.h58
-rw-r--r--va/x11/va_x11.c34
14 files changed, 1396 insertions, 509 deletions
diff --git a/Android.mk b/Android.mk
index 5e7744e..ba71130 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,5 +1,7 @@
1# Recursive call sub-folder Android.mk 1# Recursive call sub-folder Android.mk
2# 2#
3# include $(call all-subdir-makefiles)
3LOCAL_PATH := $(my-dir) 4LOCAL_PATH := $(my-dir)
4 5
5include $(LOCAL_PATH)/va/Android.mk 6include $(LOCAL_PATH)/va/Android.mk
7
diff --git a/COPYING b/COPYING
index 765e825..900e775 100644
--- a/COPYING
+++ b/COPYING
@@ -5,11 +5,11 @@
5 distribute, sub license, and/or sell copies of the Software, and to 5 distribute, sub license, and/or sell copies of the Software, and to
6 permit persons to whom the Software is furnished to do so, subject to 6 permit persons to whom the Software is furnished to do so, subject to
7 the following conditions: 7 the following conditions:
8 8
9 The above copyright notice and this permission notice (including the 9 The above copyright notice and this permission notice (including the
10 next paragraph) shall be included in all copies or substantial portions 10 next paragraph) shall be included in all copies or substantial portions
11 of the Software. 11 of the Software.
12 12
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 14 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 15 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
diff --git a/configure.ac b/configure.ac
index ac54963..6debe95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,11 +7,11 @@
7# distribute, sub license, and/or sell copies of the Software, and to 7# distribute, sub license, and/or sell copies of the Software, and to
8# permit persons to whom the Software is furnished to do so, subject to 8# permit persons to whom the Software is furnished to do so, subject to
9# the following conditions: 9# the following conditions:
10# 10#
11# The above copyright notice and this permission notice (including the 11# The above copyright notice and this permission notice (including the
12# next paragraph) shall be included in all copies or substantial portions 12# next paragraph) shall be included in all copies or substantial portions
13# of the Software. 13# of the Software.
14# 14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 17# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -29,7 +29,7 @@ m4_define([libva_version],
29 [libva_major_version.libva_minor_version.libva_micro_version]) 29 [libva_major_version.libva_minor_version.libva_micro_version])
30 30
31# if the library source code has changed, increment revision 31# if the library source code has changed, increment revision
32m4_define([libva_lt_revision], [5]) 32m4_define([libva_lt_revision], [6])
33# if any interface was added/removed/changed, then inc current, reset revision 33# if any interface was added/removed/changed, then inc current, reset revision
34m4_define([libva_lt_current], [1]) 34m4_define([libva_lt_current], [1])
35# if any interface was added since last public release, then increment age 35# if any interface was added since last public release, then increment age
diff --git a/dummy_drv_video/dummy_drv_video.c b/dummy_drv_video/dummy_drv_video.c
index 90eb9c6..1a78b3f 100644
--- a/dummy_drv_video/dummy_drv_video.c
+++ b/dummy_drv_video/dummy_drv_video.c
@@ -1058,7 +1058,7 @@ VAStatus dummy_PutSurface(
1058 Drawable drawable = (Drawable)draw; 1058 Drawable drawable = (Drawable)draw;
1059 1059
1060 (void)drawable; 1060 (void)drawable;
1061 1061
1062 return VA_STATUS_ERROR_UNKNOWN; 1062 return VA_STATUS_ERROR_UNKNOWN;
1063} 1063}
1064 1064
diff --git a/test/vainfo.c b/test/vainfo.c
index 33d6ea4..847e57e 100644
--- a/test/vainfo.c
+++ b/test/vainfo.c
@@ -22,7 +22,12 @@
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */ 23 */
24 24
25#ifndef ANDROID
25#include <va/va_x11.h> 26#include <va/va_x11.h>
27#else
28#include "va/va_android.h"
29#define Display unsigned int
30#endif
26 31
27#include <stdarg.h> 32#include <stdarg.h>
28#include <stdio.h> 33#include <stdio.h>
@@ -87,7 +92,11 @@ int main(int argc, const char* argv[])
87 else 92 else
88 name = argv[0]; 93 name = argv[0];
89 94
95#ifndef ANDROID
90 dpy = XOpenDisplay(":0.0"); 96 dpy = XOpenDisplay(":0.0");
97#else
98 dpy = (Display*)malloc(sizeof(Display));
99#endif
91 if (NULL == dpy) 100 if (NULL == dpy)
92 { 101 {
93 fprintf(stderr, "%s: Error, can't open display: '%s'\n", name, display ? display : ""); 102 fprintf(stderr, "%s: Error, can't open display: '%s'\n", name, display ? display : "");
diff --git a/va/Android.mk b/va/Android.mk
index 848aa83..494f7c7 100644
--- a/va/Android.mk
+++ b/va/Android.mk
@@ -13,6 +13,7 @@ include $(CLEAR_VARS)
13LOCAL_SRC_FILES := \ 13LOCAL_SRC_FILES := \
14 va.c \ 14 va.c \
15 va_trace.c \ 15 va_trace.c \
16 va_fool.c
16 17
17LOCAL_CFLAGS += \ 18LOCAL_CFLAGS += \
18 -DANDROID \ 19 -DANDROID \
diff --git a/va/Makefile.am b/va/Makefile.am
index 8451a38..685fb12 100644
--- a/va/Makefile.am
+++ b/va/Makefile.am
@@ -27,7 +27,7 @@ INCLUDES = \
27LDADD = \ 27LDADD = \
28 $(LIBVA_LT_LDFLAGS) 28 $(LIBVA_LT_LDFLAGS)
29 29
30libva_la_SOURCES = va.c va_trace.c 30libva_la_SOURCES = va.c va_trace.c va_fool.c
31libva_ladir = $(libdir) 31libva_ladir = $(libdir)
32libva_la_LDFLAGS = $(LDADD) -no-undefined 32libva_la_LDFLAGS = $(LDADD) -no-undefined
33libva_la_LIBADD = $(LIBVA_LIBS) -ldl 33libva_la_LIBADD = $(LIBVA_LIBS) -ldl
diff --git a/va/android/va_android.cpp b/va/android/va_android.cpp
index 4eb90a2..b4727aa 100644
--- a/va/android/va_android.cpp
+++ b/va/android/va_android.cpp
@@ -250,7 +250,7 @@ VADisplay vaGetDisplay (
250 pDisplayContext->vaDestroy = va_DisplayContextDestroy; 250 pDisplayContext->vaDestroy = va_DisplayContextDestroy;
251 pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName; 251 pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
252 pDisplayContexts = pDisplayContext; 252 pDisplayContexts = pDisplayContext;
253 pDriverContext->dri_state = dri_state; 253 pDriverContext->dri_state = dri_state;
254 dpy = (VADisplay)pDisplayContext; 254 dpy = (VADisplay)pDisplayContext;
255 } 255 }
256 else 256 else
@@ -272,6 +272,33 @@ VADisplay vaGetDisplay (
272 272
273 273
274#ifdef ANDROID 274#ifdef ANDROID
275extern "C" {
276 extern int fool_postp; /* do nothing for vaPutSurface if set */
277 extern int trace_flag; /* trace vaPutSurface parameters */
278
279 void va_TracePutSurface (
280 VADisplay dpy,
281 VASurfaceID surface,
282 void *draw, /* the target Drawable */
283 short srcx,
284 short srcy,
285 unsigned short srcw,
286 unsigned short srch,
287 short destx,
288 short desty,
289 unsigned short destw,
290 unsigned short desth,
291 VARectangle *cliprects, /* client supplied clip list */
292 unsigned int number_cliprects, /* number of clip rects in the clip list */
293 unsigned int flags /* de-interlacing flags */
294 );
295}
296
297#define VA_TRACE(trace_func,...) \
298 if (trace_flag) { \
299 trace_func(__VA_ARGS__); \
300 }
301
275VAStatus vaPutSurface ( 302VAStatus vaPutSurface (
276 VADisplay dpy, 303 VADisplay dpy,
277 VASurfaceID surface, 304 VASurfaceID surface,
@@ -291,8 +318,16 @@ VAStatus vaPutSurface (
291{ 318{
292 VADriverContextP ctx; 319 VADriverContextP ctx;
293 320
321 if (fool_postp)
322 return VA_STATUS_SUCCESS;
323
294 CHECK_DISPLAY(dpy); 324 CHECK_DISPLAY(dpy);
295 ctx = CTX(dpy); 325 ctx = CTX(dpy);
326
327 VA_TRACE(va_TracePutSurface, dpy, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch,
328 destx, desty, destw, desth,
329 cliprects, number_cliprects, flags );
330
296 return ctx->vtable.vaPutSurface( ctx, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch, 331 return ctx->vtable.vaPutSurface( ctx, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch,
297 destx, desty, destw, desth, 332 destx, desty, destw, desth,
298 cliprects, number_cliprects, flags ); 333 cliprects, number_cliprects, flags );
diff --git a/va/va.c b/va/va.c
index c0722ba..0320ed3 100644
--- a/va/va.c
+++ b/va/va.c
@@ -26,6 +26,7 @@
26#include "va.h" 26#include "va.h"
27#include "va_backend.h" 27#include "va_backend.h"
28#include "va_trace.h" 28#include "va_trace.h"
29#include "va_fool.h"
29#include "config.h" 30#include "config.h"
30 31
31#include <assert.h> 32#include <assert.h>
@@ -57,17 +58,65 @@
57extern int trace_flag; 58extern int trace_flag;
58#define VA_TRACE(trace_func,...) \ 59#define VA_TRACE(trace_func,...) \
59 if (trace_flag) { \ 60 if (trace_flag) { \
60 va_TraceMsg("========%s========\n", __func__); \
61 trace_func(__VA_ARGS__); \ 61 trace_func(__VA_ARGS__); \
62 } 62 }
63 63
64/*
65 * read a config "env" for libva.conf or from environment setting
66 * liva.conf has higher priority
67 * return 0: the "env" is set, and the value is copied into env_value
68 * 1: the env is not set
69 */
70int va_parseConfig(char *env, char *env_value)
71{
72 char *token, *value, *saveptr;
73 char oneline[1024];
74 FILE *fp=NULL;
75
76
77 if (env == NULL)
78 return 1;
79
80 fp = fopen("/etc/libva.conf", "r");
81 while (fp && (fgets(oneline, 1024, fp) != NULL)) {
82 if (strlen(oneline) == 1)
83 continue;
84 token = strtok_r(oneline, "=\n", &saveptr);
85 value = strtok_r(NULL, "=\n", &saveptr);
86
87 if (NULL == token || NULL == value)
88 continue;
89
90 if (strcmp(token, env) == 0) {
91 if (env_value)
92 strncpy(env_value,value, 1024);
93
94 fclose(fp);
95
96 return 0;
97 }
98 }
99 if (fp)
100 fclose(fp);
101
102 /* no setting in config file, use env setting */
103 if (getenv(env)) {
104 if (env_value)
105 strncpy(env_value, getenv(env), 1024);
106
107 return 0;
108 }
109
110 return 1;
111}
112
64int vaDisplayIsValid(VADisplay dpy) 113int vaDisplayIsValid(VADisplay dpy)
65{ 114{
66 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; 115 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
67 return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext); 116 return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext);
68} 117}
69 118
70static void va_errorMessage(const char *msg, ...) 119void va_errorMessage(const char *msg, ...)
71{ 120{
72 va_list args; 121 va_list args;
73 122
@@ -77,7 +126,7 @@ static void va_errorMessage(const char *msg, ...)
77 va_end(args); 126 va_end(args);
78} 127}
79 128
80static void va_infoMessage(const char *msg, ...) 129void va_infoMessage(const char *msg, ...)
81{ 130{
82 va_list args; 131 va_list args;
83 132
@@ -340,7 +389,9 @@ VAStatus vaInitialize (
340 389
341 CHECK_DISPLAY(dpy); 390 CHECK_DISPLAY(dpy);
342 391
343 va_TraceInit(); 392 va_TraceInit(dpy);
393
394 va_FoolInit(dpy);
344 395
345 va_infoMessage("libva version %s\n", VA_VERSION_S); 396 va_infoMessage("libva version %s\n", VA_VERSION_S);
346 397
@@ -397,7 +448,9 @@ VAStatus vaTerminate (
397 if (VA_STATUS_SUCCESS == vaStatus) 448 if (VA_STATUS_SUCCESS == vaStatus)
398 pDisplayContext->vaDestroy(pDisplayContext); 449 pDisplayContext->vaDestroy(pDisplayContext);
399 450
400 va_TraceEnd(); 451 va_TraceEnd(dpy);
452
453 va_FoolEnd(dpy);
401 454
402 return vaStatus; 455 return vaStatus;
403} 456}
@@ -511,6 +564,7 @@ VAStatus vaCreateConfig (
511 ctx = CTX(dpy); 564 ctx = CTX(dpy);
512 565
513 VA_TRACE(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id); 566 VA_TRACE(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
567 va_FoolCreateConfig(dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
514 return ctx->vtable.vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id ); 568 return ctx->vtable.vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
515} 569}
516 570
@@ -552,11 +606,15 @@ VAStatus vaCreateSurfaces (
552) 606)
553{ 607{
554 VADriverContextP ctx; 608 VADriverContextP ctx;
609 VAStatus ret;
555 CHECK_DISPLAY(dpy); 610 CHECK_DISPLAY(dpy);
556 ctx = CTX(dpy); 611 ctx = CTX(dpy);
557 612
558 VA_TRACE(va_TraceCreateSurface, dpy, width, height, format, num_surfaces, surfaces); 613 VA_TRACE(va_TraceCreateSurface, dpy, width, height, format, num_surfaces, surfaces);
559 return ctx->vtable.vaCreateSurfaces( ctx, width, height, format, num_surfaces, surfaces ); 614
615 ret = ctx->vtable.vaCreateSurfaces( ctx, width, height, format, num_surfaces, surfaces );
616 va_FoolCreateSurfaces(dpy, width, height, format, num_surfaces, surfaces);
617 return ret;
560} 618}
561 619
562 620
@@ -619,6 +677,8 @@ VAStatus vaCreateBuffer (
619 CHECK_DISPLAY(dpy); 677 CHECK_DISPLAY(dpy);
620 ctx = CTX(dpy); 678 ctx = CTX(dpy);
621 679
680 if (va_FoolCreateBuffer(dpy, context, type, size, num_elements, data, buf_id))
681 return VA_STATUS_SUCCESS;
622 return ctx->vtable.vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id); 682 return ctx->vtable.vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id);
623} 683}
624 684
@@ -643,10 +703,19 @@ VAStatus vaMapBuffer (
643) 703)
644{ 704{
645 VADriverContextP ctx; 705 VADriverContextP ctx;
706 VAStatus va_status;
707
646 CHECK_DISPLAY(dpy); 708 CHECK_DISPLAY(dpy);
647 ctx = CTX(dpy); 709 ctx = CTX(dpy);
710
711 if (va_FoolMapBuffer(dpy, buf_id, pbuf))
712 return VA_STATUS_SUCCESS;
713 va_status = ctx->vtable.vaMapBuffer( ctx, buf_id, pbuf );
648 714
649 return ctx->vtable.vaMapBuffer( ctx, buf_id, pbuf ); 715 if (va_status == VA_STATUS_SUCCESS)
716 VA_TRACE(va_TraceMapBuffer, dpy, buf_id, pbuf);
717
718 return va_status;
650} 719}
651 720
652VAStatus vaUnmapBuffer ( 721VAStatus vaUnmapBuffer (
@@ -658,6 +727,8 @@ VAStatus vaUnmapBuffer (
658 CHECK_DISPLAY(dpy); 727 CHECK_DISPLAY(dpy);
659 ctx = CTX(dpy); 728 ctx = CTX(dpy);
660 729
730 if (va_FoolUnmapBuffer(dpy, buf_id))
731 return VA_STATUS_SUCCESS;
661 return ctx->vtable.vaUnmapBuffer( ctx, buf_id ); 732 return ctx->vtable.vaUnmapBuffer( ctx, buf_id );
662} 733}
663 734
@@ -699,7 +770,11 @@ VAStatus vaBeginPicture (
699 CHECK_DISPLAY(dpy); 770 CHECK_DISPLAY(dpy);
700 ctx = CTX(dpy); 771 ctx = CTX(dpy);
701 772
702 VA_TRACE(va_TraceBeginPicture, ctx, context, render_target); 773 VA_TRACE(va_TraceBeginPicture, dpy, context, render_target);
774
775 if (va_FoolBeginPicture(dpy, context, render_target))
776 return VA_STATUS_SUCCESS;
777
703 return ctx->vtable.vaBeginPicture( ctx, context, render_target ); 778 return ctx->vtable.vaBeginPicture( ctx, context, render_target );
704} 779}
705 780
@@ -714,7 +789,11 @@ VAStatus vaRenderPicture (
714 CHECK_DISPLAY(dpy); 789 CHECK_DISPLAY(dpy);
715 ctx = CTX(dpy); 790 ctx = CTX(dpy);
716 791
792 if (va_FoolRenderPicture(dpy, context, buffers, num_buffers))
793 return VA_STATUS_SUCCESS;
794
717 VA_TRACE(va_TraceRenderPicture, dpy, context, buffers, num_buffers); 795 VA_TRACE(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
796
718 return ctx->vtable.vaRenderPicture( ctx, context, buffers, num_buffers ); 797 return ctx->vtable.vaRenderPicture( ctx, context, buffers, num_buffers );
719} 798}
720 799
@@ -728,8 +807,15 @@ VAStatus vaEndPicture (
728 CHECK_DISPLAY(dpy); 807 CHECK_DISPLAY(dpy);
729 ctx = CTX(dpy); 808 ctx = CTX(dpy);
730 809
810 if (va_FoolEndPicture(dpy, context)) {
811 VA_TRACE(va_TraceEndPicture, dpy, context);
812 return VA_STATUS_SUCCESS;
813 }
814
731 va_status = ctx->vtable.vaEndPicture( ctx, context ); 815 va_status = ctx->vtable.vaEndPicture( ctx, context );
816
732 VA_TRACE(va_TraceEndPicture, dpy, context); 817 VA_TRACE(va_TraceEndPicture, dpy, context);
818
733 return va_status; 819 return va_status;
734} 820}
735 821
@@ -742,6 +828,9 @@ VAStatus vaSyncSurface (
742 CHECK_DISPLAY(dpy); 828 CHECK_DISPLAY(dpy);
743 ctx = CTX(dpy); 829 ctx = CTX(dpy);
744 830
831 if (va_FoolSyncSurface( dpy, render_target))
832 return VA_STATUS_SUCCESS;
833
745 return ctx->vtable.vaSyncSurface( ctx, render_target ); 834 return ctx->vtable.vaSyncSurface( ctx, render_target );
746} 835}
747 836
@@ -953,6 +1042,8 @@ VAStatus vaQuerySubpictureFormats (
953 CHECK_DISPLAY(dpy); 1042 CHECK_DISPLAY(dpy);
954 ctx = CTX(dpy); 1043 ctx = CTX(dpy);
955 1044
1045 if (va_FoolQuerySubpictureFormats(dpy, format_list, flags, num_formats))
1046 return VA_STATUS_SUCCESS;
956 return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats); 1047 return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
957} 1048}
958 1049
@@ -1096,10 +1187,16 @@ int vaMaxNumDisplayAttributes (
1096 VADisplay dpy 1187 VADisplay dpy
1097) 1188)
1098{ 1189{
1190 int tmp;
1191
1099 if( !vaDisplayIsValid(dpy) ) 1192 if( !vaDisplayIsValid(dpy) )
1100 return 0; 1193 return 0;
1101 1194
1102 return CTX(dpy)->max_display_attributes; 1195 tmp = CTX(dpy)->max_display_attributes;
1196
1197 VA_TRACE(va_TraceMaxNumDisplayAttributes, dpy, tmp);
1198
1199 return tmp;
1103} 1200}
1104 1201
1105/* 1202/*
@@ -1118,7 +1215,14 @@ VAStatus vaQueryDisplayAttributes (
1118 CHECK_DISPLAY(dpy); 1215 CHECK_DISPLAY(dpy);
1119 ctx = CTX(dpy); 1216 ctx = CTX(dpy);
1120 1217
1121 return ctx->vtable.vaQueryDisplayAttributes ( ctx, attr_list, num_attributes ); 1218 VAStatus va_status;
1219
1220 va_status = ctx->vtable.vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
1221
1222 VA_TRACE(va_TraceQueryDisplayAttributes, dpy, attr_list, num_attributes);
1223
1224 return va_status;
1225
1122} 1226}
1123 1227
1124/* 1228/*
@@ -1137,7 +1241,13 @@ VAStatus vaGetDisplayAttributes (
1137 CHECK_DISPLAY(dpy); 1241 CHECK_DISPLAY(dpy);
1138 ctx = CTX(dpy); 1242 ctx = CTX(dpy);
1139 1243
1140 return ctx->vtable.vaGetDisplayAttributes ( ctx, attr_list, num_attributes ); 1244 VAStatus va_status;
1245
1246 va_status = ctx->vtable.vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
1247
1248 VA_TRACE(va_TraceGetDisplayAttributes, dpy, attr_list, num_attributes);
1249
1250 return va_status;
1141} 1251}
1142 1252
1143/* 1253/*
@@ -1156,6 +1266,9 @@ VAStatus vaSetDisplayAttributes (
1156 CHECK_DISPLAY(dpy); 1266 CHECK_DISPLAY(dpy);
1157 ctx = CTX(dpy); 1267 ctx = CTX(dpy);
1158 1268
1269 VA_TRACE(va_TraceSetDisplayAttributes, dpy, attr_list, num_attributes);
1270
1271
1159 return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes ); 1272 return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
1160} 1273}
1161 1274
diff --git a/va/va.h b/va/va.h
index 0f12dfb..7f24a85 100644
--- a/va/va.h
+++ b/va/va.h
@@ -128,6 +128,8 @@ typedef int VAStatus; /* Return status type from functions */
128#define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014 128#define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014
129#define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015 129#define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015
130#define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016 130#define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016
131#define VA_STATUS_ERROR_DECODING_ERROR 0x00000017
132#define VA_STATUS_ERROR_ENCODING_ERROR 0x00000018
131#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF 133#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
132 134
133/* De-interlacing flags for vaPutSurface() */ 135/* De-interlacing flags for vaPutSurface() */
@@ -136,11 +138,19 @@ typedef int VAStatus; /* Return status type from functions */
136#define VA_BOTTOM_FIELD 0x00000002 138#define VA_BOTTOM_FIELD 0x00000002
137 139
138/* 140/*
141 * Enabled the positioning/cropping/blending feature:
142 * 1, specify the video playback position in the isurface
143 * 2, specify the cropping info for video playback
144 * 3, encoded video will blend with background color
145 */
146#define VA_ENABLE_BLEND 0x00000004 /* video area blend with the constant color */
147
148/*
139 * Clears the drawable with background color. 149 * Clears the drawable with background color.
140 * for hardware overlay based implementation this flag 150 * for hardware overlay based implementation this flag
141 * can be used to turn off the overlay 151 * can be used to turn off the overlay
142 */ 152 */
143#define VA_CLEAR_DRAWABLE 0x00000008 153#define VA_CLEAR_DRAWABLE 0x00000008
144 154
145/* Color space conversion flags for vaPutSurface() */ 155/* Color space conversion flags for vaPutSurface() */
146#define VA_SRC_BT601 0x00000010 156#define VA_SRC_BT601 0x00000010
@@ -273,6 +283,7 @@ typedef struct _VAConfigAttrib {
273#define VA_RC_NONE 0x00000001 283#define VA_RC_NONE 0x00000001
274#define VA_RC_CBR 0x00000002 284#define VA_RC_CBR 0x00000002
275#define VA_RC_VBR 0x00000004 285#define VA_RC_VBR 0x00000004
286#define VA_RC_VCM 0x00000008 /* video conference mode */
276 287
277/* 288/*
278 * if an attribute is not applicable for a given 289 * if an attribute is not applicable for a given
@@ -502,8 +513,75 @@ typedef enum
502 VAEncSliceParameterBufferType = 24, 513 VAEncSliceParameterBufferType = 24,
503 VAEncH264VUIBufferType = 25, 514 VAEncH264VUIBufferType = 25,
504 VAEncH264SEIBufferType = 26, 515 VAEncH264SEIBufferType = 26,
516 VAEncMiscParameterBufferType = 27,
517 VABufferTypeMax = 0xff
505} VABufferType; 518} VABufferType;
506 519
520typedef enum
521{
522 VAEncMiscParameterTypeFrameRate = 0,
523 VAEncMiscParameterTypeRateControl = 1,
524 VAEncMiscParameterTypeMaxSliceSize = 2,
525 VAEncMiscParameterTypeAIR = 3,
526} VAEncMiscParameterType;
527
528/*
529 * For application, e.g. set a new bitrate
530 * VABufferID buf_id;
531 * VAEncMiscParameterBuffer *misc_param;
532 * VAEncMiscParameterRateControl *misc_rate_ctrl;
533 *
534 * vaCreateBuffer(dpy, context, VAEncMiscParameterBufferType,
535 * sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterRateControl),
536 * 1, NULL, &buf_id);
537 *
538 * vaMapBuffer(dpy,buf_id,(void **)&misc_param);
539 * misc_param->type = VAEncMiscParameterTypeRateControl;
540 * misc_rate_ctrl= (VAEncMiscParameterRateControl *)misc_param->data;
541 * misc_rate_ctrl->bits_per_second = 6400000;
542 * vaUnmapBuffer(dpy, buf_id);
543 * vaRenderPicture(dpy, context, &buf_id, 1);
544 */
545typedef struct _VAEncMiscParameterBuffer
546{
547 VAEncMiscParameterType type;
548 unsigned int data[0];
549} VAEncMiscParameterBuffer;
550
551typedef struct _VAEncMiscParameterRateControl
552{
553 unsigned int bits_per_second; /* this is the maximum bit-rate to be constrained by the rate control implementation */
554 unsigned int target_percentage; /* this is the bit-rate the rate control is targeting, as a percentage of the maximum bit-rate */
555 /* for example if target_percentage is 95 then the rate control will target a bit-rate that is */
556 /* 95% of the maximum bit-rate */
557 unsigned int window_size; /* windows size in milliseconds. For example if this is set to 500, then the rate control will guarantee the */
558 /* target bit-rate over a 500 ms window */
559 unsigned int initial_qp; /* initial QP at I frames */
560 unsigned int min_qp;
561} VAEncMiscParameterRateControl;
562
563typedef struct _VAEncMiscParameterFrameRate
564{
565 unsigned int framerate;
566} VAEncMiscParameterFrameRate;
567
568/*
569 * Allow a maximum slice size to be specified (in bits).
570 * The encoder will attempt to make sure that individual slices do not exceed this size
571 * Or to signal applicate if the slice size exceed this size, see "status" of VACodedBufferSegment
572 */
573typedef struct _VAEncMiscParameterMaxSliceSize
574{
575 unsigned int max_slice_size;
576} VAEncMiscParameterMaxSliceSize;
577
578typedef struct _VAEncMiscParameterAIR
579{
580 unsigned int air_num_mbs;
581 unsigned int air_threshold;
582 unsigned int air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */
583} VAEncMiscParameterAIR;
584
507 585
508/* 586/*
509 * There will be cases where the bitstream buffer will not have enough room to hold 587 * There will be cases where the bitstream buffer will not have enough room to hold
@@ -1115,6 +1193,8 @@ typedef struct _VAEncSequenceParameterBufferH264
1115 unsigned char vui_flag; 1193 unsigned char vui_flag;
1116} VAEncSequenceParameterBufferH264; 1194} VAEncSequenceParameterBufferH264;
1117 1195
1196#define H264_LAST_PICTURE_EOSEQ 0x01 /* the last picture in the sequence */
1197#define H264_LAST_PICTURE_EOSTREAM 0x02 /* the last picture in the stream */
1118typedef struct _VAEncPictureParameterBufferH264 1198typedef struct _VAEncPictureParameterBufferH264
1119{ 1199{
1120 VASurfaceID reference_picture; 1200 VASurfaceID reference_picture;
@@ -1122,9 +1202,7 @@ typedef struct _VAEncPictureParameterBufferH264
1122 VABufferID coded_buf; 1202 VABufferID coded_buf;
1123 unsigned short picture_width; 1203 unsigned short picture_width;
1124 unsigned short picture_height; 1204 unsigned short picture_height;
1125 unsigned char last_picture; /* if set to 1 it indicates the last picture in the sequence 1205 unsigned char last_picture;
1126 * if set to 2 it indicates the last picture of the stream
1127 */
1128} VAEncPictureParameterBufferH264; 1206} VAEncPictureParameterBufferH264;
1129 1207
1130/**************************** 1208/****************************
@@ -1225,9 +1303,26 @@ VAStatus vaBufferSetNumElements (
1225/* 1303/*
1226 * device independent data structure for codedbuffer 1304 * device independent data structure for codedbuffer
1227 */ 1305 */
1228typedef struct _VACodedBufferSegment { 1306
1229 unsigned int size; /* size of the data buffer in the coded buffer segment, in bytes */ 1307/*
1230 unsigned int bit_offset;/* bit offset into the data buffer where valid bitstream data begins */ 1308 * FICTURE_AVE_QP(bit7-0): The average Qp value used during this frame
1309 * LARGE_SLICE(bit8):At least one slice in the current frame was large
1310 * enough for the encoder to attempt to limit its size.
1311 * SLICE_OVERFLOW(bit9): At least one slice in the current frame has
1312 * exceeded the maximum slice size specified.
1313 */
1314#define VA_CODED_BUF_STATUS_PICTURE_AVE_QP_MASK 0xff
1315#define VA_CODED_BUF_STATUS_LARGE_SLICE_MASK 0x100
1316#define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK 0x200
1317
1318/*
1319 * device independent data structure for codedbuffer
1320 */
1321typedef struct _VACodedBufferSegment {
1322 unsigned int size;/* size of the data buffer in the coded buffer segment, in bytes */
1323 unsigned int bit_offset; /* bit offset into the data buffer where valid bitstream data begins */
1324 unsigned int status; /* status set by the driver on the coded buffer*/
1325 unsigned int reserved; /* for future use */
1231 void *buf; /* pointer to the beginning of the data buffer in the coded buffer segment */ 1326 void *buf; /* pointer to the beginning of the data buffer in the coded buffer segment */
1232 void *next; /* pointer to the next VACodedBufferSegment */ 1327 void *next; /* pointer to the next VACodedBufferSegment */
1233} VACodedBufferSegment; 1328} VACodedBufferSegment;
@@ -1713,7 +1808,10 @@ typedef enum
1713 VADisplayAttribContrast = 1, 1808 VADisplayAttribContrast = 1,
1714 VADisplayAttribHue = 2, 1809 VADisplayAttribHue = 2,
1715 VADisplayAttribSaturation = 3, 1810 VADisplayAttribSaturation = 3,
1716 /* client can specifiy a background color for the target window */ 1811 /* client can specifiy a background color for the target window
1812 * the new feature of video conference,
1813 * the uncovered area of the surface is filled by this color
1814 * also it will blend with the decoded video color*/
1717 VADisplayAttribBackgroundColor = 4, 1815 VADisplayAttribBackgroundColor = 4,
1718 /* 1816 /*
1719 * this is a gettable only attribute. For some implementations that use the 1817 * this is a gettable only attribute. For some implementations that use the
@@ -1739,7 +1837,15 @@ typedef enum
1739 * For type VADisplayAttribCSCMatrix, "value" field is a pointer to the color 1837 * For type VADisplayAttribCSCMatrix, "value" field is a pointer to the color
1740 * conversion matrix. Each element in the matrix is float-point 1838 * conversion matrix. Each element in the matrix is float-point
1741 */ 1839 */
1742 VADisplayAttribCSCMatrix = 12 1840 VADisplayAttribCSCMatrix = 12,
1841 /* specify the constant color used to blend with video surface
1842 * Cd = Cv*Cc*Ac + Cb *(1 - Ac) C means the constant RGB
1843 * d: the final color to overwrite into the frame buffer
1844 * v: decoded video after color conversion,
1845 * c: video color specified by VADisplayAttribBlendColor
1846 * b: background color of the drawable
1847 */
1848 VADisplayAttribBlendColor = 13,
1743} VADisplayAttribType; 1849} VADisplayAttribType;
1744 1850
1745/* flags for VADisplayAttribute */ 1851/* flags for VADisplayAttribute */
diff --git a/va/va_android.h b/va/va_android.h
index 08844f4..7b98949 100644
--- a/va/va_android.h
+++ b/va/va_android.h
@@ -19,8 +19,8 @@ VADisplay vaGetDisplay (
19#endif 19#endif
20 20
21#ifdef __cplusplus 21#ifdef __cplusplus
22#ifdef ANDROID 22#ifdef ANDROID
23#include <ui/ISurface.h> 23#include <surfaceflinger/ISurface.h>
24using namespace android; 24using namespace android;
25 25
26/* 26/*
diff --git a/va/va_trace.c b/va/va_trace.c
index 4ec9195..d289383 100644
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -34,23 +34,87 @@
34#include <string.h> 34#include <string.h>
35#include <dlfcn.h> 35#include <dlfcn.h>
36#include <unistd.h> 36#include <unistd.h>
37#include <sys/types.h>
38#include <sys/stat.h>
39#include <unistd.h>
40#include <time.h>
41
42
43/*
44 * Env. to debug some issue, e.g. the decode/encode issue in a video conference scenerio:
45 * .LIBVA_TRACE=log_file: general VA parameters saved into log_file
46 * .LIBVA_TRACE_BUFDATA: dump VA buffer data into log_file (if not set, just calculate a checksum)
47 * .LIBVA_TRACE_CODEDBUF=coded_clip_file: save the coded clip into file coded_clip_file
48 * .LIBVA_TRACE_SURFACE=decoded_yuv_file: save the decoded YUV file decoded_yuv_file
49 * .LIBVA_TRACE_LOGSIZE=numeric number: truncate the log_file or coded_clip_file, or decoded_yuv_file
50 * when the size is bigger than the number
51 */
52
37 53
54/* global settings */
55
56/* LIBVA_TRACE */
38unsigned int trace_flag = 0; 57unsigned int trace_flag = 0;
39 58
40static const char *trace_file = 0; 59/* LIBVA_TRACE_LOGSIZE */
41static FILE *trace_fp = 0; 60static unsigned int trace_logsize = 0xffffffff; /* truncate the log when the size is bigger than it */
61
62/* LIBVA_TRACE_BUFDATA */
63static unsigned int trace_buffer_data; /* dump buffer data or not */
64
65#define TRACE_CONTEXT_MAX 4
66/* per context settings */
67static struct _trace_context {
68 VADisplay dpy; /* should use context as the key */
69
70 /* LIBVA_TRACE */
71 FILE *trace_fp_log; /* save the log into a file */
72 char trace_log_fn[1024]; /* file name */
73
74 /* LIBVA_TRACE_CODEDBUF */
75 FILE *trace_fp_codedbuf; /* save the encode result into a file */
76 char trace_codedbuf_fn[1024]; /* file name */
77
78 /* LIBVA_TRACE_SURFACE */
79 FILE *trace_fp_surface; /* save the surface YUV into a file */
80 char trace_surface_fn[1024]; /* file name */
81
82 VAContextID trace_context; /* current context */
83
84 VASurfaceID trace_rendertarget; /* current render target */
85 VAProfile trace_profile; /* current profile for buffers */
86 VAEntrypoint trace_entrypoint; /* current entrypoint */
87 VABufferID trace_codedbuf;
88
89 unsigned int trace_frame_no; /* current frame NO */
90 unsigned int trace_slice_no; /* current slice NO */
91 unsigned int trace_slice_size; /* current slice buffer size */
92
93 unsigned int trace_frame_width; /* current frame width */
94 unsigned int trace_frame_height; /* current frame height */
95 unsigned int trace_sequence_start; /* get a new sequence for encoding or not */
96} trace_context[TRACE_CONTEXT_MAX] = { {0} }; /* trace five context at the same time */
97
98#define DPY2INDEX(dpy) \
99 int idx; \
100 \
101 for (idx = 0; idx < TRACE_CONTEXT_MAX; idx++) \
102 if (trace_context[idx].dpy == dpy) \
103 break; \
104 \
105 if (idx == TRACE_CONTEXT_MAX) \
106 return;
107
108#define TRACE_FUNCNAME(idx) va_TraceMsg(idx, "==========%s\n", __func__);
42 109
43static VASurfaceID trace_rendertarget; /* current render target */ 110/* Prototype declarations (functions defined in va.c) */
44static VAProfile trace_profile; /* current entrypoint for buffers */
45 111
46static unsigned int trace_frame; 112void va_errorMessage(const char *msg, ...);
47static unsigned int trace_slice; 113void va_infoMessage(const char *msg, ...);
48 114
49static unsigned int trace_width; 115int va_parseConfig(char *env, char *env_value);
50static unsigned int trace_height;
51 116
52/* Prototypes (functions defined in va.c) */ 117VAStatus vaBufferInfo(
53VAStatus vaBufferInfo (
54 VADisplay dpy, 118 VADisplay dpy,
55 VAContextID context, /* in */ 119 VAContextID context, /* in */
56 VABufferID buf_id, /* in */ 120 VABufferID buf_id, /* in */
@@ -76,45 +140,263 @@ VAStatus vaUnlockSurface(VADisplay dpy,
76 VASurfaceID surface 140 VASurfaceID surface
77); 141);
78 142
79void va_TraceInit(void) 143
144void va_TraceInit(VADisplay dpy)
80{ 145{
81 trace_file = (const char *)getenv("LIBVA_TRACE"); 146 char env_value[1024];
82 if (trace_file) { 147 unsigned int suffix = 0xffff & ((unsigned int)time(NULL));
83 trace_fp = fopen(trace_file, "w"); 148 int trace_index = 0;
84 if (trace_fp) 149 FILE *tmp;
85 trace_flag = 1; 150
151 for (trace_index = 0; trace_index < TRACE_CONTEXT_MAX; trace_index++)
152 if (trace_context[trace_index].dpy == 0)
153 break;
154
155 if (trace_index == TRACE_CONTEXT_MAX)
156 return;
157
158 if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
159 trace_flag = 1;
160
161 sprintf(env_value+strlen(env_value), ".%d.%d", trace_index, suffix);
162
163 tmp = fopen(env_value, "w");
164 if (tmp) {
165 trace_context[trace_index].trace_fp_log = tmp;
166 strcpy(trace_context[trace_index].trace_log_fn, env_value);
167 } else {
168 trace_context[trace_index].trace_fp_log = stderr;
169 strcpy(trace_context[trace_index].trace_codedbuf_fn, "/dev/stderr");
170 }
171 va_infoMessage("LIBVA_TRACE is on, save log into %s\n", trace_context[trace_index].trace_log_fn);
172 }
173
174 if (trace_flag == 0)
175 return;
176
177 /* may re-get the global settings for multiple context */
178 if (va_parseConfig("LIBVA_TRACE_LOGSIZE", &env_value[0]) == 0) {
179 trace_logsize = atoi(env_value);
180 va_infoMessage("LIBVA_TRACE_LOGSIZE is on, size is %d\n", trace_logsize);
181 }
182
183
184 if (va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0) {
185 trace_buffer_data = 1; /* dump buffer data */
186 va_infoMessage("LIBVA_TRACE_BUFDATA is on, dump buffer into log file\n");
187 }
188
189
190 /* per-context setting */
191 if (va_parseConfig("LIBVA_TRACE_CODEDBUF", &env_value[0]) == 0) {
192 sprintf(env_value+strlen(env_value), ".%d.%d", trace_index, suffix);
193
194 tmp = fopen(env_value, "w");
195
196 if (tmp) {
197 trace_context[trace_index].trace_fp_codedbuf = tmp;
198 strcpy(trace_context[trace_index].trace_codedbuf_fn, env_value);
199 } else {
200 trace_context[trace_index].trace_fp_codedbuf = stderr;
201 strcpy(trace_context[trace_index].trace_codedbuf_fn, "/dev/stderr");
202 }
203
204 va_infoMessage("LIBVA_TRACE_CODEDBUF is on, save coded clip into %s\n", trace_context[trace_index].trace_codedbuf_fn);
205 }
206
207 if (va_parseConfig("LIBVA_TRACE_SURFACE", &env_value[0]) == 0) {
208 sprintf(env_value+strlen(env_value), ".%d.%d", trace_index, suffix);
209
210 tmp = fopen(env_value, "w");
211
212 if (tmp) {
213 trace_context[trace_index].trace_fp_surface = tmp;
214 strcpy(trace_context[trace_index].trace_surface_fn, env_value);
215 } else {
216 trace_context[trace_index].trace_fp_surface = stderr;
217 strcpy(trace_context[trace_index].trace_surface_fn, "/dev/stderr");
218 }
219
220 va_infoMessage("LIBVA_TRACE_SURFACE is on, save coded clip into %s\n", trace_context[trace_index].trace_surface_fn);
86 } 221 }
222
223 trace_context[trace_index].dpy = dpy;
87} 224}
88 225
89void va_TraceEnd(void) 226
227void va_TraceEnd(VADisplay dpy)
90{ 228{
91 if (trace_file && trace_fp) { 229 DPY2INDEX(dpy);
92 fclose(trace_fp); 230
231 if (trace_context[idx].trace_fp_log && (trace_context[idx].trace_fp_log != stderr))
232 fclose(trace_context[idx].trace_fp_log);
233
234 if (trace_context[idx].trace_fp_codedbuf && (trace_context[idx].trace_fp_codedbuf != stderr))
235 fclose(trace_context[idx].trace_fp_codedbuf);
236
237 if (trace_context[idx].trace_fp_surface && (trace_context[idx].trace_fp_surface != stderr))
238 fclose(trace_context[idx].trace_fp_surface);
239
240 memset(&trace_context[idx], sizeof(struct _trace_context), 0);
241}
93 242
94 trace_file = NULL; 243static unsigned int file_size(FILE *fp)
95 trace_fp = NULL; 244{
245 struct stat buf;
96 246
97 trace_flag = 0; 247 fstat(fileno(fp), &buf);
98 248
99 trace_width = 0; 249 return buf.st_size;
100 trace_height = 0;
101 }
102} 250}
103 251
104void va_TraceMsg(const char *msg, ...) 252
253static void truncate_file(FILE *fp)
254{
255 ftruncate(fileno(fp), 0);
256 rewind(fp);
257}
258
259void va_TraceMsg(int idx, const char *msg, ...)
105{ 260{
106 va_list args; 261 va_list args;
262
263 if (file_size(trace_context[idx].trace_fp_log) >= trace_logsize)
264 truncate_file(trace_context[idx].trace_fp_log);
107 265
108 if (msg) { 266 if (msg) {
109 va_start(args, msg); 267 va_start(args, msg);
110 vfprintf(trace_fp, msg, args); 268 vfprintf(trace_context[idx].trace_fp_log, msg, args);
111 va_end(args); 269 va_end(args);
112 } else { 270 } else
113 fflush(trace_fp); 271 fflush(trace_context[idx].trace_fp_log);
272}
273
274void va_TraceCodedBuf(VADisplay dpy)
275{
276 VACodedBufferSegment *buf_list = NULL;
277 VAStatus va_status;
278 unsigned char check_sum = 0;
279 DPY2INDEX(dpy);
280
281 /* can only truncate at a sequence boudary */
282 if (((file_size(trace_context[idx].trace_fp_log) >= trace_logsize))
283 && trace_context[idx].trace_sequence_start) {
284 va_TraceMsg(idx, "==========truncate file %s\n", trace_context[idx].trace_codedbuf_fn);
285 truncate_file(trace_context[idx].trace_fp_log);
114 } 286 }
287
288
289 trace_context[idx].trace_sequence_start = 0; /* only truncate coded file when meet next new sequence */
290
291 va_status = vaMapBuffer(dpy, trace_context[idx].trace_codedbuf, (void **)(&buf_list));
292 if (va_status != VA_STATUS_SUCCESS)
293 return;
294
295 va_TraceMsg(idx, "==========dump codedbuf into file %s\n", trace_context[idx].trace_codedbuf_fn);
296
297 while (buf_list != NULL) {
298 unsigned int i;
299
300 va_TraceMsg(idx, "\tsize = %d\n", buf_list->size);
301 if (trace_context[idx].trace_fp_log)
302 fwrite(buf_list->buf, buf_list->size, 1, trace_context[idx].trace_fp_codedbuf);
303
304 for (i=0; i<buf_list->size; i++)
305 check_sum ^= *((unsigned char *)buf_list->buf + i);
306
307 buf_list = buf_list->next;
308 }
309 vaUnmapBuffer(dpy,trace_context[idx].trace_codedbuf);
310
311 va_TraceMsg(idx, "\tchecksum = 0x%02x\n", check_sum);
115} 312}
116 313
117 314
315void va_TraceSurface(VADisplay dpy)
316{
317 unsigned int i, j;
318 unsigned int fourcc; /* following are output argument */
319 unsigned int luma_stride;
320 unsigned int chroma_u_stride;
321 unsigned int chroma_v_stride;
322 unsigned int luma_offset;
323 unsigned int chroma_u_offset;
324 unsigned int chroma_v_offset;
325 unsigned int buffer_name;
326 void *buffer = NULL;
327 unsigned char *Y_data, *UV_data, *tmp;
328 VAStatus va_status;
329 unsigned char check_sum = 0;
330 DPY2INDEX(dpy);
331
332 va_TraceMsg(idx, "==========dump surface data in file %s\n", trace_context[idx].trace_surface_fn);
333
334 if ((file_size(trace_context[idx].trace_fp_surface) >= trace_logsize)) {
335 va_TraceMsg(idx, "==========truncate file %s\n", trace_context[idx].trace_surface_fn);
336 truncate_file(trace_context[idx].trace_fp_surface);
337 }
338
339 va_status = vaLockSurface(dpy, trace_context[idx].trace_rendertarget, &fourcc,
340 &luma_stride, &chroma_u_stride, &chroma_v_stride,
341 &luma_offset, &chroma_u_offset, &chroma_v_offset,
342 &buffer_name, &buffer);
343
344 if (va_status != VA_STATUS_SUCCESS) {
345 va_TraceMsg(idx, "Error:vaLockSurface failed\n");
346
347 return;
348 }
349
350 va_TraceMsg(idx, "\tfourcc = 0x%08x\n", fourcc);
351 va_TraceMsg(idx, "\twidth = %d\n", trace_context[idx].trace_frame_width);
352 va_TraceMsg(idx, "\theight = %d\n", trace_context[idx].trace_frame_height);
353 va_TraceMsg(idx, "\tluma_stride = %d\n", luma_stride);
354 va_TraceMsg(idx, "\tchroma_u_stride = %d\n", chroma_u_stride);
355 va_TraceMsg(idx, "\tchroma_v_stride = %d\n", chroma_v_stride);
356 va_TraceMsg(idx, "\tluma_offset = %d\n", luma_offset);
357 va_TraceMsg(idx, "\tchroma_u_offset = %d\n", chroma_u_offset);
358 va_TraceMsg(idx, "\tchroma_v_offset = %d\n", chroma_v_offset);
359
360 if (*(unsigned int *)buffer == 0) {
361 va_TraceMsg(idx, "Error:vaLockSurface return NULL buffer\n");
362
363 vaUnlockSurface(dpy, trace_context[idx].trace_rendertarget);
364 return;
365 }
366 va_TraceMsg(idx, "\tbuffer location = 0x%08x\n", buffer);
367
368 Y_data = buffer;
369 UV_data = buffer + chroma_u_offset;
370
371 tmp = Y_data;
372 for (i=0; i<trace_context[idx].trace_frame_height; i++) {
373 for (j=0; j<trace_context[idx].trace_frame_width; j++)
374 check_sum ^= tmp[j];
375
376 if (trace_context[idx].trace_fp_surface)
377 fwrite(tmp, trace_context[idx].trace_frame_width, 1, trace_context[idx].trace_fp_surface);
378
379 tmp = Y_data + i * luma_stride;
380 }
381
382 tmp = UV_data;
383 if (fourcc == VA_FOURCC_NV12) {
384 for (i=0; i<trace_context[idx].trace_frame_height/2; i++) {
385 for (j=0; j<trace_context[idx].trace_frame_width; j++)
386 check_sum ^= tmp[j];
387
388 if (trace_context[idx].trace_fp_surface)
389 fwrite(tmp, trace_context[idx].trace_frame_width, 1, trace_context[idx].trace_fp_surface);
390
391 tmp = UV_data + i * chroma_u_stride;
392 }
393 }
394
395 vaUnlockSurface(dpy, trace_context[idx].trace_rendertarget);
396
397 va_TraceMsg(idx, "\tchecksum = 0x%02x\n", check_sum & 0xff);
398}
399
118void va_TraceCreateConfig( 400void va_TraceCreateConfig(
119 VADisplay dpy, 401 VADisplay dpy,
120 VAProfile profile, 402 VAProfile profile,
@@ -122,19 +404,23 @@ void va_TraceCreateConfig(
122 VAConfigAttrib *attrib_list, 404 VAConfigAttrib *attrib_list,
123 int num_attribs, 405 int num_attribs,
124 VAConfigID *config_id /* out */ 406 VAConfigID *config_id /* out */
125 ) 407)
126{ 408{
127 int i; 409 int i;
410 DPY2INDEX(dpy);
411
412 TRACE_FUNCNAME(idx);
128 413
129 va_TraceMsg("\tprofile = %d\n", profile); 414 va_TraceMsg(idx, "\tprofile = %d\n", profile);
130 va_TraceMsg("\tentrypoint = %d\n", entrypoint); 415 va_TraceMsg(idx, "\tentrypoint = %d\n", entrypoint);
131 va_TraceMsg("\tnum_attribs = %d\n", num_attribs); 416 va_TraceMsg(idx, "\tnum_attribs = %d\n", num_attribs);
132 for (i = 0; i < num_attribs; i++) { 417 for (i = 0; i < num_attribs; i++) {
133 va_TraceMsg("\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type); 418 va_TraceMsg(idx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
134 va_TraceMsg("\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value); 419 va_TraceMsg(idx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
135 } 420 }
136 421
137 trace_profile = profile; 422 trace_context[idx].trace_profile = profile;
423 trace_context[idx].trace_entrypoint = entrypoint;
138} 424}
139 425
140 426
@@ -145,17 +431,20 @@ void va_TraceCreateSurface(
145 int format, 431 int format,
146 int num_surfaces, 432 int num_surfaces,
147 VASurfaceID *surfaces /* out */ 433 VASurfaceID *surfaces /* out */
148 ) 434)
149{ 435{
150 int i; 436 int i;
437 DPY2INDEX(dpy);
438
439 TRACE_FUNCNAME(idx);
151 440
152 va_TraceMsg("\twidth = %d\n", width); 441 va_TraceMsg(idx, "\twidth = %d\n", width);
153 va_TraceMsg("\theight = %d\n", height); 442 va_TraceMsg(idx, "\theight = %d\n", height);
154 va_TraceMsg("\tformat = %d\n", format); 443 va_TraceMsg(idx, "\tformat = %d\n", format);
155 va_TraceMsg("\tnum_surfaces = %d\n", num_surfaces); 444 va_TraceMsg(idx, "\tnum_surfaces = %d\n", num_surfaces);
156 445
157 for (i = 0; i < num_surfaces; i++) 446 for (i = 0; i < num_surfaces; i++)
158 va_TraceMsg("\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]); 447 va_TraceMsg(idx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
159} 448}
160 449
161 450
@@ -168,24 +457,29 @@ void va_TraceCreateContext(
168 VASurfaceID *render_targets, 457 VASurfaceID *render_targets,
169 int num_render_targets, 458 int num_render_targets,
170 VAContextID *context /* out */ 459 VAContextID *context /* out */
171 ) 460)
172{ 461{
173 int i; 462 int i;
463 DPY2INDEX(dpy);
174 464
175 va_TraceMsg("\twidth = %d\n", picture_width); 465 TRACE_FUNCNAME(idx);
176 va_TraceMsg("\theight = %d\n", picture_height); 466
177 va_TraceMsg("\tflag = 0x%08x\n", flag); 467 va_TraceMsg(idx, "\twidth = %d\n", picture_width);
178 va_TraceMsg("\tnum_render_targets = %d\n", num_render_targets); 468 va_TraceMsg(idx, "\theight = %d\n", picture_height);
469 va_TraceMsg(idx, "\tflag = 0x%08x\n", flag);
470 va_TraceMsg(idx, "\tnum_render_targets = %d\n", num_render_targets);
179 for (i=0; i<num_render_targets; i++) 471 for (i=0; i<num_render_targets; i++)
180 va_TraceMsg("\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]); 472 va_TraceMsg(idx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
181 va_TraceMsg("\tcontext = 0x%08x\n", context); 473 va_TraceMsg(idx, "\tcontext = 0x%08x\n", *context);
182 474
183 475
184 trace_frame = 0; 476 trace_context[idx].trace_context = *context;
185 trace_slice = 0;
186 477
187 trace_width = picture_width; 478 trace_context[idx].trace_frame_no = 0;
188 trace_height = picture_height; 479 trace_context[idx].trace_slice_no = 0;
480
481 trace_context[idx].trace_frame_width = picture_width;
482 trace_context[idx].trace_frame_height = picture_height;
189} 483}
190 484
191 485
@@ -207,12 +501,55 @@ static char * buffer_type_to_string(int type)
207 case VAEncSequenceParameterBufferType: return "VAEncSequenceParameterBufferType"; 501 case VAEncSequenceParameterBufferType: return "VAEncSequenceParameterBufferType";
208 case VAEncPictureParameterBufferType: return "VAEncPictureParameterBufferType"; 502 case VAEncPictureParameterBufferType: return "VAEncPictureParameterBufferType";
209 case VAEncSliceParameterBufferType: return "VAEncSliceParameterBufferType"; 503 case VAEncSliceParameterBufferType: return "VAEncSliceParameterBufferType";
504 case VAEncMiscParameterBufferType: return "VAEncMiscParameterBufferType";
210 default: return "UnknowBuffer"; 505 default: return "UnknowBuffer";
211 } 506 }
212} 507}
213 508
509void va_TraceMapBuffer (
510 VADisplay dpy,
511 VABufferID buf_id, /* in */
512 void **pbuf /* out */
513)
514{
515 VABufferType type;
516 unsigned int size;
517 unsigned int num_elements;
518
519 VACodedBufferSegment *buf_list;
520 int i = 0;
521
522 DPY2INDEX(dpy);
523
524 vaBufferInfo(dpy, trace_context[idx].trace_context, buf_id, &type, &size, &num_elements);
525 /*
526 va_TraceMsg(idx, "\tbuf_id=0x%x\n", buf_id);
527 va_TraceMsg(idx, "\tbuf_type=%s\n", buffer_type_to_string(type));
528 va_TraceMsg(idx, "\tbuf_size=%s\n", size);
529 va_TraceMsg(idx, "\tbuf_elements=%s\n", &num_elements);
530 */
531
532 /* only trace CodedBuffer */
533 if (type != VAEncCodedBufferType)
534 return;
535
536 buf_list = (VACodedBufferSegment *)(*pbuf);
537 while (buf_list != NULL) {
538 va_TraceMsg(idx, "\tCodedbuf[%d] =\n", i++);
539
540 va_TraceMsg(idx, "\t size = %d\n", buf_list->size);
541 va_TraceMsg(idx, "\t bit_offset = %d\n", buf_list->bit_offset);
542 va_TraceMsg(idx, "\t status = 0x%08x\n", buf_list->status);
543 va_TraceMsg(idx, "\t reserved = 0x%08x\n", buf_list->reserved);
544 va_TraceMsg(idx, "\t buf = 0x%08x\n", buf_list->buf);
545
546 buf_list = buf_list->next;
547 }
548
549
550}
214 551
215static int va_TraceVABuffers( 552static void va_TraceVABuffers(
216 VADisplay dpy, 553 VADisplay dpy,
217 VAContextID context, 554 VAContextID context,
218 VABufferID buffer, 555 VABufferID buffer,
@@ -220,21 +557,30 @@ static int va_TraceVABuffers(
220 unsigned int size, 557 unsigned int size,
221 unsigned int num_elements, 558 unsigned int num_elements,
222 void *pbuf 559 void *pbuf
223 ) 560)
224{ 561{
225 int i; 562 unsigned int i;
226 unsigned char *p = pbuf; 563 unsigned char *p = pbuf;
227 unsigned int *pi = (unsigned int *)pbuf; 564 unsigned char check_sum = 0;
565 DPY2INDEX(dpy);
566
567 va_TraceMsg(idx, "%s\n", buffer_type_to_string(type));
228 568
229 va_TraceMsg("***Buffer Data***");
230 for (i=0; i<size; i++) { 569 for (i=0; i<size; i++) {
231 if ((i%16) == 0) 570 unsigned char value = p[i];
232 va_TraceMsg("\n0x%08x:", i); 571
233 va_TraceMsg(" %02x", p[i]); 572 if ((trace_buffer_data) && ((i%16) == 0))
573 va_TraceMsg(idx, "\n0x%08x:", i);
574
575 if (trace_buffer_data)
576 va_TraceMsg(idx, " %02x", value);
577
578 check_sum ^= value;
234 } 579 }
235 580
236 va_TraceMsg("\n"); 581 va_TraceMsg(idx, "\tchecksum = 0x%02x\n", check_sum & 0xff);
237 return 0; 582
583 return;
238} 584}
239 585
240 586
@@ -247,6 +593,8 @@ static void va_TraceVAPictureParameterBufferMPEG2(
247 unsigned int num_elements, 593 unsigned int num_elements,
248 void *data) 594 void *data)
249{ 595{
596 DPY2INDEX(dpy);
597
250 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); 598 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
251 599
252 return; 600 return;
@@ -262,6 +610,8 @@ static void va_TraceVAIQMatrixBufferMPEG2(
262 unsigned int num_elements, 610 unsigned int num_elements,
263 void *data) 611 void *data)
264{ 612{
613 DPY2INDEX(dpy);
614
265 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); 615 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
266 616
267 return; 617 return;
@@ -277,6 +627,12 @@ static void va_TraceVASliceParameterBufferMPEG2(
277 unsigned int num_elements, 627 unsigned int num_elements,
278 void *data) 628 void *data)
279{ 629{
630 DPY2INDEX(dpy);
631
632 trace_context[idx].trace_slice_no++;
633
634 /* todo: log TraceVASliceParameterBufferMPEG2 */
635 /* trace_context[idx].trace_slice_size = p->slice_data_size; */
280 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); 636 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
281 637
282 return; 638 return;
@@ -293,6 +649,8 @@ static void va_TraceVAPictureParameterBufferMPEG4(
293 unsigned int num_elements, 649 unsigned int num_elements,
294 void *data) 650 void *data)
295{ 651{
652 DPY2INDEX(dpy);
653
296 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); 654 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
297 655
298 return; 656 return;
@@ -308,6 +666,9 @@ static void va_TraceVAIQMatrixBufferMPEG4(
308 unsigned int num_elements, 666 unsigned int num_elements,
309 void *data) 667 void *data)
310{ 668{
669 DPY2INDEX(dpy);
670
671 /* todo: log VAIQMatrixBufferMPEG4 */
311 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); 672 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
312 673
313 return; 674 return;
@@ -323,6 +684,12 @@ static void va_TraceVASliceParameterBufferMPEG4(
323 unsigned int num_elements, 684 unsigned int num_elements,
324 void *data) 685 void *data)
325{ 686{
687 DPY2INDEX(dpy);
688
689 trace_context[idx].trace_slice_no++;
690
691 /* todo: log VASliceParameterBufferMPEG4 */
692 /* trace_context[idx].trace_slice_size = p->slice_data_size; */
326 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); 693 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
327 694
328 return; 695 return;
@@ -339,76 +706,59 @@ static void va_TraceVAPictureParameterBufferH264(
339 void *data) 706 void *data)
340{ 707{
341 int i; 708 int i;
342 709 DPY2INDEX(dpy);
710
343 VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data; 711 VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data;
344 712
345 va_TraceMsg ("==========H264PicParameterBuffer============\n"); 713 va_TraceMsg(idx, "VAPictureParameterBufferH264\n");
346
347#if 0
348 if (p->num_ref_frames > 4)
349 {
350 int num = 0;
351 for (i = 15; i >= 0; i--)
352 {
353 if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID)
354 {
355 num++;
356 }
357 if (num > 4)
358 {
359 p->ReferenceFrames[i].flags = VA_PICTURE_H264_INVALID;
360 }
361 }
362 p->num_ref_frames = 4;
363 }
364#endif
365
366#if 1
367 va_TraceMsg("picture id: %d\n", p->CurrPic.picture_id);
368 va_TraceMsg("frame idx: %d\n", p->CurrPic.frame_idx);
369 va_TraceMsg("picture flags: %d\n", p->CurrPic.flags);
370 va_TraceMsg("top field order count: %d\n", p->CurrPic.TopFieldOrderCnt);
371 va_TraceMsg("bottom field order count: %d\n", p->CurrPic.BottomFieldOrderCnt);
372 714
715 va_TraceMsg(idx, "\tCurrPic.picture_id = %d\n", p->CurrPic.picture_id);
716 va_TraceMsg(idx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
717 va_TraceMsg(idx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
718 va_TraceMsg(idx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
719 va_TraceMsg(idx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
373 720
374 va_TraceMsg("Reference frames: \n"); 721 va_TraceMsg(idx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx:\n");
375 for (i = 0; i < 16; i++) 722 for (i = 0; i < 16; i++)
376 { 723 {
377 if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID) 724 if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID) {
378 { 725 va_TraceMsg(idx, "\t\t%d-%d-%d-%d\n",
379 //va_TraceMsg("%d-%d; ", p->ReferenceFrames[i].TopFieldOrderCnt, p->ReferenceFrames[i].BottomFieldOrderCnt); 726 p->ReferenceFrames[i].TopFieldOrderCnt,
380 va_TraceMsg("%d-%d-%d-%d; ", p->ReferenceFrames[i].TopFieldOrderCnt, p->ReferenceFrames[i].BottomFieldOrderCnt, p->ReferenceFrames[i].picture_id, p->ReferenceFrames[i].frame_idx); 727 p->ReferenceFrames[i].BottomFieldOrderCnt,
381 } 728 p->ReferenceFrames[i].picture_id,
729 p->ReferenceFrames[i].frame_idx);
730 } else
731 va_TraceMsg(idx, "\t\t%inv-%inv-%inv-%inv\n");
382 } 732 }
383 va_TraceMsg("\n"); 733 va_TraceMsg(idx, "\n");
384#endif 734
385 va_TraceMsg("picture_width_in_mbs_minus1: %d\n", p->picture_width_in_mbs_minus1); 735 va_TraceMsg(idx, "\tpicture_width_in_mbs_minus1 = %d\n", p->picture_width_in_mbs_minus1);
386 va_TraceMsg("picture_height_in_mbs_minus1: %d\n", p->picture_height_in_mbs_minus1); 736 va_TraceMsg(idx, "\tpicture_height_in_mbs_minus1 = %d\n", p->picture_height_in_mbs_minus1);
387 va_TraceMsg("bit_depth_luma_minus8: %d\n", p->bit_depth_luma_minus8); 737 va_TraceMsg(idx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
388 va_TraceMsg("bit_depth_chroma_minus8: %d\n", p->bit_depth_chroma_minus8); 738 va_TraceMsg(idx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
389 va_TraceMsg("num_ref_frames: %d\n", p->num_ref_frames); 739 va_TraceMsg(idx, "\tnum_ref_frames = %d\n", p->num_ref_frames);
390 va_TraceMsg("seq fields: %d\n", p->seq_fields.value); 740 va_TraceMsg(idx, "\tseq fields = %d\n", p->seq_fields.value);
391 va_TraceMsg("\t chroma_format_idc: %d\n", p->seq_fields.bits.chroma_format_idc); 741 va_TraceMsg(idx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
392 va_TraceMsg("\t residual_colour_transform_flag: %d\n", p->seq_fields.bits.residual_colour_transform_flag); 742 va_TraceMsg(idx, "\tresidual_colour_transform_flag = %d\n", p->seq_fields.bits.residual_colour_transform_flag);
393 va_TraceMsg("\t frame_mbs_only_flag: %d\n", p->seq_fields.bits.frame_mbs_only_flag); 743 va_TraceMsg(idx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
394 va_TraceMsg("\t mb_adaptive_frame_field_flag: %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag); 744 va_TraceMsg(idx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
395 va_TraceMsg("\t direct_8x8_inference_flag: %d\n", p->seq_fields.bits.direct_8x8_inference_flag); 745 va_TraceMsg(idx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
396 va_TraceMsg("\t MinLumaBiPredSize8x8: %d\n", p->seq_fields.bits.MinLumaBiPredSize8x8); 746 va_TraceMsg(idx, "\tMinLumaBiPredSize8x8 = %d\n", p->seq_fields.bits.MinLumaBiPredSize8x8);
397 va_TraceMsg("num_slice_groups_minus1: %d\n", p->num_slice_groups_minus1); 747 va_TraceMsg(idx, "\tnum_slice_groups_minus1 = %d\n", p->num_slice_groups_minus1);
398 va_TraceMsg("slice_group_map_type: %d\n", p->slice_group_map_type); 748 va_TraceMsg(idx, "\tslice_group_map_type = %d\n", p->slice_group_map_type);
399 va_TraceMsg("slice_group_change_rate_minus1: %d\n", p->slice_group_change_rate_minus1); 749 va_TraceMsg(idx, "\tslice_group_change_rate_minus1 = %d\n", p->slice_group_change_rate_minus1);
400 va_TraceMsg("pic_init_qp_minus26: %d\n", p->pic_init_qp_minus26); 750 va_TraceMsg(idx, "\tpic_init_qp_minus26 = %d\n", p->pic_init_qp_minus26);
401 va_TraceMsg("pic_init_qs_minus26: %d\n", p->pic_init_qs_minus26); 751 va_TraceMsg(idx, "\tpic_init_qs_minus26 = %d\n", p->pic_init_qs_minus26);
402 va_TraceMsg("chroma_qp_index_offset: %d\n", p->chroma_qp_index_offset); 752 va_TraceMsg(idx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
403 va_TraceMsg("second_chroma_qp_index_offset: %d\n", p->second_chroma_qp_index_offset); 753 va_TraceMsg(idx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
404 va_TraceMsg("pic_fields: %d\n", p->pic_fields.value); 754 va_TraceMsg(idx, "\tpic_fields = %d\n", p->pic_fields.value);
405 va_TraceMsg("\t entropy_coding_mode_flag: %d\n", p->pic_fields.bits.entropy_coding_mode_flag); 755 va_TraceMsg(idx, "\tentropy_coding_mode_flag = %d\n", p->pic_fields.bits.entropy_coding_mode_flag);
406 va_TraceMsg("\t weighted_pred_flag: %d\n", p->pic_fields.bits.weighted_pred_flag); 756 va_TraceMsg(idx, "\tweighted_pred_flag = %d\n", p->pic_fields.bits.weighted_pred_flag);
407 va_TraceMsg("\t weighted_bipred_idc: %d\n", p->pic_fields.bits.weighted_bipred_idc); 757 va_TraceMsg(idx, "\tweighted_bipred_idc = %d\n", p->pic_fields.bits.weighted_bipred_idc);
408 va_TraceMsg("\t transform_8x8_mode_flag: %d\n", p->pic_fields.bits.transform_8x8_mode_flag); 758 va_TraceMsg(idx, "\ttransform_8x8_mode_flag = %d\n", p->pic_fields.bits.transform_8x8_mode_flag);
409 va_TraceMsg("\t field_pic_flag: %d\n", p->pic_fields.bits.field_pic_flag); 759 va_TraceMsg(idx, "\tfield_pic_flag = %d\n", p->pic_fields.bits.field_pic_flag);
410 va_TraceMsg("\t constrained_intra_pred_flag: %d\n", p->pic_fields.bits.constrained_intra_pred_flag); 760 va_TraceMsg(idx, "\tconstrained_intra_pred_flag = %d\n", p->pic_fields.bits.constrained_intra_pred_flag);
411 va_TraceMsg("frame_num: %d\n", p->frame_num); 761 va_TraceMsg(idx, "\tframe_num = %d\n", p->frame_num);
412 762
413 return; 763 return;
414} 764}
@@ -424,93 +774,78 @@ static void va_TraceVASliceParameterBufferH264(
424{ 774{
425 int i; 775 int i;
426 VASliceParameterBufferH264* p = (VASliceParameterBufferH264*)data; 776 VASliceParameterBufferH264* p = (VASliceParameterBufferH264*)data;
427 777 DPY2INDEX(dpy);
428 va_TraceMsg ("========== SLICE HEADER ============.\n"); 778
429 va_TraceMsg("slice_data_size: %d\n", p->slice_data_size); 779 trace_context[idx].trace_slice_no++;
430 va_TraceMsg("slice_data_offset: %d\n", p->slice_data_offset); 780 trace_context[idx].trace_slice_size = p->slice_data_size;
431 va_TraceMsg("slice_data_flag: %d\n", p->slice_data_flag); 781
432 va_TraceMsg("slice_data_bit_offset: %d\n", p->slice_data_bit_offset); 782 va_TraceMsg(idx, "VASliceParameterBufferH264\n");
433 va_TraceMsg("first_mb_in_slice: %d\n", p->first_mb_in_slice); 783 va_TraceMsg(idx, "\tslice_data_size = %d\n", p->slice_data_size);
434 va_TraceMsg("slice_type: %d\n", p->slice_type); 784 va_TraceMsg(idx, "\tslice_data_offset = %d\n", p->slice_data_offset);
435 va_TraceMsg("direct_spatial_mv_pred_flag: %d\n", p->direct_spatial_mv_pred_flag); 785 va_TraceMsg(idx, "\tslice_data_flag = %d\n", p->slice_data_flag);
436 va_TraceMsg("num_ref_idx_l0_active_minus1: %d\n", p->num_ref_idx_l0_active_minus1); 786 va_TraceMsg(idx, "\tslice_data_bit_offset = %d\n", p->slice_data_bit_offset);
437 va_TraceMsg("num_ref_idx_l1_active_minus1: %d\n", p->num_ref_idx_l1_active_minus1); 787 va_TraceMsg(idx, "\tfirst_mb_in_slice = %d\n", p->first_mb_in_slice);
438 va_TraceMsg("cabac_init_idc: %d\n", p->cabac_init_idc); 788 va_TraceMsg(idx, "\tslice_type = %d\n", p->slice_type);
439 va_TraceMsg("slice_qp_delta: %d\n", p->slice_qp_delta); 789 va_TraceMsg(idx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
440 va_TraceMsg("disable_deblocking_filter_idc: %d\n", p->disable_deblocking_filter_idc); 790 va_TraceMsg(idx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
441 va_TraceMsg("slice_alpha_c0_offset_div2: %d\n", p->slice_alpha_c0_offset_div2); 791 va_TraceMsg(idx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
442 va_TraceMsg("slice_beta_offset_div2: %d\n", p->slice_beta_offset_div2); 792 va_TraceMsg(idx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
443 793 va_TraceMsg(idx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
444#if 1 794 va_TraceMsg(idx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
445 if (p->slice_type == 0 || p->slice_type == 1) 795 va_TraceMsg(idx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
446 { 796 va_TraceMsg(idx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
447 va_TraceMsg("RefPicList0:\n"); 797
448 for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1; i++) 798 if (p->slice_type == 0 || p->slice_type == 1) {
449 { 799 va_TraceMsg(idx, "\tRefPicList0 =");
450 //va_TraceMsg("%d-%d; ", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt); 800 for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1; i++) {
451 va_TraceMsg("%d-%d-%d-%d; ", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx); 801 va_TraceMsg(idx, "%d-%d-%d-%d\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx);
452 } 802 }
453 va_TraceMsg("\n"); 803 if (p->slice_type == 1) {
454 if (p->slice_type == 1) 804 va_TraceMsg(idx, "\tRefPicList1 =");
455 {
456 va_TraceMsg("RefPicList1:\n");
457 for (i = 0; i < p->num_ref_idx_l1_active_minus1 + 1; i++) 805 for (i = 0; i < p->num_ref_idx_l1_active_minus1 + 1; i++)
458 { 806 {
459 //va_TraceMsg("%d-%d; ", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt); 807 va_TraceMsg(idx, "%d-%d-%d-%d\n", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx);
460 va_TraceMsg("%d-%d-%d-%d; ", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx);
461 } 808 }
462 } 809 }
463 va_TraceMsg("\n");
464 } 810 }
465#endif 811
466 812 va_TraceMsg(idx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
467 va_TraceMsg("luma_log2_weight_denom: %d\n", p->luma_log2_weight_denom); 813 va_TraceMsg(idx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
468 va_TraceMsg("chroma_log2_weight_denom: %d\n", p->chroma_log2_weight_denom); 814 va_TraceMsg(idx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
469 va_TraceMsg("luma_weight_l0_flag: %d\n", p->luma_weight_l0_flag); 815 if (p->luma_weight_l0_flag) {
470 if (p->luma_weight_l0_flag) 816 for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
471 { 817 va_TraceMsg(idx, "\t%d ", p->luma_weight_l0[i]);
472 for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) 818 va_TraceMsg(idx, "\t%d ", p->luma_offset_l0[i]);
473 {
474 va_TraceMsg("%d ", p->luma_weight_l0[i]);
475 va_TraceMsg("%d ", p->luma_offset_l0[i]);
476 } 819 }
477 va_TraceMsg("\n");
478 } 820 }
479
480 821
481 va_TraceMsg("chroma_weight_l0_flag: %d\n", p->chroma_weight_l0_flag); 822 va_TraceMsg(idx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
482 if (p->chroma_weight_l0_flag) 823 if (p->chroma_weight_l0_flag) {
483 { 824 for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
484 for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) 825 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][0]);
485 { 826 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][0]);
486 va_TraceMsg("%d ", p->chroma_weight_l0[i][0]); 827 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][1]);
487 va_TraceMsg("%d ", p->chroma_offset_l0[i][0]); 828 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][1]);
488 va_TraceMsg("%d ", p->chroma_weight_l0[i][1]);
489 va_TraceMsg("%d ", p->chroma_offset_l0[i][1]);
490 } 829 }
491 va_TraceMsg("\n");
492 } 830 }
493 va_TraceMsg("luma_weight_l1_flag: %d\n", p->luma_weight_l1_flag); 831
494 if (p->luma_weight_l1_flag) 832 va_TraceMsg(idx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
495 { 833 if (p->luma_weight_l1_flag) {
496 for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) 834 for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
497 { 835 va_TraceMsg(idx, "\t\t%d ", p->luma_weight_l1[i]);
498 va_TraceMsg("%d ", p->luma_weight_l1[i]); 836 va_TraceMsg(idx, "\t\t%d ", p->luma_offset_l1[i]);
499 va_TraceMsg("%d ", p->luma_offset_l1[i]);
500 } 837 }
501 va_TraceMsg("\n");
502 } 838 }
503 va_TraceMsg("chroma_weight_l1_flag: %d\n", p->chroma_weight_l1_flag); 839
504 if (p->chroma_weight_l1_flag) 840 va_TraceMsg(idx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
505 { 841 if (p->chroma_weight_l1_flag) {
506 for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) 842 for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
507 { 843 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][0]);
508 va_TraceMsg("%d ", p->chroma_weight_l1[i][0]); 844 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][0]);
509 va_TraceMsg("%d ", p->chroma_offset_l1[i][0]); 845 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][1]);
510 va_TraceMsg("%d ", p->chroma_weight_l1[i][1]); 846 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][1]);
511 va_TraceMsg("%d ", p->chroma_offset_l1[i][1]);
512 } 847 }
513 va_TraceMsg("\n"); 848 va_TraceMsg(idx, "\n");
514 } 849 }
515} 850}
516 851
@@ -524,30 +859,171 @@ static void va_TraceVAIQMatrixBufferH264(
524 void *data 859 void *data
525) 860)
526{ 861{
527 va_TraceMsg("========== IQMatrix ============.\n");
528 VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data; 862 VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data;
529 int i, j; 863 int i, j;
530 for (i = 0; i < 6; i++) 864 DPY2INDEX(dpy);
531 { 865
532 for (j = 0; j < 16; j++) 866 va_TraceMsg(idx, "VAIQMatrixBufferH264\n");
533 { 867
534 va_TraceMsg("%d\t", p->ScalingList4x4[i][j]); 868 va_TraceMsg(idx, "\tScalingList4x4[6][16]=\n");
869 for (i = 0; i < 6; i++) {
870 for (j = 0; j < 16; j++) {
871 va_TraceMsg(idx, "\t%d\t", p->ScalingList4x4[i][j]);
535 if ((j + 1) % 8 == 0) 872 if ((j + 1) % 8 == 0)
536 va_TraceMsg("\n"); 873 va_TraceMsg(idx, "\n");
537 } 874 }
538 } 875 }
539 876
540 for (i = 0; i < 2; i++) 877 va_TraceMsg(idx, "\tScalingList8x8[2][64]=\n");
541 { 878 for (i = 0; i < 2; i++) {
542 for (j = 0; j < 64; j++) 879 for (j = 0; j < 64; j++) {
543 { 880 va_TraceMsg(idx, "\t%d", p->ScalingList8x8[i][j]);
544 va_TraceMsg("%d\t", p->ScalingList8x8[i][j]);
545 if ((j + 1) % 8 == 0) 881 if ((j + 1) % 8 == 0)
546 va_TraceMsg("\n"); 882 va_TraceMsg(idx, "\n");
547 } 883 }
548 } 884 }
549} 885}
550 886
887static void va_TraceVAEncSequenceParameterBufferH264(
888 VADisplay dpy,
889 VAContextID context,
890 VABufferID buffer,
891 VABufferType type,
892 unsigned int size,
893 unsigned int num_elements,
894 void *data)
895{
896 VAEncSequenceParameterBufferH264 *p = (VAEncSequenceParameterBufferH264 *)data;
897 DPY2INDEX(dpy);
898
899 va_TraceMsg(idx, "VAEncSequenceParameterBufferH264\n");
900
901 va_TraceMsg(idx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
902 va_TraceMsg(idx, "\tlevel_idc = %d\n", p->level_idc);
903 va_TraceMsg(idx, "\tintra_period = %d\n", p->intra_period);
904 va_TraceMsg(idx, "\tintra_idr_period = %d\n", p->intra_idr_period);
905 va_TraceMsg(idx, "\tpicture_width_in_mbs = %d\n", p->picture_width_in_mbs);
906 va_TraceMsg(idx, "\tpicture_height_in_mbs = %d\n", p->picture_height_in_mbs);
907 va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
908 va_TraceMsg(idx, "\tframe_rate = %d\n", p->frame_rate);
909 va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
910 va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
911 va_TraceMsg(idx, "\tbasic_unit_size = %d\n", p->basic_unit_size);
912 va_TraceMsg(idx, "\tvui_flag = %d\n", p->vui_flag);
913
914 /* start a new sequce, coded log file can be truncated */
915 trace_context[idx].trace_sequence_start = 1;
916
917 return;
918}
919
920static void va_TraceVAEncPictureParameterBufferH264(
921 VADisplay dpy,
922 VAContextID context,
923 VABufferID buffer,
924 VABufferType type,
925 unsigned int size,
926 unsigned int num_elements,
927 void *data)
928{
929 VAEncPictureParameterBufferH264 *p = (VAEncPictureParameterBufferH264 *)data;
930 DPY2INDEX(dpy);
931
932 va_TraceMsg(idx, "VAEncSequenceParameterBufferH264\n");
933 va_TraceMsg(idx, "\treference_picture = 0x%08x\n", p->reference_picture);
934 va_TraceMsg(idx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
935 va_TraceMsg(idx, "\tcoded_buf = %08x\n", p->coded_buf);
936 va_TraceMsg(idx, "\tpicture_width = %d\n", p->picture_width);
937 va_TraceMsg(idx, "\tpicture_height = %d\n", p->picture_height);
938 va_TraceMsg(idx, "\tlast_picture = 0x%08x\n", p->last_picture);
939
940 trace_context[idx].trace_codedbuf = p->coded_buf;
941
942 return;
943}
944
945
946static void va_TraceVAEncSliceParameterBuffer(
947 VADisplay dpy,
948 VAContextID context,
949 VABufferID buffer,
950 VABufferType type,
951 unsigned int size,
952 unsigned int num_elements,
953 void *data)
954{
955 VAEncSliceParameterBuffer* p = (VAEncSliceParameterBuffer*)data;
956 DPY2INDEX(dpy);
957
958 va_TraceMsg(idx, "VAEncSliceParameterBuffer\n");
959
960 va_TraceMsg(idx, "\tstart_row_number = %d\n", p->start_row_number);
961 va_TraceMsg(idx, "\tslice_height = %d\n", p->slice_height);
962 va_TraceMsg(idx, "\tslice_flags.is_intra = %d\n", p->slice_flags.bits.is_intra);
963 va_TraceMsg(idx, "\tslice_flags.disable_deblocking_filter_idc = %d\n", p->slice_flags.bits.disable_deblocking_filter_idc);
964
965 return;
966}
967
968static void va_TraceVAEncMiscParameterBuffer(
969 VADisplay dpy,
970 VAContextID context,
971 VABufferID buffer,
972 VABufferType type,
973 unsigned int size,
974 unsigned int num_elements,
975 void *data)
976{
977 VAEncMiscParameterBuffer* tmp = (VAEncMiscParameterBuffer*)data;
978 DPY2INDEX(dpy);
979
980 switch (tmp->type) {
981 case VAEncMiscParameterTypeFrameRate:
982 {
983 VAEncMiscParameterFrameRate *p = (VAEncMiscParameterFrameRate *)tmp->data;
984 va_TraceMsg(idx, "VAEncMiscParameterFrameRate\n");
985 va_TraceMsg(idx, "\tframerate = %d\n", p->framerate);
986
987 break;
988 }
989 case VAEncMiscParameterTypeRateControl:
990 {
991 VAEncMiscParameterRateControl *p = (VAEncMiscParameterRateControl *)tmp->data;
992
993 va_TraceMsg(idx, "VAEncMiscParameterRateControl\n");
994 va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
995 va_TraceMsg(idx, "\twindow_size = %d\n", p->window_size);
996 va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
997 va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
998 break;
999 }
1000 case VAEncMiscParameterTypeMaxSliceSize:
1001 {
1002 VAEncMiscParameterMaxSliceSize *p = (VAEncMiscParameterMaxSliceSize *)tmp->data;
1003
1004 va_TraceMsg(idx, "VAEncMiscParameterTypeMaxSliceSize\n");
1005 va_TraceMsg(idx, "\tmax_slice_size = %d\n", p->max_slice_size);
1006 break;
1007 }
1008 case VAEncMiscParameterTypeAIR:
1009 {
1010 VAEncMiscParameterAIR *p = (VAEncMiscParameterAIR *)tmp->data;
1011
1012 va_TraceMsg(idx, "VAEncMiscParameterAIR\n");
1013 va_TraceMsg(idx, "\tair_num_mbs = %d\n", p->air_num_mbs);
1014 va_TraceMsg(idx, "\tair_threshold = %d\n", p->air_threshold);
1015 va_TraceMsg(idx, "\tair_auto = %d\n", p->air_auto);
1016 break;
1017 }
1018 default:
1019 va_TraceMsg(idx, "invalid VAEncMiscParameterBuffer type = %d\n", tmp->type);
1020 break;
1021 }
1022
1023 return;
1024}
1025
1026
551static void va_TraceVAPictureParameterBufferVC1( 1027static void va_TraceVAPictureParameterBufferVC1(
552 VADisplay dpy, 1028 VADisplay dpy,
553 VAContextID context, 1029 VAContextID context,
@@ -559,174 +1035,96 @@ static void va_TraceVAPictureParameterBufferVC1(
559) 1035)
560{ 1036{
561 VAPictureParameterBufferVC1* p = (VAPictureParameterBufferVC1*)data; 1037 VAPictureParameterBufferVC1* p = (VAPictureParameterBufferVC1*)data;
562 1038 DPY2INDEX(dpy);
563 va_TraceMsg("\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture); 1039
564 va_TraceMsg("\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture); 1040 va_TraceMsg(idx, "VAPictureParameterBufferVC1\n");
565 va_TraceMsg("\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture); 1041
566 1042 va_TraceMsg(idx, "\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture);
567 va_TraceMsg("\tpulldown = %d\n", p->sequence_fields.bits.pulldown); 1043 va_TraceMsg(idx, "\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture);
568 va_TraceMsg("\tinterlace = %d\n", p->sequence_fields.bits.interlace); 1044 va_TraceMsg(idx, "\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture);
569 va_TraceMsg("\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag); 1045
570 va_TraceMsg("\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag); 1046 va_TraceMsg(idx, "\tpulldown = %d\n", p->sequence_fields.bits.pulldown);
571 va_TraceMsg("\tpsf = %d.\n", 1047 va_TraceMsg(idx, "\tinterlace = %d\n", p->sequence_fields.bits.interlace);
572 p->sequence_fields.bits.psf); 1048 va_TraceMsg(idx, "\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag);
573 va_TraceMsg("\tmultires = %d.\n", 1049 va_TraceMsg(idx, "\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag);
574 p->sequence_fields.bits.multires); 1050 va_TraceMsg(idx, "\tpsf = %d\n", p->sequence_fields.bits.psf);
575 va_TraceMsg("\toverlap = %d.\n", 1051 va_TraceMsg(idx, "\tmultires = %d\n", p->sequence_fields.bits.multires);
576 p->sequence_fields.bits.overlap); 1052 va_TraceMsg(idx, "\toverlap = %d\n", p->sequence_fields.bits.overlap);
577 va_TraceMsg("\tsyncmarker = %d.\n", 1053 va_TraceMsg(idx, "\tsyncmarker = %d\n", p->sequence_fields.bits.syncmarker);
578 p->sequence_fields.bits.syncmarker); 1054 va_TraceMsg(idx, "\trangered = %d\n", p->sequence_fields.bits.rangered);
579 va_TraceMsg("\trangered = %d.\n", 1055 va_TraceMsg(idx, "\tmax_b_frames = %d\n", p->sequence_fields.bits.max_b_frames);
580 p->sequence_fields.bits.rangered); 1056 va_TraceMsg(idx, "\tcoded_width = %d\n", p->coded_width);
581 va_TraceMsg("\tmax_b_frames = %d.\n", 1057 va_TraceMsg(idx, "\tcoded_height = %d\n", p->coded_height);
582 p->sequence_fields.bits.max_b_frames); 1058 va_TraceMsg(idx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
583 va_TraceMsg("\tcoded_width = %d.\n", 1059 va_TraceMsg(idx, "\tbroken_link = %d\n", p->entrypoint_fields.bits.broken_link);
584 p->coded_width); 1060 va_TraceMsg(idx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
585 va_TraceMsg("\tcoded_height = %d.\n", 1061 va_TraceMsg(idx, "\tpanscan_flag = %d\n", p->entrypoint_fields.bits.panscan_flag);
586 p->coded_height); 1062 va_TraceMsg(idx, "\tloopfilter = %d\n", p->entrypoint_fields.bits.loopfilter);
587 va_TraceMsg("\tclosed_entry = %d.\n", 1063 va_TraceMsg(idx, "\tconditional_overlap_flag = %d\n", p->conditional_overlap_flag);
588 p->entrypoint_fields.bits.closed_entry); 1064 va_TraceMsg(idx, "\tfast_uvmc_flag = %d\n", p->fast_uvmc_flag);
589 va_TraceMsg("\tbroken_link = %d.\n", 1065 va_TraceMsg(idx, "\trange_mapping_luma_flag = %d\n", p->range_mapping_fields.bits.luma_flag);
590 p->entrypoint_fields.bits.broken_link); 1066 va_TraceMsg(idx, "\trange_mapping_luma = %d\n", p->range_mapping_fields.bits.luma);
591 va_TraceMsg("\tclosed_entry = %d.\n", 1067 va_TraceMsg(idx, "\trange_mapping_chroma_flag = %d\n", p->range_mapping_fields.bits.chroma_flag);
592 p->entrypoint_fields.bits.closed_entry); 1068 va_TraceMsg(idx, "\trange_mapping_chroma = %d\n", p->range_mapping_fields.bits.chroma);
593 va_TraceMsg("\tpanscan_flag = %d.\n", 1069 va_TraceMsg(idx, "\tb_picture_fraction = %d\n", p->b_picture_fraction);
594 p->entrypoint_fields.bits.panscan_flag); 1070 va_TraceMsg(idx, "\tcbp_table = %d\n", p->cbp_table);
595 va_TraceMsg("\tloopfilter = %d.\n", 1071 va_TraceMsg(idx, "\tmb_mode_table = %d\n", p->mb_mode_table);
596 p->entrypoint_fields.bits.loopfilter); 1072 va_TraceMsg(idx, "\trange_reduction_frame = %d\n", p->range_reduction_frame);
597 va_TraceMsg("\tconditional_overlap_flag = %d.\n", 1073 va_TraceMsg(idx, "\trounding_control = %d\n", p->rounding_control);
598 p->conditional_overlap_flag); 1074 va_TraceMsg(idx, "\tpost_processing = %d\n", p->post_processing);
599 va_TraceMsg("\tfast_uvmc_flag = %d.\n", 1075 va_TraceMsg(idx, "\tpicture_resolution_index = %d\n", p->picture_resolution_index);
600 p->fast_uvmc_flag); 1076 va_TraceMsg(idx, "\tluma_scale = %d\n", p->luma_scale);
601 va_TraceMsg("\trange_mapping_luma_flag = %d.\n", 1077 va_TraceMsg(idx, "\tluma_shift = %d\n", p->luma_shift);
602 p->range_mapping_fields.bits.luma_flag); 1078 va_TraceMsg(idx, "\tpicture_type = %d\n", p->picture_fields.bits.picture_type);
603 va_TraceMsg("\trange_mapping_luma = %d.\n", 1079 va_TraceMsg(idx, "\tframe_coding_mode = %d\n", p->picture_fields.bits.frame_coding_mode);
604 p->range_mapping_fields.bits.luma); 1080 va_TraceMsg(idx, "\ttop_field_first = %d\n", p->picture_fields.bits.top_field_first);
605 va_TraceMsg("\trange_mapping_chroma_flag = %d.\n", 1081 va_TraceMsg(idx, "\tis_first_field = %d\n", p->picture_fields.bits.is_first_field);
606 p->range_mapping_fields.bits.chroma_flag); 1082 va_TraceMsg(idx, "\tintensity_compensation = %d\n", p->picture_fields.bits.intensity_compensation);
607 va_TraceMsg("\trange_mapping_chroma = %d.\n", 1083 va_TraceMsg(idx, "\tmv_type_mb = %d\n", p->raw_coding.flags.mv_type_mb);
608 p->range_mapping_fields.bits.chroma); 1084 va_TraceMsg(idx, "\tdirect_mb = %d\n", p->raw_coding.flags.direct_mb);
609 va_TraceMsg("\tb_picture_fraction = %d.\n", 1085 va_TraceMsg(idx, "\tskip_mb = %d\n", p->raw_coding.flags.skip_mb);
610 p->b_picture_fraction); 1086 va_TraceMsg(idx, "\tfield_tx = %d\n", p->raw_coding.flags.field_tx);
611 va_TraceMsg("\tcbp_table = %d.\n", 1087 va_TraceMsg(idx, "\tforward_mb = %d\n", p->raw_coding.flags.forward_mb);
612 p->cbp_table); 1088 va_TraceMsg(idx, "\tac_pred = %d\n", p->raw_coding.flags.ac_pred);
613 va_TraceMsg("\tmb_mode_table = %d.\n", 1089 va_TraceMsg(idx, "\toverflags = %d\n", p->raw_coding.flags.overflags);
614 p->mb_mode_table); 1090 va_TraceMsg(idx, "\tbp_mv_type_mb = %d\n", p->bitplane_present.flags.bp_mv_type_mb);
615 va_TraceMsg("\trange_reduction_frame = %d.\n", 1091 va_TraceMsg(idx, "\tbp_direct_mb = %d\n", p->bitplane_present.flags.bp_direct_mb);
616 p->range_reduction_frame); 1092 va_TraceMsg(idx, "\tbp_skip_mb = %d\n", p->bitplane_present.flags.bp_skip_mb);
617 va_TraceMsg("\trounding_control = %d.\n", 1093 va_TraceMsg(idx, "\tbp_field_tx = %d\n", p->bitplane_present.flags.bp_field_tx);
618 p->rounding_control); 1094 va_TraceMsg(idx, "\tbp_forward_mb = %d\n", p->bitplane_present.flags.bp_forward_mb);
619 va_TraceMsg("\tpost_processing = %d.\n", 1095 va_TraceMsg(idx, "\tbp_ac_pred = %d\n", p->bitplane_present.flags.bp_ac_pred);
620 p->post_processing); 1096 va_TraceMsg(idx, "\tbp_overflags = %d\n", p->bitplane_present.flags.bp_overflags);
621 va_TraceMsg("\tpicture_resolution_index = %d.\n", 1097 va_TraceMsg(idx, "\treference_distance_flag = %d\n", p->reference_fields.bits.reference_distance_flag);
622 p->picture_resolution_index); 1098 va_TraceMsg(idx, "\treference_distance = %d\n", p->reference_fields.bits.reference_distance);
623 va_TraceMsg("\tluma_scale = %d.\n", 1099 va_TraceMsg(idx, "\tnum_reference_pictures = %d\n", p->reference_fields.bits.num_reference_pictures);
624 p->luma_scale); 1100 va_TraceMsg(idx, "\treference_field_pic_indicator = %d\n", p->reference_fields.bits.reference_field_pic_indicator);
625 va_TraceMsg("\tluma_shift = %d.\n", 1101 va_TraceMsg(idx, "\tmv_mode = %d\n", p->mv_fields.bits.mv_mode);
626 p->luma_shift); 1102 va_TraceMsg(idx, "\tmv_mode2 = %d\n", p->mv_fields.bits.mv_mode2);
627 va_TraceMsg("\tpicture_type = %d.\n", 1103 va_TraceMsg(idx, "\tmv_table = %d\n", p->mv_fields.bits.mv_table);
628 p->picture_fields.bits.picture_type); 1104 va_TraceMsg(idx, "\ttwo_mv_block_pattern_table = %d\n", p->mv_fields.bits.two_mv_block_pattern_table);
629 va_TraceMsg("\tframe_coding_mode = %d.\n", 1105 va_TraceMsg(idx, "\tfour_mv_switch = %d\n", p->mv_fields.bits.four_mv_switch);
630 p->picture_fields.bits.frame_coding_mode); 1106 va_TraceMsg(idx, "\tfour_mv_block_pattern_table = %d\n", p->mv_fields.bits.four_mv_block_pattern_table);
631 va_TraceMsg("\ttop_field_first = %d.\n", 1107 va_TraceMsg(idx, "\textended_mv_flag = %d\n", p->mv_fields.bits.extended_mv_flag);
632 p->picture_fields.bits.top_field_first); 1108 va_TraceMsg(idx, "\textended_mv_range = %d\n", p->mv_fields.bits.extended_mv_range);
633 va_TraceMsg("\tis_first_field = %d.\n", 1109 va_TraceMsg(idx, "\textended_dmv_flag = %d\n", p->mv_fields.bits.extended_dmv_flag);
634 p->picture_fields.bits.is_first_field); 1110 va_TraceMsg(idx, "\textended_dmv_range = %d\n", p->mv_fields.bits.extended_dmv_range);
635 va_TraceMsg("\tintensity_compensation = %d.\n", 1111 va_TraceMsg(idx, "\tdquant = %d\n", p->pic_quantizer_fields.bits.dquant);
636 p->picture_fields.bits.intensity_compensation); 1112 va_TraceMsg(idx, "\tquantizer = %d\n", p->pic_quantizer_fields.bits.quantizer);
637 va_TraceMsg(" ---------------------------------\n"); 1113 va_TraceMsg(idx, "\thalf_qp = %d\n", p->pic_quantizer_fields.bits.half_qp);
638 va_TraceMsg("\tmv_type_mb = %d.\n", 1114 va_TraceMsg(idx, "\tpic_quantizer_scale = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_scale);
639 p->raw_coding.flags.mv_type_mb); 1115 va_TraceMsg(idx, "\tpic_quantizer_type = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_type);
640 va_TraceMsg("\tdirect_mb = %d.\n", 1116 va_TraceMsg(idx, "\tdq_frame = %d\n", p->pic_quantizer_fields.bits.dq_frame);
641 p->raw_coding.flags.direct_mb); 1117 va_TraceMsg(idx, "\tdq_profile = %d\n", p->pic_quantizer_fields.bits.dq_profile);
642 va_TraceMsg("\tskip_mb = %d.\n", 1118 va_TraceMsg(idx, "\tdq_sb_edge = %d\n", p->pic_quantizer_fields.bits.dq_sb_edge);
643 p->raw_coding.flags.skip_mb); 1119 va_TraceMsg(idx, "\tdq_db_edge = %d\n", p->pic_quantizer_fields.bits.dq_db_edge);
644 va_TraceMsg("\tfield_tx = %d.\n", 1120 va_TraceMsg(idx, "\tdq_binary_level = %d\n", p->pic_quantizer_fields.bits.dq_binary_level);
645 p->raw_coding.flags.field_tx); 1121 va_TraceMsg(idx, "\talt_pic_quantizer = %d\n", p->pic_quantizer_fields.bits.alt_pic_quantizer);
646 va_TraceMsg("\tforward_mb = %d.\n", 1122 va_TraceMsg(idx, "\tvariable_sized_transform_flag = %d\n", p->transform_fields.bits.variable_sized_transform_flag);
647 p->raw_coding.flags.forward_mb); 1123 va_TraceMsg(idx, "\tmb_level_transform_type_flag = %d\n", p->transform_fields.bits.mb_level_transform_type_flag);
648 va_TraceMsg("\tac_pred = %d.\n", 1124 va_TraceMsg(idx, "\tframe_level_transform_type = %d\n", p->transform_fields.bits.frame_level_transform_type);
649 p->raw_coding.flags.ac_pred); 1125 va_TraceMsg(idx, "\ttransform_ac_codingset_idx1 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx1);
650 va_TraceMsg("\toverflags = %d.\n", 1126 va_TraceMsg(idx, "\ttransform_ac_codingset_idx2 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx2);
651 p->raw_coding.flags.overflags); 1127 va_TraceMsg(idx, "\tintra_transform_dc_table = %d\n", p->transform_fields.bits.intra_transform_dc_table);
652 va_TraceMsg(" ---------------------------------\n");
653 va_TraceMsg("\tbp_mv_type_mb = %d.\n",
654 p->bitplane_present.flags.bp_mv_type_mb);
655 va_TraceMsg("\tbp_direct_mb = %d.\n",
656 p->bitplane_present.flags.bp_direct_mb);
657 va_TraceMsg("\tbp_skip_mb = %d.\n",
658 p->bitplane_present.flags.bp_skip_mb);
659 va_TraceMsg("\tbp_field_tx = %d.\n",
660 p->bitplane_present.flags.bp_field_tx);
661 va_TraceMsg("\tbp_forward_mb = %d.\n",
662 p->bitplane_present.flags.bp_forward_mb);
663 va_TraceMsg("\tbp_ac_pred = %d.\n",
664 p->bitplane_present.flags.bp_ac_pred);
665 va_TraceMsg("\tbp_overflags = %d.\n",
666 p->bitplane_present.flags.bp_overflags);
667 va_TraceMsg(" ---------------------------------\n");
668 va_TraceMsg("\treference_distance_flag = %d.\n",
669 p->reference_fields.bits.reference_distance_flag);
670 va_TraceMsg("\treference_distance = %d.\n",
671 p->reference_fields.bits.reference_distance);
672 va_TraceMsg("\tnum_reference_pictures = %d.\n",
673 p->reference_fields.bits.num_reference_pictures);
674 va_TraceMsg("\treference_field_pic_indicator = %d.\n",
675 p->reference_fields.bits.reference_field_pic_indicator);
676 va_TraceMsg("\tmv_mode = %d.\n",
677 p->mv_fields.bits.mv_mode);
678 va_TraceMsg("\tmv_mode2 = %d.\n",
679 p->mv_fields.bits.mv_mode2);
680 va_TraceMsg("\tmv_table = %d.\n",
681 p->mv_fields.bits.mv_table);
682 va_TraceMsg("\ttwo_mv_block_pattern_table = %d.\n",
683 p->mv_fields.bits.two_mv_block_pattern_table);
684 va_TraceMsg("\tfour_mv_switch = %d.\n",
685 p->mv_fields.bits.four_mv_switch);
686 va_TraceMsg("\tfour_mv_block_pattern_table = %d.\n",
687 p->mv_fields.bits.four_mv_block_pattern_table);
688 va_TraceMsg("\textended_mv_flag = %d.\n",
689 p->mv_fields.bits.extended_mv_flag);
690 va_TraceMsg("\textended_mv_range = %d.\n",
691 p->mv_fields.bits.extended_mv_range);
692 va_TraceMsg("\textended_dmv_flag = %d.\n",
693 p->mv_fields.bits.extended_dmv_flag);
694 va_TraceMsg("\textended_dmv_range = %d.\n",
695 p->mv_fields.bits.extended_dmv_range);
696 va_TraceMsg("\tdquant = %d.\n",
697 p->pic_quantizer_fields.bits.dquant);
698 va_TraceMsg("\tquantizer = %d.\n",
699 p->pic_quantizer_fields.bits.quantizer);
700 va_TraceMsg("\thalf_qp = %d.\n",
701 p->pic_quantizer_fields.bits.half_qp);
702 va_TraceMsg("\tpic_quantizer_scale = %d.\n",
703 p->pic_quantizer_fields.bits.pic_quantizer_scale);
704 va_TraceMsg("\tpic_quantizer_type = %d.\n",
705 p->pic_quantizer_fields.bits.pic_quantizer_type);
706 va_TraceMsg("\tdq_frame = %d.\n",
707 p->pic_quantizer_fields.bits.dq_frame);
708 va_TraceMsg("\tdq_profile = %d.\n",
709 p->pic_quantizer_fields.bits.dq_profile);
710 va_TraceMsg("\tdq_sb_edge = %d.\n",
711 p->pic_quantizer_fields.bits.dq_sb_edge);
712 va_TraceMsg("\tdq_db_edge = %d.\n",
713 p->pic_quantizer_fields.bits.dq_db_edge);
714 va_TraceMsg("\tdq_binary_level = %d.\n",
715 p->pic_quantizer_fields.bits.dq_binary_level);
716 va_TraceMsg("\talt_pic_quantizer = %d.\n",
717 p->pic_quantizer_fields.bits.alt_pic_quantizer);
718 va_TraceMsg("\tvariable_sized_transform_flag = %d.\n",
719 p->transform_fields.bits.variable_sized_transform_flag);
720 va_TraceMsg("\tmb_level_transform_type_flag = %d.\n",
721 p->transform_fields.bits.mb_level_transform_type_flag);
722 va_TraceMsg("\tframe_level_transform_type = %d.\n",
723 p->transform_fields.bits.frame_level_transform_type);
724 va_TraceMsg("\ttransform_ac_codingset_idx1 = %d.\n",
725 p->transform_fields.bits.transform_ac_codingset_idx1);
726 va_TraceMsg("\ttransform_ac_codingset_idx2 = %d.\n",
727 p->transform_fields.bits.transform_ac_codingset_idx2);
728 va_TraceMsg("\tintra_transform_dc_table = %d.\n",
729 p->transform_fields.bits.intra_transform_dc_table);
730} 1128}
731 1129
732static void va_TraceVASliceParameterBufferVC1( 1130static void va_TraceVASliceParameterBufferVC1(
@@ -740,13 +1138,17 @@ static void va_TraceVASliceParameterBufferVC1(
740) 1138)
741{ 1139{
742 VASliceParameterBufferVC1 *p = (VASliceParameterBufferVC1*)data; 1140 VASliceParameterBufferVC1 *p = (VASliceParameterBufferVC1*)data;
1141 DPY2INDEX(dpy);
1142
1143 trace_context[idx].trace_slice_no++;
1144 trace_context[idx].trace_slice_size = p->slice_data_size;
743 1145
744 va_TraceMsg ("========== SLICE NUMBER ==========\n"); 1146 va_TraceMsg(idx, "VASliceParameterBufferVC1\n");
745 va_TraceMsg (" slice_data_size = %d\n", p->slice_data_size); 1147 va_TraceMsg(idx, "\tslice_data_size = %d\n", p->slice_data_size);
746 va_TraceMsg (" slice_data_offset = %d\n", p->slice_data_offset); 1148 va_TraceMsg(idx, "\tslice_data_offset = %d\n", p->slice_data_offset);
747 va_TraceMsg (" slice_data_flag = %d\n", p->slice_data_flag); 1149 va_TraceMsg(idx, "\tslice_data_flag = %d\n", p->slice_data_flag);
748 va_TraceMsg (" macroblock_offset = %d\n", p->macroblock_offset); 1150 va_TraceMsg(idx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
749 va_TraceMsg (" slice_vertical_position = %d\n", p->slice_vertical_position); 1151 va_TraceMsg(idx, "\tslice_vertical_position = %d\n", p->slice_vertical_position);
750} 1152}
751 1153
752void va_TraceBeginPicture( 1154void va_TraceBeginPicture(
@@ -755,15 +1157,17 @@ void va_TraceBeginPicture(
755 VASurfaceID render_target 1157 VASurfaceID render_target
756) 1158)
757{ 1159{
758 int i; 1160 DPY2INDEX(dpy);
759 1161
760 va_TraceMsg("\tcontext = 0x%08x\n", context); 1162 TRACE_FUNCNAME(idx);
761 va_TraceMsg("\t\trender_targets = 0x%08x\n", render_target); 1163
1164 va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
1165 va_TraceMsg(idx, "\trender_targets = 0x%08x\n", render_target);
762 1166
763 trace_rendertarget = render_target; /* for surface data dump after vaEndPicture */ 1167 trace_context[idx].trace_rendertarget = render_target; /* for surface data dump after vaEndPicture */
764 1168
765 trace_frame++; 1169 trace_context[idx].trace_frame_no++;
766 trace_slice = 0; 1170 trace_context[idx].trace_slice_no = 0;
767} 1171}
768 1172
769static void va_TraceMPEG2Buf( 1173static void va_TraceMPEG2Buf(
@@ -784,25 +1188,30 @@ static void va_TraceMPEG2Buf(
784 va_TraceVAIQMatrixBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf); 1188 va_TraceVAIQMatrixBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
785 break; 1189 break;
786 case VABitPlaneBufferType: 1190 case VABitPlaneBufferType:
1191 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
787 break; 1192 break;
788 case VASliceGroupMapBufferType: 1193 case VASliceGroupMapBufferType:
1194 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
789 break; 1195 break;
790 case VASliceParameterBufferType: 1196 case VASliceParameterBufferType:
791 trace_slice++;
792 va_TraceVASliceParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf); 1197 va_TraceVASliceParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
793 break; 1198 break;
794 case VASliceDataBufferType: 1199 case VASliceDataBufferType:
795 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); 1200 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
796 break; 1201 break;
797 case VAMacroblockParameterBufferType: 1202 case VAMacroblockParameterBufferType:
1203 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
798 break; 1204 break;
799 case VAResidualDataBufferType: 1205 case VAResidualDataBufferType:
1206 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
800 break; 1207 break;
801 case VADeblockingParameterBufferType: 1208 case VADeblockingParameterBufferType:
1209 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
802 break; 1210 break;
803 case VAImageBufferType: 1211 case VAImageBufferType:
804 break; 1212 break;
805 case VAProtectedSliceDataBufferType: 1213 case VAProtectedSliceDataBufferType:
1214 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
806 break; 1215 break;
807 case VAEncCodedBufferType: 1216 case VAEncCodedBufferType:
808 break; 1217 break;
@@ -816,6 +1225,8 @@ static void va_TraceMPEG2Buf(
816 break; 1225 break;
817 case VAEncH264SEIBufferType: 1226 case VAEncH264SEIBufferType:
818 break; 1227 break;
1228 default:
1229 break;
819 } 1230 }
820} 1231}
821 1232
@@ -837,6 +1248,7 @@ static void va_TraceMPEG4Buf(
837 va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf); 1248 va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
838 break; 1249 break;
839 case VABitPlaneBufferType: 1250 case VABitPlaneBufferType:
1251 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
840 break; 1252 break;
841 case VASliceGroupMapBufferType: 1253 case VASliceGroupMapBufferType:
842 break; 1254 break;
@@ -847,10 +1259,13 @@ static void va_TraceMPEG4Buf(
847 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); 1259 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
848 break; 1260 break;
849 case VAMacroblockParameterBufferType: 1261 case VAMacroblockParameterBufferType:
1262 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
850 break; 1263 break;
851 case VAResidualDataBufferType: 1264 case VAResidualDataBufferType:
1265 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
852 break; 1266 break;
853 case VADeblockingParameterBufferType: 1267 case VADeblockingParameterBufferType:
1268 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
854 break; 1269 break;
855 case VAImageBufferType: 1270 case VAImageBufferType:
856 break; 1271 break;
@@ -860,10 +1275,13 @@ static void va_TraceMPEG4Buf(
860 case VAEncCodedBufferType: 1275 case VAEncCodedBufferType:
861 break; 1276 break;
862 case VAEncSequenceParameterBufferType: 1277 case VAEncSequenceParameterBufferType:
1278 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
863 break; 1279 break;
864 case VAEncPictureParameterBufferType: 1280 case VAEncPictureParameterBufferType:
1281 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
865 break; 1282 break;
866 case VAEncSliceParameterBufferType: 1283 case VAEncSliceParameterBufferType:
1284 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
867 break; 1285 break;
868 case VAEncH264VUIBufferType: 1286 case VAEncH264VUIBufferType:
869 break; 1287 break;
@@ -885,6 +1303,8 @@ static void va_TraceH264Buf(
885 void *pbuf 1303 void *pbuf
886) 1304)
887{ 1305{
1306 DPY2INDEX(dpy);
1307
888 switch (type) { 1308 switch (type) {
889 case VAPictureParameterBufferType: 1309 case VAPictureParameterBufferType:
890 va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); 1310 va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
@@ -893,20 +1313,25 @@ static void va_TraceH264Buf(
893 va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); 1313 va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
894 break; 1314 break;
895 case VABitPlaneBufferType: 1315 case VABitPlaneBufferType:
1316 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
896 break; 1317 break;
897 case VASliceGroupMapBufferType: 1318 case VASliceGroupMapBufferType:
1319 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
898 break; 1320 break;
899 case VASliceParameterBufferType: 1321 case VASliceParameterBufferType:
900 va_TraceVASliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); 1322 va_TraceVASliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
901 break; 1323 break;
902 case VASliceDataBufferType: 1324 case VASliceDataBufferType:
903 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); 1325 va_TraceVABuffers(dpy, context, buffer, type, trace_context[idx].trace_slice_size, num_elements, pbuf);
904 break; 1326 break;
905 case VAMacroblockParameterBufferType: 1327 case VAMacroblockParameterBufferType:
1328 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
906 break; 1329 break;
907 case VAResidualDataBufferType: 1330 case VAResidualDataBufferType:
1331 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
908 break; 1332 break;
909 case VADeblockingParameterBufferType: 1333 case VADeblockingParameterBufferType:
1334 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
910 break; 1335 break;
911 case VAImageBufferType: 1336 case VAImageBufferType:
912 break; 1337 break;
@@ -916,14 +1341,22 @@ static void va_TraceH264Buf(
916 case VAEncCodedBufferType: 1341 case VAEncCodedBufferType:
917 break; 1342 break;
918 case VAEncSequenceParameterBufferType: 1343 case VAEncSequenceParameterBufferType:
1344 va_TraceVAEncSequenceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
919 break; 1345 break;
920 case VAEncPictureParameterBufferType: 1346 case VAEncPictureParameterBufferType:
1347 va_TraceVAEncPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
921 break; 1348 break;
922 case VAEncSliceParameterBufferType: 1349 case VAEncSliceParameterBufferType:
1350 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
923 break; 1351 break;
924 case VAEncH264VUIBufferType: 1352 case VAEncH264VUIBufferType:
1353 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
925 break; 1354 break;
926 case VAEncH264SEIBufferType: 1355 case VAEncH264SEIBufferType:
1356 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1357 break;
1358 case VAEncMiscParameterBufferType:
1359 va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
927 break; 1360 break;
928 default: 1361 default:
929 break; 1362 break;
@@ -941,6 +1374,8 @@ static void va_TraceVC1Buf(
941 void *pbuf 1374 void *pbuf
942) 1375)
943{ 1376{
1377 DPY2INDEX(dpy);
1378
944 switch (type) { 1379 switch (type) {
945 case VAPictureParameterBufferType: 1380 case VAPictureParameterBufferType:
946 va_TraceVAPictureParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf); 1381 va_TraceVAPictureParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
@@ -951,18 +1386,22 @@ static void va_TraceVC1Buf(
951 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); 1386 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
952 break; 1387 break;
953 case VASliceGroupMapBufferType: 1388 case VASliceGroupMapBufferType:
1389 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
954 break; 1390 break;
955 case VASliceParameterBufferType: 1391 case VASliceParameterBufferType:
956 va_TraceVASliceParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf); 1392 va_TraceVASliceParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
957 break; 1393 break;
958 case VASliceDataBufferType: 1394 case VASliceDataBufferType:
959 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); 1395 va_TraceVABuffers(dpy, context, buffer, type, trace_context[idx].trace_slice_size, num_elements, pbuf);
960 break; 1396 break;
961 case VAMacroblockParameterBufferType: 1397 case VAMacroblockParameterBufferType:
1398 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
962 break; 1399 break;
963 case VAResidualDataBufferType: 1400 case VAResidualDataBufferType:
1401 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
964 break; 1402 break;
965 case VADeblockingParameterBufferType: 1403 case VADeblockingParameterBufferType:
1404 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
966 break; 1405 break;
967 case VAImageBufferType: 1406 case VAImageBufferType:
968 break; 1407 break;
@@ -972,14 +1411,13 @@ static void va_TraceVC1Buf(
972 case VAEncCodedBufferType: 1411 case VAEncCodedBufferType:
973 break; 1412 break;
974 case VAEncSequenceParameterBufferType: 1413 case VAEncSequenceParameterBufferType:
1414 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
975 break; 1415 break;
976 case VAEncPictureParameterBufferType: 1416 case VAEncPictureParameterBufferType:
1417 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
977 break; 1418 break;
978 case VAEncSliceParameterBufferType: 1419 case VAEncSliceParameterBufferType:
979 break; 1420 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
980 case VAEncH264VUIBufferType:
981 break;
982 case VAEncH264SEIBufferType:
983 break; 1421 break;
984 default: 1422 default:
985 break; 1423 break;
@@ -997,44 +1435,74 @@ void va_TraceRenderPicture(
997 unsigned int size; 1435 unsigned int size;
998 unsigned int num_elements; 1436 unsigned int num_elements;
999 int i; 1437 int i;
1438 DPY2INDEX(dpy);
1000 1439
1001 va_TraceMsg("\tcontext = 0x%08x\n", context); 1440 TRACE_FUNCNAME(idx);
1002 va_TraceMsg("\tnum_buffers = %d\n", num_buffers); 1441
1442 va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
1443 va_TraceMsg(idx, "\tnum_buffers = %d\n", num_buffers);
1003 for (i = 0; i < num_buffers; i++) { 1444 for (i = 0; i < num_buffers; i++) {
1004 void *pbuf; 1445 void *pbuf;
1005 1446 unsigned int j;
1447
1006 /* get buffer type information */ 1448 /* get buffer type information */
1007 vaBufferInfo(dpy, context, buffers[i], &type, &size, &num_elements); 1449 vaBufferInfo(dpy, context, buffers[i], &type, &size, &num_elements);
1008
1009 va_TraceMsg("\t\tbuffers[%d] = 0x%08x\n", i, buffers[i]);
1010 va_TraceMsg("\t\t\ttype = %s\n", buffer_type_to_string(type));
1011 va_TraceMsg("\t\t\tsize = %d\n", size);
1012 va_TraceMsg("\t\t\tnum_elements = %d\n", num_elements);
1013 1450
1451 va_TraceMsg(idx, "\t---------------------------\n");
1452 va_TraceMsg(idx, "\tbuffers[%d] = 0x%08x\n", i, buffers[i]);
1453 va_TraceMsg(idx, "\t type = %s\n", buffer_type_to_string(type));
1454 va_TraceMsg(idx, "\t size = %d\n", size);
1455 va_TraceMsg(idx, "\t num_elements = %d\n", num_elements);
1014 1456
1015 vaMapBuffer(dpy, buffers[i], &pbuf); 1457 vaMapBuffer(dpy, buffers[i], &pbuf);
1016 1458
1017 switch (trace_profile) { 1459 switch (trace_context[idx].trace_profile) {
1018 case VAProfileMPEG2Simple: 1460 case VAProfileMPEG2Simple:
1019 case VAProfileMPEG2Main: 1461 case VAProfileMPEG2Main:
1020 va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf); 1462 for (j=0; j<num_elements; j++) {
1463 va_TraceMsg(idx, "\t element[%d] = ", j);
1464 va_TraceMsg(idx, "\t------------------", j);
1465 va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
1466 }
1021 break; 1467 break;
1022 case VAProfileMPEG4Simple: 1468 case VAProfileMPEG4Simple:
1023 case VAProfileMPEG4AdvancedSimple: 1469 case VAProfileMPEG4AdvancedSimple:
1024 case VAProfileMPEG4Main: 1470 case VAProfileMPEG4Main:
1025 va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf); 1471 for (j=0; j<num_elements; j++) {
1472 va_TraceMsg(idx, "\t element[%d] = ", j);
1473 va_TraceMsg(idx, "\t------------------", j);
1474 va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
1475 }
1026 break; 1476 break;
1027 case VAProfileH264Baseline: 1477 case VAProfileH264Baseline:
1028 case VAProfileH264Main: 1478 case VAProfileH264Main:
1029 case VAProfileH264High: 1479 case VAProfileH264High:
1030 va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf); 1480 for (j=0; j<num_elements; j++) {
1481 va_TraceMsg(idx, "\t element[%d] = ", j);
1482 va_TraceMsg(idx, "\t------------------", j);
1483
1484 va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
1485 }
1031 break; 1486 break;
1032 case VAProfileVC1Simple: 1487 case VAProfileVC1Simple:
1033 case VAProfileVC1Main: 1488 case VAProfileVC1Main:
1034 case VAProfileVC1Advanced: 1489 case VAProfileVC1Advanced:
1035 va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf); 1490 for (j=0; j<num_elements; j++) {
1491 va_TraceMsg(idx, "\t element[%d] = ", j);
1492 va_TraceMsg(idx, "\t------------------", j);
1493
1494 va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
1495 }
1036 break; 1496 break;
1037 case VAProfileH263Baseline: 1497 case VAProfileH263Baseline:
1498 for (j=0; j<num_elements; j++) {
1499 va_TraceMsg(idx, "\t element[%d] = ", j);
1500 va_TraceMsg(idx, "\t------------------", j);
1501
1502 va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
1503 }
1504 break;
1505 default:
1038 break; 1506 break;
1039 } 1507 }
1040 1508
@@ -1048,80 +1516,149 @@ void va_TraceEndPicture(
1048 VAContextID context 1516 VAContextID context
1049) 1517)
1050{ 1518{
1051 int i, j; 1519 DPY2INDEX(dpy);
1052 unsigned int fourcc; /* following are output argument */ 1520
1053 unsigned int luma_stride; 1521 TRACE_FUNCNAME(idx);
1054 unsigned int chroma_u_stride;
1055 unsigned int chroma_v_stride;
1056 unsigned int luma_offset;
1057 unsigned int chroma_u_offset;
1058 unsigned int chroma_v_offset;
1059 unsigned int buffer_name;
1060 void *buffer;
1061 char *Y_data, *UV_data, *tmp;
1062
1063 VAStatus va_status;
1064
1065 va_TraceMsg("\tcontext = 0x%08x\n", context);
1066 va_TraceMsg("\t\trender_targets = 0x%08x\n", trace_rendertarget);
1067 1522
1068 /* force the pipleline finish rendering */ 1523 va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
1069 vaSyncSurface(dpy, trace_rendertarget); 1524 va_TraceMsg(idx, "\trender_targets = 0x%08x\n", trace_context[idx].trace_rendertarget);
1070 1525
1071 va_TraceMsg("***dump surface data***\n", trace_rendertarget);
1072 1526
1073 va_status = vaLockSurface(dpy, trace_rendertarget, &fourcc, &luma_stride, &chroma_u_stride, &chroma_v_stride, 1527 /* want to trace codedbuf, and it is encode */
1074 &luma_offset, &chroma_u_offset, &chroma_v_offset, &buffer_name, &buffer); 1528 if (trace_context[idx].trace_fp_codedbuf &&
1529 ((trace_context[idx].trace_entrypoint == VAEntrypointEncSlice) ||
1530 (trace_context[idx].trace_entrypoint == VAEntrypointEncPicture))) {
1531 /* force the pipleline finish rendering */
1532 vaSyncSurface(dpy, trace_context[idx].trace_rendertarget);
1533 va_TraceCodedBuf(dpy);
1534 }
1075 1535
1076 if (va_status != VA_STATUS_SUCCESS) 1536 /* trace decoded surface for decoding, or the source sourface for encoding */
1077 return; 1537 if (trace_context[idx].trace_fp_surface) {
1078 1538 /* force the pipleline finish rendering */
1079 va_TraceMsg("\tfourcc=0x%08x\n", fourcc); 1539 vaSyncSurface(dpy, trace_context[idx].trace_rendertarget);
1080 va_TraceMsg("\twidth=%d\n", trace_width); 1540
1081 va_TraceMsg("\theight=%d\n", trace_height); 1541 va_TraceSurface(dpy);
1082 va_TraceMsg("\tluma_stride=%d\n", luma_stride);
1083 va_TraceMsg("\tchroma_u_stride=%d\n", chroma_u_stride);
1084 va_TraceMsg("\tchroma_v_stride=%d\n", chroma_v_stride);
1085 va_TraceMsg("\tluma_offset=%d\n", luma_offset);
1086 va_TraceMsg("\tchroma_u_offset=%d\n", chroma_u_offset);
1087 va_TraceMsg("\tchroma_v_offset=%d\n", chroma_v_offset);
1088
1089 if (!buffer) {
1090 vaUnlockSurface(dpy, trace_rendertarget);
1091 return;
1092 } 1542 }
1543}
1093 1544
1094 Y_data = buffer;
1095 UV_data = buffer + luma_offset;
1096 1545
1097 tmp = Y_data; 1546void va_TraceMaxNumDisplayAttributes (
1098 va_TraceMsg("**Y data**\n"); 1547 VADisplay dpy,
1099 for (i=0; i<trace_height; i++) { 1548 int number
1100 for (j=0; j<trace_width; j++) { 1549)
1101 if ((j%16) == 0) 1550{
1102 va_TraceMsg("\n0x%08x:", j + i*trace_width); 1551 DPY2INDEX(dpy);
1103 va_TraceMsg(" %02x", tmp[j]);
1104 }
1105 1552
1106 va_TraceMsg("\n"); 1553 TRACE_FUNCNAME(idx);
1107 tmp = Y_data + i * luma_stride; 1554
1555 va_TraceMsg(idx, "\t>max_display_attributes = %d\n", number);
1556}
1557
1558void va_TraceQueryDisplayAttributes (
1559 VADisplay dpy,
1560 VADisplayAttribute *attr_list, /* out */
1561 int *num_attributes /* out */
1562)
1563{
1564 int i;
1565
1566 DPY2INDEX(dpy);
1567
1568 va_TraceMsg(idx, "\tnum_attributes = %d\n", *num_attributes);
1569
1570 for (i=0; i<*num_attributes; i++) {
1571 va_TraceMsg(idx, "\tattr_list[%d] =\n");
1572 va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);
1573 va_TraceMsg(idx, "\t min_value = %d\n", attr_list[i].min_value);
1574 va_TraceMsg(idx, "\t max_value = %d\n", attr_list[i].max_value);
1575 va_TraceMsg(idx, "\t value = %d\n", attr_list[i].value);
1576 va_TraceMsg(idx, "\t flags = %d\n", attr_list[i].flags);
1108 } 1577 }
1578}
1109 1579
1110 tmp = UV_data;
1111 if (fourcc == VA_FOURCC_NV12) {
1112 va_TraceMsg("**UV data**\n");
1113
1114 for (i=0; i<trace_height/2; i++) {
1115 for (j=0; j<trace_width; j++) {
1116 if ((j%16) == 0)
1117 va_TraceMsg("\n0x%08x:", j + i*trace_width);
1118 va_TraceMsg(" %02x", tmp[j]);
1119 }
1120 1580
1121 va_TraceMsg("\n"); 1581static void va_TraceDisplayAttributes (
1122 tmp = UV_data + i * chroma_u_stride; 1582 VADisplay dpy,
1123 } 1583 VADisplayAttribute *attr_list,
1584 int num_attributes
1585)
1586{
1587 int i;
1588
1589 DPY2INDEX(dpy);
1590
1591 va_TraceMsg(idx, "\tnum_attributes = %d\n", num_attributes);
1592 for (i=0; i<num_attributes; i++) {
1593 va_TraceMsg(idx, "\tattr_list[%d] =\n");
1594 va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);
1595 va_TraceMsg(idx, "\t min_value = %d\n", attr_list[i].min_value);
1596 va_TraceMsg(idx, "\t max_value = %d\n", attr_list[i].max_value);
1597 va_TraceMsg(idx, "\t value = %d\n", attr_list[i].value);
1598 va_TraceMsg(idx, "\t flags = %d\n", attr_list[i].flags);
1124 } 1599 }
1600}
1601
1602
1603void va_TraceGetDisplayAttributes (
1604 VADisplay dpy,
1605 VADisplayAttribute *attr_list,
1606 int num_attributes
1607)
1608{
1609 DPY2INDEX(dpy);
1125 1610
1126 vaUnlockSurface(dpy, trace_rendertarget); 1611 TRACE_FUNCNAME(idx);
1612
1613 va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
1614}
1615
1616void va_TraceSetDisplayAttributes (
1617 VADisplay dpy,
1618 VADisplayAttribute *attr_list,
1619 int num_attributes
1620)
1621{
1622 DPY2INDEX(dpy);
1623
1624 TRACE_FUNCNAME(idx);
1625
1626 va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
1627}
1628
1629
1630void va_TracePutSurface (
1631 VADisplay dpy,
1632 VASurfaceID surface,
1633 void *draw, /* the target Drawable */
1634 short srcx,
1635 short srcy,
1636 unsigned short srcw,
1637 unsigned short srch,
1638 short destx,
1639 short desty,
1640 unsigned short destw,
1641 unsigned short desth,
1642 VARectangle *cliprects, /* client supplied clip list */
1643 unsigned int number_cliprects, /* number of clip rects in the clip list */
1644 unsigned int flags /* de-interlacing flags */
1645)
1646{
1647 DPY2INDEX(dpy);
1648
1649 TRACE_FUNCNAME(idx);
1650
1651 va_TraceMsg(idx, "\tsurface = 0x%08x\n", surface);
1652 va_TraceMsg(idx, "\tdraw = 0x%08x\n", draw);
1653 va_TraceMsg(idx, "\tsrcx = %d\n", surface);
1654 va_TraceMsg(idx, "\tsrcy = %d\n", surface);
1655 va_TraceMsg(idx, "\tsrcw = %d\n", surface);
1656 va_TraceMsg(idx, "\tsrch = %d\n", surface);
1657 va_TraceMsg(idx, "\tdestx = %d\n", surface);
1658 va_TraceMsg(idx, "\tdesty = %d\n", surface);
1659 va_TraceMsg(idx, "\tdestw = %d\n", destw);
1660 va_TraceMsg(idx, "\tdesth = %d\n", desth);
1661 va_TraceMsg(idx, "\tcliprects = 0x%08x\n", cliprects);
1662 va_TraceMsg(idx, "\tnumber_cliprects = %d\n", number_cliprects);
1663 va_TraceMsg(idx, "\tflags = 0x%08x\n", flags);
1127} 1664}
diff --git a/va/va_trace.h b/va/va_trace.h
index 1c860e3..bb1238f 100644
--- a/va/va_trace.h
+++ b/va/va_trace.h
@@ -25,10 +25,10 @@
25#ifndef VA_TRACE_H 25#ifndef VA_TRACE_H
26#define VA_TRACE_H 26#define VA_TRACE_H
27 27
28void va_TraceInit(void); 28void va_TraceInit(VADisplay dpy);
29void va_TraceEnd(void); 29void va_TraceEnd(VADisplay dpy);
30 30
31void va_TraceMsg(const char *msg, ...); 31void va_TraceMsg(int idx, const char *msg, ...);
32 32
33void va_TraceCreateConfig( 33void va_TraceCreateConfig(
34 VADisplay dpy, 34 VADisplay dpy,
@@ -59,6 +59,14 @@ void va_TraceCreateContext(
59 VAContextID *context /* out */ 59 VAContextID *context /* out */
60); 60);
61 61
62
63void va_TraceMapBuffer (
64 VADisplay dpy,
65 VABufferID buf_id, /* in */
66 void **pbuf /* out */
67);
68
69
62void va_TraceBeginPicture( 70void va_TraceBeginPicture(
63 VADisplay dpy, 71 VADisplay dpy,
64 VAContextID context, 72 VAContextID context,
@@ -77,4 +85,48 @@ void va_TraceEndPicture(
77 VAContextID context 85 VAContextID context
78); 86);
79 87
88
89void va_TraceMaxNumDisplayAttributes (
90 VADisplay dpy,
91 int number
92);
93
94void va_TraceQueryDisplayAttributes (
95 VADisplay dpy,
96 VADisplayAttribute *attr_list, /* out */
97 int *num_attributes /* out */
98);
99
100void va_TraceGetDisplayAttributes (
101 VADisplay dpy,
102 VADisplayAttribute *attr_list,
103 int num_attributes
104);
105
106void va_TraceSetDisplayAttributes (
107 VADisplay dpy,
108 VADisplayAttribute *attr_list,
109 int num_attributes
110);
111
112/* extern function called by display side */
113void va_TracePutSurface (
114 VADisplay dpy,
115 VASurfaceID surface,
116 void *draw, /* the target Drawable */
117 short srcx,
118 short srcy,
119 unsigned short srcw,
120 unsigned short srch,
121 short destx,
122 short desty,
123 unsigned short destw,
124 unsigned short desth,
125 VARectangle *cliprects, /* client supplied clip list */
126 unsigned int number_cliprects, /* number of clip rects in the clip list */
127 unsigned int flags /* de-interlacing flags */
128);
129
130
131
80#endif /* VA_TRACE_H */ 132#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 (
231#define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext) 231#define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
232#define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; } 232#define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
233 233
234extern int fool_postp; /* do nothing for vaPutSurface if set */
235extern int trace_flag; /* trace vaPutSurface parameters */
236#define VA_TRACE(trace_func,...) \
237 if (trace_flag) { \
238 trace_func(__VA_ARGS__); \
239 }
240
241void va_TracePutSurface (
242 VADisplay dpy,
243 VASurfaceID surface,
244 void *draw, /* the target Drawable */
245 short srcx,
246 short srcy,
247 unsigned short srcw,
248 unsigned short srch,
249 short destx,
250 short desty,
251 unsigned short destw,
252 unsigned short desth,
253 VARectangle *cliprects, /* client supplied clip list */
254 unsigned int number_cliprects, /* number of clip rects in the clip list */
255 unsigned int flags /* de-interlacing flags */
256);
257
258
234VAStatus vaPutSurface ( 259VAStatus vaPutSurface (
235 VADisplay dpy, 260 VADisplay dpy,
236 VASurfaceID surface, 261 VASurfaceID surface,
@@ -250,9 +275,16 @@ VAStatus vaPutSurface (
250{ 275{
251 VADriverContextP ctx; 276 VADriverContextP ctx;
252 277
278 if (fool_postp)
279 return VA_STATUS_SUCCESS;
280
253 CHECK_DISPLAY(dpy); 281 CHECK_DISPLAY(dpy);
254 ctx = CTX(dpy); 282 ctx = CTX(dpy);
255 283
284 VA_TRACE(va_TracePutSurface, dpy, surface, (void *)draw, srcx, srcy, srcw, srch,
285 destx, desty, destw, desth,
286 cliprects, number_cliprects, flags );
287
256 return ctx->vtable.vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch, 288 return ctx->vtable.vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
257 destx, desty, destw, desth, 289 destx, desty, destw, desth,
258 cliprects, number_cliprects, flags ); 290 cliprects, number_cliprects, flags );