hardware/intel/libva
Revision | 881b49c5f154ee6603eee4aebb8becae6097a4bd (tree) |
---|---|
Zeit | 2010-10-28 08:18:18 |
Autor | Austin Yuan <shengquan.yuan@gmai...> |
Commiter | Austin Yuan |
libva-1.0.6
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>
@@ -1,5 +1,7 @@ | ||
1 | 1 | # Recursive call sub-folder Android.mk |
2 | 2 | # |
3 | +# include $(call all-subdir-makefiles) | |
3 | 4 | LOCAL_PATH := $(my-dir) |
4 | 5 | |
5 | 6 | include $(LOCAL_PATH)/va/Android.mk |
7 | + |
@@ -5,11 +5,11 @@ | ||
5 | 5 | distribute, sub license, and/or sell copies of the Software, and to |
6 | 6 | permit persons to whom the Software is furnished to do so, subject to |
7 | 7 | the following conditions: |
8 | - | |
8 | + | |
9 | 9 | The above copyright notice and this permission notice (including the |
10 | 10 | next paragraph) shall be included in all copies or substantial portions |
11 | 11 | of the Software. |
12 | - | |
12 | + | |
13 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
14 | 14 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
15 | 15 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
@@ -7,11 +7,11 @@ | ||
7 | 7 | # distribute, sub license, and/or sell copies of the Software, and to |
8 | 8 | # permit persons to whom the Software is furnished to do so, subject to |
9 | 9 | # the following conditions: |
10 | -# | |
10 | +# | |
11 | 11 | # The above copyright notice and this permission notice (including the |
12 | 12 | # next paragraph) shall be included in all copies or substantial portions |
13 | 13 | # of the Software. |
14 | -# | |
14 | +# | |
15 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
16 | 16 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
17 | 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
@@ -29,7 +29,7 @@ m4_define([libva_version], | ||
29 | 29 | [libva_major_version.libva_minor_version.libva_micro_version]) |
30 | 30 | |
31 | 31 | # if the library source code has changed, increment revision |
32 | -m4_define([libva_lt_revision], [5]) | |
32 | +m4_define([libva_lt_revision], [6]) | |
33 | 33 | # if any interface was added/removed/changed, then inc current, reset revision |
34 | 34 | m4_define([libva_lt_current], [1]) |
35 | 35 | # if any interface was added since last public release, then increment age |
@@ -1058,7 +1058,7 @@ VAStatus dummy_PutSurface( | ||
1058 | 1058 | Drawable drawable = (Drawable)draw; |
1059 | 1059 | |
1060 | 1060 | (void)drawable; |
1061 | - | |
1061 | + | |
1062 | 1062 | return VA_STATUS_ERROR_UNKNOWN; |
1063 | 1063 | } |
1064 | 1064 |
@@ -22,7 +22,12 @@ | ||
22 | 22 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
23 | 23 | */ |
24 | 24 | |
25 | +#ifndef ANDROID | |
25 | 26 | #include <va/va_x11.h> |
27 | +#else | |
28 | +#include "va/va_android.h" | |
29 | +#define Display unsigned int | |
30 | +#endif | |
26 | 31 | |
27 | 32 | #include <stdarg.h> |
28 | 33 | #include <stdio.h> |
@@ -87,7 +92,11 @@ int main(int argc, const char* argv[]) | ||
87 | 92 | else |
88 | 93 | name = argv[0]; |
89 | 94 | |
95 | +#ifndef ANDROID | |
90 | 96 | dpy = XOpenDisplay(":0.0"); |
97 | +#else | |
98 | + dpy = (Display*)malloc(sizeof(Display)); | |
99 | +#endif | |
91 | 100 | if (NULL == dpy) |
92 | 101 | { |
93 | 102 | fprintf(stderr, "%s: Error, can't open display: '%s'\n", name, display ? display : ""); |
@@ -13,6 +13,7 @@ include $(CLEAR_VARS) | ||
13 | 13 | LOCAL_SRC_FILES := \ |
14 | 14 | va.c \ |
15 | 15 | va_trace.c \ |
16 | + va_fool.c | |
16 | 17 | |
17 | 18 | LOCAL_CFLAGS += \ |
18 | 19 | -DANDROID \ |
@@ -27,7 +27,7 @@ INCLUDES = \ | ||
27 | 27 | LDADD = \ |
28 | 28 | $(LIBVA_LT_LDFLAGS) |
29 | 29 | |
30 | -libva_la_SOURCES = va.c va_trace.c | |
30 | +libva_la_SOURCES = va.c va_trace.c va_fool.c | |
31 | 31 | libva_ladir = $(libdir) |
32 | 32 | libva_la_LDFLAGS = $(LDADD) -no-undefined |
33 | 33 | libva_la_LIBADD = $(LIBVA_LIBS) -ldl |
@@ -250,7 +250,7 @@ VADisplay vaGetDisplay ( | ||
250 | 250 | pDisplayContext->vaDestroy = va_DisplayContextDestroy; |
251 | 251 | pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName; |
252 | 252 | pDisplayContexts = pDisplayContext; |
253 | - pDriverContext->dri_state = dri_state; | |
253 | + pDriverContext->dri_state = dri_state; | |
254 | 254 | dpy = (VADisplay)pDisplayContext; |
255 | 255 | } |
256 | 256 | else |
@@ -272,6 +272,33 @@ VADisplay vaGetDisplay ( | ||
272 | 272 | |
273 | 273 | |
274 | 274 | #ifdef ANDROID |
275 | +extern "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 | + | |
275 | 302 | VAStatus vaPutSurface ( |
276 | 303 | VADisplay dpy, |
277 | 304 | VASurfaceID surface, |
@@ -291,8 +318,16 @@ VAStatus vaPutSurface ( | ||
291 | 318 | { |
292 | 319 | VADriverContextP ctx; |
293 | 320 | |
321 | + if (fool_postp) | |
322 | + return VA_STATUS_SUCCESS; | |
323 | + | |
294 | 324 | CHECK_DISPLAY(dpy); |
295 | 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 | 331 | return ctx->vtable.vaPutSurface( ctx, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch, |
297 | 332 | destx, desty, destw, desth, |
298 | 333 | cliprects, number_cliprects, flags ); |
@@ -26,6 +26,7 @@ | ||
26 | 26 | #include "va.h" |
27 | 27 | #include "va_backend.h" |
28 | 28 | #include "va_trace.h" |
29 | +#include "va_fool.h" | |
29 | 30 | #include "config.h" |
30 | 31 | |
31 | 32 | #include <assert.h> |
@@ -57,17 +58,65 @@ | ||
57 | 58 | extern int trace_flag; |
58 | 59 | #define VA_TRACE(trace_func,...) \ |
59 | 60 | if (trace_flag) { \ |
60 | - va_TraceMsg("========%s========\n", __func__); \ | |
61 | 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 | + */ | |
70 | +int 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 | + | |
64 | 113 | int vaDisplayIsValid(VADisplay dpy) |
65 | 114 | { |
66 | 115 | VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; |
67 | 116 | return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext); |
68 | 117 | } |
69 | 118 | |
70 | -static void va_errorMessage(const char *msg, ...) | |
119 | +void va_errorMessage(const char *msg, ...) | |
71 | 120 | { |
72 | 121 | va_list args; |
73 | 122 |
@@ -77,7 +126,7 @@ static void va_errorMessage(const char *msg, ...) | ||
77 | 126 | va_end(args); |
78 | 127 | } |
79 | 128 | |
80 | -static void va_infoMessage(const char *msg, ...) | |
129 | +void va_infoMessage(const char *msg, ...) | |
81 | 130 | { |
82 | 131 | va_list args; |
83 | 132 |
@@ -340,7 +389,9 @@ VAStatus vaInitialize ( | ||
340 | 389 | |
341 | 390 | CHECK_DISPLAY(dpy); |
342 | 391 | |
343 | - va_TraceInit(); | |
392 | + va_TraceInit(dpy); | |
393 | + | |
394 | + va_FoolInit(dpy); | |
344 | 395 | |
345 | 396 | va_infoMessage("libva version %s\n", VA_VERSION_S); |
346 | 397 |
@@ -397,7 +448,9 @@ VAStatus vaTerminate ( | ||
397 | 448 | if (VA_STATUS_SUCCESS == vaStatus) |
398 | 449 | pDisplayContext->vaDestroy(pDisplayContext); |
399 | 450 | |
400 | - va_TraceEnd(); | |
451 | + va_TraceEnd(dpy); | |
452 | + | |
453 | + va_FoolEnd(dpy); | |
401 | 454 | |
402 | 455 | return vaStatus; |
403 | 456 | } |
@@ -511,6 +564,7 @@ VAStatus vaCreateConfig ( | ||
511 | 564 | ctx = CTX(dpy); |
512 | 565 | |
513 | 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 | 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 | 608 | VADriverContextP ctx; |
609 | + VAStatus ret; | |
555 | 610 | CHECK_DISPLAY(dpy); |
556 | 611 | ctx = CTX(dpy); |
557 | 612 | |
558 | 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 | 677 | CHECK_DISPLAY(dpy); |
620 | 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 | 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 | 705 | VADriverContextP ctx; |
706 | + VAStatus va_status; | |
707 | + | |
646 | 708 | CHECK_DISPLAY(dpy); |
647 | 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 | |
652 | 721 | VAStatus vaUnmapBuffer ( |
@@ -658,6 +727,8 @@ VAStatus vaUnmapBuffer ( | ||
658 | 727 | CHECK_DISPLAY(dpy); |
659 | 728 | ctx = CTX(dpy); |
660 | 729 | |
730 | + if (va_FoolUnmapBuffer(dpy, buf_id)) | |
731 | + return VA_STATUS_SUCCESS; | |
661 | 732 | return ctx->vtable.vaUnmapBuffer( ctx, buf_id ); |
662 | 733 | } |
663 | 734 |
@@ -699,7 +770,11 @@ VAStatus vaBeginPicture ( | ||
699 | 770 | CHECK_DISPLAY(dpy); |
700 | 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 | 778 | return ctx->vtable.vaBeginPicture( ctx, context, render_target ); |
704 | 779 | } |
705 | 780 |
@@ -714,7 +789,11 @@ VAStatus vaRenderPicture ( | ||
714 | 789 | CHECK_DISPLAY(dpy); |
715 | 790 | ctx = CTX(dpy); |
716 | 791 | |
792 | + if (va_FoolRenderPicture(dpy, context, buffers, num_buffers)) | |
793 | + return VA_STATUS_SUCCESS; | |
794 | + | |
717 | 795 | VA_TRACE(va_TraceRenderPicture, dpy, context, buffers, num_buffers); |
796 | + | |
718 | 797 | return ctx->vtable.vaRenderPicture( ctx, context, buffers, num_buffers ); |
719 | 798 | } |
720 | 799 |
@@ -728,8 +807,15 @@ VAStatus vaEndPicture ( | ||
728 | 807 | CHECK_DISPLAY(dpy); |
729 | 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 | 815 | va_status = ctx->vtable.vaEndPicture( ctx, context ); |
816 | + | |
732 | 817 | VA_TRACE(va_TraceEndPicture, dpy, context); |
818 | + | |
733 | 819 | return va_status; |
734 | 820 | } |
735 | 821 |
@@ -742,6 +828,9 @@ VAStatus vaSyncSurface ( | ||
742 | 828 | CHECK_DISPLAY(dpy); |
743 | 829 | ctx = CTX(dpy); |
744 | 830 | |
831 | + if (va_FoolSyncSurface( dpy, render_target)) | |
832 | + return VA_STATUS_SUCCESS; | |
833 | + | |
745 | 834 | return ctx->vtable.vaSyncSurface( ctx, render_target ); |
746 | 835 | } |
747 | 836 |
@@ -953,6 +1042,8 @@ VAStatus vaQuerySubpictureFormats ( | ||
953 | 1042 | CHECK_DISPLAY(dpy); |
954 | 1043 | ctx = CTX(dpy); |
955 | 1044 | |
1045 | + if (va_FoolQuerySubpictureFormats(dpy, format_list, flags, num_formats)) | |
1046 | + return VA_STATUS_SUCCESS; | |
956 | 1047 | return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats); |
957 | 1048 | } |
958 | 1049 |
@@ -1096,10 +1187,16 @@ int vaMaxNumDisplayAttributes ( | ||
1096 | 1187 | VADisplay dpy |
1097 | 1188 | ) |
1098 | 1189 | { |
1190 | + int tmp; | |
1191 | + | |
1099 | 1192 | if( !vaDisplayIsValid(dpy) ) |
1100 | 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 | 1215 | CHECK_DISPLAY(dpy); |
1119 | 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 | 1241 | CHECK_DISPLAY(dpy); |
1138 | 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 | 1266 | CHECK_DISPLAY(dpy); |
1157 | 1267 | ctx = CTX(dpy); |
1158 | 1268 | |
1269 | + VA_TRACE(va_TraceSetDisplayAttributes, dpy, attr_list, num_attributes); | |
1270 | + | |
1271 | + | |
1159 | 1272 | return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes ); |
1160 | 1273 | } |
1161 | 1274 |
@@ -128,6 +128,8 @@ typedef int VAStatus; /* Return status type from functions */ | ||
128 | 128 | #define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014 |
129 | 129 | #define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015 |
130 | 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 | 133 | #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF |
132 | 134 | |
133 | 135 | /* De-interlacing flags for vaPutSurface() */ |
@@ -136,11 +138,19 @@ typedef int VAStatus; /* Return status type from functions */ | ||
136 | 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 | 149 | * Clears the drawable with background color. |
140 | 150 | * for hardware overlay based implementation this flag |
141 | 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 | 155 | /* Color space conversion flags for vaPutSurface() */ |
146 | 156 | #define VA_SRC_BT601 0x00000010 |
@@ -273,6 +283,7 @@ typedef struct _VAConfigAttrib { | ||
273 | 283 | #define VA_RC_NONE 0x00000001 |
274 | 284 | #define VA_RC_CBR 0x00000002 |
275 | 285 | #define VA_RC_VBR 0x00000004 |
286 | +#define VA_RC_VCM 0x00000008 /* video conference mode */ | |
276 | 287 | |
277 | 288 | /* |
278 | 289 | * if an attribute is not applicable for a given |
@@ -502,8 +513,75 @@ typedef enum | ||
502 | 513 | VAEncSliceParameterBufferType = 24, |
503 | 514 | VAEncH264VUIBufferType = 25, |
504 | 515 | VAEncH264SEIBufferType = 26, |
516 | + VAEncMiscParameterBufferType = 27, | |
517 | + VABufferTypeMax = 0xff | |
505 | 518 | } VABufferType; |
506 | 519 | |
520 | +typedef 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 | + */ | |
545 | +typedef struct _VAEncMiscParameterBuffer | |
546 | +{ | |
547 | + VAEncMiscParameterType type; | |
548 | + unsigned int data[0]; | |
549 | +} VAEncMiscParameterBuffer; | |
550 | + | |
551 | +typedef 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 | + | |
563 | +typedef 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 | + */ | |
573 | +typedef struct _VAEncMiscParameterMaxSliceSize | |
574 | +{ | |
575 | + unsigned int max_slice_size; | |
576 | +} VAEncMiscParameterMaxSliceSize; | |
577 | + | |
578 | +typedef 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 | 587 | * There will be cases where the bitstream buffer will not have enough room to hold |
@@ -1115,6 +1193,8 @@ typedef struct _VAEncSequenceParameterBufferH264 | ||
1115 | 1193 | unsigned char vui_flag; |
1116 | 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 */ | |
1118 | 1198 | typedef struct _VAEncPictureParameterBufferH264 |
1119 | 1199 | { |
1120 | 1200 | VASurfaceID reference_picture; |
@@ -1122,9 +1202,7 @@ typedef struct _VAEncPictureParameterBufferH264 | ||
1122 | 1202 | VABufferID coded_buf; |
1123 | 1203 | unsigned short picture_width; |
1124 | 1204 | unsigned short picture_height; |
1125 | - unsigned char last_picture; /* if set to 1 it indicates the last picture in the sequence | |
1126 | - * if set to 2 it indicates the last picture of the stream | |
1127 | - */ | |
1205 | + unsigned char last_picture; | |
1128 | 1206 | } VAEncPictureParameterBufferH264; |
1129 | 1207 | |
1130 | 1208 | /**************************** |
@@ -1225,9 +1303,26 @@ VAStatus vaBufferSetNumElements ( | ||
1225 | 1303 | /* |
1226 | 1304 | * device independent data structure for codedbuffer |
1227 | 1305 | */ |
1228 | -typedef struct _VACodedBufferSegment { | |
1229 | - unsigned int size; /* size of the data buffer in the coded buffer segment, in bytes */ | |
1230 | - unsigned int bit_offset;/* bit offset into the data buffer where valid bitstream data begins */ | |
1306 | + | |
1307 | +/* | |
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 | + */ | |
1321 | +typedef 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 | 1326 | void *buf; /* pointer to the beginning of the data buffer in the coded buffer segment */ |
1232 | 1327 | void *next; /* pointer to the next VACodedBufferSegment */ |
1233 | 1328 | } VACodedBufferSegment; |
@@ -1713,7 +1808,10 @@ typedef enum | ||
1713 | 1808 | VADisplayAttribContrast = 1, |
1714 | 1809 | VADisplayAttribHue = 2, |
1715 | 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 | 1815 | VADisplayAttribBackgroundColor = 4, |
1718 | 1816 | /* |
1719 | 1817 | * this is a gettable only attribute. For some implementations that use the |
@@ -1739,7 +1837,15 @@ typedef enum | ||
1739 | 1837 | * For type VADisplayAttribCSCMatrix, "value" field is a pointer to the color |
1740 | 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 | 1849 | } VADisplayAttribType; |
1744 | 1850 | |
1745 | 1851 | /* flags for VADisplayAttribute */ |
@@ -19,8 +19,8 @@ VADisplay vaGetDisplay ( | ||
19 | 19 | #endif |
20 | 20 | |
21 | 21 | #ifdef __cplusplus |
22 | -#ifdef ANDROID | |
23 | -#include <ui/ISurface.h> | |
22 | +#ifdef ANDROID | |
23 | +#include <surfaceflinger/ISurface.h> | |
24 | 24 | using namespace android; |
25 | 25 | |
26 | 26 | /* |
@@ -34,23 +34,87 @@ | ||
34 | 34 | #include <string.h> |
35 | 35 | #include <dlfcn.h> |
36 | 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 */ | |
38 | 57 | unsigned int trace_flag = 0; |
39 | 58 | |
40 | -static const char *trace_file = 0; | |
41 | -static FILE *trace_fp = 0; | |
59 | +/* LIBVA_TRACE_LOGSIZE */ | |
60 | +static unsigned int trace_logsize = 0xffffffff; /* truncate the log when the size is bigger than it */ | |
61 | + | |
62 | +/* LIBVA_TRACE_BUFDATA */ | |
63 | +static unsigned int trace_buffer_data; /* dump buffer data or not */ | |
64 | + | |
65 | +#define TRACE_CONTEXT_MAX 4 | |
66 | +/* per context settings */ | |
67 | +static 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 | |
43 | -static VASurfaceID trace_rendertarget; /* current render target */ | |
44 | -static VAProfile trace_profile; /* current entrypoint for buffers */ | |
110 | +/* Prototype declarations (functions defined in va.c) */ | |
45 | 111 | |
46 | -static unsigned int trace_frame; | |
47 | -static unsigned int trace_slice; | |
112 | +void va_errorMessage(const char *msg, ...); | |
113 | +void va_infoMessage(const char *msg, ...); | |
48 | 114 | |
49 | -static unsigned int trace_width; | |
50 | -static unsigned int trace_height; | |
115 | +int va_parseConfig(char *env, char *env_value); | |
51 | 116 | |
52 | -/* Prototypes (functions defined in va.c) */ | |
53 | -VAStatus vaBufferInfo ( | |
117 | +VAStatus vaBufferInfo( | |
54 | 118 | VADisplay dpy, |
55 | 119 | VAContextID context, /* in */ |
56 | 120 | VABufferID buf_id, /* in */ |
@@ -76,45 +140,263 @@ VAStatus vaUnlockSurface(VADisplay dpy, | ||
76 | 140 | VASurfaceID surface |
77 | 141 | ); |
78 | 142 | |
79 | -void va_TraceInit(void) | |
143 | + | |
144 | +void va_TraceInit(VADisplay dpy) | |
80 | 145 | { |
81 | - trace_file = (const char *)getenv("LIBVA_TRACE"); | |
82 | - if (trace_file) { | |
83 | - trace_fp = fopen(trace_file, "w"); | |
84 | - if (trace_fp) | |
85 | - trace_flag = 1; | |
146 | + char env_value[1024]; | |
147 | + unsigned int suffix = 0xffff & ((unsigned int)time(NULL)); | |
148 | + int trace_index = 0; | |
149 | + FILE *tmp; | |
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 | |
89 | -void va_TraceEnd(void) | |
226 | + | |
227 | +void va_TraceEnd(VADisplay dpy) | |
90 | 228 | { |
91 | - if (trace_file && trace_fp) { | |
92 | - fclose(trace_fp); | |
229 | + DPY2INDEX(dpy); | |
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; | |
95 | - trace_fp = NULL; | |
243 | +static unsigned int file_size(FILE *fp) | |
244 | +{ | |
245 | + struct stat buf; | |
96 | 246 | |
97 | - trace_flag = 0; | |
247 | + fstat(fileno(fp), &buf); | |
98 | 248 | |
99 | - trace_width = 0; | |
100 | - trace_height = 0; | |
101 | - } | |
249 | + return buf.st_size; | |
102 | 250 | } |
103 | 251 | |
104 | -void va_TraceMsg(const char *msg, ...) | |
252 | + | |
253 | +static void truncate_file(FILE *fp) | |
254 | +{ | |
255 | + ftruncate(fileno(fp), 0); | |
256 | + rewind(fp); | |
257 | +} | |
258 | + | |
259 | +void va_TraceMsg(int idx, const char *msg, ...) | |
105 | 260 | { |
106 | 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 | 266 | if (msg) { |
109 | 267 | va_start(args, msg); |
110 | - vfprintf(trace_fp, msg, args); | |
268 | + vfprintf(trace_context[idx].trace_fp_log, msg, args); | |
111 | 269 | va_end(args); |
112 | - } else { | |
113 | - fflush(trace_fp); | |
270 | + } else | |
271 | + fflush(trace_context[idx].trace_fp_log); | |
272 | +} | |
273 | + | |
274 | +void 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 | |
315 | +void 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 | + | |
118 | 400 | void va_TraceCreateConfig( |
119 | 401 | VADisplay dpy, |
120 | 402 | VAProfile profile, |
@@ -122,19 +404,23 @@ void va_TraceCreateConfig( | ||
122 | 404 | VAConfigAttrib *attrib_list, |
123 | 405 | int num_attribs, |
124 | 406 | VAConfigID *config_id /* out */ |
125 | - ) | |
407 | +) | |
126 | 408 | { |
127 | 409 | int i; |
410 | + DPY2INDEX(dpy); | |
411 | + | |
412 | + TRACE_FUNCNAME(idx); | |
128 | 413 | |
129 | - va_TraceMsg("\tprofile = %d\n", profile); | |
130 | - va_TraceMsg("\tentrypoint = %d\n", entrypoint); | |
131 | - va_TraceMsg("\tnum_attribs = %d\n", num_attribs); | |
414 | + va_TraceMsg(idx, "\tprofile = %d\n", profile); | |
415 | + va_TraceMsg(idx, "\tentrypoint = %d\n", entrypoint); | |
416 | + va_TraceMsg(idx, "\tnum_attribs = %d\n", num_attribs); | |
132 | 417 | for (i = 0; i < num_attribs; i++) { |
133 | - va_TraceMsg("\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); | |
418 | + va_TraceMsg(idx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type); | |
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 | 431 | int format, |
146 | 432 | int num_surfaces, |
147 | 433 | VASurfaceID *surfaces /* out */ |
148 | - ) | |
434 | +) | |
149 | 435 | { |
150 | 436 | int i; |
437 | + DPY2INDEX(dpy); | |
438 | + | |
439 | + TRACE_FUNCNAME(idx); | |
151 | 440 | |
152 | - va_TraceMsg("\twidth = %d\n", width); | |
153 | - va_TraceMsg("\theight = %d\n", height); | |
154 | - va_TraceMsg("\tformat = %d\n", format); | |
155 | - va_TraceMsg("\tnum_surfaces = %d\n", num_surfaces); | |
441 | + va_TraceMsg(idx, "\twidth = %d\n", width); | |
442 | + va_TraceMsg(idx, "\theight = %d\n", height); | |
443 | + va_TraceMsg(idx, "\tformat = %d\n", format); | |
444 | + va_TraceMsg(idx, "\tnum_surfaces = %d\n", num_surfaces); | |
156 | 445 | |
157 | 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 | 457 | VASurfaceID *render_targets, |
169 | 458 | int num_render_targets, |
170 | 459 | VAContextID *context /* out */ |
171 | - ) | |
460 | +) | |
172 | 461 | { |
173 | 462 | int i; |
463 | + DPY2INDEX(dpy); | |
174 | 464 | |
175 | - va_TraceMsg("\twidth = %d\n", picture_width); | |
176 | - va_TraceMsg("\theight = %d\n", picture_height); | |
177 | - va_TraceMsg("\tflag = 0x%08x\n", flag); | |
178 | - va_TraceMsg("\tnum_render_targets = %d\n", num_render_targets); | |
465 | + TRACE_FUNCNAME(idx); | |
466 | + | |
467 | + va_TraceMsg(idx, "\twidth = %d\n", picture_width); | |
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 | 471 | for (i=0; i<num_render_targets; i++) |
180 | - va_TraceMsg("\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]); | |
181 | - va_TraceMsg("\tcontext = 0x%08x\n", context); | |
472 | + va_TraceMsg(idx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]); | |
473 | + va_TraceMsg(idx, "\tcontext = 0x%08x\n", *context); | |
182 | 474 | |
183 | 475 | |
184 | - trace_frame = 0; | |
185 | - trace_slice = 0; | |
476 | + trace_context[idx].trace_context = *context; | |
186 | 477 | |
187 | - trace_width = picture_width; | |
188 | - trace_height = picture_height; | |
478 | + trace_context[idx].trace_frame_no = 0; | |
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 | 501 | case VAEncSequenceParameterBufferType: return "VAEncSequenceParameterBufferType"; |
208 | 502 | case VAEncPictureParameterBufferType: return "VAEncPictureParameterBufferType"; |
209 | 503 | case VAEncSliceParameterBufferType: return "VAEncSliceParameterBufferType"; |
504 | + case VAEncMiscParameterBufferType: return "VAEncMiscParameterBufferType"; | |
210 | 505 | default: return "UnknowBuffer"; |
211 | 506 | } |
212 | 507 | } |
213 | 508 | |
509 | +void 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 | |
215 | -static int va_TraceVABuffers( | |
552 | +static void va_TraceVABuffers( | |
216 | 553 | VADisplay dpy, |
217 | 554 | VAContextID context, |
218 | 555 | VABufferID buffer, |
@@ -220,21 +557,30 @@ static int va_TraceVABuffers( | ||
220 | 557 | unsigned int size, |
221 | 558 | unsigned int num_elements, |
222 | 559 | void *pbuf |
223 | - ) | |
560 | +) | |
224 | 561 | { |
225 | - int i; | |
562 | + unsigned int i; | |
226 | 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 | 569 | for (i=0; i<size; i++) { |
231 | - if ((i%16) == 0) | |
232 | - va_TraceMsg("\n0x%08x:", i); | |
233 | - va_TraceMsg(" %02x", p[i]); | |
570 | + unsigned char value = p[i]; | |
571 | + | |
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"); | |
237 | - return 0; | |
581 | + va_TraceMsg(idx, "\tchecksum = 0x%02x\n", check_sum & 0xff); | |
582 | + | |
583 | + return; | |
238 | 584 | } |
239 | 585 | |
240 | 586 |
@@ -247,6 +593,8 @@ static void va_TraceVAPictureParameterBufferMPEG2( | ||
247 | 593 | unsigned int num_elements, |
248 | 594 | void *data) |
249 | 595 | { |
596 | + DPY2INDEX(dpy); | |
597 | + | |
250 | 598 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); |
251 | 599 | |
252 | 600 | return; |
@@ -262,6 +610,8 @@ static void va_TraceVAIQMatrixBufferMPEG2( | ||
262 | 610 | unsigned int num_elements, |
263 | 611 | void *data) |
264 | 612 | { |
613 | + DPY2INDEX(dpy); | |
614 | + | |
265 | 615 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); |
266 | 616 | |
267 | 617 | return; |
@@ -277,6 +627,12 @@ static void va_TraceVASliceParameterBufferMPEG2( | ||
277 | 627 | unsigned int num_elements, |
278 | 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 | 636 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); |
281 | 637 | |
282 | 638 | return; |
@@ -293,6 +649,8 @@ static void va_TraceVAPictureParameterBufferMPEG4( | ||
293 | 649 | unsigned int num_elements, |
294 | 650 | void *data) |
295 | 651 | { |
652 | + DPY2INDEX(dpy); | |
653 | + | |
296 | 654 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); |
297 | 655 | |
298 | 656 | return; |
@@ -308,6 +666,9 @@ static void va_TraceVAIQMatrixBufferMPEG4( | ||
308 | 666 | unsigned int num_elements, |
309 | 667 | void *data) |
310 | 668 | { |
669 | + DPY2INDEX(dpy); | |
670 | + | |
671 | + /* todo: log VAIQMatrixBufferMPEG4 */ | |
311 | 672 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); |
312 | 673 | |
313 | 674 | return; |
@@ -323,6 +684,12 @@ static void va_TraceVASliceParameterBufferMPEG4( | ||
323 | 684 | unsigned int num_elements, |
324 | 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 | 693 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); |
327 | 694 | |
328 | 695 | return; |
@@ -339,76 +706,59 @@ static void va_TraceVAPictureParameterBufferH264( | ||
339 | 706 | void *data) |
340 | 707 | { |
341 | 708 | int i; |
342 | - | |
709 | + DPY2INDEX(dpy); | |
710 | + | |
343 | 711 | VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data; |
344 | 712 | |
345 | - va_TraceMsg ("==========H264PicParameterBuffer============\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); | |
713 | + va_TraceMsg(idx, "VAPictureParameterBufferH264\n"); | |
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 | 722 | for (i = 0; i < 16; i++) |
376 | 723 | { |
377 | - if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID) | |
378 | - { | |
379 | - //va_TraceMsg("%d-%d; ", p->ReferenceFrames[i].TopFieldOrderCnt, p->ReferenceFrames[i].BottomFieldOrderCnt); | |
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); | |
381 | - } | |
724 | + if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID) { | |
725 | + va_TraceMsg(idx, "\t\t%d-%d-%d-%d\n", | |
726 | + p->ReferenceFrames[i].TopFieldOrderCnt, | |
727 | + p->ReferenceFrames[i].BottomFieldOrderCnt, | |
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"); | |
384 | -#endif | |
385 | - va_TraceMsg("picture_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); | |
387 | - va_TraceMsg("bit_depth_luma_minus8: %d\n", p->bit_depth_luma_minus8); | |
388 | - va_TraceMsg("bit_depth_chroma_minus8: %d\n", p->bit_depth_chroma_minus8); | |
389 | - va_TraceMsg("num_ref_frames: %d\n", p->num_ref_frames); | |
390 | - va_TraceMsg("seq fields: %d\n", p->seq_fields.value); | |
391 | - va_TraceMsg("\t chroma_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); | |
393 | - va_TraceMsg("\t frame_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); | |
395 | - va_TraceMsg("\t direct_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); | |
397 | - va_TraceMsg("num_slice_groups_minus1: %d\n", p->num_slice_groups_minus1); | |
398 | - va_TraceMsg("slice_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); | |
400 | - va_TraceMsg("pic_init_qp_minus26: %d\n", p->pic_init_qp_minus26); | |
401 | - va_TraceMsg("pic_init_qs_minus26: %d\n", p->pic_init_qs_minus26); | |
402 | - va_TraceMsg("chroma_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); | |
404 | - va_TraceMsg("pic_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); | |
406 | - va_TraceMsg("\t weighted_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); | |
408 | - va_TraceMsg("\t transform_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); | |
410 | - va_TraceMsg("\t constrained_intra_pred_flag: %d\n", p->pic_fields.bits.constrained_intra_pred_flag); | |
411 | - va_TraceMsg("frame_num: %d\n", p->frame_num); | |
733 | + va_TraceMsg(idx, "\n"); | |
734 | + | |
735 | + va_TraceMsg(idx, "\tpicture_width_in_mbs_minus1 = %d\n", p->picture_width_in_mbs_minus1); | |
736 | + va_TraceMsg(idx, "\tpicture_height_in_mbs_minus1 = %d\n", p->picture_height_in_mbs_minus1); | |
737 | + va_TraceMsg(idx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8); | |
738 | + va_TraceMsg(idx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8); | |
739 | + va_TraceMsg(idx, "\tnum_ref_frames = %d\n", p->num_ref_frames); | |
740 | + va_TraceMsg(idx, "\tseq fields = %d\n", p->seq_fields.value); | |
741 | + va_TraceMsg(idx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc); | |
742 | + va_TraceMsg(idx, "\tresidual_colour_transform_flag = %d\n", p->seq_fields.bits.residual_colour_transform_flag); | |
743 | + va_TraceMsg(idx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag); | |
744 | + va_TraceMsg(idx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag); | |
745 | + va_TraceMsg(idx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag); | |
746 | + va_TraceMsg(idx, "\tMinLumaBiPredSize8x8 = %d\n", p->seq_fields.bits.MinLumaBiPredSize8x8); | |
747 | + va_TraceMsg(idx, "\tnum_slice_groups_minus1 = %d\n", p->num_slice_groups_minus1); | |
748 | + va_TraceMsg(idx, "\tslice_group_map_type = %d\n", p->slice_group_map_type); | |
749 | + va_TraceMsg(idx, "\tslice_group_change_rate_minus1 = %d\n", p->slice_group_change_rate_minus1); | |
750 | + va_TraceMsg(idx, "\tpic_init_qp_minus26 = %d\n", p->pic_init_qp_minus26); | |
751 | + va_TraceMsg(idx, "\tpic_init_qs_minus26 = %d\n", p->pic_init_qs_minus26); | |
752 | + va_TraceMsg(idx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset); | |
753 | + va_TraceMsg(idx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset); | |
754 | + va_TraceMsg(idx, "\tpic_fields = %d\n", p->pic_fields.value); | |
755 | + va_TraceMsg(idx, "\tentropy_coding_mode_flag = %d\n", p->pic_fields.bits.entropy_coding_mode_flag); | |
756 | + va_TraceMsg(idx, "\tweighted_pred_flag = %d\n", p->pic_fields.bits.weighted_pred_flag); | |
757 | + va_TraceMsg(idx, "\tweighted_bipred_idc = %d\n", p->pic_fields.bits.weighted_bipred_idc); | |
758 | + va_TraceMsg(idx, "\ttransform_8x8_mode_flag = %d\n", p->pic_fields.bits.transform_8x8_mode_flag); | |
759 | + va_TraceMsg(idx, "\tfield_pic_flag = %d\n", p->pic_fields.bits.field_pic_flag); | |
760 | + va_TraceMsg(idx, "\tconstrained_intra_pred_flag = %d\n", p->pic_fields.bits.constrained_intra_pred_flag); | |
761 | + va_TraceMsg(idx, "\tframe_num = %d\n", p->frame_num); | |
412 | 762 | |
413 | 763 | return; |
414 | 764 | } |
@@ -424,93 +774,78 @@ static void va_TraceVASliceParameterBufferH264( | ||
424 | 774 | { |
425 | 775 | int i; |
426 | 776 | VASliceParameterBufferH264* p = (VASliceParameterBufferH264*)data; |
427 | - | |
428 | - va_TraceMsg ("========== SLICE HEADER ============.\n"); | |
429 | - va_TraceMsg("slice_data_size: %d\n", p->slice_data_size); | |
430 | - va_TraceMsg("slice_data_offset: %d\n", p->slice_data_offset); | |
431 | - va_TraceMsg("slice_data_flag: %d\n", p->slice_data_flag); | |
432 | - va_TraceMsg("slice_data_bit_offset: %d\n", p->slice_data_bit_offset); | |
433 | - va_TraceMsg("first_mb_in_slice: %d\n", p->first_mb_in_slice); | |
434 | - va_TraceMsg("slice_type: %d\n", p->slice_type); | |
435 | - va_TraceMsg("direct_spatial_mv_pred_flag: %d\n", p->direct_spatial_mv_pred_flag); | |
436 | - va_TraceMsg("num_ref_idx_l0_active_minus1: %d\n", p->num_ref_idx_l0_active_minus1); | |
437 | - va_TraceMsg("num_ref_idx_l1_active_minus1: %d\n", p->num_ref_idx_l1_active_minus1); | |
438 | - va_TraceMsg("cabac_init_idc: %d\n", p->cabac_init_idc); | |
439 | - va_TraceMsg("slice_qp_delta: %d\n", p->slice_qp_delta); | |
440 | - va_TraceMsg("disable_deblocking_filter_idc: %d\n", p->disable_deblocking_filter_idc); | |
441 | - va_TraceMsg("slice_alpha_c0_offset_div2: %d\n", p->slice_alpha_c0_offset_div2); | |
442 | - va_TraceMsg("slice_beta_offset_div2: %d\n", p->slice_beta_offset_div2); | |
443 | - | |
444 | -#if 1 | |
445 | - if (p->slice_type == 0 || p->slice_type == 1) | |
446 | - { | |
447 | - va_TraceMsg("RefPicList0:\n"); | |
448 | - for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1; i++) | |
449 | - { | |
450 | - //va_TraceMsg("%d-%d; ", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt); | |
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); | |
777 | + DPY2INDEX(dpy); | |
778 | + | |
779 | + trace_context[idx].trace_slice_no++; | |
780 | + trace_context[idx].trace_slice_size = p->slice_data_size; | |
781 | + | |
782 | + va_TraceMsg(idx, "VASliceParameterBufferH264\n"); | |
783 | + va_TraceMsg(idx, "\tslice_data_size = %d\n", p->slice_data_size); | |
784 | + va_TraceMsg(idx, "\tslice_data_offset = %d\n", p->slice_data_offset); | |
785 | + va_TraceMsg(idx, "\tslice_data_flag = %d\n", p->slice_data_flag); | |
786 | + va_TraceMsg(idx, "\tslice_data_bit_offset = %d\n", p->slice_data_bit_offset); | |
787 | + va_TraceMsg(idx, "\tfirst_mb_in_slice = %d\n", p->first_mb_in_slice); | |
788 | + va_TraceMsg(idx, "\tslice_type = %d\n", p->slice_type); | |
789 | + va_TraceMsg(idx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag); | |
790 | + va_TraceMsg(idx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1); | |
791 | + va_TraceMsg(idx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1); | |
792 | + va_TraceMsg(idx, "\tcabac_init_idc = %d\n", p->cabac_init_idc); | |
793 | + va_TraceMsg(idx, "\tslice_qp_delta = %d\n", p->slice_qp_delta); | |
794 | + va_TraceMsg(idx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc); | |
795 | + va_TraceMsg(idx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2); | |
796 | + va_TraceMsg(idx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2); | |
797 | + | |
798 | + if (p->slice_type == 0 || p->slice_type == 1) { | |
799 | + va_TraceMsg(idx, "\tRefPicList0 ="); | |
800 | + for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1; i++) { | |
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"); | |
454 | - if (p->slice_type == 1) | |
455 | - { | |
456 | - va_TraceMsg("RefPicList1:\n"); | |
803 | + if (p->slice_type == 1) { | |
804 | + va_TraceMsg(idx, "\tRefPicList1 ="); | |
457 | 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); | |
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); | |
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); | |
461 | 808 | } |
462 | 809 | } |
463 | - va_TraceMsg("\n"); | |
464 | 810 | } |
465 | -#endif | |
466 | - | |
467 | - va_TraceMsg("luma_log2_weight_denom: %d\n", p->luma_log2_weight_denom); | |
468 | - va_TraceMsg("chroma_log2_weight_denom: %d\n", p->chroma_log2_weight_denom); | |
469 | - va_TraceMsg("luma_weight_l0_flag: %d\n", p->luma_weight_l0_flag); | |
470 | - if (p->luma_weight_l0_flag) | |
471 | - { | |
472 | - for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) | |
473 | - { | |
474 | - va_TraceMsg("%d ", p->luma_weight_l0[i]); | |
475 | - va_TraceMsg("%d ", p->luma_offset_l0[i]); | |
811 | + | |
812 | + va_TraceMsg(idx, "\tluma_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); | |
814 | + va_TraceMsg(idx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag); | |
815 | + if (p->luma_weight_l0_flag) { | |
816 | + for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) { | |
817 | + va_TraceMsg(idx, "\t%d ", p->luma_weight_l0[i]); | |
818 | + va_TraceMsg(idx, "\t%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); | |
482 | - if (p->chroma_weight_l0_flag) | |
483 | - { | |
484 | - for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) | |
485 | - { | |
486 | - va_TraceMsg("%d ", p->chroma_weight_l0[i][0]); | |
487 | - va_TraceMsg("%d ", p->chroma_offset_l0[i][0]); | |
488 | - va_TraceMsg("%d ", p->chroma_weight_l0[i][1]); | |
489 | - va_TraceMsg("%d ", p->chroma_offset_l0[i][1]); | |
822 | + va_TraceMsg(idx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag); | |
823 | + if (p->chroma_weight_l0_flag) { | |
824 | + 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]); | |
826 | + va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][0]); | |
827 | + va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][1]); | |
828 | + va_TraceMsg(idx, "\t\t%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); | |
494 | - if (p->luma_weight_l1_flag) | |
495 | - { | |
496 | - for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) | |
497 | - { | |
498 | - va_TraceMsg("%d ", p->luma_weight_l1[i]); | |
499 | - va_TraceMsg("%d ", p->luma_offset_l1[i]); | |
831 | + | |
832 | + va_TraceMsg(idx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag); | |
833 | + if (p->luma_weight_l1_flag) { | |
834 | + for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) { | |
835 | + va_TraceMsg(idx, "\t\t%d ", p->luma_weight_l1[i]); | |
836 | + va_TraceMsg(idx, "\t\t%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); | |
504 | - if (p->chroma_weight_l1_flag) | |
505 | - { | |
506 | - for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) | |
507 | - { | |
508 | - va_TraceMsg("%d ", p->chroma_weight_l1[i][0]); | |
509 | - va_TraceMsg("%d ", p->chroma_offset_l1[i][0]); | |
510 | - va_TraceMsg("%d ", p->chroma_weight_l1[i][1]); | |
511 | - va_TraceMsg("%d ", p->chroma_offset_l1[i][1]); | |
839 | + | |
840 | + va_TraceMsg(idx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag); | |
841 | + if (p->chroma_weight_l1_flag) { | |
842 | + for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) { | |
843 | + va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][0]); | |
844 | + va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][0]); | |
845 | + va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][1]); | |
846 | + va_TraceMsg(idx, "\t\t%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 | 859 | void *data |
525 | 860 | ) |
526 | 861 | { |
527 | - va_TraceMsg("========== IQMatrix ============.\n"); | |
528 | 862 | VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data; |
529 | 863 | int i, j; |
530 | - for (i = 0; i < 6; i++) | |
531 | - { | |
532 | - for (j = 0; j < 16; j++) | |
533 | - { | |
534 | - va_TraceMsg("%d\t", p->ScalingList4x4[i][j]); | |
864 | + DPY2INDEX(dpy); | |
865 | + | |
866 | + va_TraceMsg(idx, "VAIQMatrixBufferH264\n"); | |
867 | + | |
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 | 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++) | |
541 | - { | |
542 | - for (j = 0; j < 64; j++) | |
543 | - { | |
544 | - va_TraceMsg("%d\t", p->ScalingList8x8[i][j]); | |
877 | + va_TraceMsg(idx, "\tScalingList8x8[2][64]=\n"); | |
878 | + for (i = 0; i < 2; i++) { | |
879 | + for (j = 0; j < 64; j++) { | |
880 | + va_TraceMsg(idx, "\t%d", p->ScalingList8x8[i][j]); | |
545 | 881 | if ((j + 1) % 8 == 0) |
546 | - va_TraceMsg("\n"); | |
882 | + va_TraceMsg(idx, "\n"); | |
547 | 883 | } |
548 | 884 | } |
549 | 885 | } |
550 | 886 | |
887 | +static 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 | + | |
920 | +static 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 | + | |
946 | +static 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 | + | |
968 | +static 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 | + | |
551 | 1027 | static void va_TraceVAPictureParameterBufferVC1( |
552 | 1028 | VADisplay dpy, |
553 | 1029 | VAContextID context, |
@@ -559,174 +1035,96 @@ static void va_TraceVAPictureParameterBufferVC1( | ||
559 | 1035 | ) |
560 | 1036 | { |
561 | 1037 | VAPictureParameterBufferVC1* p = (VAPictureParameterBufferVC1*)data; |
562 | - | |
563 | - va_TraceMsg("\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture); | |
564 | - va_TraceMsg("\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture); | |
565 | - va_TraceMsg("\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture); | |
566 | - | |
567 | - va_TraceMsg("\tpulldown = %d\n", p->sequence_fields.bits.pulldown); | |
568 | - va_TraceMsg("\tinterlace = %d\n", p->sequence_fields.bits.interlace); | |
569 | - va_TraceMsg("\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag); | |
570 | - va_TraceMsg("\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag); | |
571 | - va_TraceMsg("\tpsf = %d.\n", | |
572 | - p->sequence_fields.bits.psf); | |
573 | - va_TraceMsg("\tmultires = %d.\n", | |
574 | - p->sequence_fields.bits.multires); | |
575 | - va_TraceMsg("\toverlap = %d.\n", | |
576 | - p->sequence_fields.bits.overlap); | |
577 | - va_TraceMsg("\tsyncmarker = %d.\n", | |
578 | - p->sequence_fields.bits.syncmarker); | |
579 | - va_TraceMsg("\trangered = %d.\n", | |
580 | - p->sequence_fields.bits.rangered); | |
581 | - va_TraceMsg("\tmax_b_frames = %d.\n", | |
582 | - p->sequence_fields.bits.max_b_frames); | |
583 | - va_TraceMsg("\tcoded_width = %d.\n", | |
584 | - p->coded_width); | |
585 | - va_TraceMsg("\tcoded_height = %d.\n", | |
586 | - p->coded_height); | |
587 | - va_TraceMsg("\tclosed_entry = %d.\n", | |
588 | - p->entrypoint_fields.bits.closed_entry); | |
589 | - va_TraceMsg("\tbroken_link = %d.\n", | |
590 | - p->entrypoint_fields.bits.broken_link); | |
591 | - va_TraceMsg("\tclosed_entry = %d.\n", | |
592 | - p->entrypoint_fields.bits.closed_entry); | |
593 | - va_TraceMsg("\tpanscan_flag = %d.\n", | |
594 | - p->entrypoint_fields.bits.panscan_flag); | |
595 | - va_TraceMsg("\tloopfilter = %d.\n", | |
596 | - p->entrypoint_fields.bits.loopfilter); | |
597 | - va_TraceMsg("\tconditional_overlap_flag = %d.\n", | |
598 | - p->conditional_overlap_flag); | |
599 | - va_TraceMsg("\tfast_uvmc_flag = %d.\n", | |
600 | - p->fast_uvmc_flag); | |
601 | - va_TraceMsg("\trange_mapping_luma_flag = %d.\n", | |
602 | - p->range_mapping_fields.bits.luma_flag); | |
603 | - va_TraceMsg("\trange_mapping_luma = %d.\n", | |
604 | - p->range_mapping_fields.bits.luma); | |
605 | - va_TraceMsg("\trange_mapping_chroma_flag = %d.\n", | |
606 | - p->range_mapping_fields.bits.chroma_flag); | |
607 | - va_TraceMsg("\trange_mapping_chroma = %d.\n", | |
608 | - p->range_mapping_fields.bits.chroma); | |
609 | - va_TraceMsg("\tb_picture_fraction = %d.\n", | |
610 | - p->b_picture_fraction); | |
611 | - va_TraceMsg("\tcbp_table = %d.\n", | |
612 | - p->cbp_table); | |
613 | - va_TraceMsg("\tmb_mode_table = %d.\n", | |
614 | - p->mb_mode_table); | |
615 | - va_TraceMsg("\trange_reduction_frame = %d.\n", | |
616 | - p->range_reduction_frame); | |
617 | - va_TraceMsg("\trounding_control = %d.\n", | |
618 | - p->rounding_control); | |
619 | - va_TraceMsg("\tpost_processing = %d.\n", | |
620 | - p->post_processing); | |
621 | - va_TraceMsg("\tpicture_resolution_index = %d.\n", | |
622 | - p->picture_resolution_index); | |
623 | - va_TraceMsg("\tluma_scale = %d.\n", | |
624 | - p->luma_scale); | |
625 | - va_TraceMsg("\tluma_shift = %d.\n", | |
626 | - p->luma_shift); | |
627 | - va_TraceMsg("\tpicture_type = %d.\n", | |
628 | - p->picture_fields.bits.picture_type); | |
629 | - va_TraceMsg("\tframe_coding_mode = %d.\n", | |
630 | - p->picture_fields.bits.frame_coding_mode); | |
631 | - va_TraceMsg("\ttop_field_first = %d.\n", | |
632 | - p->picture_fields.bits.top_field_first); | |
633 | - va_TraceMsg("\tis_first_field = %d.\n", | |
634 | - p->picture_fields.bits.is_first_field); | |
635 | - va_TraceMsg("\tintensity_compensation = %d.\n", | |
636 | - p->picture_fields.bits.intensity_compensation); | |
637 | - va_TraceMsg(" ---------------------------------\n"); | |
638 | - va_TraceMsg("\tmv_type_mb = %d.\n", | |
639 | - p->raw_coding.flags.mv_type_mb); | |
640 | - va_TraceMsg("\tdirect_mb = %d.\n", | |
641 | - p->raw_coding.flags.direct_mb); | |
642 | - va_TraceMsg("\tskip_mb = %d.\n", | |
643 | - p->raw_coding.flags.skip_mb); | |
644 | - va_TraceMsg("\tfield_tx = %d.\n", | |
645 | - p->raw_coding.flags.field_tx); | |
646 | - va_TraceMsg("\tforward_mb = %d.\n", | |
647 | - p->raw_coding.flags.forward_mb); | |
648 | - va_TraceMsg("\tac_pred = %d.\n", | |
649 | - p->raw_coding.flags.ac_pred); | |
650 | - va_TraceMsg("\toverflags = %d.\n", | |
651 | - p->raw_coding.flags.overflags); | |
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); | |
1038 | + DPY2INDEX(dpy); | |
1039 | + | |
1040 | + va_TraceMsg(idx, "VAPictureParameterBufferVC1\n"); | |
1041 | + | |
1042 | + va_TraceMsg(idx, "\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture); | |
1043 | + va_TraceMsg(idx, "\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture); | |
1044 | + va_TraceMsg(idx, "\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture); | |
1045 | + | |
1046 | + va_TraceMsg(idx, "\tpulldown = %d\n", p->sequence_fields.bits.pulldown); | |
1047 | + va_TraceMsg(idx, "\tinterlace = %d\n", p->sequence_fields.bits.interlace); | |
1048 | + va_TraceMsg(idx, "\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag); | |
1049 | + va_TraceMsg(idx, "\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag); | |
1050 | + va_TraceMsg(idx, "\tpsf = %d\n", p->sequence_fields.bits.psf); | |
1051 | + va_TraceMsg(idx, "\tmultires = %d\n", p->sequence_fields.bits.multires); | |
1052 | + va_TraceMsg(idx, "\toverlap = %d\n", p->sequence_fields.bits.overlap); | |
1053 | + va_TraceMsg(idx, "\tsyncmarker = %d\n", p->sequence_fields.bits.syncmarker); | |
1054 | + va_TraceMsg(idx, "\trangered = %d\n", p->sequence_fields.bits.rangered); | |
1055 | + va_TraceMsg(idx, "\tmax_b_frames = %d\n", p->sequence_fields.bits.max_b_frames); | |
1056 | + va_TraceMsg(idx, "\tcoded_width = %d\n", p->coded_width); | |
1057 | + va_TraceMsg(idx, "\tcoded_height = %d\n", p->coded_height); | |
1058 | + va_TraceMsg(idx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry); | |
1059 | + va_TraceMsg(idx, "\tbroken_link = %d\n", p->entrypoint_fields.bits.broken_link); | |
1060 | + va_TraceMsg(idx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry); | |
1061 | + va_TraceMsg(idx, "\tpanscan_flag = %d\n", p->entrypoint_fields.bits.panscan_flag); | |
1062 | + va_TraceMsg(idx, "\tloopfilter = %d\n", p->entrypoint_fields.bits.loopfilter); | |
1063 | + va_TraceMsg(idx, "\tconditional_overlap_flag = %d\n", p->conditional_overlap_flag); | |
1064 | + va_TraceMsg(idx, "\tfast_uvmc_flag = %d\n", p->fast_uvmc_flag); | |
1065 | + va_TraceMsg(idx, "\trange_mapping_luma_flag = %d\n", p->range_mapping_fields.bits.luma_flag); | |
1066 | + va_TraceMsg(idx, "\trange_mapping_luma = %d\n", p->range_mapping_fields.bits.luma); | |
1067 | + va_TraceMsg(idx, "\trange_mapping_chroma_flag = %d\n", p->range_mapping_fields.bits.chroma_flag); | |
1068 | + va_TraceMsg(idx, "\trange_mapping_chroma = %d\n", p->range_mapping_fields.bits.chroma); | |
1069 | + va_TraceMsg(idx, "\tb_picture_fraction = %d\n", p->b_picture_fraction); | |
1070 | + va_TraceMsg(idx, "\tcbp_table = %d\n", p->cbp_table); | |
1071 | + va_TraceMsg(idx, "\tmb_mode_table = %d\n", p->mb_mode_table); | |
1072 | + va_TraceMsg(idx, "\trange_reduction_frame = %d\n", p->range_reduction_frame); | |
1073 | + va_TraceMsg(idx, "\trounding_control = %d\n", p->rounding_control); | |
1074 | + va_TraceMsg(idx, "\tpost_processing = %d\n", p->post_processing); | |
1075 | + va_TraceMsg(idx, "\tpicture_resolution_index = %d\n", p->picture_resolution_index); | |
1076 | + va_TraceMsg(idx, "\tluma_scale = %d\n", p->luma_scale); | |
1077 | + va_TraceMsg(idx, "\tluma_shift = %d\n", p->luma_shift); | |
1078 | + va_TraceMsg(idx, "\tpicture_type = %d\n", p->picture_fields.bits.picture_type); | |
1079 | + va_TraceMsg(idx, "\tframe_coding_mode = %d\n", p->picture_fields.bits.frame_coding_mode); | |
1080 | + va_TraceMsg(idx, "\ttop_field_first = %d\n", p->picture_fields.bits.top_field_first); | |
1081 | + va_TraceMsg(idx, "\tis_first_field = %d\n", p->picture_fields.bits.is_first_field); | |
1082 | + va_TraceMsg(idx, "\tintensity_compensation = %d\n", p->picture_fields.bits.intensity_compensation); | |
1083 | + va_TraceMsg(idx, "\tmv_type_mb = %d\n", p->raw_coding.flags.mv_type_mb); | |
1084 | + va_TraceMsg(idx, "\tdirect_mb = %d\n", p->raw_coding.flags.direct_mb); | |
1085 | + va_TraceMsg(idx, "\tskip_mb = %d\n", p->raw_coding.flags.skip_mb); | |
1086 | + va_TraceMsg(idx, "\tfield_tx = %d\n", p->raw_coding.flags.field_tx); | |
1087 | + va_TraceMsg(idx, "\tforward_mb = %d\n", p->raw_coding.flags.forward_mb); | |
1088 | + va_TraceMsg(idx, "\tac_pred = %d\n", p->raw_coding.flags.ac_pred); | |
1089 | + va_TraceMsg(idx, "\toverflags = %d\n", p->raw_coding.flags.overflags); | |
1090 | + va_TraceMsg(idx, "\tbp_mv_type_mb = %d\n", p->bitplane_present.flags.bp_mv_type_mb); | |
1091 | + va_TraceMsg(idx, "\tbp_direct_mb = %d\n", p->bitplane_present.flags.bp_direct_mb); | |
1092 | + va_TraceMsg(idx, "\tbp_skip_mb = %d\n", p->bitplane_present.flags.bp_skip_mb); | |
1093 | + va_TraceMsg(idx, "\tbp_field_tx = %d\n", p->bitplane_present.flags.bp_field_tx); | |
1094 | + va_TraceMsg(idx, "\tbp_forward_mb = %d\n", p->bitplane_present.flags.bp_forward_mb); | |
1095 | + va_TraceMsg(idx, "\tbp_ac_pred = %d\n", p->bitplane_present.flags.bp_ac_pred); | |
1096 | + va_TraceMsg(idx, "\tbp_overflags = %d\n", p->bitplane_present.flags.bp_overflags); | |
1097 | + va_TraceMsg(idx, "\treference_distance_flag = %d\n", p->reference_fields.bits.reference_distance_flag); | |
1098 | + va_TraceMsg(idx, "\treference_distance = %d\n", p->reference_fields.bits.reference_distance); | |
1099 | + va_TraceMsg(idx, "\tnum_reference_pictures = %d\n", p->reference_fields.bits.num_reference_pictures); | |
1100 | + va_TraceMsg(idx, "\treference_field_pic_indicator = %d\n", p->reference_fields.bits.reference_field_pic_indicator); | |
1101 | + va_TraceMsg(idx, "\tmv_mode = %d\n", p->mv_fields.bits.mv_mode); | |
1102 | + va_TraceMsg(idx, "\tmv_mode2 = %d\n", p->mv_fields.bits.mv_mode2); | |
1103 | + va_TraceMsg(idx, "\tmv_table = %d\n", p->mv_fields.bits.mv_table); | |
1104 | + va_TraceMsg(idx, "\ttwo_mv_block_pattern_table = %d\n", p->mv_fields.bits.two_mv_block_pattern_table); | |
1105 | + va_TraceMsg(idx, "\tfour_mv_switch = %d\n", p->mv_fields.bits.four_mv_switch); | |
1106 | + va_TraceMsg(idx, "\tfour_mv_block_pattern_table = %d\n", p->mv_fields.bits.four_mv_block_pattern_table); | |
1107 | + va_TraceMsg(idx, "\textended_mv_flag = %d\n", p->mv_fields.bits.extended_mv_flag); | |
1108 | + va_TraceMsg(idx, "\textended_mv_range = %d\n", p->mv_fields.bits.extended_mv_range); | |
1109 | + va_TraceMsg(idx, "\textended_dmv_flag = %d\n", p->mv_fields.bits.extended_dmv_flag); | |
1110 | + va_TraceMsg(idx, "\textended_dmv_range = %d\n", p->mv_fields.bits.extended_dmv_range); | |
1111 | + va_TraceMsg(idx, "\tdquant = %d\n", p->pic_quantizer_fields.bits.dquant); | |
1112 | + va_TraceMsg(idx, "\tquantizer = %d\n", p->pic_quantizer_fields.bits.quantizer); | |
1113 | + va_TraceMsg(idx, "\thalf_qp = %d\n", p->pic_quantizer_fields.bits.half_qp); | |
1114 | + va_TraceMsg(idx, "\tpic_quantizer_scale = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_scale); | |
1115 | + va_TraceMsg(idx, "\tpic_quantizer_type = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_type); | |
1116 | + va_TraceMsg(idx, "\tdq_frame = %d\n", p->pic_quantizer_fields.bits.dq_frame); | |
1117 | + va_TraceMsg(idx, "\tdq_profile = %d\n", p->pic_quantizer_fields.bits.dq_profile); | |
1118 | + va_TraceMsg(idx, "\tdq_sb_edge = %d\n", p->pic_quantizer_fields.bits.dq_sb_edge); | |
1119 | + va_TraceMsg(idx, "\tdq_db_edge = %d\n", p->pic_quantizer_fields.bits.dq_db_edge); | |
1120 | + va_TraceMsg(idx, "\tdq_binary_level = %d\n", p->pic_quantizer_fields.bits.dq_binary_level); | |
1121 | + va_TraceMsg(idx, "\talt_pic_quantizer = %d\n", p->pic_quantizer_fields.bits.alt_pic_quantizer); | |
1122 | + va_TraceMsg(idx, "\tvariable_sized_transform_flag = %d\n", p->transform_fields.bits.variable_sized_transform_flag); | |
1123 | + va_TraceMsg(idx, "\tmb_level_transform_type_flag = %d\n", p->transform_fields.bits.mb_level_transform_type_flag); | |
1124 | + va_TraceMsg(idx, "\tframe_level_transform_type = %d\n", p->transform_fields.bits.frame_level_transform_type); | |
1125 | + va_TraceMsg(idx, "\ttransform_ac_codingset_idx1 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx1); | |
1126 | + va_TraceMsg(idx, "\ttransform_ac_codingset_idx2 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx2); | |
1127 | + va_TraceMsg(idx, "\tintra_transform_dc_table = %d\n", p->transform_fields.bits.intra_transform_dc_table); | |
730 | 1128 | } |
731 | 1129 | |
732 | 1130 | static void va_TraceVASliceParameterBufferVC1( |
@@ -740,13 +1138,17 @@ static void va_TraceVASliceParameterBufferVC1( | ||
740 | 1138 | ) |
741 | 1139 | { |
742 | 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"); | |
745 | - va_TraceMsg (" slice_data_size = %d\n", p->slice_data_size); | |
746 | - va_TraceMsg (" slice_data_offset = %d\n", p->slice_data_offset); | |
747 | - va_TraceMsg (" slice_data_flag = %d\n", p->slice_data_flag); | |
748 | - va_TraceMsg (" macroblock_offset = %d\n", p->macroblock_offset); | |
749 | - va_TraceMsg (" slice_vertical_position = %d\n", p->slice_vertical_position); | |
1146 | + va_TraceMsg(idx, "VASliceParameterBufferVC1\n"); | |
1147 | + va_TraceMsg(idx, "\tslice_data_size = %d\n", p->slice_data_size); | |
1148 | + va_TraceMsg(idx, "\tslice_data_offset = %d\n", p->slice_data_offset); | |
1149 | + va_TraceMsg(idx, "\tslice_data_flag = %d\n", p->slice_data_flag); | |
1150 | + va_TraceMsg(idx, "\tmacroblock_offset = %d\n", p->macroblock_offset); | |
1151 | + va_TraceMsg(idx, "\tslice_vertical_position = %d\n", p->slice_vertical_position); | |
750 | 1152 | } |
751 | 1153 | |
752 | 1154 | void va_TraceBeginPicture( |
@@ -755,15 +1157,17 @@ void va_TraceBeginPicture( | ||
755 | 1157 | VASurfaceID render_target |
756 | 1158 | ) |
757 | 1159 | { |
758 | - int i; | |
1160 | + DPY2INDEX(dpy); | |
759 | 1161 | |
760 | - va_TraceMsg("\tcontext = 0x%08x\n", context); | |
761 | - va_TraceMsg("\t\trender_targets = 0x%08x\n", render_target); | |
1162 | + TRACE_FUNCNAME(idx); | |
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++; | |
766 | - trace_slice = 0; | |
1169 | + trace_context[idx].trace_frame_no++; | |
1170 | + trace_context[idx].trace_slice_no = 0; | |
767 | 1171 | } |
768 | 1172 | |
769 | 1173 | static void va_TraceMPEG2Buf( |
@@ -784,25 +1188,30 @@ static void va_TraceMPEG2Buf( | ||
784 | 1188 | va_TraceVAIQMatrixBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf); |
785 | 1189 | break; |
786 | 1190 | case VABitPlaneBufferType: |
1191 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
787 | 1192 | break; |
788 | 1193 | case VASliceGroupMapBufferType: |
1194 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
789 | 1195 | break; |
790 | 1196 | case VASliceParameterBufferType: |
791 | - trace_slice++; | |
792 | 1197 | va_TraceVASliceParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf); |
793 | 1198 | break; |
794 | 1199 | case VASliceDataBufferType: |
795 | 1200 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); |
796 | 1201 | break; |
797 | 1202 | case VAMacroblockParameterBufferType: |
1203 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
798 | 1204 | break; |
799 | 1205 | case VAResidualDataBufferType: |
1206 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
800 | 1207 | break; |
801 | 1208 | case VADeblockingParameterBufferType: |
1209 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
802 | 1210 | break; |
803 | 1211 | case VAImageBufferType: |
804 | 1212 | break; |
805 | 1213 | case VAProtectedSliceDataBufferType: |
1214 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
806 | 1215 | break; |
807 | 1216 | case VAEncCodedBufferType: |
808 | 1217 | break; |
@@ -816,6 +1225,8 @@ static void va_TraceMPEG2Buf( | ||
816 | 1225 | break; |
817 | 1226 | case VAEncH264SEIBufferType: |
818 | 1227 | break; |
1228 | + default: | |
1229 | + break; | |
819 | 1230 | } |
820 | 1231 | } |
821 | 1232 |
@@ -837,6 +1248,7 @@ static void va_TraceMPEG4Buf( | ||
837 | 1248 | va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf); |
838 | 1249 | break; |
839 | 1250 | case VABitPlaneBufferType: |
1251 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
840 | 1252 | break; |
841 | 1253 | case VASliceGroupMapBufferType: |
842 | 1254 | break; |
@@ -847,10 +1259,13 @@ static void va_TraceMPEG4Buf( | ||
847 | 1259 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); |
848 | 1260 | break; |
849 | 1261 | case VAMacroblockParameterBufferType: |
1262 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
850 | 1263 | break; |
851 | 1264 | case VAResidualDataBufferType: |
1265 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
852 | 1266 | break; |
853 | 1267 | case VADeblockingParameterBufferType: |
1268 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
854 | 1269 | break; |
855 | 1270 | case VAImageBufferType: |
856 | 1271 | break; |
@@ -860,10 +1275,13 @@ static void va_TraceMPEG4Buf( | ||
860 | 1275 | case VAEncCodedBufferType: |
861 | 1276 | break; |
862 | 1277 | case VAEncSequenceParameterBufferType: |
1278 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
863 | 1279 | break; |
864 | 1280 | case VAEncPictureParameterBufferType: |
1281 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
865 | 1282 | break; |
866 | 1283 | case VAEncSliceParameterBufferType: |
1284 | + va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf); | |
867 | 1285 | break; |
868 | 1286 | case VAEncH264VUIBufferType: |
869 | 1287 | break; |
@@ -885,6 +1303,8 @@ static void va_TraceH264Buf( | ||
885 | 1303 | void *pbuf |
886 | 1304 | ) |
887 | 1305 | { |
1306 | + DPY2INDEX(dpy); | |
1307 | + | |
888 | 1308 | switch (type) { |
889 | 1309 | case VAPictureParameterBufferType: |
890 | 1310 | va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); |
@@ -893,20 +1313,25 @@ static void va_TraceH264Buf( | ||
893 | 1313 | va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); |
894 | 1314 | break; |
895 | 1315 | case VABitPlaneBufferType: |
1316 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
896 | 1317 | break; |
897 | 1318 | case VASliceGroupMapBufferType: |
1319 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
898 | 1320 | break; |
899 | 1321 | case VASliceParameterBufferType: |
900 | 1322 | va_TraceVASliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); |
901 | 1323 | break; |
902 | 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 | 1326 | break; |
905 | 1327 | case VAMacroblockParameterBufferType: |
1328 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
906 | 1329 | break; |
907 | 1330 | case VAResidualDataBufferType: |
1331 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
908 | 1332 | break; |
909 | 1333 | case VADeblockingParameterBufferType: |
1334 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
910 | 1335 | break; |
911 | 1336 | case VAImageBufferType: |
912 | 1337 | break; |
@@ -916,14 +1341,22 @@ static void va_TraceH264Buf( | ||
916 | 1341 | case VAEncCodedBufferType: |
917 | 1342 | break; |
918 | 1343 | case VAEncSequenceParameterBufferType: |
1344 | + va_TraceVAEncSequenceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); | |
919 | 1345 | break; |
920 | 1346 | case VAEncPictureParameterBufferType: |
1347 | + va_TraceVAEncPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); | |
921 | 1348 | break; |
922 | 1349 | case VAEncSliceParameterBufferType: |
1350 | + va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf); | |
923 | 1351 | break; |
924 | 1352 | case VAEncH264VUIBufferType: |
1353 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
925 | 1354 | break; |
926 | 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 | 1360 | break; |
928 | 1361 | default: |
929 | 1362 | break; |
@@ -941,6 +1374,8 @@ static void va_TraceVC1Buf( | ||
941 | 1374 | void *pbuf |
942 | 1375 | ) |
943 | 1376 | { |
1377 | + DPY2INDEX(dpy); | |
1378 | + | |
944 | 1379 | switch (type) { |
945 | 1380 | case VAPictureParameterBufferType: |
946 | 1381 | va_TraceVAPictureParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf); |
@@ -951,18 +1386,22 @@ static void va_TraceVC1Buf( | ||
951 | 1386 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); |
952 | 1387 | break; |
953 | 1388 | case VASliceGroupMapBufferType: |
1389 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
954 | 1390 | break; |
955 | 1391 | case VASliceParameterBufferType: |
956 | 1392 | va_TraceVASliceParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf); |
957 | 1393 | break; |
958 | 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 | 1396 | break; |
961 | 1397 | case VAMacroblockParameterBufferType: |
1398 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
962 | 1399 | break; |
963 | 1400 | case VAResidualDataBufferType: |
1401 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
964 | 1402 | break; |
965 | 1403 | case VADeblockingParameterBufferType: |
1404 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
966 | 1405 | break; |
967 | 1406 | case VAImageBufferType: |
968 | 1407 | break; |
@@ -972,14 +1411,13 @@ static void va_TraceVC1Buf( | ||
972 | 1411 | case VAEncCodedBufferType: |
973 | 1412 | break; |
974 | 1413 | case VAEncSequenceParameterBufferType: |
1414 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
975 | 1415 | break; |
976 | 1416 | case VAEncPictureParameterBufferType: |
1417 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
977 | 1418 | break; |
978 | 1419 | case VAEncSliceParameterBufferType: |
979 | - break; | |
980 | - case VAEncH264VUIBufferType: | |
981 | - break; | |
982 | - case VAEncH264SEIBufferType: | |
1420 | + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); | |
983 | 1421 | break; |
984 | 1422 | default: |
985 | 1423 | break; |
@@ -997,44 +1435,74 @@ void va_TraceRenderPicture( | ||
997 | 1435 | unsigned int size; |
998 | 1436 | unsigned int num_elements; |
999 | 1437 | int i; |
1438 | + DPY2INDEX(dpy); | |
1000 | 1439 | |
1001 | - va_TraceMsg("\tcontext = 0x%08x\n", context); | |
1002 | - va_TraceMsg("\tnum_buffers = %d\n", num_buffers); | |
1440 | + TRACE_FUNCNAME(idx); | |
1441 | + | |
1442 | + va_TraceMsg(idx, "\tcontext = 0x%08x\n", context); | |
1443 | + va_TraceMsg(idx, "\tnum_buffers = %d\n", num_buffers); | |
1003 | 1444 | for (i = 0; i < num_buffers; i++) { |
1004 | 1445 | void *pbuf; |
1005 | - | |
1446 | + unsigned int j; | |
1447 | + | |
1006 | 1448 | /* get buffer type information */ |
1007 | 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 | 1457 | vaMapBuffer(dpy, buffers[i], &pbuf); |
1016 | 1458 | |
1017 | - switch (trace_profile) { | |
1459 | + switch (trace_context[idx].trace_profile) { | |
1018 | 1460 | case VAProfileMPEG2Simple: |
1019 | 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 | 1467 | break; |
1022 | 1468 | case VAProfileMPEG4Simple: |
1023 | 1469 | case VAProfileMPEG4AdvancedSimple: |
1024 | 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 | 1476 | break; |
1027 | 1477 | case VAProfileH264Baseline: |
1028 | 1478 | case VAProfileH264Main: |
1029 | 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 | 1486 | break; |
1032 | 1487 | case VAProfileVC1Simple: |
1033 | 1488 | case VAProfileVC1Main: |
1034 | 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 | 1496 | break; |
1037 | 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 | 1506 | break; |
1039 | 1507 | } |
1040 | 1508 |
@@ -1048,80 +1516,149 @@ void va_TraceEndPicture( | ||
1048 | 1516 | VAContextID context |
1049 | 1517 | ) |
1050 | 1518 | { |
1051 | - int i, j; | |
1052 | - unsigned int fourcc; /* following are output argument */ | |
1053 | - unsigned int luma_stride; | |
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); | |
1519 | + DPY2INDEX(dpy); | |
1520 | + | |
1521 | + TRACE_FUNCNAME(idx); | |
1067 | 1522 | |
1068 | - /* force the pipleline finish rendering */ | |
1069 | - vaSyncSurface(dpy, trace_rendertarget); | |
1523 | + va_TraceMsg(idx, "\tcontext = 0x%08x\n", context); | |
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, | |
1074 | - &luma_offset, &chroma_u_offset, &chroma_v_offset, &buffer_name, &buffer); | |
1527 | + /* want to trace codedbuf, and it is encode */ | |
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) | |
1077 | - return; | |
1078 | - | |
1079 | - va_TraceMsg("\tfourcc=0x%08x\n", fourcc); | |
1080 | - va_TraceMsg("\twidth=%d\n", trace_width); | |
1081 | - va_TraceMsg("\theight=%d\n", trace_height); | |
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; | |
1536 | + /* trace decoded surface for decoding, or the source sourface for encoding */ | |
1537 | + if (trace_context[idx].trace_fp_surface) { | |
1538 | + /* force the pipleline finish rendering */ | |
1539 | + vaSyncSurface(dpy, trace_context[idx].trace_rendertarget); | |
1540 | + | |
1541 | + va_TraceSurface(dpy); | |
1092 | 1542 | } |
1543 | +} | |
1093 | 1544 | |
1094 | - Y_data = buffer; | |
1095 | - UV_data = buffer + luma_offset; | |
1096 | 1545 | |
1097 | - tmp = Y_data; | |
1098 | - va_TraceMsg("**Y data**\n"); | |
1099 | - for (i=0; i<trace_height; i++) { | |
1100 | - for (j=0; j<trace_width; j++) { | |
1101 | - if ((j%16) == 0) | |
1102 | - va_TraceMsg("\n0x%08x:", j + i*trace_width); | |
1103 | - va_TraceMsg(" %02x", tmp[j]); | |
1104 | - } | |
1546 | +void va_TraceMaxNumDisplayAttributes ( | |
1547 | + VADisplay dpy, | |
1548 | + int number | |
1549 | +) | |
1550 | +{ | |
1551 | + DPY2INDEX(dpy); | |
1105 | 1552 | |
1106 | - va_TraceMsg("\n"); | |
1107 | - tmp = Y_data + i * luma_stride; | |
1553 | + TRACE_FUNCNAME(idx); | |
1554 | + | |
1555 | + va_TraceMsg(idx, "\t>max_display_attributes = %d\n", number); | |
1556 | +} | |
1557 | + | |
1558 | +void 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"); | |
1122 | - tmp = UV_data + i * chroma_u_stride; | |
1123 | - } | |
1581 | +static void va_TraceDisplayAttributes ( | |
1582 | + VADisplay dpy, | |
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 | + | |
1603 | +void 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 | + | |
1616 | +void 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 | + | |
1630 | +void 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 | } |
@@ -25,10 +25,10 @@ | ||
25 | 25 | #ifndef VA_TRACE_H |
26 | 26 | #define VA_TRACE_H |
27 | 27 | |
28 | -void va_TraceInit(void); | |
29 | -void va_TraceEnd(void); | |
28 | +void va_TraceInit(VADisplay dpy); | |
29 | +void va_TraceEnd(VADisplay dpy); | |
30 | 30 | |
31 | -void va_TraceMsg(const char *msg, ...); | |
31 | +void va_TraceMsg(int idx, const char *msg, ...); | |
32 | 32 | |
33 | 33 | void va_TraceCreateConfig( |
34 | 34 | VADisplay dpy, |
@@ -59,6 +59,14 @@ void va_TraceCreateContext( | ||
59 | 59 | VAContextID *context /* out */ |
60 | 60 | ); |
61 | 61 | |
62 | + | |
63 | +void va_TraceMapBuffer ( | |
64 | + VADisplay dpy, | |
65 | + VABufferID buf_id, /* in */ | |
66 | + void **pbuf /* out */ | |
67 | +); | |
68 | + | |
69 | + | |
62 | 70 | void va_TraceBeginPicture( |
63 | 71 | VADisplay dpy, |
64 | 72 | VAContextID context, |
@@ -77,4 +85,48 @@ void va_TraceEndPicture( | ||
77 | 85 | VAContextID context |
78 | 86 | ); |
79 | 87 | |
88 | + | |
89 | +void va_TraceMaxNumDisplayAttributes ( | |
90 | + VADisplay dpy, | |
91 | + int number | |
92 | +); | |
93 | + | |
94 | +void va_TraceQueryDisplayAttributes ( | |
95 | + VADisplay dpy, | |
96 | + VADisplayAttribute *attr_list, /* out */ | |
97 | + int *num_attributes /* out */ | |
98 | +); | |
99 | + | |
100 | +void va_TraceGetDisplayAttributes ( | |
101 | + VADisplay dpy, | |
102 | + VADisplayAttribute *attr_list, | |
103 | + int num_attributes | |
104 | +); | |
105 | + | |
106 | +void va_TraceSetDisplayAttributes ( | |
107 | + VADisplay dpy, | |
108 | + VADisplayAttribute *attr_list, | |
109 | + int num_attributes | |
110 | +); | |
111 | + | |
112 | +/* extern function called by display side */ | |
113 | +void 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 | 132 | #endif /* VA_TRACE_H */ |
@@ -231,6 +231,31 @@ VADisplay vaGetDisplay ( | ||
231 | 231 | #define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext) |
232 | 232 | #define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; } |
233 | 233 | |
234 | +extern int fool_postp; /* do nothing for vaPutSurface if set */ | |
235 | +extern int trace_flag; /* trace vaPutSurface parameters */ | |
236 | +#define VA_TRACE(trace_func,...) \ | |
237 | + if (trace_flag) { \ | |
238 | + trace_func(__VA_ARGS__); \ | |
239 | + } | |
240 | + | |
241 | +void 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 | + | |
234 | 259 | VAStatus vaPutSurface ( |
235 | 260 | VADisplay dpy, |
236 | 261 | VASurfaceID surface, |
@@ -250,9 +275,16 @@ VAStatus vaPutSurface ( | ||
250 | 275 | { |
251 | 276 | VADriverContextP ctx; |
252 | 277 | |
278 | + if (fool_postp) | |
279 | + return VA_STATUS_SUCCESS; | |
280 | + | |
253 | 281 | CHECK_DISPLAY(dpy); |
254 | 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 | 288 | return ctx->vtable.vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch, |
257 | 289 | destx, desty, destw, desth, |
258 | 290 | cliprects, number_cliprects, flags ); |