1 
2 /*
3  * Copyright (c) 2009-2011 Intel Corporation. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sub license, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the
14  * next paragraph) shall be included in all copies or substantial portions
15  * of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
21  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 #define _GNU_SOURCE 1
27 #include "va.h"
28 #include "va_enc_h264.h"
29 #include "va_backend.h"
30 #include "va_trace.h"
31 #include "va_enc_h264.h"
32 #include "va_enc_jpeg.h"
33 #include "va_enc_vp8.h"
34 #include "va_dec_jpeg.h"
35 #include "va_dec_vp8.h"
36 #include "va_vpp.h"
37 #include <assert.h>
38 #include <stdarg.h>
39 #include <stdlib.h>
40 #include <stdio.h>
41 #include <string.h>
42 #include <dlfcn.h>
43 #include <unistd.h>
44 #include <sys/types.h>
45 #include <sys/stat.h>
46 #include <unistd.h>
47 #include <time.h>
48 #include <errno.h>
49 
50 /*
51  * Env. to debug some issue, e.g. the decode/encode issue in a video conference scenerio:
52  * .LIBVA_TRACE=log_file: general VA parameters saved into log_file
53  * .LIBVA_TRACE_BUFDATA: dump all VA data buffer into log_file
54  * .LIBVA_TRACE_CODEDBUF=coded_clip_file: save the coded clip into file coded_clip_file
55  * .LIBVA_TRACE_SURFACE=yuv_file: save surface YUV into file yuv_file. Use file name to determine
56  *                                decode/encode or jpeg surfaces
57  * .LIBVA_TRACE_SURFACE_GEOMETRY=WIDTHxHEIGHT+XOFF+YOFF: only save part of surface context into file
58  *                                due to storage bandwidth limitation
59  */
60 
61 /* global settings */
62 
63 /* LIBVA_TRACE */
64 int trace_flag = 0;
65 
66 /* per context settings */
67 struct trace_context {
68     /* LIBVA_TRACE */
69     FILE *trace_fp_log; /* save the log into a file */
70     char *trace_log_fn; /* file name */
71 
72     /* LIBVA_TRACE_CODEDBUF */
73     FILE *trace_fp_codedbuf; /* save the encode result into a file */
74     char *trace_codedbuf_fn; /* file name */
75 
76     /* LIBVA_TRACE_SURFACE */
77     FILE *trace_fp_surface; /* save the surface YUV into a file */
78     char *trace_surface_fn; /* file name */
79 
80     VAContextID  trace_context; /* current context */
81 
82     VASurfaceID  trace_rendertarget; /* current render target */
83     VAProfile trace_profile; /* current profile for buffers */
84     VAEntrypoint trace_entrypoint; /* current entrypoint */
85 
86     unsigned int trace_frame_no; /* current frame NO */
87     unsigned int trace_slice_no; /* current slice NO */
88     unsigned int trace_slice_size; /* current slice buffer size */
89 
90     unsigned int trace_surface_width; /* surface dumping geometry */
91     unsigned int trace_surface_height;
92     unsigned int trace_surface_xoff;
93     unsigned int trace_surface_yoff;
94 
95     unsigned int trace_frame_width; /* current frame width */
96     unsigned int trace_frame_height; /* current frame height */
97 };
98 
99 #define TRACE_CTX(dpy) ((struct trace_context *)((VADisplayContextP)dpy)->vatrace)
100 
101 #define DPY2TRACECTX(dpy)                               \
102     struct trace_context *trace_ctx = TRACE_CTX(dpy);   \
103                                                         \
104     if (trace_ctx == NULL)                              \
105         return;                                         \
106 
107 #define TRACE_FUNCNAME(idx)    va_TraceMsg(trace_ctx, "==========%s\n", __func__);
108 
109 /* Prototype declarations (functions defined in va.c) */
110 
111 void va_errorMessage(const char *msg, ...);
112 void va_infoMessage(const char *msg, ...);
113 
114 int va_parseConfig(char *env, char *env_value);
115 
116 VAStatus vaBufferInfo(
117     VADisplay dpy,
118     VAContextID context,        /* in */
119     VABufferID buf_id,          /* in */
120     VABufferType *type,         /* out */
121     unsigned int *size,         /* out */
122     unsigned int *num_elements  /* out */
123     );
124 
125 VAStatus vaLockSurface(VADisplay dpy,
126                        VASurfaceID surface,
127                        unsigned int *fourcc, /* following are output argument */
128                        unsigned int *luma_stride,
129                        unsigned int *chroma_u_stride,
130                        unsigned int *chroma_v_stride,
131                        unsigned int *luma_offset,
132                        unsigned int *chroma_u_offset,
133                        unsigned int *chroma_v_offset,
134                        unsigned int *buffer_name,
135                        void **buffer
136                        );
137 
138 VAStatus vaUnlockSurface(VADisplay dpy,
139                          VASurfaceID surface
140                          );
141 
142 #define FILE_NAME_SUFFIX(env_value)                      \
143 do {                                                    \
144     int tmp = strnlen(env_value, sizeof(env_value));    \
145     int left = sizeof(env_value) - tmp;                 \
146                                                         \
147     snprintf(env_value+tmp,                             \
148              left,                                      \
149              ".%04d.%08lx",                             \
150              suffix,                                    \
151              (unsigned long)trace_ctx);                 \
152 } while (0)
153 
va_TraceInit(VADisplay dpy)154 void va_TraceInit(VADisplay dpy)
155 {
156     char env_value[1024];
157     unsigned short suffix = 0xffff & ((unsigned int)time(NULL));
158     FILE *tmp;
159     struct trace_context *trace_ctx = calloc(sizeof(struct trace_context), 1);
160 
161     if (trace_ctx == NULL)
162         return;
163 
164     if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
165         FILE_NAME_SUFFIX(env_value);
166         trace_ctx->trace_log_fn = strdup(env_value);
167 
168         tmp = fopen(env_value, "w");
169         if (tmp) {
170             trace_ctx->trace_fp_log = tmp;
171             va_infoMessage("LIBVA_TRACE is on, save log into %s\n", trace_ctx->trace_log_fn);
172             trace_flag = VA_TRACE_FLAG_LOG;
173         } else
174             va_errorMessage("Open file %s failed (%s)\n", env_value, strerror(errno));
175     }
176 
177     /* may re-get the global settings for multiple context */
178     if ((trace_flag & VA_TRACE_FLAG_LOG) && (va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0)) {
179         trace_flag |= VA_TRACE_FLAG_BUFDATA;
180         va_infoMessage("LIBVA_TRACE_BUFDATA is on, dump buffer into log file\n");
181     }
182 
183     /* per-context setting */
184     if (va_parseConfig("LIBVA_TRACE_CODEDBUF", &env_value[0]) == 0) {
185         FILE_NAME_SUFFIX(env_value);
186         trace_ctx->trace_codedbuf_fn = strdup(env_value);
187         va_infoMessage("LIBVA_TRACE_CODEDBUF is on, save codedbuf into log file %s\n",
188                        trace_ctx->trace_codedbuf_fn);
189         trace_flag |= VA_TRACE_FLAG_CODEDBUF;
190     }
191 
192     if (va_parseConfig("LIBVA_TRACE_SURFACE", &env_value[0]) == 0) {
193         FILE_NAME_SUFFIX(env_value);
194         trace_ctx->trace_surface_fn = strdup(env_value);
195 
196         va_infoMessage("LIBVA_TRACE_SURFACE is on, save surface into %s\n",
197                        trace_ctx->trace_surface_fn);
198 
199         /* for surface data dump, it is time-consume, and may
200          * cause some side-effect, so only trace the needed surfaces
201          * to trace encode surface, set the trace file name to sth like *enc*
202          * to trace decode surface, set the trace file name to sth like *dec*
203          * if no dec/enc in file name, set both
204          */
205         if (strstr(env_value, "dec"))
206             trace_flag |= VA_TRACE_FLAG_SURFACE_DECODE;
207         if (strstr(env_value, "enc"))
208             trace_flag |= VA_TRACE_FLAG_SURFACE_ENCODE;
209         if (strstr(env_value, "jpeg") || strstr(env_value, "jpg"))
210             trace_flag |= VA_TRACE_FLAG_SURFACE_JPEG;
211 
212         if (va_parseConfig("LIBVA_TRACE_SURFACE_GEOMETRY", &env_value[0]) == 0) {
213             char *p = env_value, *q;
214 
215             trace_ctx->trace_surface_width = strtod(p, &q);
216             p = q+1; /* skip "x" */
217             trace_ctx->trace_surface_height = strtod(p, &q);
218             p = q+1; /* skip "+" */
219             trace_ctx->trace_surface_xoff = strtod(p, &q);
220             p = q+1; /* skip "+" */
221             trace_ctx->trace_surface_yoff = strtod(p, &q);
222 
223             va_infoMessage("LIBVA_TRACE_SURFACE_GEOMETRY is on, only dump surface %dx%d+%d+%d content\n",
224                            trace_ctx->trace_surface_width,
225                            trace_ctx->trace_surface_height,
226                            trace_ctx->trace_surface_xoff,
227                            trace_ctx->trace_surface_yoff);
228         }
229     }
230 
231     ((VADisplayContextP)dpy)->vatrace = trace_ctx;
232 }
233 
234 
va_TraceEnd(VADisplay dpy)235 void va_TraceEnd(VADisplay dpy)
236 {
237     DPY2TRACECTX(dpy);
238 
239     if (trace_ctx->trace_fp_log)
240         fclose(trace_ctx->trace_fp_log);
241 
242     if (trace_ctx->trace_fp_codedbuf)
243         fclose(trace_ctx->trace_fp_codedbuf);
244 
245     if (trace_ctx->trace_fp_surface)
246         fclose(trace_ctx->trace_fp_surface);
247 
248     if (trace_ctx->trace_log_fn)
249         free(trace_ctx->trace_log_fn);
250 
251     if (trace_ctx->trace_codedbuf_fn)
252         free(trace_ctx->trace_codedbuf_fn);
253 
254     if (trace_ctx->trace_surface_fn)
255         free(trace_ctx->trace_surface_fn);
256 
257     free(trace_ctx);
258     ((VADisplayContextP)dpy)->vatrace = NULL;
259 }
260 
261 
va_TraceMsg(struct trace_context * trace_ctx,const char * msg,...)262 void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...)
263 {
264     va_list args;
265 
266     if (!(trace_flag & VA_TRACE_FLAG_LOG))
267         return;
268 
269     if (msg)  {
270         struct timeval tv;
271 
272         if (gettimeofday(&tv, NULL) == 0)
273             fprintf(trace_ctx->trace_fp_log, "[%04d.%06d] ",
274                     (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec);
275         va_start(args, msg);
276         vfprintf(trace_ctx->trace_fp_log, msg, args);
277         va_end(args);
278     } else
279         fflush(trace_ctx->trace_fp_log);
280 }
281 
282 
va_TraceSurface(VADisplay dpy)283 void va_TraceSurface(VADisplay dpy)
284 {
285     unsigned int i;
286     unsigned int fourcc; /* following are output argument */
287     unsigned int luma_stride;
288     unsigned int chroma_u_stride;
289     unsigned int chroma_v_stride;
290     unsigned int luma_offset;
291     unsigned int chroma_u_offset;
292     unsigned int chroma_v_offset;
293     unsigned int buffer_name;
294     void *buffer = NULL;
295     unsigned char *Y_data, *UV_data, *tmp;
296     VAStatus va_status;
297     DPY2TRACECTX(dpy);
298 
299     if (!trace_ctx->trace_fp_surface)
300         return;
301 
302     va_TraceMsg(trace_ctx, "==========dump surface data in file %s\n", trace_ctx->trace_surface_fn);
303 
304     va_TraceMsg(trace_ctx, NULL);
305 
306     va_status = vaLockSurface(
307         dpy,
308         trace_ctx->trace_rendertarget,
309         &fourcc,
310         &luma_stride, &chroma_u_stride, &chroma_v_stride,
311         &luma_offset, &chroma_u_offset, &chroma_v_offset,
312         &buffer_name, &buffer);
313 
314     if (va_status != VA_STATUS_SUCCESS) {
315         va_TraceMsg(trace_ctx, "Error:vaLockSurface failed\n");
316         return;
317     }
318 
319     va_TraceMsg(trace_ctx, "\tfourcc = 0x%08x\n", fourcc);
320     va_TraceMsg(trace_ctx, "\twidth = %d\n", trace_ctx->trace_frame_width);
321     va_TraceMsg(trace_ctx, "\theight = %d\n", trace_ctx->trace_frame_height);
322     va_TraceMsg(trace_ctx, "\tluma_stride = %d\n", luma_stride);
323     va_TraceMsg(trace_ctx, "\tchroma_u_stride = %d\n", chroma_u_stride);
324     va_TraceMsg(trace_ctx, "\tchroma_v_stride = %d\n", chroma_v_stride);
325     va_TraceMsg(trace_ctx, "\tluma_offset = %d\n", luma_offset);
326     va_TraceMsg(trace_ctx, "\tchroma_u_offset = %d\n", chroma_u_offset);
327     va_TraceMsg(trace_ctx, "\tchroma_v_offset = %d\n", chroma_v_offset);
328 
329     if (buffer == NULL) {
330         va_TraceMsg(trace_ctx, "Error:vaLockSurface return NULL buffer\n");
331         va_TraceMsg(trace_ctx, NULL);
332 
333         vaUnlockSurface(dpy, trace_ctx->trace_rendertarget);
334         return;
335     }
336     va_TraceMsg(trace_ctx, "\tbuffer location = 0x%08x\n", buffer);
337     va_TraceMsg(trace_ctx, NULL);
338 
339     Y_data = (unsigned char*)buffer;
340     UV_data = (unsigned char*)buffer + chroma_u_offset;
341 
342     tmp = Y_data + luma_stride * trace_ctx->trace_surface_yoff;
343     for (i=0; i<trace_ctx->trace_surface_height; i++) {
344         fwrite(tmp + trace_ctx->trace_surface_xoff,
345                trace_ctx->trace_surface_width,
346                1, trace_ctx->trace_fp_surface);
347 
348         tmp += luma_stride;
349     }
350     tmp = UV_data + chroma_u_stride * trace_ctx->trace_surface_yoff / 2;
351     if (fourcc == VA_FOURCC_NV12) {
352         for (i=0; i<trace_ctx->trace_surface_height/2; i++) {
353             fwrite(tmp + trace_ctx->trace_surface_xoff,
354                    trace_ctx->trace_surface_width,
355                    1, trace_ctx->trace_fp_surface);
356 
357             tmp += chroma_u_stride;
358         }
359     }
360 
361     vaUnlockSurface(dpy, trace_ctx->trace_rendertarget);
362 
363     va_TraceMsg(trace_ctx, NULL);
364 }
365 
366 
va_TraceInitialize(VADisplay dpy,int __maybe_unused * major_version,int __maybe_unused * minor_version)367 void va_TraceInitialize (
368     VADisplay dpy,
369     int __maybe_unused *major_version,     /* out */
370     int __maybe_unused *minor_version      /* out */
371 )
372 {
373     DPY2TRACECTX(dpy);
374 
375     TRACE_FUNCNAME(idx);
376 }
377 
va_TraceTerminate(VADisplay dpy)378 void va_TraceTerminate (
379     VADisplay dpy
380 )
381 {
382     DPY2TRACECTX(dpy);
383     TRACE_FUNCNAME(idx);
384 }
385 
386 
va_TraceCreateConfig(VADisplay dpy,VAProfile profile,VAEntrypoint entrypoint,VAConfigAttrib * attrib_list,int num_attribs,VAConfigID __maybe_unused * config_id)387 void va_TraceCreateConfig(
388     VADisplay dpy,
389     VAProfile profile,
390     VAEntrypoint entrypoint,
391     VAConfigAttrib *attrib_list,
392     int num_attribs,
393     VAConfigID __maybe_unused *config_id /* out */
394 )
395 {
396     int i;
397     int encode, decode, jpeg;
398     DPY2TRACECTX(dpy);
399 
400     TRACE_FUNCNAME(idx);
401 
402     va_TraceMsg(trace_ctx, "\tprofile = %d\n", profile);
403     va_TraceMsg(trace_ctx, "\tentrypoint = %d\n", entrypoint);
404     va_TraceMsg(trace_ctx, "\tnum_attribs = %d\n", num_attribs);
405     if (attrib_list) {
406         for (i = 0; i < num_attribs; i++) {
407             va_TraceMsg(trace_ctx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
408             va_TraceMsg(trace_ctx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
409         }
410     }
411     va_TraceMsg(trace_ctx, NULL);
412 
413     trace_ctx->trace_profile = profile;
414     trace_ctx->trace_entrypoint = entrypoint;
415 
416     /* avoid to create so many empty files */
417     encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice);
418     decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD);
419     jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture);
420     if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) ||
421         (decode && (trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) ||
422         (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) {
423         FILE *tmp = fopen(trace_ctx->trace_surface_fn, "w");
424 
425         if (tmp)
426             trace_ctx->trace_fp_surface = tmp;
427         else {
428             va_errorMessage("Open file %s failed (%s)\n",
429                             trace_ctx->trace_surface_fn,
430                             strerror(errno));
431             trace_ctx->trace_fp_surface = NULL;
432             trace_flag &= ~(VA_TRACE_FLAG_SURFACE);
433         }
434     }
435 
436     if (encode && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
437         FILE *tmp = fopen(trace_ctx->trace_codedbuf_fn, "w");
438 
439         if (tmp)
440             trace_ctx->trace_fp_codedbuf = tmp;
441         else {
442             va_errorMessage("Open file %s failed (%s)\n",
443                             trace_ctx->trace_codedbuf_fn,
444                             strerror(errno));
445             trace_ctx->trace_fp_codedbuf = NULL;
446             trace_flag &= ~VA_TRACE_FLAG_CODEDBUF;
447         }
448     }
449 }
450 
va_TraceSurfaceAttributes(struct trace_context * trace_ctx,VASurfaceAttrib * attrib_list,unsigned int * num_attribs)451 static void va_TraceSurfaceAttributes(
452     struct trace_context *trace_ctx,
453     VASurfaceAttrib    *attrib_list,
454     unsigned int       *num_attribs
455 )
456 {
457     int i, num;
458     VASurfaceAttrib *p;
459 
460     if (!attrib_list || !num_attribs)
461         return;
462 
463     p = attrib_list;
464     num = *num_attribs;
465     if (num > VASurfaceAttribCount)
466         num = VASurfaceAttribCount;
467 
468     for (i=0; i<num; i++) {
469         int type = p->value.type;
470 
471         va_TraceMsg(trace_ctx, "\tattrib_list[%i] =\n", i);
472 
473         va_TraceMsg(trace_ctx, "\t\ttype = %d\n", p->type);
474         va_TraceMsg(trace_ctx, "\t\tflags = %d\n", p->flags);
475         va_TraceMsg(trace_ctx, "\t\tvalue.type = %d\n", type);
476         switch (type) {
477         case VAGenericValueTypeInteger:
478             va_TraceMsg(trace_ctx, "\t\tvalue.value.i = 0x%08x\n", p->value.value.i);
479             break;
480         case VAGenericValueTypeFloat:
481             va_TraceMsg(trace_ctx, "\t\tvalue.value.f = %f\n", p->value.value.f);
482             break;
483         case VAGenericValueTypePointer:
484             va_TraceMsg(trace_ctx, "\t\tvalue.value.p = %p\n", p->value.value.p);
485             if ((p->type == VASurfaceAttribExternalBufferDescriptor) && p->value.value.p) {
486                 VASurfaceAttribExternalBuffers *tmp = (VASurfaceAttribExternalBuffers *) p->value.value.p;
487                 unsigned int j;
488 
489                 va_TraceMsg(trace_ctx, "\t\t--VASurfaceAttribExternalBufferDescriptor\n");
490                 va_TraceMsg(trace_ctx, "\t\t  pixel_format=0x%08x\n", tmp->pixel_format);
491                 va_TraceMsg(trace_ctx, "\t\t  width=%d\n", tmp->width);
492                 va_TraceMsg(trace_ctx, "\t\t  height=%d\n", tmp->height);
493                 va_TraceMsg(trace_ctx, "\t\t  data_size=%d\n", tmp->data_size);
494                 va_TraceMsg(trace_ctx, "\t\t  num_planes=%d\n", tmp->num_planes);
495                 va_TraceMsg(trace_ctx, "\t\t  pitches[4]=%d %d %d %d\n",
496                             tmp->pitches[0], tmp->pitches[1], tmp->pitches[2], tmp->pitches[3]);
497                 va_TraceMsg(trace_ctx, "\t\t  offsets[4]=%d %d %d %d\n",
498                             tmp->offsets[0], tmp->offsets[1], tmp->offsets[2], tmp->offsets[3]);
499                 va_TraceMsg(trace_ctx, "\t\t  flags=0x%08x\n", tmp->flags);
500                 va_TraceMsg(trace_ctx, "\t\t  num_buffers=0x%08x\n", tmp->num_buffers);
501                 va_TraceMsg(trace_ctx, "\t\t  buffers=%p\n", tmp->buffers);
502                 for (j = 0; j < tmp->num_buffers; j++) {
503                     va_TraceMsg(trace_ctx, "\t\t\tbuffers[%d]=%p\n", j, tmp->buffers[j]);
504                 }
505             }
506             break;
507         case VAGenericValueTypeFunc:
508             va_TraceMsg(trace_ctx, "\t\tvalue.value.fn = %p\n", p->value.value.fn);
509             break;
510         default:
511             break;
512         }
513 
514         p++;
515     }
516 }
517 
va_TraceCreateSurfaces(VADisplay dpy,int width,int height,int format,int num_surfaces,VASurfaceID * surfaces,VASurfaceAttrib * attrib_list,unsigned int num_attribs)518 void va_TraceCreateSurfaces(
519     VADisplay dpy,
520     int width,
521     int height,
522     int format,
523     int num_surfaces,
524     VASurfaceID *surfaces,    /* out */
525     VASurfaceAttrib    *attrib_list,
526     unsigned int        num_attribs
527 )
528 {
529     int i;
530     DPY2TRACECTX(dpy);
531 
532     TRACE_FUNCNAME(idx);
533 
534     va_TraceMsg(trace_ctx, "\twidth = %d\n", width);
535     va_TraceMsg(trace_ctx, "\theight = %d\n", height);
536     va_TraceMsg(trace_ctx, "\tformat = %d\n", format);
537     va_TraceMsg(trace_ctx, "\tnum_surfaces = %d\n", num_surfaces);
538 
539     if (surfaces) {
540         for (i = 0; i < num_surfaces; i++)
541             va_TraceMsg(trace_ctx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
542     }
543 
544     va_TraceSurfaceAttributes(trace_ctx, attrib_list, &num_attribs);
545 
546     va_TraceMsg(trace_ctx, NULL);
547 }
548 
549 
va_TraceDestroySurfaces(VADisplay dpy,VASurfaceID * surface_list,int num_surfaces)550 void va_TraceDestroySurfaces(
551     VADisplay dpy,
552     VASurfaceID *surface_list,
553     int num_surfaces
554 )
555 {
556     int i;
557     DPY2TRACECTX(dpy);
558 
559     TRACE_FUNCNAME(idx);
560 
561     if (surface_list) {
562         for (i = 0; i < num_surfaces; i++)
563             va_TraceMsg(trace_ctx, "\t\tsurfaces[%d] = 0x%08x\n", i, surface_list[i]);
564     }
565 
566     va_TraceMsg(trace_ctx, NULL);
567 }
568 
569 
va_TraceCreateContext(VADisplay dpy,VAConfigID config_id,int picture_width,int picture_height,int flag,VASurfaceID * render_targets,int num_render_targets,VAContextID * context)570 void va_TraceCreateContext(
571     VADisplay dpy,
572     VAConfigID config_id,
573     int picture_width,
574     int picture_height,
575     int flag,
576     VASurfaceID *render_targets,
577     int num_render_targets,
578     VAContextID *context        /* out */
579 )
580 {
581     int i;
582     DPY2TRACECTX(dpy);
583 
584     TRACE_FUNCNAME(idx);
585 
586     va_TraceMsg(trace_ctx, "\tconfig = 0x%08x\n", config_id);
587     va_TraceMsg(trace_ctx, "\twidth = %d\n", picture_width);
588     va_TraceMsg(trace_ctx, "\theight = %d\n", picture_height);
589     va_TraceMsg(trace_ctx, "\tflag = 0x%08x\n", flag);
590     va_TraceMsg(trace_ctx, "\tnum_render_targets = %d\n", num_render_targets);
591     if (render_targets) {
592         for (i=0; i<num_render_targets; i++)
593             va_TraceMsg(trace_ctx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
594     }
595     if (context) {
596         va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", *context);
597         trace_ctx->trace_context = *context;
598     } else
599         trace_ctx->trace_context = VA_INVALID_ID;
600 
601     trace_ctx->trace_frame_no = 0;
602     trace_ctx->trace_slice_no = 0;
603 
604     trace_ctx->trace_frame_width = picture_width;
605     trace_ctx->trace_frame_height = picture_height;
606 
607     if (trace_ctx->trace_surface_width == 0)
608         trace_ctx->trace_surface_width = picture_width;
609     if (trace_ctx->trace_surface_height == 0)
610         trace_ctx->trace_surface_height = picture_height;
611 }
612 
613 
buffer_type_to_string(int type)614 static char * buffer_type_to_string(int type)
615 {
616     switch (type) {
617     case VAPictureParameterBufferType: return "VAPictureParameterBufferType";
618     case VAIQMatrixBufferType: return "VAIQMatrixBufferType";
619     case VABitPlaneBufferType: return "VABitPlaneBufferType";
620     case VASliceGroupMapBufferType: return "VASliceGroupMapBufferType";
621     case VASliceParameterBufferType: return "VASliceParameterBufferType";
622     case VASliceDataBufferType: return "VASliceDataBufferType";
623     case VAProtectedSliceDataBufferType: return "VAProtectedSliceDataBufferType";
624     case VAMacroblockParameterBufferType: return "VAMacroblockParameterBufferType";
625     case VAResidualDataBufferType: return "VAResidualDataBufferType";
626     case VADeblockingParameterBufferType: return "VADeblockingParameterBufferType";
627     case VAImageBufferType: return "VAImageBufferType";
628     case VAQMatrixBufferType: return "VAQMatrixBufferType";
629     case VAHuffmanTableBufferType: return "VAHuffmanTableBufferType";
630     case VAProbabilityBufferType: return "VAProbabilityBufferType";
631 /* Following are encode buffer types */
632     case VAEncCodedBufferType: return "VAEncCodedBufferType";
633     case VAEncSequenceParameterBufferType: return "VAEncSequenceParameterBufferType";
634     case VAEncPictureParameterBufferType: return "VAEncPictureParameterBufferType";
635     case VAEncSliceParameterBufferType: return "VAEncSliceParameterBufferType";
636     case VAEncPackedHeaderParameterBufferType: return "VAEncPackedHeaderParameterBufferType";
637     case VAEncPackedHeaderDataBufferType: return "VAEncPackedHeaderDataBufferType";
638     case VAEncMiscParameterBufferType: return "VAEncMiscParameterBufferType";
639     case VAEncMacroblockParameterBufferType: return "VAEncMacroblockParameterBufferType";
640     case VAProcPipelineParameterBufferType: return "VAProcPipelineParameterBufferType";
641     case VAProcFilterParameterBufferType: return "VAProcFilterParameterBufferType";
642     default: return "UnknowBuffer";
643     }
644 }
645 
va_TraceCreateBuffer(VADisplay dpy,VAContextID __maybe_unused context,VABufferType type,unsigned int size,unsigned int num_elements,void __maybe_unused * data,VABufferID * buf_id)646 void va_TraceCreateBuffer (
647     VADisplay dpy,
648     VAContextID __maybe_unused context,	/* in */
649     VABufferType type,		/* in */
650     unsigned int size,		/* in */
651     unsigned int num_elements,	/* in */
652     void __maybe_unused *data,			/* in */
653     VABufferID *buf_id		/* out */
654 )
655 {
656     DPY2TRACECTX(dpy);
657 
658     /* only trace CodedBuffer */
659     if (type != VAEncCodedBufferType)
660         return;
661 
662     TRACE_FUNCNAME(idx);
663     va_TraceMsg(trace_ctx, "\tbuf_type=%s\n", buffer_type_to_string(type));
664     if (buf_id)
665         va_TraceMsg(trace_ctx, "\tbuf_id=0x%x\n", *buf_id);
666     va_TraceMsg(trace_ctx, "\tsize=%d\n", size);
667     va_TraceMsg(trace_ctx, "\tnum_elements=%d\n", num_elements);
668 
669     va_TraceMsg(trace_ctx, NULL);
670 }
671 
va_TraceDestroyBuffer(VADisplay dpy,VABufferID buf_id)672 void va_TraceDestroyBuffer (
673     VADisplay dpy,
674     VABufferID buf_id    /* in */
675 )
676 {
677     VABufferType type;
678     unsigned int size;
679     unsigned int num_elements;
680 
681     DPY2TRACECTX(dpy);
682 
683     vaBufferInfo(dpy, trace_ctx->trace_context, buf_id, &type, &size, &num_elements);
684 
685     /* only trace CodedBuffer */
686     if (type != VAEncCodedBufferType)
687         return;
688 
689     TRACE_FUNCNAME(idx);
690     va_TraceMsg(trace_ctx, "\tbuf_type=%s\n", buffer_type_to_string(type));
691     va_TraceMsg(trace_ctx, "\tbuf_id=0x%x\n", buf_id);
692     va_TraceMsg(trace_ctx, "\tsize=%d\n", size);
693     va_TraceMsg(trace_ctx, "\tnum_elements=%d\n", num_elements);
694 
695     va_TraceMsg(trace_ctx, NULL);
696 }
697 
698 
va_TraceMapBuffer(VADisplay dpy,VABufferID buf_id,void ** pbuf)699 void va_TraceMapBuffer (
700     VADisplay dpy,
701     VABufferID buf_id,    /* in */
702     void **pbuf           /* out */
703 )
704 {
705     VABufferType type;
706     unsigned int size;
707     unsigned int num_elements;
708 
709     VACodedBufferSegment *buf_list;
710     int i = 0;
711 
712     DPY2TRACECTX(dpy);
713 
714     vaBufferInfo(dpy, trace_ctx->trace_context, buf_id, &type, &size, &num_elements);
715 
716     /* only trace CodedBuffer */
717     if (type != VAEncCodedBufferType)
718         return;
719 
720     TRACE_FUNCNAME(idx);
721     va_TraceMsg(trace_ctx, "\tbuf_id=0x%x\n", buf_id);
722     va_TraceMsg(trace_ctx, "\tbuf_type=%s\n", buffer_type_to_string(type));
723     if ((pbuf == NULL) || (*pbuf == NULL))
724         return;
725 
726     buf_list = (VACodedBufferSegment *)(*pbuf);
727     while (buf_list != NULL) {
728         va_TraceMsg(trace_ctx, "\tCodedbuf[%d] =\n", i++);
729 
730         va_TraceMsg(trace_ctx, "\t   size = %d\n", buf_list->size);
731         va_TraceMsg(trace_ctx, "\t   bit_offset = %d\n", buf_list->bit_offset);
732         va_TraceMsg(trace_ctx, "\t   status = 0x%08x\n", buf_list->status);
733         va_TraceMsg(trace_ctx, "\t   reserved = 0x%08x\n", buf_list->reserved);
734         va_TraceMsg(trace_ctx, "\t   buf = 0x%08x\n", buf_list->buf);
735 
736         if (trace_ctx->trace_fp_codedbuf) {
737             va_TraceMsg(trace_ctx, "\tDump the content to file\n");
738             fwrite(buf_list->buf, buf_list->size, 1, trace_ctx->trace_fp_codedbuf);
739         }
740 
741         buf_list = buf_list->next;
742     }
743     va_TraceMsg(trace_ctx, NULL);
744 }
745 
va_TraceVABuffers(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * pbuf)746 static void va_TraceVABuffers(
747     VADisplay dpy,
748     VAContextID context,
749     VABufferID buffer,
750     VABufferType type,
751     unsigned int size,
752     unsigned int num_elements,
753     void *pbuf
754 )
755 {
756     unsigned int i;
757     unsigned char *p = pbuf;
758     unsigned int dump_size = 64;
759 
760     DPY2TRACECTX(dpy);
761 
762     va_TraceMsg(trace_ctx, "\t    context = %d, buffer = %d, type = %d, size = %d, num_elements = %d\n",
763                 context, buffer, type, size, num_elements);
764     va_TraceMsg(trace_ctx, "--%s\n",  buffer_type_to_string(type));
765 
766     if (dump_size>size)
767         dump_size = size;
768 
769     if (trace_flag & VA_TRACE_FLAG_BUFDATA)
770         dump_size = size;
771 
772     if (trace_ctx->trace_fp_log) {
773         for (i=0; i<dump_size; i++) {
774             unsigned char value =  p[i];
775 
776             if (i==0)
777                 fprintf(trace_ctx->trace_fp_log, "\t\t0x%04x:", i);
778             else if ((i%16) == 0)
779                 fprintf(trace_ctx->trace_fp_log, "\n\t\t0x%04x:", i);
780 
781             fprintf(trace_ctx->trace_fp_log, " %02x", value);
782         }
783         fprintf(trace_ctx->trace_fp_log, "\n");
784     }
785 
786     va_TraceMsg(trace_ctx, NULL);
787 
788     return;
789 }
790 
791 
va_TraceVAPictureParameterBufferMPEG2(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)792 static void va_TraceVAPictureParameterBufferMPEG2(
793     VADisplay dpy,
794     VAContextID __maybe_unused context,
795     VABufferID __maybe_unused buffer,
796     VABufferType __maybe_unused type,
797     unsigned int __maybe_unused size,
798     unsigned int __maybe_unused num_elements,
799     void *data)
800 {
801     VAPictureParameterBufferMPEG2 *p=(VAPictureParameterBufferMPEG2 *)data;
802     DPY2TRACECTX(dpy);
803 
804     va_TraceMsg(trace_ctx,"VAPictureParameterBufferMPEG2\n");
805     va_TraceMsg(trace_ctx,"\thorizontal size= %d\n", p->horizontal_size);
806     va_TraceMsg(trace_ctx,"\tvertical size= %d\n", p->vertical_size);
807     va_TraceMsg(trace_ctx,"\tforward reference picture= %d\n", p->forward_reference_picture);
808     va_TraceMsg(trace_ctx,"\tbackward reference picture= %d\n", p->backward_reference_picture);
809     va_TraceMsg(trace_ctx,"\tpicture coding type= %d\n", p->picture_coding_type);
810     va_TraceMsg(trace_ctx,"\tf mode= %d\n", p->f_code);
811 
812     va_TraceMsg(trace_ctx,"\tpicture coding extension = %d\n", p->picture_coding_extension.value);
813     va_TraceMsg(trace_ctx,"\tintra_dc_precision= %d\n", p->picture_coding_extension.bits.intra_dc_precision);
814     va_TraceMsg(trace_ctx,"\tpicture_structure= %d\n", p->picture_coding_extension.bits.picture_structure);
815     va_TraceMsg(trace_ctx,"\ttop_field_first= %d\n", p->picture_coding_extension.bits.top_field_first);
816     va_TraceMsg(trace_ctx,"\tframe_pred_frame_dct= %d\n", p->picture_coding_extension.bits.frame_pred_frame_dct);
817     va_TraceMsg(trace_ctx,"\tconcealment_motion_vectors= %d\n", p->picture_coding_extension.bits.concealment_motion_vectors);
818     va_TraceMsg(trace_ctx,"\tq_scale_type= %d\n", p->picture_coding_extension.bits.q_scale_type);
819     va_TraceMsg(trace_ctx,"\tintra_vlc_format= %d\n", p->picture_coding_extension.bits.intra_vlc_format);
820     va_TraceMsg(trace_ctx,"\talternate_scan= %d\n", p->picture_coding_extension.bits.alternate_scan);
821     va_TraceMsg(trace_ctx,"\trepeat_first_field= %d\n", p->picture_coding_extension.bits.repeat_first_field);
822     va_TraceMsg(trace_ctx,"\tprogressive_frame= %d\n", p->picture_coding_extension.bits.progressive_frame);
823     va_TraceMsg(trace_ctx,"\tis_first_field= %d\n", p->picture_coding_extension.bits.is_first_field);
824     va_TraceMsg(trace_ctx, NULL);
825 
826     return;
827 }
828 
829 
va_TraceVAIQMatrixBufferMPEG2(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)830 static void va_TraceVAIQMatrixBufferMPEG2(
831     VADisplay dpy,
832     VAContextID __maybe_unused context,
833     VABufferID __maybe_unused buffer,
834     VABufferType __maybe_unused type,
835     unsigned int __maybe_unused size,
836     unsigned int __maybe_unused num_elements,
837     void *data)
838 {
839     VAIQMatrixBufferMPEG2 *p=(VAIQMatrixBufferMPEG2 *)data;
840     DPY2TRACECTX(dpy);
841 
842     va_TraceMsg(trace_ctx,"VAIQMatrixBufferMPEG2\n");
843     va_TraceMsg(trace_ctx,"\tload_intra_quantiser_matrix = %d\n", p->load_intra_quantiser_matrix);
844     va_TraceMsg(trace_ctx,"\tload_non_intra_quantiser_matrix = %d\n", p->load_non_intra_quantiser_matrix);
845     va_TraceMsg(trace_ctx,"\tload_chroma_intra_quantiser_matrix = %d\n", p->load_chroma_intra_quantiser_matrix);
846     va_TraceMsg(trace_ctx,"\tload_chroma_non_intra_quantiser_matrix = %d\n", p->load_chroma_non_intra_quantiser_matrix);
847     va_TraceMsg(trace_ctx,"\tintra_quantiser_matrix = %d\n", p->intra_quantiser_matrix);
848     va_TraceMsg(trace_ctx,"\tnon_intra_quantiser_matrix = %d\n", p->non_intra_quantiser_matrix);
849     va_TraceMsg(trace_ctx,"\tchroma_intra_quantiser_matrix = %d\n", p->chroma_intra_quantiser_matrix);
850     va_TraceMsg(trace_ctx,"\tchroma_non_intra_quantiser_matrix = %d\n", p->chroma_non_intra_quantiser_matrix);
851     va_TraceMsg(trace_ctx, NULL);
852 
853     return;
854 }
855 
856 
va_TraceVASliceParameterBufferMPEG2(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)857 static void va_TraceVASliceParameterBufferMPEG2(
858     VADisplay dpy,
859     VAContextID __maybe_unused context,
860     VABufferID __maybe_unused buffer,
861     VABufferType __maybe_unused type,
862     unsigned int __maybe_unused size,
863     unsigned int __maybe_unused num_elements,
864     void *data)
865 {
866     VASliceParameterBufferMPEG2 *p=(VASliceParameterBufferMPEG2 *)data;
867 
868     DPY2TRACECTX(dpy);
869 
870     trace_ctx->trace_slice_no++;
871 
872     trace_ctx->trace_slice_size = p->slice_data_size;
873 
874     va_TraceMsg(trace_ctx,"VASliceParameterBufferMPEG2\n");
875     va_TraceMsg(trace_ctx,"\tslice_data_size = %d\n", p->slice_data_size);
876     va_TraceMsg(trace_ctx,"\tslice_data_offset = %d\n", p->slice_data_offset);
877     va_TraceMsg(trace_ctx,"\tslice_data_flag = %d\n", p->slice_data_flag);
878     va_TraceMsg(trace_ctx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
879     va_TraceMsg(trace_ctx,"\tslice_horizontal_position = %d\n", p->slice_horizontal_position);
880     va_TraceMsg(trace_ctx,"\tslice_vertical_position = %d\n", p->slice_vertical_position);
881     va_TraceMsg(trace_ctx,"\tquantiser_scale_code = %d\n", p->quantiser_scale_code);
882     va_TraceMsg(trace_ctx,"\tintra_slice_flag = %d\n", p->intra_slice_flag);
883     va_TraceMsg(trace_ctx, NULL);
884 
885     return;
886 }
887 
va_TraceVAPictureParameterBufferJPEG(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)888 static void va_TraceVAPictureParameterBufferJPEG(
889     VADisplay dpy,
890     VAContextID __maybe_unused context,
891     VABufferID __maybe_unused buffer,
892     VABufferType __maybe_unused type,
893     unsigned int __maybe_unused size,
894     unsigned int __maybe_unused num_elements,
895     void *data)
896 {
897     int i;
898     VAPictureParameterBufferJPEGBaseline *p=(VAPictureParameterBufferJPEGBaseline *)data;
899     DPY2TRACECTX(dpy);
900 
901     va_TraceMsg(trace_ctx,"*VAPictureParameterBufferJPEG\n");
902     va_TraceMsg(trace_ctx,"\tpicture_width = %u\n", p->picture_width);
903     va_TraceMsg(trace_ctx,"\tpicture_height = %u\n", p->picture_height);
904     va_TraceMsg(trace_ctx,"\tcomponents = \n");
905     for (i = 0; i < p->num_components && i < 255; ++i) {
906         va_TraceMsg(trace_ctx,"\t\t[%d] component_id = %u\n", i, p->components[i].component_id);
907         va_TraceMsg(trace_ctx,"\t\t[%d] h_sampling_factor = %u\n", i, p->components[i].h_sampling_factor);
908         va_TraceMsg(trace_ctx,"\t\t[%d] v_sampling_factor = %u\n", i, p->components[i].v_sampling_factor);
909         va_TraceMsg(trace_ctx,"\t\t[%d] quantiser_table_selector = %u\n", i, p->components[i].quantiser_table_selector);
910     }
911 }
912 
va_TraceVAIQMatrixBufferJPEG(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)913 static void va_TraceVAIQMatrixBufferJPEG(
914     VADisplay dpy,
915     VAContextID __maybe_unused context,
916     VABufferID __maybe_unused buffer,
917     VABufferType __maybe_unused type,
918     unsigned int __maybe_unused size,
919     unsigned int __maybe_unused num_elements,
920     void *data)
921 {
922     int i, j;
923     static char tmp[1024];
924     VAIQMatrixBufferJPEGBaseline *p=(VAIQMatrixBufferJPEGBaseline *)data;
925     DPY2TRACECTX(dpy);
926 
927     va_TraceMsg(trace_ctx,"*VAIQMatrixParameterBufferJPEG\n");
928     va_TraceMsg(trace_ctx,"\tload_quantiser_table =\n");
929     for (i = 0; i < 4; ++i) {
930         va_TraceMsg(trace_ctx,"\t\t[%d] = %u\n", i, p->load_quantiser_table[i]);
931     }
932     va_TraceMsg(trace_ctx,"\tquantiser_table =\n");
933     for (i = 0; i < 4; ++i) {
934         memset(tmp, 0, sizeof tmp);
935         for (j = 0; j < 64; ++j) {
936             sprintf(tmp + strlen(tmp), "%u ", p->quantiser_table[i][j]);
937         }
938         va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
939     }
940 }
941 
va_TraceVASliceParameterBufferJPEG(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)942 static void va_TraceVASliceParameterBufferJPEG(
943     VADisplay dpy,
944     VAContextID __maybe_unused context,
945     VABufferID __maybe_unused buffer,
946     VABufferType __maybe_unused type,
947     unsigned int __maybe_unused size,
948     unsigned int __maybe_unused num_elements,
949     void *data)
950 {
951     int i;
952     VASliceParameterBufferJPEGBaseline *p=(VASliceParameterBufferJPEGBaseline *)data;
953     DPY2TRACECTX(dpy);
954 
955     va_TraceMsg(trace_ctx,"*VASliceParameterBufferJPEG\n");
956     va_TraceMsg(trace_ctx,"\tslice_data_size = %u\n", p->slice_data_size);
957     va_TraceMsg(trace_ctx,"\tslice_data_offset = %u\n", p->slice_data_offset);
958     va_TraceMsg(trace_ctx,"\tslice_data_flag = %u\n", p->slice_data_flag);
959     va_TraceMsg(trace_ctx,"\tslice_horizontal_position = %u\n", p->slice_horizontal_position);
960     va_TraceMsg(trace_ctx,"\tslice_vertical_position = %u\n", p->slice_vertical_position);
961     va_TraceMsg(trace_ctx,"\tcomponents = \n");
962     for (i = 0; i < p->num_components && i < 4; ++i) {
963         va_TraceMsg(trace_ctx,"\t\t[%d] component_selector = %u\n", i, p->components[i].component_selector);
964         va_TraceMsg(trace_ctx,"\t\t[%d] dc_table_selector = %u\n", i, p->components[i].dc_table_selector);
965         va_TraceMsg(trace_ctx,"\t\t[%d] ac_table_selector = %u\n", i, p->components[i].ac_table_selector);
966     }
967     va_TraceMsg(trace_ctx,"\trestart_interval = %u\n", p->restart_interval);
968     va_TraceMsg(trace_ctx,"\tnum_mcus = %u\n", p->num_mcus);
969 }
970 
va_TraceVAHuffmanTableBufferJPEG(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)971 static void va_TraceVAHuffmanTableBufferJPEG(
972     VADisplay dpy,
973     VAContextID __maybe_unused context,
974     VABufferID __maybe_unused buffer,
975     VABufferType __maybe_unused type,
976     unsigned int __maybe_unused size,
977     unsigned int __maybe_unused num_elements,
978     void *data)
979 {
980     int i, j;
981     static char tmp[1024];
982     VAHuffmanTableBufferJPEGBaseline *p=(VAHuffmanTableBufferJPEGBaseline *)data;
983     DPY2TRACECTX(dpy);
984     va_TraceMsg(trace_ctx,"*VAHuffmanTableBufferJPEG\n");
985 
986     for (i = 0; i < 2; ++i) {
987         va_TraceMsg(trace_ctx,"\tload_huffman_table[%d] =%u\n", i, p->load_huffman_table[0]);
988         va_TraceMsg(trace_ctx,"\thuffman_table[%d] =\n", i);
989         memset(tmp, 0, sizeof tmp);
990         for (j = 0; j < 16; ++j) {
991             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].num_dc_codes[j]);
992         }
993         va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
994         memset(tmp, 0, sizeof tmp);
995         for (j = 0; j < 12; ++j) {
996             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].dc_values[j]);
997         }
998         va_TraceMsg(trace_ctx,"\t\tdc_values =%s\n", tmp);
999         memset(tmp, 0, sizeof tmp);
1000         for (j = 0; j < 16; ++j) {
1001             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].num_ac_codes[j]);
1002         }
1003         va_TraceMsg(trace_ctx,"\t\tnum_ac_codes =%s\n", tmp);
1004         memset(tmp, 0, sizeof tmp);
1005         for (j = 0; j < 162; ++j) {
1006             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].ac_values[j]);
1007         }
1008         va_TraceMsg(trace_ctx,"\t\tac_values =%s\n", tmp);
1009         memset(tmp, 0, sizeof tmp);
1010         for (j = 0; j < 2; ++j) {
1011             sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].pad[j]);
1012         }
1013         va_TraceMsg(trace_ctx,"\t\tpad =%s\n", tmp);
1014     }
1015 }
1016 
va_TraceVAPictureParameterBufferMPEG4(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1017 static void va_TraceVAPictureParameterBufferMPEG4(
1018     VADisplay dpy,
1019     VAContextID __maybe_unused context,
1020     VABufferID __maybe_unused buffer,
1021     VABufferType __maybe_unused type,
1022     unsigned int __maybe_unused size,
1023     unsigned int __maybe_unused num_elements,
1024     void *data)
1025 {
1026     int i;
1027     VAPictureParameterBufferMPEG4 *p=(VAPictureParameterBufferMPEG4 *)data;
1028 
1029     DPY2TRACECTX(dpy);
1030 
1031     va_TraceMsg(trace_ctx,"*VAPictureParameterBufferMPEG4\n");
1032     va_TraceMsg(trace_ctx,"\tvop_width = %d\n", p->vop_width);
1033     va_TraceMsg(trace_ctx,"\tvop_height = %d\n", p->vop_height);
1034     va_TraceMsg(trace_ctx,"\tforward_reference_picture = %d\n", p->forward_reference_picture);
1035     va_TraceMsg(trace_ctx,"\tbackward_reference_picture = %d\n", p->backward_reference_picture);
1036     va_TraceMsg(trace_ctx,"\tvol_fields value = %d\n", p->vol_fields.value);
1037     va_TraceMsg(trace_ctx,"\tshort_video_header= %d\n", p->vol_fields.bits.short_video_header);
1038     va_TraceMsg(trace_ctx,"\tchroma_format= %d\n", p->vol_fields.bits.chroma_format);
1039     va_TraceMsg(trace_ctx,"\tinterlaced= %d\n", p->vol_fields.bits.interlaced);
1040     va_TraceMsg(trace_ctx,"\tobmc_disable= %d\n", p->vol_fields.bits.obmc_disable);
1041     va_TraceMsg(trace_ctx,"\tsprite_enable= %d\n", p->vol_fields.bits.sprite_enable);
1042     va_TraceMsg(trace_ctx,"\tsprite_warping_accuracy= %d\n", p->vol_fields.bits.sprite_warping_accuracy);
1043     va_TraceMsg(trace_ctx,"\tquant_type= %d\n", p->vol_fields.bits.quant_type);
1044     va_TraceMsg(trace_ctx,"\tquarter_sample= %d\n", p->vol_fields.bits.quarter_sample);
1045     va_TraceMsg(trace_ctx,"\tdata_partitioned= %d\n", p->vol_fields.bits.data_partitioned);
1046     va_TraceMsg(trace_ctx,"\treversible_vlc= %d\n", p->vol_fields.bits.reversible_vlc);
1047     va_TraceMsg(trace_ctx,"\tresync_marker_disable= %d\n", p->vol_fields.bits.resync_marker_disable);
1048     va_TraceMsg(trace_ctx,"\tno_of_sprite_warping_points = %d\n", p->no_of_sprite_warping_points);
1049     va_TraceMsg(trace_ctx,"\tsprite_trajectory_du =");
1050     for(i=0;i<3;i++)
1051         va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_du[i]);
1052 
1053     va_TraceMsg(trace_ctx,"\n");
1054     va_TraceMsg(trace_ctx,"\tsprite_trajectory_dv =");
1055     for(i=0;i<3;i++)
1056         va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_dv[i]);
1057     va_TraceMsg(trace_ctx,"\n");
1058     va_TraceMsg(trace_ctx,"\tvop_fields value = %d\n", p->vop_fields.value);
1059     va_TraceMsg(trace_ctx,"\tvop_coding_type= %d\n", p->vop_fields.bits.vop_coding_type);
1060     va_TraceMsg(trace_ctx,"\tbackward_reference_vop_coding_type= %d\n", p->vop_fields.bits.backward_reference_vop_coding_type);
1061     va_TraceMsg(trace_ctx,"\tvop_rounding_type= %d\n", p->vop_fields.bits.vop_rounding_type);
1062     va_TraceMsg(trace_ctx,"\tintra_dc_vlc_thr= %d\n", p->vop_fields.bits.intra_dc_vlc_thr);
1063     va_TraceMsg(trace_ctx,"\ttop_field_first= %d\n", p->vop_fields.bits.top_field_first);
1064     va_TraceMsg(trace_ctx,"\talternate_vertical_scan_flag= %d\n", p->vop_fields.bits.alternate_vertical_scan_flag);
1065     va_TraceMsg(trace_ctx,"\tvop_fcode_forward = %d\n", p->vop_fcode_forward);
1066     va_TraceMsg(trace_ctx,"\tvop_fcode_backward = %d\n", p->vop_fcode_backward);
1067     va_TraceMsg(trace_ctx,"\tnum_gobs_in_vop = %d\n", p->num_gobs_in_vop);
1068     va_TraceMsg(trace_ctx,"\tnum_macroblocks_in_gob = %d\n", p->num_macroblocks_in_gob);
1069     va_TraceMsg(trace_ctx,"\tTRB = %d\n", p->TRB);
1070     va_TraceMsg(trace_ctx,"\tTRD = %d\n", p->TRD);
1071     va_TraceMsg(trace_ctx, NULL);
1072 
1073     return;
1074 }
1075 
1076 
va_TraceVAIQMatrixBufferMPEG4(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1077 static void va_TraceVAIQMatrixBufferMPEG4(
1078     VADisplay dpy,
1079     VAContextID __maybe_unused context,
1080     VABufferID __maybe_unused buffer,
1081     VABufferType __maybe_unused type,
1082     unsigned int __maybe_unused size,
1083     unsigned int __maybe_unused num_elements,
1084     void *data)
1085 {
1086     int i;
1087     VAIQMatrixBufferMPEG4 *p=(VAIQMatrixBufferMPEG4 *)data;
1088     DPY2TRACECTX(dpy);
1089 
1090     va_TraceMsg(trace_ctx,"VAIQMatrixBufferMPEG4\n");
1091 
1092     va_TraceMsg(trace_ctx,"\tload_intra_quant_mat = %d\n", p->load_intra_quant_mat);
1093     va_TraceMsg(trace_ctx,"\tload_non_intra_quant_mat = %d\n", p->load_non_intra_quant_mat);
1094     va_TraceMsg(trace_ctx,"\tintra_quant_mat =\n");
1095     for(i=0;i<64;i++)
1096         va_TraceMsg(trace_ctx,"\t\t%d\n", p->intra_quant_mat[i]);
1097 
1098     va_TraceMsg(trace_ctx,"\tnon_intra_quant_mat =\n");
1099     for(i=0;i<64;i++)
1100         va_TraceMsg(trace_ctx,"\t\t%d\n", p->non_intra_quant_mat[i]);
1101     va_TraceMsg(trace_ctx, NULL);
1102 
1103     return;
1104 }
1105 
va_TraceVAEncSequenceParameterBufferMPEG4(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1106 static void va_TraceVAEncSequenceParameterBufferMPEG4(
1107     VADisplay dpy,
1108     VAContextID __maybe_unused context,
1109     VABufferID __maybe_unused buffer,
1110     VABufferType __maybe_unused type,
1111     unsigned int __maybe_unused size,
1112     unsigned int __maybe_unused num_elements,
1113     void *data)
1114 {
1115     VAEncSequenceParameterBufferMPEG4 *p = (VAEncSequenceParameterBufferMPEG4 *)data;
1116     DPY2TRACECTX(dpy);
1117 
1118     va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferMPEG4\n");
1119     va_TraceMsg(trace_ctx, "\tprofile_and_level_indication = %d\n", p->profile_and_level_indication);
1120     va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
1121     va_TraceMsg(trace_ctx, "\tvideo_object_layer_width = %d\n", p->video_object_layer_width);
1122     va_TraceMsg(trace_ctx, "\tvideo_object_layer_height = %d\n", p->video_object_layer_height);
1123     va_TraceMsg(trace_ctx, "\tvop_time_increment_resolution = %d\n", p->vop_time_increment_resolution);
1124     va_TraceMsg(trace_ctx, "\tfixed_vop_rate = %d\n", p->fixed_vop_rate);
1125     va_TraceMsg(trace_ctx, "\tfixed_vop_time_increment = %d\n", p->fixed_vop_time_increment);
1126     va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1127     va_TraceMsg(trace_ctx, "\tframe_rate = %d\n", p->frame_rate);
1128     va_TraceMsg(trace_ctx, "\tinitial_qp = %d\n", p->initial_qp);
1129     va_TraceMsg(trace_ctx, "\tmin_qp = %d\n", p->min_qp);
1130     va_TraceMsg(trace_ctx, NULL);
1131 
1132     return;
1133 }
1134 
va_TraceVAEncPictureParameterBufferMPEG4(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1135 static void va_TraceVAEncPictureParameterBufferMPEG4(
1136     VADisplay dpy,
1137     VAContextID __maybe_unused context,
1138     VABufferID __maybe_unused buffer,
1139     VABufferType __maybe_unused type,
1140     unsigned int __maybe_unused size,
1141     unsigned int __maybe_unused num_elements,
1142     void *data)
1143 {
1144     VAEncPictureParameterBufferMPEG4 *p = (VAEncPictureParameterBufferMPEG4 *)data;
1145     DPY2TRACECTX(dpy);
1146 
1147     va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferMPEG4\n");
1148     va_TraceMsg(trace_ctx, "\treference_picture = 0x%08x\n", p->reference_picture);
1149     va_TraceMsg(trace_ctx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
1150     va_TraceMsg(trace_ctx, "\tcoded_buf = 0x%08x\n", p->coded_buf);
1151     va_TraceMsg(trace_ctx, "\tpicture_width = %d\n", p->picture_width);
1152     va_TraceMsg(trace_ctx, "\tpicture_height = %d\n", p->picture_height);
1153     va_TraceMsg(trace_ctx, "\tmodulo_time_base = %d\n", p->modulo_time_base);
1154     va_TraceMsg(trace_ctx, "\tvop_time_increment = %d\n", p->vop_time_increment);
1155     va_TraceMsg(trace_ctx, "\tpicture_type = %d\n", p->picture_type);
1156     va_TraceMsg(trace_ctx, NULL);
1157 
1158     return;
1159 }
1160 
1161 
va_TraceVASliceParameterBufferMPEG4(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1162 static void va_TraceVASliceParameterBufferMPEG4(
1163     VADisplay dpy,
1164     VAContextID __maybe_unused context,
1165     VABufferID __maybe_unused buffer,
1166     VABufferType __maybe_unused type,
1167     unsigned int __maybe_unused size,
1168     unsigned int __maybe_unused num_elements,
1169     void *data)
1170 {
1171     VASliceParameterBufferMPEG4 *p=(VASliceParameterBufferMPEG4 *)data;
1172 
1173     DPY2TRACECTX(dpy);
1174 
1175     trace_ctx->trace_slice_no++;
1176 
1177     trace_ctx->trace_slice_size = p->slice_data_size;
1178 
1179     va_TraceMsg(trace_ctx,"VASliceParameterBufferMPEG4\n");
1180 
1181     va_TraceMsg(trace_ctx,"\tslice_data_size = %d\n", p->slice_data_size);
1182     va_TraceMsg(trace_ctx,"\tslice_data_offset = %d\n", p->slice_data_offset);
1183     va_TraceMsg(trace_ctx,"\tslice_data_flag = %d\n", p->slice_data_flag);
1184     va_TraceMsg(trace_ctx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
1185     va_TraceMsg(trace_ctx,"\tmacroblock_number = %d\n", p->macroblock_number);
1186     va_TraceMsg(trace_ctx,"\tquant_scale = %d\n", p->quant_scale);
1187     va_TraceMsg(trace_ctx, NULL);
1188 
1189     return;
1190 }
1191 
1192 
va_TraceFlagIfNotZero(struct trace_context * trace_ctx,const char * name,unsigned int flag)1193 static inline void va_TraceFlagIfNotZero(
1194     struct trace_context *trace_ctx,
1195     const char *name,   /* in */
1196     unsigned int flag   /* in */
1197 )
1198 {
1199     if (flag != 0) {
1200         va_TraceMsg(trace_ctx, "%s = %x\n", name, flag);
1201     }
1202 }
1203 
1204 
va_TraceVAPictureParameterBufferH264(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1205 static void va_TraceVAPictureParameterBufferH264(
1206     VADisplay dpy,
1207     VAContextID __maybe_unused context,
1208     VABufferID __maybe_unused buffer,
1209     VABufferType __maybe_unused type,
1210     unsigned int __maybe_unused size,
1211     unsigned int __maybe_unused num_elements,
1212     void *data)
1213 {
1214     int i;
1215     VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data;
1216 
1217     DPY2TRACECTX(dpy);
1218 
1219     va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferH264\n");
1220 
1221     va_TraceMsg(trace_ctx, "\tCurrPic.picture_id = 0x%08x\n", p->CurrPic.picture_id);
1222     va_TraceMsg(trace_ctx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
1223     va_TraceMsg(trace_ctx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
1224     va_TraceMsg(trace_ctx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
1225     va_TraceMsg(trace_ctx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
1226 
1227     va_TraceMsg(trace_ctx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags:\n");
1228     for (i = 0; i < 16; i++)
1229     {
1230         if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) &&
1231             ((p->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) == 0)) {
1232             va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08x\n",
1233                         p->ReferenceFrames[i].TopFieldOrderCnt,
1234                         p->ReferenceFrames[i].BottomFieldOrderCnt,
1235                         p->ReferenceFrames[i].picture_id,
1236                         p->ReferenceFrames[i].frame_idx,
1237                         p->ReferenceFrames[i].flags);
1238         } else
1239             break;
1240     }
1241     va_TraceMsg(trace_ctx, "\tpicture_width_in_mbs_minus1 = %d\n", p->picture_width_in_mbs_minus1);
1242     va_TraceMsg(trace_ctx, "\tpicture_height_in_mbs_minus1 = %d\n", p->picture_height_in_mbs_minus1);
1243     va_TraceMsg(trace_ctx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
1244     va_TraceMsg(trace_ctx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
1245     va_TraceMsg(trace_ctx, "\tnum_ref_frames = %d\n", p->num_ref_frames);
1246     va_TraceMsg(trace_ctx, "\tseq fields = %d\n", p->seq_fields.value);
1247     va_TraceMsg(trace_ctx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
1248     va_TraceMsg(trace_ctx, "\tresidual_colour_transform_flag = %d\n", p->seq_fields.bits.residual_colour_transform_flag);
1249     va_TraceMsg(trace_ctx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
1250     va_TraceMsg(trace_ctx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
1251     va_TraceMsg(trace_ctx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
1252     va_TraceMsg(trace_ctx, "\tMinLumaBiPredSize8x8 = %d\n", p->seq_fields.bits.MinLumaBiPredSize8x8);
1253     va_TraceMsg(trace_ctx, "\tnum_slice_groups_minus1 = %d\n", p->num_slice_groups_minus1);
1254     va_TraceMsg(trace_ctx, "\tslice_group_map_type = %d\n", p->slice_group_map_type);
1255     va_TraceMsg(trace_ctx, "\tslice_group_change_rate_minus1 = %d\n", p->slice_group_change_rate_minus1);
1256     va_TraceMsg(trace_ctx, "\tpic_init_qp_minus26 = %d\n", p->pic_init_qp_minus26);
1257     va_TraceMsg(trace_ctx, "\tpic_init_qs_minus26 = %d\n", p->pic_init_qs_minus26);
1258     va_TraceMsg(trace_ctx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
1259     va_TraceMsg(trace_ctx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
1260     va_TraceMsg(trace_ctx, "\tpic_fields = 0x%03x\n", p->pic_fields.value);
1261     va_TraceFlagIfNotZero(trace_ctx, "\t\tentropy_coding_mode_flag", p->pic_fields.bits.entropy_coding_mode_flag);
1262     va_TraceFlagIfNotZero(trace_ctx, "\t\tweighted_pred_flag", p->pic_fields.bits.weighted_pred_flag);
1263     va_TraceFlagIfNotZero(trace_ctx, "\t\tweighted_bipred_idc", p->pic_fields.bits.weighted_bipred_idc);
1264     va_TraceFlagIfNotZero(trace_ctx, "\t\ttransform_8x8_mode_flag", p->pic_fields.bits.transform_8x8_mode_flag);
1265     va_TraceFlagIfNotZero(trace_ctx, "\t\tfield_pic_flag", p->pic_fields.bits.field_pic_flag);
1266     va_TraceFlagIfNotZero(trace_ctx, "\t\tconstrained_intra_pred_flag", p->pic_fields.bits.constrained_intra_pred_flag);
1267     va_TraceFlagIfNotZero(trace_ctx, "\t\tpic_order_present_flag", p->pic_fields.bits.pic_order_present_flag);
1268     va_TraceFlagIfNotZero(trace_ctx, "\t\tdeblocking_filter_control_present_flag", p->pic_fields.bits.deblocking_filter_control_present_flag);
1269     va_TraceFlagIfNotZero(trace_ctx, "\t\tredundant_pic_cnt_present_flag", p->pic_fields.bits.redundant_pic_cnt_present_flag);
1270     va_TraceFlagIfNotZero(trace_ctx, "\t\treference_pic_flag", p->pic_fields.bits.reference_pic_flag);
1271     va_TraceMsg(trace_ctx, "\tframe_num = %d\n", p->frame_num);
1272     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l0_default_active_minus1 = %d\n", p->num_ref_idx_l0_default_active_minus1);
1273     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_default_active_minus1 = %d\n", p->num_ref_idx_l1_default_active_minus1);
1274 
1275     va_TraceMsg(trace_ctx, NULL);
1276 
1277     return;
1278 }
1279 
va_TraceVASliceParameterBufferH264(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1280 static void va_TraceVASliceParameterBufferH264(
1281     VADisplay dpy,
1282     VAContextID __maybe_unused context,
1283     VABufferID __maybe_unused buffer,
1284     VABufferType __maybe_unused type,
1285     unsigned int __maybe_unused size,
1286     unsigned int __maybe_unused num_elements,
1287     void *data)
1288 {
1289     int i;
1290     VASliceParameterBufferH264* p = (VASliceParameterBufferH264*)data;
1291     DPY2TRACECTX(dpy);
1292 
1293     trace_ctx->trace_slice_no++;
1294     trace_ctx->trace_slice_size = p->slice_data_size;
1295 
1296     va_TraceMsg(trace_ctx, "\t--VASliceParameterBufferH264\n");
1297     va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
1298     va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
1299     va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
1300     va_TraceMsg(trace_ctx, "\tslice_data_bit_offset = %d\n", p->slice_data_bit_offset);
1301     va_TraceMsg(trace_ctx, "\tfirst_mb_in_slice = %d\n", p->first_mb_in_slice);
1302     va_TraceMsg(trace_ctx, "\tslice_type = %d\n", p->slice_type);
1303     va_TraceMsg(trace_ctx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
1304     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
1305     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1306     va_TraceMsg(trace_ctx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
1307     va_TraceMsg(trace_ctx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
1308     va_TraceMsg(trace_ctx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
1309     va_TraceMsg(trace_ctx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
1310     va_TraceMsg(trace_ctx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1311 
1312     va_TraceMsg(trace_ctx, "\tRefPicList0 =\n");
1313     for (i = 0; i < 32; i++) {
1314         if ((p->RefPicList0[i].picture_id != VA_INVALID_SURFACE) &&
1315             ((p->RefPicList0[i].flags & VA_PICTURE_H264_INVALID) == 0))
1316         va_TraceMsg(trace_ctx, "%08d-%08d-0x%08x-%08d-0x%08x\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx,  p->RefPicList0[i].flags);
1317         else
1318             break;
1319     }
1320     va_TraceMsg(trace_ctx, "\tRefPicList1 =\n");
1321     for (i = 0; i < 32; i++) {
1322         if ((p->RefPicList1[i].picture_id != VA_INVALID_SURFACE) &&
1323             ((p->RefPicList1[i].flags & VA_PICTURE_H264_INVALID) == 0))
1324             va_TraceMsg(trace_ctx, "%08d-%08d-0x%08x-%08d-0x%08x\n", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx, p->RefPicList1[i].flags);
1325         else
1326             break;
1327     }
1328 
1329     va_TraceMsg(trace_ctx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
1330     va_TraceMsg(trace_ctx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
1331     va_TraceMsg(trace_ctx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
1332 
1333     for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1334         va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
1335             p->luma_weight_l0[i],
1336             p->luma_offset_l0[i]);
1337     }
1338 
1339 
1340     va_TraceMsg(trace_ctx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
1341 
1342     for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1343         va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1344             p->chroma_weight_l0[i][0],
1345             p->chroma_offset_l0[i][0],
1346             p->chroma_weight_l0[i][1],
1347             p->chroma_offset_l0[i][1]);
1348     }
1349 
1350 
1351     va_TraceMsg(trace_ctx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
1352 
1353     for (i = 0; (i <=  p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1354         va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
1355             p->luma_weight_l1[i],
1356             p->luma_offset_l1[i]);
1357     }
1358 
1359 
1360     va_TraceMsg(trace_ctx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
1361 
1362     for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1363         va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1364             p->chroma_weight_l1[i][0],
1365             p->chroma_offset_l1[i][0],
1366             p->chroma_weight_l1[i][1],
1367             p->chroma_offset_l1[i][1]);
1368 
1369     }
1370     va_TraceMsg(trace_ctx, NULL);
1371 }
1372 
va_TraceVAIQMatrixBufferH264(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1373 static void va_TraceVAIQMatrixBufferH264(
1374     VADisplay dpy,
1375     VAContextID __maybe_unused context,
1376     VABufferID __maybe_unused buffer,
1377     VABufferType __maybe_unused type,
1378     unsigned int __maybe_unused size,
1379     unsigned int __maybe_unused num_elements,
1380     void *data
1381 )
1382 {
1383     int i, j;
1384     VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data;
1385 
1386     DPY2TRACECTX(dpy);
1387 
1388     va_TraceMsg(trace_ctx, "\t--VAIQMatrixBufferH264\n");
1389 
1390     va_TraceMsg(trace_ctx, "\tScalingList4x4[6][16]=\n");
1391     for (i = 0; i < 6; i++) {
1392         for (j = 0; j < 16; j++) {
1393             if (trace_ctx->trace_fp_log) {
1394                 fprintf(trace_ctx->trace_fp_log, "\t%d", p->ScalingList4x4[i][j]);
1395                 if ((j + 1) % 8 == 0)
1396                     fprintf(trace_ctx->trace_fp_log, "\n");
1397             }
1398         }
1399     }
1400 
1401     va_TraceMsg(trace_ctx, "\tScalingList8x8[2][64]=\n");
1402     for (i = 0; i < 2; i++) {
1403         for (j = 0; j < 64; j++) {
1404             if (trace_ctx->trace_fp_log) {
1405                 fprintf(trace_ctx->trace_fp_log,"\t%d", p->ScalingList8x8[i][j]);
1406                 if ((j + 1) % 8 == 0)
1407                     fprintf(trace_ctx->trace_fp_log, "\n");
1408             }
1409         }
1410     }
1411 
1412     va_TraceMsg(trace_ctx, NULL);
1413 }
1414 
1415 
1416 
va_TraceVAEncSequenceParameterBufferH264(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1417 static void va_TraceVAEncSequenceParameterBufferH264(
1418     VADisplay dpy,
1419     VAContextID __maybe_unused context,
1420     VABufferID __maybe_unused buffer,
1421     VABufferType __maybe_unused type,
1422     unsigned int __maybe_unused size,
1423     unsigned int __maybe_unused num_elements,
1424     void *data)
1425 {
1426     VAEncSequenceParameterBufferH264 *p = (VAEncSequenceParameterBufferH264 *)data;
1427     DPY2TRACECTX(dpy);
1428     unsigned int i;
1429 
1430     va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferH264\n");
1431 
1432     va_TraceMsg(trace_ctx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
1433     va_TraceMsg(trace_ctx, "\tlevel_idc = %d\n", p->level_idc);
1434     va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
1435     va_TraceMsg(trace_ctx, "\tintra_idr_period = %d\n", p->intra_idr_period);
1436     va_TraceMsg(trace_ctx, "\tip_period = %d\n", p->ip_period);
1437     va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1438     va_TraceMsg(trace_ctx, "\tmax_num_ref_frames = %d\n", p->max_num_ref_frames);
1439     va_TraceMsg(trace_ctx, "\tpicture_width_in_mbs = %d\n", p->picture_width_in_mbs);
1440     va_TraceMsg(trace_ctx, "\tpicture_height_in_mbs = %d\n", p->picture_height_in_mbs);
1441     va_TraceMsg(trace_ctx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
1442     va_TraceMsg(trace_ctx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
1443     va_TraceMsg(trace_ctx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
1444     va_TraceMsg(trace_ctx, "\tseq_scaling_matrix_present_flag = %d\n", p->seq_fields.bits.seq_scaling_matrix_present_flag);
1445     va_TraceMsg(trace_ctx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
1446     va_TraceMsg(trace_ctx, "\tlog2_max_frame_num_minus4 = %d\n", p->seq_fields.bits.log2_max_frame_num_minus4);
1447     va_TraceMsg(trace_ctx, "\tpic_order_cnt_type = %d\n", p->seq_fields.bits.pic_order_cnt_type);
1448     va_TraceMsg(trace_ctx, "\tlog2_max_pic_order_cnt_lsb_minus4 = %d\n", p->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4);
1449     va_TraceMsg(trace_ctx, "\tdelta_pic_order_always_zero_flag = %d\n", p->seq_fields.bits.delta_pic_order_always_zero_flag);
1450     va_TraceMsg(trace_ctx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
1451     va_TraceMsg(trace_ctx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
1452     va_TraceMsg(trace_ctx, "\tnum_ref_frames_in_pic_order_cnt_cycle = %d\n", p->num_ref_frames_in_pic_order_cnt_cycle);
1453     va_TraceMsg(trace_ctx, "\toffset_for_non_ref_pic = %d\n", p->offset_for_non_ref_pic);
1454     va_TraceMsg(trace_ctx, "\toffset_for_top_to_bottom_field = %d\n", p->offset_for_top_to_bottom_field);
1455     for(i = 0; (i < p->max_num_ref_frames) && (i < 32); ++i)
1456         va_TraceMsg(trace_ctx, "\toffset_for_ref_frame[%d] = %d\n", i, p->offset_for_ref_frame[i]);
1457     va_TraceMsg(trace_ctx, "\tframe_cropping_flag = %d\n", p->frame_cropping_flag);
1458     va_TraceMsg(trace_ctx, "\tframe_crop_left_offset = %d\n", p->frame_crop_left_offset);
1459     va_TraceMsg(trace_ctx, "\tframe_crop_right_offset = %d\n", p->frame_crop_right_offset);
1460     va_TraceMsg(trace_ctx, "\tframe_crop_top_offset = %d\n", p->frame_crop_top_offset);
1461     va_TraceMsg(trace_ctx, "\tframe_crop_bottom_offset = %d\n", p->frame_crop_bottom_offset);
1462     va_TraceMsg(trace_ctx, "\tvui_parameters_present_flag = %d\n", p->vui_parameters_present_flag);
1463     va_TraceMsg(trace_ctx, "\taspect_ratio_info_present_flag = %d\n", p->vui_fields.bits.aspect_ratio_info_present_flag);
1464     va_TraceMsg(trace_ctx, "\ttiming_info_present_flag = %d\n", p->vui_fields.bits.timing_info_present_flag);
1465     va_TraceMsg(trace_ctx, "\tbitstream_restriction_flag = %d\n", p->vui_fields.bits.bitstream_restriction_flag);
1466     va_TraceMsg(trace_ctx, "\tlog2_max_mv_length_horizontal = %d\n", p->vui_fields.bits.log2_max_mv_length_horizontal);
1467     va_TraceMsg(trace_ctx, "\tlog2_max_mv_length_vertical = %d\n", p->vui_fields.bits.log2_max_mv_length_vertical);
1468     va_TraceMsg(trace_ctx, "\taspect_ratio_idc = %d\n", p->aspect_ratio_idc);
1469     va_TraceMsg(trace_ctx, "\tsar_width = %d\n", p->sar_width);
1470     va_TraceMsg(trace_ctx, "\tsar_height = %d\n", p->sar_height);
1471     va_TraceMsg(trace_ctx, "\tnum_units_in_tick = %d\n", p->num_units_in_tick);
1472     va_TraceMsg(trace_ctx, "\ttime_scale = %d\n", p->time_scale);
1473 
1474     va_TraceMsg(trace_ctx, NULL);
1475 
1476     return;
1477 }
1478 
1479 
va_TraceVAEncPictureParameterBufferH264(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1480 static void va_TraceVAEncPictureParameterBufferH264(
1481     VADisplay dpy,
1482     VAContextID __maybe_unused context,
1483     VABufferID __maybe_unused buffer,
1484     VABufferType __maybe_unused type,
1485     unsigned int __maybe_unused size,
1486     unsigned int __maybe_unused num_elements,
1487     void *data)
1488 {
1489     VAEncPictureParameterBufferH264 *p = (VAEncPictureParameterBufferH264 *)data;
1490     DPY2TRACECTX(dpy);
1491     int i;
1492 
1493     va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferH264\n");
1494 
1495     va_TraceMsg(trace_ctx, "\tCurrPic.picture_id = 0x%08x\n", p->CurrPic.picture_id);
1496     va_TraceMsg(trace_ctx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
1497     va_TraceMsg(trace_ctx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
1498     va_TraceMsg(trace_ctx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
1499     va_TraceMsg(trace_ctx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
1500     va_TraceMsg(trace_ctx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
1501     for (i = 0; i < 16; i++)
1502     {
1503         if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) &&
1504             ((p->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) == 0)) {
1505             va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08x\n",
1506                         p->ReferenceFrames[i].TopFieldOrderCnt,
1507                         p->ReferenceFrames[i].BottomFieldOrderCnt,
1508                         p->ReferenceFrames[i].picture_id,
1509                         p->ReferenceFrames[i].frame_idx,
1510                         p->ReferenceFrames[i].flags
1511                         );
1512         } else
1513             break;
1514     }
1515     va_TraceMsg(trace_ctx, "\tcoded_buf = %08x\n", p->coded_buf);
1516     va_TraceMsg(trace_ctx, "\tpic_parameter_set_id = %d\n", p->pic_parameter_set_id);
1517     va_TraceMsg(trace_ctx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
1518     va_TraceMsg(trace_ctx, "\tlast_picture = 0x%08x\n", p->last_picture);
1519     va_TraceMsg(trace_ctx, "\tframe_num = %d\n", p->frame_num);
1520     va_TraceMsg(trace_ctx, "\tpic_init_qp = %d\n", p->pic_init_qp);
1521     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
1522     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1523     va_TraceMsg(trace_ctx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
1524     va_TraceMsg(trace_ctx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
1525     va_TraceMsg(trace_ctx, "\tpic_fields = 0x%03x\n", p->pic_fields.value);
1526     va_TraceMsg(trace_ctx, "\tidr_pic_flag = %d\n", p->pic_fields.bits.idr_pic_flag);
1527     va_TraceMsg(trace_ctx, "\treference_pic_flag = %d\n", p->pic_fields.bits.reference_pic_flag);
1528     va_TraceMsg(trace_ctx, "\tentropy_coding_mode_flag = %d\n", p->pic_fields.bits.entropy_coding_mode_flag);
1529     va_TraceMsg(trace_ctx, "\tweighted_pred_flag = %d\n", p->pic_fields.bits.weighted_pred_flag);
1530     va_TraceMsg(trace_ctx, "\tweighted_bipred_idc = %d\n", p->pic_fields.bits.weighted_bipred_idc);
1531     va_TraceMsg(trace_ctx, "\tconstrained_intra_pred_flag = %d\n", p->pic_fields.bits.constrained_intra_pred_flag);
1532     va_TraceMsg(trace_ctx, "\ttransform_8x8_mode_flag = %d\n", p->pic_fields.bits.transform_8x8_mode_flag);
1533     va_TraceMsg(trace_ctx, "\tdeblocking_filter_control_present_flag = %d\n", p->pic_fields.bits.deblocking_filter_control_present_flag);
1534     va_TraceMsg(trace_ctx, "\tredundant_pic_cnt_present_flag = %d\n", p->pic_fields.bits.redundant_pic_cnt_present_flag);
1535     va_TraceMsg(trace_ctx, "\tpic_order_present_flag = %d\n", p->pic_fields.bits.pic_order_present_flag);
1536     va_TraceMsg(trace_ctx, "\tpic_scaling_matrix_present_flag = %d\n", p->pic_fields.bits.pic_scaling_matrix_present_flag);
1537 
1538     va_TraceMsg(trace_ctx, NULL);
1539 
1540     return;
1541 }
1542 
va_TraceVAEncSliceParameterBuffer(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1543 static void va_TraceVAEncSliceParameterBuffer(
1544     VADisplay dpy,
1545     VAContextID __maybe_unused context,
1546     VABufferID __maybe_unused buffer,
1547     VABufferType __maybe_unused type,
1548     unsigned int __maybe_unused size,
1549     unsigned int __maybe_unused num_elements,
1550     void *data)
1551 {
1552     VAEncSliceParameterBuffer* p = (VAEncSliceParameterBuffer*)data;
1553     DPY2TRACECTX(dpy);
1554 
1555     va_TraceMsg(trace_ctx, "\t--VAEncSliceParameterBuffer\n");
1556 
1557     va_TraceMsg(trace_ctx, "\tstart_row_number = %d\n", p->start_row_number);
1558     va_TraceMsg(trace_ctx, "\tslice_height = %d\n", p->slice_height);
1559     va_TraceMsg(trace_ctx, "\tslice_flags.is_intra = %d\n", p->slice_flags.bits.is_intra);
1560     va_TraceMsg(trace_ctx, "\tslice_flags.disable_deblocking_filter_idc = %d\n", p->slice_flags.bits.disable_deblocking_filter_idc);
1561     va_TraceMsg(trace_ctx, "\tslice_flags.uses_long_term_ref = %d\n", p->slice_flags.bits.uses_long_term_ref);
1562     va_TraceMsg(trace_ctx, "\tslice_flags.is_long_term_ref = %d\n", p->slice_flags.bits.is_long_term_ref);
1563     va_TraceMsg(trace_ctx, NULL);
1564 
1565     return;
1566 }
1567 
va_TraceVAEncSliceParameterBufferH264(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1568 static void va_TraceVAEncSliceParameterBufferH264(
1569     VADisplay dpy,
1570     VAContextID __maybe_unused context,
1571     VABufferID __maybe_unused buffer,
1572     VABufferType __maybe_unused type,
1573     unsigned int __maybe_unused size,
1574     unsigned int __maybe_unused num_elements,
1575     void *data)
1576 {
1577     VAEncSliceParameterBufferH264* p = (VAEncSliceParameterBufferH264*)data;
1578     DPY2TRACECTX(dpy);
1579     int i;
1580 
1581     if (!p)
1582         return;
1583 
1584     va_TraceMsg(trace_ctx, "\t--VAEncSliceParameterBufferH264\n");
1585     va_TraceMsg(trace_ctx, "\tmacroblock_address = %d\n", p->macroblock_address);
1586     va_TraceMsg(trace_ctx, "\tnum_macroblocks = %d\n", p->num_macroblocks);
1587     va_TraceMsg(trace_ctx, "\tmacroblock_info = %08x\n", p->macroblock_info);
1588     va_TraceMsg(trace_ctx, "\tslice_type = %d\n", p->slice_type);
1589     va_TraceMsg(trace_ctx, "\tpic_parameter_set_id = %d\n", p->pic_parameter_set_id);
1590     va_TraceMsg(trace_ctx, "\tidr_pic_id = %d\n", p->idr_pic_id);
1591     va_TraceMsg(trace_ctx, "\tpic_order_cnt_lsb = %d\n", p->pic_order_cnt_lsb);
1592     va_TraceMsg(trace_ctx, "\tdelta_pic_order_cnt_bottom = %d\n", p->delta_pic_order_cnt_bottom);
1593     va_TraceMsg(trace_ctx, "\tdelta_pic_order_cnt[0] = %d\n", p->delta_pic_order_cnt[0]);
1594     va_TraceMsg(trace_ctx, "\tdelta_pic_order_cnt[1] = %d\n", p->delta_pic_order_cnt[1]);
1595     va_TraceMsg(trace_ctx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
1596     va_TraceMsg(trace_ctx, "\tnum_ref_idx_active_override_flag = %d\n", p->num_ref_idx_active_override_flag);
1597     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1598     va_TraceMsg(trace_ctx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1599 
1600     va_TraceMsg(trace_ctx, "\tRefPicList0 (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
1601 
1602 
1603 
1604     for (i = 0; i < 32; i++) {
1605         if ((p->RefPicList0[i].picture_id != VA_INVALID_SURFACE) &&
1606             ((p->RefPicList0[i].flags & VA_PICTURE_H264_INVALID) == 0))
1607             va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08x\n",
1608                         p->RefPicList0[i].TopFieldOrderCnt,
1609                         p->RefPicList0[i].BottomFieldOrderCnt,
1610                         p->RefPicList0[i].picture_id,
1611                         p->RefPicList0[i].frame_idx,
1612                         p->RefPicList0[i].flags);
1613         else
1614             break;
1615     }
1616 
1617     va_TraceMsg(trace_ctx, "\tRefPicList1 (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
1618     for (i = 0; i < 32; i++) {
1619         if ((p->RefPicList1[i].picture_id != VA_INVALID_SURFACE) &&
1620             ((p->RefPicList1[i].flags & VA_PICTURE_H264_INVALID) == 0))
1621             va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08d\n",
1622                         p->RefPicList1[i].TopFieldOrderCnt,
1623                         p->RefPicList1[i].BottomFieldOrderCnt,
1624                         p->RefPicList1[i].picture_id,
1625                         p->RefPicList1[i].frame_idx,
1626                         p->RefPicList1[i].flags
1627                         );
1628         else
1629             break;
1630     }
1631 
1632     va_TraceMsg(trace_ctx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
1633     va_TraceMsg(trace_ctx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
1634     va_TraceMsg(trace_ctx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
1635     if (p->luma_weight_l0_flag) {
1636         for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1637             va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
1638                         p->luma_weight_l0[i],
1639                         p->luma_offset_l0[i]);
1640         }
1641     }
1642 
1643     va_TraceMsg(trace_ctx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
1644     if (p->chroma_weight_l0_flag) {
1645         for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1646             va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1647                         p->chroma_weight_l0[i][0],
1648                         p->chroma_offset_l0[i][0],
1649                         p->chroma_weight_l0[i][1],
1650                         p->chroma_offset_l0[i][1]);
1651         }
1652     }
1653 
1654     va_TraceMsg(trace_ctx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
1655     if (p->luma_weight_l1_flag) {
1656         for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1657             va_TraceMsg(trace_ctx, "\t\t%d\t\t%d\n",
1658                         p->luma_weight_l1[i],
1659                         p->luma_offset_l1[i]);
1660         }
1661     }
1662 
1663     va_TraceMsg(trace_ctx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
1664     if (p->chroma_weight_l1_flag && p->num_ref_idx_l1_active_minus1 < 32) {
1665         for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1666             va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1667                         p->chroma_weight_l1[i][0],
1668                         p->chroma_offset_l1[i][0],
1669                         p->chroma_weight_l1[i][1],
1670                         p->chroma_offset_l1[i][1]);
1671         }
1672     }
1673     va_TraceMsg(trace_ctx, NULL);
1674 
1675     va_TraceMsg(trace_ctx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
1676     va_TraceMsg(trace_ctx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
1677     va_TraceMsg(trace_ctx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
1678     va_TraceMsg(trace_ctx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
1679     va_TraceMsg(trace_ctx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1680     va_TraceMsg(trace_ctx, NULL);
1681 
1682     return;
1683 }
1684 
1685 
va_TraceVAEncPackedHeaderParameterBufferType(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1686 static void va_TraceVAEncPackedHeaderParameterBufferType(
1687     VADisplay dpy,
1688     VAContextID __maybe_unused context,
1689     VABufferID __maybe_unused buffer,
1690     VABufferType __maybe_unused type,
1691     unsigned int __maybe_unused size,
1692     unsigned int __maybe_unused num_elements,
1693     void *data)
1694 {
1695     VAEncPackedHeaderParameterBuffer* p = (VAEncPackedHeaderParameterBuffer*)data;
1696     DPY2TRACECTX(dpy);
1697 
1698     if (!p)
1699         return;
1700     va_TraceMsg(trace_ctx, "\t--VAEncPackedHeaderParameterBuffer\n");
1701     va_TraceMsg(trace_ctx, "\ttype = 0x%08x\n", p->type);
1702     va_TraceMsg(trace_ctx, "\tbit_length = %d\n", p->bit_length);
1703     va_TraceMsg(trace_ctx, "\thas_emulation_bytes = %d\n", p->has_emulation_bytes);
1704     va_TraceMsg(trace_ctx, NULL);
1705 
1706     return;
1707 }
1708 
va_TraceVAEncMiscParameterBuffer(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * data)1709 static void va_TraceVAEncMiscParameterBuffer(
1710     VADisplay dpy,
1711     VAContextID context,
1712     VABufferID buffer,
1713     VABufferType type,
1714     unsigned int size,
1715     unsigned int num_elements,
1716     void *data)
1717 {
1718     VAEncMiscParameterBuffer* tmp = (VAEncMiscParameterBuffer*)data;
1719     DPY2TRACECTX(dpy);
1720     uint32_t i;
1721 
1722     switch (tmp->type) {
1723     case VAEncMiscParameterTypeFrameRate:
1724     {
1725         VAEncMiscParameterFrameRate *p = (VAEncMiscParameterFrameRate *)tmp->data;
1726         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterFrameRate\n");
1727         va_TraceMsg(trace_ctx, "\tframerate = %d\n", p->framerate);
1728 
1729         break;
1730     }
1731     case VAEncMiscParameterTypeRateControl:
1732     {
1733         VAEncMiscParameterRateControl *p = (VAEncMiscParameterRateControl *)tmp->data;
1734 
1735         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterRateControl\n");
1736         va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1737         va_TraceMsg(trace_ctx, "\ttarget_percentage = %d\n", p->target_percentage);
1738         va_TraceMsg(trace_ctx, "\twindow_size = %d\n", p->window_size);
1739         va_TraceMsg(trace_ctx, "\tinitial_qp = %d\n", p->initial_qp);
1740         va_TraceMsg(trace_ctx, "\tmin_qp = %d\n", p->min_qp);
1741         va_TraceMsg(trace_ctx, "\tbasic_unit_size = %d\n", p->basic_unit_size);
1742         va_TraceMsg(trace_ctx, "\trc_flags.reset = %d \n", p->rc_flags.bits.reset);
1743         va_TraceMsg(trace_ctx, "\trc_flags.disable_frame_skip = %d\n", p->rc_flags.bits.disable_frame_skip);
1744         va_TraceMsg(trace_ctx, "\trc_flags.disable_bit_stuffing = %d\n", p->rc_flags.bits.disable_bit_stuffing);
1745         break;
1746     }
1747     case VAEncMiscParameterTypeMaxSliceSize:
1748     {
1749         VAEncMiscParameterMaxSliceSize *p = (VAEncMiscParameterMaxSliceSize *)tmp->data;
1750 
1751         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMaxSliceSize\n");
1752         va_TraceMsg(trace_ctx, "\tmax_slice_size = %d\n", p->max_slice_size);
1753         break;
1754     }
1755     case VAEncMiscParameterTypeAIR:
1756     {
1757         VAEncMiscParameterAIR *p = (VAEncMiscParameterAIR *)tmp->data;
1758 
1759         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterAIR\n");
1760         va_TraceMsg(trace_ctx, "\tair_num_mbs = %d\n", p->air_num_mbs);
1761         va_TraceMsg(trace_ctx, "\tair_threshold = %d\n", p->air_threshold);
1762         va_TraceMsg(trace_ctx, "\tair_auto = %d\n", p->air_auto);
1763         break;
1764     }
1765     case VAEncMiscParameterTypeHRD:
1766     {
1767         VAEncMiscParameterHRD *p = (VAEncMiscParameterHRD *)tmp->data;
1768 
1769         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterHRD\n");
1770         va_TraceMsg(trace_ctx, "\tinitial_buffer_fullness = %d\n", p->initial_buffer_fullness);
1771         va_TraceMsg(trace_ctx, "\tbuffer_size = %d\n", p->buffer_size);
1772         break;
1773     }
1774     case VAEncMiscParameterTypeMaxFrameSize:
1775     {
1776         VAEncMiscParameterBufferMaxFrameSize *p = (VAEncMiscParameterBufferMaxFrameSize *)tmp->data;
1777 
1778         va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMaxFrameSize\n");
1779         va_TraceMsg(trace_ctx, "\tmax_frame_size = %d\n", p->max_frame_size);
1780         break;
1781     }
1782     case VAEncMiscParameterTypeTemporalLayerStructure:
1783     {
1784         VAEncMiscParameterTemporalLayerStructure *p = (VAEncMiscParameterTemporalLayerStructure *)tmp->data;
1785         va_TraceMsg(trace_ctx,"\t--VAEncMiscParameterTypeTemporalLayerStructure\n");
1786         va_TraceMsg(trace_ctx,"\tnumber_of_layers = %d\n", p->number_of_layers);
1787         va_TraceMsg(trace_ctx,"\tperiodicity = %d\n", p->periodicity);
1788         for(i=0;i<p->periodicity;i++)
1789                 va_TraceMsg(trace_ctx,"\tlayer_id[%d] = %d\n", i, p->layer_id[i]);
1790         break;
1791     }
1792     default:
1793         va_TraceMsg(trace_ctx, "Unknown VAEncMiscParameterBuffer(type = %d):\n", tmp->type);
1794         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
1795         break;
1796     }
1797     va_TraceMsg(trace_ctx, NULL);
1798 
1799     return;
1800 }
1801 
1802 
va_TraceVAPictureParameterBufferVC1(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * data)1803 static void va_TraceVAPictureParameterBufferVC1(
1804     VADisplay dpy,
1805     VAContextID context,
1806     VABufferID buffer,
1807     VABufferType type,
1808     unsigned int size,
1809     unsigned int num_elements,
1810     void *data
1811 )
1812 {
1813     VAPictureParameterBufferVC1* p = (VAPictureParameterBufferVC1*)data;
1814     DPY2TRACECTX(dpy);
1815 
1816     va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferVC1\n");
1817     va_TraceMsg(trace_ctx, "\t    context = %d, buffer = %d, type = %d, size = %d, num_elements = %d\n",
1818                 context, buffer, type, size, num_elements);
1819     va_TraceMsg(trace_ctx, "\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture);
1820     va_TraceMsg(trace_ctx, "\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture);
1821     va_TraceMsg(trace_ctx, "\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture);
1822 
1823     va_TraceMsg(trace_ctx, "\tpulldown = %d\n", p->sequence_fields.bits.pulldown);
1824     va_TraceMsg(trace_ctx, "\tinterlace = %d\n", p->sequence_fields.bits.interlace);
1825     va_TraceMsg(trace_ctx, "\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag);
1826     va_TraceMsg(trace_ctx, "\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag);
1827     va_TraceMsg(trace_ctx, "\tpsf = %d\n", p->sequence_fields.bits.psf);
1828     va_TraceMsg(trace_ctx, "\tmultires = %d\n", p->sequence_fields.bits.multires);
1829     va_TraceMsg(trace_ctx, "\toverlap = %d\n", p->sequence_fields.bits.overlap);
1830     va_TraceMsg(trace_ctx, "\tsyncmarker = %d\n", p->sequence_fields.bits.syncmarker);
1831     va_TraceMsg(trace_ctx, "\trangered = %d\n", p->sequence_fields.bits.rangered);
1832     va_TraceMsg(trace_ctx, "\tmax_b_frames = %d\n", p->sequence_fields.bits.max_b_frames);
1833     va_TraceMsg(trace_ctx, "\tprofile = %d\n", p->sequence_fields.bits.profile);
1834     va_TraceMsg(trace_ctx, "\tcoded_width = %d\n", p->coded_width);
1835     va_TraceMsg(trace_ctx, "\tcoded_height = %d\n", p->coded_height);
1836     va_TraceMsg(trace_ctx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
1837     va_TraceMsg(trace_ctx, "\tbroken_link = %d\n", p->entrypoint_fields.bits.broken_link);
1838     va_TraceMsg(trace_ctx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
1839     va_TraceMsg(trace_ctx, "\tpanscan_flag = %d\n", p->entrypoint_fields.bits.panscan_flag);
1840     va_TraceMsg(trace_ctx, "\tloopfilter = %d\n", p->entrypoint_fields.bits.loopfilter);
1841     va_TraceMsg(trace_ctx, "\tconditional_overlap_flag = %d\n", p->conditional_overlap_flag);
1842     va_TraceMsg(trace_ctx, "\tfast_uvmc_flag = %d\n", p->fast_uvmc_flag);
1843     va_TraceMsg(trace_ctx, "\trange_mapping_luma_flag = %d\n", p->range_mapping_fields.bits.luma_flag);
1844     va_TraceMsg(trace_ctx, "\trange_mapping_luma = %d\n", p->range_mapping_fields.bits.luma);
1845     va_TraceMsg(trace_ctx, "\trange_mapping_chroma_flag = %d\n", p->range_mapping_fields.bits.chroma_flag);
1846     va_TraceMsg(trace_ctx, "\trange_mapping_chroma = %d\n", p->range_mapping_fields.bits.chroma);
1847     va_TraceMsg(trace_ctx, "\tb_picture_fraction = %d\n", p->b_picture_fraction);
1848     va_TraceMsg(trace_ctx, "\tcbp_table = %d\n", p->cbp_table);
1849     va_TraceMsg(trace_ctx, "\tmb_mode_table = %d\n", p->mb_mode_table);
1850     va_TraceMsg(trace_ctx, "\trange_reduction_frame = %d\n", p->range_reduction_frame);
1851     va_TraceMsg(trace_ctx, "\trounding_control = %d\n", p->rounding_control);
1852     va_TraceMsg(trace_ctx, "\tpost_processing = %d\n", p->post_processing);
1853     va_TraceMsg(trace_ctx, "\tpicture_resolution_index = %d\n", p->picture_resolution_index);
1854     va_TraceMsg(trace_ctx, "\tluma_scale = %d\n", p->luma_scale);
1855     va_TraceMsg(trace_ctx, "\tluma_shift = %d\n", p->luma_shift);
1856     va_TraceMsg(trace_ctx, "\tpicture_type = %d\n", p->picture_fields.bits.picture_type);
1857     va_TraceMsg(trace_ctx, "\tframe_coding_mode = %d\n", p->picture_fields.bits.frame_coding_mode);
1858     va_TraceMsg(trace_ctx, "\ttop_field_first = %d\n", p->picture_fields.bits.top_field_first);
1859     va_TraceMsg(trace_ctx, "\tis_first_field = %d\n", p->picture_fields.bits.is_first_field);
1860     va_TraceMsg(trace_ctx, "\tintensity_compensation = %d\n", p->picture_fields.bits.intensity_compensation);
1861     va_TraceMsg(trace_ctx, "\tmv_type_mb = %d\n", p->raw_coding.flags.mv_type_mb);
1862     va_TraceMsg(trace_ctx, "\tdirect_mb = %d\n", p->raw_coding.flags.direct_mb);
1863     va_TraceMsg(trace_ctx, "\tskip_mb = %d\n", p->raw_coding.flags.skip_mb);
1864     va_TraceMsg(trace_ctx, "\tfield_tx = %d\n", p->raw_coding.flags.field_tx);
1865     va_TraceMsg(trace_ctx, "\tforward_mb = %d\n", p->raw_coding.flags.forward_mb);
1866     va_TraceMsg(trace_ctx, "\tac_pred = %d\n", p->raw_coding.flags.ac_pred);
1867     va_TraceMsg(trace_ctx, "\toverflags = %d\n", p->raw_coding.flags.overflags);
1868     va_TraceMsg(trace_ctx, "\tbp_mv_type_mb = %d\n", p->bitplane_present.flags.bp_mv_type_mb);
1869     va_TraceMsg(trace_ctx, "\tbp_direct_mb = %d\n", p->bitplane_present.flags.bp_direct_mb);
1870     va_TraceMsg(trace_ctx, "\tbp_skip_mb = %d\n", p->bitplane_present.flags.bp_skip_mb);
1871     va_TraceMsg(trace_ctx, "\tbp_field_tx = %d\n", p->bitplane_present.flags.bp_field_tx);
1872     va_TraceMsg(trace_ctx, "\tbp_forward_mb = %d\n", p->bitplane_present.flags.bp_forward_mb);
1873     va_TraceMsg(trace_ctx, "\tbp_ac_pred = %d\n", p->bitplane_present.flags.bp_ac_pred);
1874     va_TraceMsg(trace_ctx, "\tbp_overflags = %d\n", p->bitplane_present.flags.bp_overflags);
1875     va_TraceMsg(trace_ctx, "\treference_distance_flag = %d\n", p->reference_fields.bits.reference_distance_flag);
1876     va_TraceMsg(trace_ctx, "\treference_distance = %d\n", p->reference_fields.bits.reference_distance);
1877     va_TraceMsg(trace_ctx, "\tnum_reference_pictures = %d\n", p->reference_fields.bits.num_reference_pictures);
1878     va_TraceMsg(trace_ctx, "\treference_field_pic_indicator = %d\n", p->reference_fields.bits.reference_field_pic_indicator);
1879     va_TraceMsg(trace_ctx, "\tmv_mode = %d\n", p->mv_fields.bits.mv_mode);
1880     va_TraceMsg(trace_ctx, "\tmv_mode2 = %d\n", p->mv_fields.bits.mv_mode2);
1881     va_TraceMsg(trace_ctx, "\tmv_table = %d\n", p->mv_fields.bits.mv_table);
1882     va_TraceMsg(trace_ctx, "\ttwo_mv_block_pattern_table = %d\n", p->mv_fields.bits.two_mv_block_pattern_table);
1883     va_TraceMsg(trace_ctx, "\tfour_mv_switch = %d\n", p->mv_fields.bits.four_mv_switch);
1884     va_TraceMsg(trace_ctx, "\tfour_mv_block_pattern_table = %d\n", p->mv_fields.bits.four_mv_block_pattern_table);
1885     va_TraceMsg(trace_ctx, "\textended_mv_flag = %d\n", p->mv_fields.bits.extended_mv_flag);
1886     va_TraceMsg(trace_ctx, "\textended_mv_range = %d\n", p->mv_fields.bits.extended_mv_range);
1887     va_TraceMsg(trace_ctx, "\textended_dmv_flag = %d\n", p->mv_fields.bits.extended_dmv_flag);
1888     va_TraceMsg(trace_ctx, "\textended_dmv_range = %d\n", p->mv_fields.bits.extended_dmv_range);
1889     va_TraceMsg(trace_ctx, "\tdquant = %d\n", p->pic_quantizer_fields.bits.dquant);
1890     va_TraceMsg(trace_ctx, "\tquantizer = %d\n", p->pic_quantizer_fields.bits.quantizer);
1891     va_TraceMsg(trace_ctx, "\thalf_qp = %d\n", p->pic_quantizer_fields.bits.half_qp);
1892     va_TraceMsg(trace_ctx, "\tpic_quantizer_scale = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_scale);
1893     va_TraceMsg(trace_ctx, "\tpic_quantizer_type = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_type);
1894     va_TraceMsg(trace_ctx, "\tdq_frame = %d\n", p->pic_quantizer_fields.bits.dq_frame);
1895     va_TraceMsg(trace_ctx, "\tdq_profile = %d\n", p->pic_quantizer_fields.bits.dq_profile);
1896     va_TraceMsg(trace_ctx, "\tdq_sb_edge = %d\n", p->pic_quantizer_fields.bits.dq_sb_edge);
1897     va_TraceMsg(trace_ctx, "\tdq_db_edge = %d\n", p->pic_quantizer_fields.bits.dq_db_edge);
1898     va_TraceMsg(trace_ctx, "\tdq_binary_level = %d\n", p->pic_quantizer_fields.bits.dq_binary_level);
1899     va_TraceMsg(trace_ctx, "\talt_pic_quantizer = %d\n", p->pic_quantizer_fields.bits.alt_pic_quantizer);
1900     va_TraceMsg(trace_ctx, "\tvariable_sized_transform_flag = %d\n", p->transform_fields.bits.variable_sized_transform_flag);
1901     va_TraceMsg(trace_ctx, "\tmb_level_transform_type_flag = %d\n", p->transform_fields.bits.mb_level_transform_type_flag);
1902     va_TraceMsg(trace_ctx, "\tframe_level_transform_type = %d\n", p->transform_fields.bits.frame_level_transform_type);
1903     va_TraceMsg(trace_ctx, "\ttransform_ac_codingset_idx1 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx1);
1904     va_TraceMsg(trace_ctx, "\ttransform_ac_codingset_idx2 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx2);
1905     va_TraceMsg(trace_ctx, "\tintra_transform_dc_table = %d\n", p->transform_fields.bits.intra_transform_dc_table);
1906     va_TraceMsg(trace_ctx, NULL);
1907 }
1908 
va_TraceVASliceParameterBufferVC1(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1909 static void va_TraceVASliceParameterBufferVC1(
1910     VADisplay dpy,
1911     VAContextID __maybe_unused context,
1912     VABufferID __maybe_unused buffer,
1913     VABufferType __maybe_unused type,
1914     unsigned int __maybe_unused size,
1915     unsigned int __maybe_unused num_elements,
1916     void* data
1917 )
1918 {
1919     VASliceParameterBufferVC1 *p = (VASliceParameterBufferVC1*)data;
1920     DPY2TRACECTX(dpy);
1921 
1922     trace_ctx->trace_slice_no++;
1923     trace_ctx->trace_slice_size = p->slice_data_size;
1924 
1925     va_TraceMsg(trace_ctx, "\t--VASliceParameterBufferVC1\n");
1926     va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
1927     va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
1928     va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
1929     va_TraceMsg(trace_ctx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
1930     va_TraceMsg(trace_ctx, "\tslice_vertical_position = %d\n", p->slice_vertical_position);
1931     va_TraceMsg(trace_ctx, NULL);
1932 }
1933 
va_TraceVAEncSequenceParameterBufferVP8(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1934 static void va_TraceVAEncSequenceParameterBufferVP8(
1935     VADisplay dpy,
1936     VAContextID __maybe_unused context,
1937     VABufferID __maybe_unused buffer,
1938     VABufferType __maybe_unused type,
1939     unsigned int __maybe_unused size,
1940     unsigned int __maybe_unused num_elements,
1941     void *data)
1942 {
1943     VAEncSequenceParameterBufferVP8 *p = (VAEncSequenceParameterBufferVP8 *)data;
1944     DPY2TRACECTX(dpy);
1945     int i;
1946 
1947     va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferVP8\n");
1948 
1949     va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1950     va_TraceMsg(trace_ctx, "\terror_resilient = %d\n", p->error_resilient);
1951     va_TraceMsg(trace_ctx, "\tframe_height = %d\n", p->frame_height);
1952     va_TraceMsg(trace_ctx, "\tframe_width = %d\n", p->frame_width);
1953     va_TraceMsg(trace_ctx, "\tframe_height_scale = %d\n", p->frame_height_scale);
1954     va_TraceMsg(trace_ctx, "\tframe_width_scale = %d\n", p->frame_width_scale);
1955     va_TraceMsg(trace_ctx, "\tkf_auto = %d\n", p->kf_auto);
1956     va_TraceMsg(trace_ctx, "\tkf_max_dist = %d\n", p->kf_max_dist);
1957     va_TraceMsg(trace_ctx, "\tkf_min_dist = %d\n", p->kf_min_dist);
1958     va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
1959 
1960     for(i = 0; i<4; ++i)
1961         va_TraceMsg(trace_ctx, "\treference_frames[%d] = 0x%08x\n", i, p->reference_frames[i]);
1962 
1963     va_TraceMsg(trace_ctx, NULL);
1964 
1965     return;
1966 }
1967 
va_TraceVAEncPictureParameterBufferVP8(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused uffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)1968 static void va_TraceVAEncPictureParameterBufferVP8(
1969     VADisplay dpy,
1970     VAContextID __maybe_unused context,
1971     VABufferID __maybe_unused uffer,
1972     VABufferType __maybe_unused type,
1973     unsigned int __maybe_unused size,
1974     unsigned int __maybe_unused num_elements,
1975     void *data)
1976 {
1977     VAEncPictureParameterBufferVP8 *p = (VAEncPictureParameterBufferVP8 *)data;
1978     DPY2TRACECTX(dpy);
1979     int i;
1980 
1981     va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferVP8\n");
1982 
1983     va_TraceMsg(trace_ctx, "\treconstructed_frame = 0x%08x\n", p->reconstructed_frame);
1984     va_TraceMsg(trace_ctx, "\tref_last_frame = 0x%08x\n", p->ref_last_frame);
1985     va_TraceMsg(trace_ctx, "\tref_gf_frame = 0x%08x\n", p->ref_gf_frame);
1986     va_TraceMsg(trace_ctx, "\tref_arf_frame = 0x%08x\n", p->ref_arf_frame);
1987     va_TraceMsg(trace_ctx, "\tcoded_buf = 0x%08x\n", p->coded_buf);
1988 
1989     va_TraceMsg(trace_ctx, "\tref_flags.bits.force_kf = %d\n", p->ref_flags.bits.force_kf);
1990     va_TraceMsg(trace_ctx, "\tref_flags.bits.no_ref_last = %d\n", p->ref_flags.bits.no_ref_last);
1991     va_TraceMsg(trace_ctx, "\tref_flags.bits.no_ref_gf = %d\n", p->ref_flags.bits.no_ref_gf);
1992     va_TraceMsg(trace_ctx, "\tref_flags.bits.no_ref_arf = %d\n", p->ref_flags.bits.no_ref_arf);
1993     va_TraceMsg(trace_ctx, "\tref_flags.bits.reserved = 0x%08x\n", p->ref_flags.bits.reserved);
1994 
1995     va_TraceMsg(trace_ctx, "\tpic_flags.bits.frame_type = %d\n", p->pic_flags.bits.frame_type);
1996     va_TraceMsg(trace_ctx, "\tpic_flags.bits.version = %d\n", p->pic_flags.bits.version);
1997     va_TraceMsg(trace_ctx, "\tpic_flags.bits.show_frame = %d\n", p->pic_flags.bits.show_frame);
1998     va_TraceMsg(trace_ctx, "\tpic_flags.bits.color_space = %d\n", p->pic_flags.bits.color_space);
1999     va_TraceMsg(trace_ctx, "\tpic_flags.bits.recon_filter_type = %d\n", p->pic_flags.bits.recon_filter_type);
2000     va_TraceMsg(trace_ctx, "\tpic_flags.bits.loop_filter_type = %d\n", p->pic_flags.bits.loop_filter_type);
2001     va_TraceMsg(trace_ctx, "\tpic_flags.bits.auto_partitions = %d\n", p->pic_flags.bits.auto_partitions);
2002     va_TraceMsg(trace_ctx, "\tpic_flags.bits.num_token_partitions = %d\n", p->pic_flags.bits.num_token_partitions);
2003     va_TraceMsg(trace_ctx, "\tpic_flags.bits.clamping_type = %d\n", p->pic_flags.bits.clamping_type);
2004     va_TraceMsg(trace_ctx, "\tpic_flags.bits.segmentation_enabled = %d\n", p->pic_flags.bits.segmentation_enabled);
2005     va_TraceMsg(trace_ctx, "\tpic_flags.bits.update_mb_segmentation_map = %d\n", p->pic_flags.bits.update_mb_segmentation_map);
2006     va_TraceMsg(trace_ctx, "\tpic_flags.bits.update_segment_feature_data = %d\n", p->pic_flags.bits.update_segment_feature_data);
2007     va_TraceMsg(trace_ctx, "\tpic_flags.bits.loop_filter_adj_enable = %d\n", p->pic_flags.bits.loop_filter_adj_enable);
2008     va_TraceMsg(trace_ctx, "\tpic_flags.bits.refresh_entropy_probs = %d\n", p->pic_flags.bits.refresh_entropy_probs);
2009     va_TraceMsg(trace_ctx, "\tpic_flags.bits.refresh_golden_frame = %d\n", p->pic_flags.bits.refresh_golden_frame);
2010     va_TraceMsg(trace_ctx, "\tpic_flags.bits.refresh_alternate_frame = %d\n", p->pic_flags.bits.refresh_alternate_frame);
2011     va_TraceMsg(trace_ctx, "\tpic_flags.bits.refresh_last = %d\n", p->pic_flags.bits.refresh_last);
2012     va_TraceMsg(trace_ctx, "\tpic_flags.bits.copy_buffer_to_golden = %d\n", p->pic_flags.bits.copy_buffer_to_golden);
2013     va_TraceMsg(trace_ctx, "\tpic_flags.bits.copy_buffer_to_alternate = %d\n", p->pic_flags.bits.copy_buffer_to_alternate);
2014 
2015     va_TraceMsg(trace_ctx, "\tpic_flags.bits.sign_bias_golden = %d\n", p->pic_flags.bits.sign_bias_golden);
2016     va_TraceMsg(trace_ctx, "\tpic_flags.bits.sign_bias_alternate = %d\n", p->pic_flags.bits.sign_bias_alternate);
2017     va_TraceMsg(trace_ctx, "\tpic_flags.bits.mb_no_coeff_skip = %d\n", p->pic_flags.bits.mb_no_coeff_skip);
2018     va_TraceMsg(trace_ctx, "\tpic_flags.bits.forced_lf_adjustment = %d\n", p->pic_flags.bits.forced_lf_adjustment);
2019     va_TraceMsg(trace_ctx, "\tpic_flags.bits.reserved = %d\n", p->pic_flags.bits.reserved);
2020 
2021 
2022     for(i=0;i<4;i++)
2023        va_TraceMsg(trace_ctx, "\tloop_filter_level[%d] = %d\n", i, p->loop_filter_level[i]);
2024     for(i=0;i<4;i++)
2025        va_TraceMsg(trace_ctx, "\tref_lf_delta[%d] = %d\n", i, p->ref_lf_delta[i]);
2026     for(i=0;i<4;i++)
2027        va_TraceMsg(trace_ctx, "\tmode_lf_delta[%d] = %d\n", i, p->mode_lf_delta[i]);
2028 
2029     va_TraceMsg(trace_ctx, "\tsharpness_level = %d\n", p->sharpness_level);
2030     va_TraceMsg(trace_ctx, "\tclamp_qindex_high = %d\n", p->clamp_qindex_high);
2031     va_TraceMsg(trace_ctx, "\tclamp_qindex_low = %d\n", p->clamp_qindex_low);
2032 
2033     va_TraceMsg(trace_ctx, NULL);
2034 
2035     return;
2036 }
2037 
va_TraceVAPictureParameterBufferVP8(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)2038 static void va_TraceVAPictureParameterBufferVP8(
2039     VADisplay dpy,
2040     VAContextID __maybe_unused context,
2041     VABufferID __maybe_unused buffer,
2042     VABufferType __maybe_unused type,
2043     unsigned int __maybe_unused size,
2044     unsigned int __maybe_unused num_elements,
2045     void *data)
2046 {
2047     char tmp[1024];
2048     VAPictureParameterBufferVP8 *p = (VAPictureParameterBufferVP8 *)data;
2049     DPY2TRACECTX(dpy);
2050     int i,j;
2051 
2052     va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferVP8\n");
2053 
2054     va_TraceMsg(trace_ctx, "\tframe_width = %d\n", p->frame_width);
2055     va_TraceMsg(trace_ctx, "\tframe_height = %d\n", p->frame_height);
2056     va_TraceMsg(trace_ctx, "\tlast_ref_frame = %x\n", p->last_ref_frame);
2057     va_TraceMsg(trace_ctx, "\tgolden_ref_frame = %x\n", p->golden_ref_frame);
2058     va_TraceMsg(trace_ctx, "\talt_ref_frame = %x\n", p->alt_ref_frame);
2059     va_TraceMsg(trace_ctx, "\tout_of_loop_frame = %x\n", p->out_of_loop_frame);
2060 
2061     va_TraceMsg(trace_ctx, "\tkey_frame = %d\n", p->pic_fields.bits.key_frame);
2062     va_TraceMsg(trace_ctx, "\tversion = %d\n", p->pic_fields.bits.version);
2063     va_TraceMsg(trace_ctx, "\tsegmentation_enabled = %d\n", p->pic_fields.bits.segmentation_enabled);
2064     va_TraceMsg(trace_ctx, "\tupdate_mb_segmentation_map = %d\n", p->pic_fields.bits.update_mb_segmentation_map);
2065     va_TraceMsg(trace_ctx, "\tupdate_segment_feature_data = %d\n", p->pic_fields.bits.update_segment_feature_data);
2066     va_TraceMsg(trace_ctx, "\tfilter_type = %d\n", p->pic_fields.bits.filter_type);
2067     va_TraceMsg(trace_ctx, "\tsharpness_level = %d\n", p->pic_fields.bits.sharpness_level);
2068     va_TraceMsg(trace_ctx, "\tloop_filter_adj_enable = %d\n", p->pic_fields.bits.loop_filter_adj_enable);
2069     va_TraceMsg(trace_ctx, "\tmode_ref_lf_delta_update = %d\n", p->pic_fields.bits.mode_ref_lf_delta_update);
2070     va_TraceMsg(trace_ctx, "\tsign_bias_golden = %d\n", p->pic_fields.bits.sign_bias_golden);
2071     va_TraceMsg(trace_ctx, "\tsign_bias_alternate = %d\n", p->pic_fields.bits.sign_bias_alternate);
2072     va_TraceMsg(trace_ctx, "\tmb_no_coeff_skip = %d\n", p->pic_fields.bits.mb_no_coeff_skip);
2073     va_TraceMsg(trace_ctx, "\tloop_filter_disable = %d\n", p->pic_fields.bits.loop_filter_disable);
2074 
2075     va_TraceMsg(trace_ctx, "\tmb_segment_tree_probs: 0x%2x, 0x%2x, 0x%2x\n",
2076         p->mb_segment_tree_probs[0], p->mb_segment_tree_probs[1], p->mb_segment_tree_probs[2]);
2077 
2078     va_TraceMsg(trace_ctx, "\tloop_filter_level: %d, %d, %d, %d\n",
2079         p->loop_filter_level[0], p->loop_filter_level[1], p->loop_filter_level[2], p->loop_filter_level[3]);
2080 
2081     va_TraceMsg(trace_ctx, "\tloop_filter_deltas_ref_frame: %d, %d, %d, %d\n",
2082         p->loop_filter_deltas_ref_frame[0], p->loop_filter_deltas_ref_frame[1], p->loop_filter_deltas_ref_frame[2], p->loop_filter_deltas_ref_frame[3]);
2083 
2084     va_TraceMsg(trace_ctx, "\tloop_filter_deltas_mode: %d, %d, %d, %d\n",
2085         p->loop_filter_deltas_mode[0], p->loop_filter_deltas_mode[1], p->loop_filter_deltas_mode[2], p->loop_filter_deltas_mode[3]);
2086 
2087     va_TraceMsg(trace_ctx, "\tprob_skip_false = %2x\n", p->prob_skip_false);
2088     va_TraceMsg(trace_ctx, "\tprob_intra = %2x\n", p->prob_intra);
2089     va_TraceMsg(trace_ctx, "\tprob_last = %2x\n", p->prob_last);
2090     va_TraceMsg(trace_ctx, "\tprob_gf = %2x\n", p->prob_gf);
2091 
2092     va_TraceMsg(trace_ctx, "\ty_mode_probs: 0x%2x, 0x%2x, 0x%2x, 0x%2x\n",
2093         p->y_mode_probs[0], p->y_mode_probs[1], p->y_mode_probs[2], p->y_mode_probs[3]);
2094 
2095     va_TraceMsg(trace_ctx, "\tuv_mode_probs: 0x%2x, 0x%2x, 0x%2x\n",
2096         p->uv_mode_probs[0], p->uv_mode_probs[1], p->uv_mode_probs[2]);
2097 
2098     va_TraceMsg(trace_ctx, "\tmv_probs[2][19]:\n");
2099     for(i = 0; i<2; ++i) {
2100         memset(tmp, 0, sizeof tmp);
2101         for (j=0; j<19; j++)
2102             sprintf(tmp + strlen(tmp), "%2x ", p->mv_probs[i][j]);
2103         va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
2104     }
2105 
2106     va_TraceMsg(trace_ctx, "\tbool_coder_ctx: range = %02x, value = %02x, count = %d\n",
2107         p->bool_coder_ctx.range, p->bool_coder_ctx.value, p->bool_coder_ctx.count);
2108 
2109     va_TraceMsg(trace_ctx, NULL);
2110 
2111     return;
2112 }
2113 
va_TraceVASliceParameterBufferVP8(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)2114 static void va_TraceVASliceParameterBufferVP8(
2115     VADisplay dpy,
2116     VAContextID __maybe_unused context,
2117     VABufferID __maybe_unused buffer,
2118     VABufferType __maybe_unused type,
2119     unsigned int __maybe_unused size,
2120     unsigned int __maybe_unused num_elements,
2121     void *data)
2122 {
2123     VASliceParameterBufferVP8 *p = (VASliceParameterBufferVP8 *)data;
2124     DPY2TRACECTX(dpy);
2125     int i;
2126 
2127     va_TraceMsg(trace_ctx, "\t--VASliceParameterBufferVP8\n");
2128 
2129     va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
2130     va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
2131     va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
2132     va_TraceMsg(trace_ctx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
2133     va_TraceMsg(trace_ctx, "\tnum_of_partitions = %d\n", p->num_of_partitions);
2134 
2135     for(i = 0; i<9; ++i)
2136         va_TraceMsg(trace_ctx, "\tpartition_size[%d] = %d\n", i, p->partition_size[i]);
2137 
2138     va_TraceMsg(trace_ctx, NULL);
2139 
2140     return;
2141 }
2142 
va_TraceVAIQMatrixBufferVP8(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)2143 static void va_TraceVAIQMatrixBufferVP8(
2144     VADisplay dpy,
2145     VAContextID __maybe_unused context,
2146     VABufferID __maybe_unused buffer,
2147     VABufferType __maybe_unused type,
2148     unsigned int __maybe_unused size,
2149     unsigned int __maybe_unused num_elements,
2150     void *data)
2151 {
2152     char tmp[1024];
2153     VAIQMatrixBufferVP8 *p = (VAIQMatrixBufferVP8 *)data;
2154     DPY2TRACECTX(dpy);
2155     int i,j;
2156 
2157     va_TraceMsg(trace_ctx, "\t--VAIQMatrixBufferVP8\n");
2158 
2159     va_TraceMsg(trace_ctx, "\tquantization_index[4][6]=\n");
2160     for (i = 0; i < 4; i++) {
2161         memset(tmp, 0, sizeof tmp);
2162         for (j = 0; j < 6; j++)
2163             sprintf(tmp + strlen(tmp), "%4x, ", p->quantization_index[i][j]);
2164         va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
2165     }
2166 
2167     va_TraceMsg(trace_ctx, NULL);
2168 
2169     return;
2170 }
va_TraceVAProbabilityBufferVP8(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)2171 static void va_TraceVAProbabilityBufferVP8(
2172     VADisplay dpy,
2173     VAContextID __maybe_unused context,
2174     VABufferID __maybe_unused buffer,
2175     VABufferType __maybe_unused type,
2176     unsigned int __maybe_unused size,
2177     unsigned int __maybe_unused num_elements,
2178     void *data)
2179 {
2180     char tmp[1024];
2181     VAProbabilityDataBufferVP8 *p = (VAProbabilityDataBufferVP8 *)data;
2182     DPY2TRACECTX(dpy);
2183     int i,j,k,l;
2184 
2185     va_TraceMsg(trace_ctx, "\t--VAProbabilityDataBufferVP8\n");
2186 
2187     for (i = 0; i < 4; i++)
2188         for (j = 0; j < 8; j++) {
2189             memset(tmp, 0, sizeof tmp);
2190             for (k=0; k<3; k++)
2191                 for (l=0; l<11; l++)
2192                     sprintf(tmp + strlen(tmp), "%2x, ", p->dct_coeff_probs[i][j][k][l]);
2193             va_TraceMsg(trace_ctx,"\t\t[%d, %d] = %s\n", i, j, tmp);
2194         }
2195 
2196     va_TraceMsg(trace_ctx, NULL);
2197 
2198     return;
2199 }
2200 
va_TraceBeginPicture(VADisplay dpy,VAContextID __maybe_unused context,VASurfaceID render_target)2201 void va_TraceBeginPicture(
2202     VADisplay dpy,
2203     VAContextID __maybe_unused context,
2204     VASurfaceID render_target
2205 )
2206 {
2207     DPY2TRACECTX(dpy);
2208 
2209     TRACE_FUNCNAME(idx);
2210 
2211     va_TraceMsg(trace_ctx, "\trender_targets = 0x%08x\n", render_target);
2212     va_TraceMsg(trace_ctx, "\tframe_count  = #%d\n", trace_ctx->trace_frame_no);
2213     va_TraceMsg(trace_ctx, NULL);
2214 
2215     trace_ctx->trace_rendertarget = render_target; /* for surface data dump after vaEndPicture */
2216 
2217     trace_ctx->trace_frame_no++;
2218     trace_ctx->trace_slice_no = 0;
2219 }
2220 
va_TraceMPEG2Buf(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * pbuf)2221 static void va_TraceMPEG2Buf(
2222     VADisplay dpy,
2223     VAContextID context,
2224     VABufferID buffer,
2225     VABufferType type,
2226     unsigned int size,
2227     unsigned int num_elements,
2228     void *pbuf
2229 )
2230 {
2231     switch (type) {
2232     case VAPictureParameterBufferType:
2233         va_TraceVAPictureParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
2234         break;
2235     case VAIQMatrixBufferType:
2236         va_TraceVAIQMatrixBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
2237         break;
2238     case VABitPlaneBufferType:
2239         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2240         break;
2241     case VASliceGroupMapBufferType:
2242         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2243         break;
2244     case VASliceParameterBufferType:
2245         va_TraceVASliceParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
2246         break;
2247     case VASliceDataBufferType:
2248         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2249         break;
2250     case VAMacroblockParameterBufferType:
2251         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2252         break;
2253     case VAResidualDataBufferType:
2254         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2255         break;
2256     case VADeblockingParameterBufferType:
2257         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2258         break;
2259     case VAImageBufferType:
2260         break;
2261     case VAProtectedSliceDataBufferType:
2262         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2263         break;
2264     case VAEncCodedBufferType:
2265         break;
2266     case VAEncSequenceParameterBufferType:
2267         break;
2268     case VAEncPictureParameterBufferType:
2269         break;
2270     case VAEncSliceParameterBufferType:
2271         break;
2272     default:
2273         break;
2274     }
2275 }
2276 
va_TraceVAEncSequenceParameterBufferH263(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)2277 static void va_TraceVAEncSequenceParameterBufferH263(
2278     VADisplay dpy,
2279     VAContextID __maybe_unused context,
2280     VABufferID __maybe_unused buffer,
2281     VABufferType __maybe_unused type,
2282     unsigned int __maybe_unused size,
2283     unsigned int __maybe_unused num_elements,
2284     void *data)
2285 {
2286     VAEncSequenceParameterBufferH263 *p = (VAEncSequenceParameterBufferH263 *)data;
2287     DPY2TRACECTX(dpy);
2288 
2289     va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferH263\n");
2290 
2291     va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
2292     va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
2293     va_TraceMsg(trace_ctx, "\tframe_rate = %d\n", p->frame_rate);
2294     va_TraceMsg(trace_ctx, "\tinitial_qp = %d\n", p->initial_qp);
2295     va_TraceMsg(trace_ctx, "\tmin_qp = %d\n", p->min_qp);
2296     va_TraceMsg(trace_ctx, NULL);
2297 
2298     return;
2299 }
2300 
2301 
va_TraceVAEncPictureParameterBufferH263(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)2302 static void va_TraceVAEncPictureParameterBufferH263(
2303     VADisplay dpy,
2304     VAContextID __maybe_unused context,
2305     VABufferID __maybe_unused buffer,
2306     VABufferType __maybe_unused type,
2307     unsigned int __maybe_unused size,
2308     unsigned int __maybe_unused num_elements,
2309     void *data)
2310 {
2311     VAEncPictureParameterBufferH263 *p = (VAEncPictureParameterBufferH263 *)data;
2312     DPY2TRACECTX(dpy);
2313 
2314     va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferH263\n");
2315     va_TraceMsg(trace_ctx, "\treference_picture = 0x%08x\n", p->reference_picture);
2316     va_TraceMsg(trace_ctx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
2317     va_TraceMsg(trace_ctx, "\tcoded_buf = %08x\n", p->coded_buf);
2318     va_TraceMsg(trace_ctx, "\tpicture_width = %d\n", p->picture_width);
2319     va_TraceMsg(trace_ctx, "\tpicture_height = %d\n", p->picture_height);
2320     va_TraceMsg(trace_ctx, "\tpicture_type = 0x%08x\n", p->picture_type);
2321     va_TraceMsg(trace_ctx, NULL);
2322 
2323     return;
2324 }
2325 
va_TraceVAEncPictureParameterBufferJPEG(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)2326 static void va_TraceVAEncPictureParameterBufferJPEG(
2327     VADisplay dpy,
2328     VAContextID __maybe_unused context,
2329     VABufferID __maybe_unused buffer,
2330     VABufferType __maybe_unused type,
2331     unsigned int __maybe_unused size,
2332     unsigned int __maybe_unused num_elements,
2333     void *data)
2334 {
2335     VAEncPictureParameterBufferJPEG *p = (VAEncPictureParameterBufferJPEG *)data;
2336     int i;
2337 
2338     DPY2TRACECTX(dpy);
2339 
2340     va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferJPEG\n");
2341     va_TraceMsg(trace_ctx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
2342     va_TraceMsg(trace_ctx, "\tcoded_buf = %08x\n", p->coded_buf);
2343     va_TraceMsg(trace_ctx, "\tpicture_width = %d\n", p->picture_width);
2344     va_TraceMsg(trace_ctx, "\tpicture_height = %d\n", p->picture_height);
2345     va_TraceMsg(trace_ctx, "\tpic_flags.bits.profile = %d\n", p->pic_flags.bits.profile);
2346     va_TraceMsg(trace_ctx, "\tpic_flags.bits.progressive = %d\n", p->pic_flags.bits.profile);
2347     va_TraceMsg(trace_ctx, "\tpic_flags.bits.huffman = %d\n", p->pic_flags.bits.huffman);
2348     va_TraceMsg(trace_ctx, "\tpic_flags.bits.interleaved = %d\n", p->pic_flags.bits.interleaved);
2349     va_TraceMsg(trace_ctx, "\tpic_flags.bits.differential = %d\n", p->pic_flags.bits.differential);
2350     va_TraceMsg(trace_ctx, "\tsample_bit_depth = %d\n", p->sample_bit_depth);
2351     va_TraceMsg(trace_ctx, "\tnum_scan = %d\n", p->num_scan);
2352     va_TraceMsg(trace_ctx, "\tnum_components = %d\n", p->num_components);
2353     for (i=0; i<p->num_components; i++)
2354         va_TraceMsg(trace_ctx, "\tcomponent_id[%d] = %d\n", i, p->component_id[i]);
2355 
2356     if (p->quality > 0)
2357         va_TraceMsg(trace_ctx, "\tquality = %d\n", p->quality);
2358     else
2359         va_TraceMsg(trace_ctx, "\tquantiser_table_selector[] = %d %d %d %d\n",
2360                     p->quantiser_table_selector[0],
2361                     p->quantiser_table_selector[1],
2362                     p->quantiser_table_selector[2],
2363                     p->quantiser_table_selector[3]);
2364 
2365     va_TraceMsg(trace_ctx, NULL);
2366 
2367     return;
2368 }
2369 
va_TraceVAEncQMatrixBufferJPEG(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)2370 static void va_TraceVAEncQMatrixBufferJPEG(
2371     VADisplay dpy,
2372     VAContextID __maybe_unused context,
2373     VABufferID __maybe_unused buffer,
2374     VABufferType __maybe_unused type,
2375     unsigned int __maybe_unused size,
2376     unsigned int __maybe_unused num_elements,
2377     void *data)
2378 {
2379     VAQMatrixBufferJPEG *p = (VAQMatrixBufferJPEG *)data;
2380     DPY2TRACECTX(dpy);
2381 
2382     va_TraceMsg(trace_ctx, "\t--VAQMatrixBufferJPEG\n");
2383     va_TraceMsg(trace_ctx, "\tload_lum_quantiser_matrix = %d\n", p->load_lum_quantiser_matrix);
2384     if (p->load_lum_quantiser_matrix) {
2385         int i;
2386         for (i = 0; i < 8; i++) {
2387             va_TraceMsg(trace_ctx,
2388                         "\t\t0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
2389                         p->lum_quantiser_matrix[i*8],
2390                         p->lum_quantiser_matrix[i*8 + 1],
2391                         p->lum_quantiser_matrix[i*8 + 2],
2392                         p->lum_quantiser_matrix[i*8 + 3],
2393                         p->lum_quantiser_matrix[i*8 + 4],
2394                         p->lum_quantiser_matrix[i*8 + 5],
2395                         p->lum_quantiser_matrix[i*8 + 6],
2396                         p->lum_quantiser_matrix[i*8 + 7]);
2397         }
2398     }
2399 
2400     va_TraceMsg(trace_ctx, "\tload_chroma_quantiser_matrix = %d\n", p->load_chroma_quantiser_matrix);
2401     if (p->load_chroma_quantiser_matrix) {
2402         int i;
2403         for (i = 0; i < 8; i++) {
2404             va_TraceMsg(trace_ctx,
2405                         "\t\t0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
2406                         p->chroma_quantiser_matrix[i*8],
2407                         p->chroma_quantiser_matrix[i*8 + 1],
2408                         p->chroma_quantiser_matrix[i*8 + 2],
2409                         p->chroma_quantiser_matrix[i*8 + 3],
2410                         p->chroma_quantiser_matrix[i*8 + 4],
2411                         p->chroma_quantiser_matrix[i*8 + 5],
2412                         p->chroma_quantiser_matrix[i*8 + 6],
2413                         p->chroma_quantiser_matrix[i*8 + 7]);
2414         }
2415     }
2416 
2417     va_TraceMsg(trace_ctx, NULL);
2418 
2419     return;
2420 }
2421 
2422 
va_TraceH263Buf(VADisplay dpy,VAContextID __maybe_unused context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * pbuf)2423 static void va_TraceH263Buf(
2424     VADisplay dpy,
2425     VAContextID __maybe_unused context,
2426     VABufferID __maybe_unused buffer,
2427     VABufferType __maybe_unused type,
2428     unsigned int __maybe_unused size,
2429     unsigned int __maybe_unused num_elements,
2430     void *pbuf
2431 )
2432 {
2433     DPY2TRACECTX(dpy);
2434 
2435     switch (type) {
2436     case VAPictureParameterBufferType:/* print MPEG4 buffer */
2437         va_TraceVAPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2438         break;
2439     case VAIQMatrixBufferType:/* print MPEG4 buffer */
2440         va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2441         break;
2442     case VABitPlaneBufferType:/* print MPEG4 buffer */
2443         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2444         break;
2445     case VASliceGroupMapBufferType:
2446         break;
2447     case VASliceParameterBufferType:/* print MPEG4 buffer */
2448         va_TraceVASliceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2449         break;
2450     case VASliceDataBufferType:
2451         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2452         break;
2453     case VAMacroblockParameterBufferType:
2454         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2455         break;
2456     case VAResidualDataBufferType:
2457         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2458         break;
2459     case VADeblockingParameterBufferType:
2460         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2461         break;
2462     case VAImageBufferType:
2463         break;
2464     case VAProtectedSliceDataBufferType:
2465         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2466         break;
2467     case VAEncCodedBufferType:
2468         break;
2469     case VAEncSequenceParameterBufferType:
2470         va_TraceVAEncSequenceParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
2471         break;
2472     case VAEncPictureParameterBufferType:
2473         va_TraceVAEncPictureParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
2474         break;
2475     case VAEncSliceParameterBufferType:
2476         va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2477         break;
2478     case VAEncPackedHeaderParameterBufferType:
2479         va_TraceVAEncPackedHeaderParameterBufferType(dpy, context, buffer, type, size, num_elements, pbuf);
2480         break;
2481     default:
2482         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2483         break;
2484     }
2485 }
2486 
2487 
va_TraceJPEGBuf(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * pbuf)2488 static void va_TraceJPEGBuf(
2489     VADisplay dpy,
2490     VAContextID context,
2491     VABufferID buffer,
2492     VABufferType type,
2493     unsigned int size,
2494     unsigned int num_elements,
2495     void *pbuf
2496 )
2497 {
2498     switch (type) {
2499     case VABitPlaneBufferType:
2500     case VASliceGroupMapBufferType:
2501     case VASliceDataBufferType:
2502     case VAMacroblockParameterBufferType:
2503     case VAResidualDataBufferType:
2504     case VADeblockingParameterBufferType:
2505     case VAImageBufferType:
2506     case VAProtectedSliceDataBufferType:
2507     case VAEncCodedBufferType:
2508     case VAEncSequenceParameterBufferType:
2509         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2510         break;
2511     case VAEncSliceParameterBufferType:
2512         va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2513         break;
2514     case VAPictureParameterBufferType:
2515         va_TraceVAPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2516         break;
2517     case VAIQMatrixBufferType:
2518         va_TraceVAIQMatrixBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2519         break;
2520     case VASliceParameterBufferType:
2521         va_TraceVASliceParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2522         break;
2523     case VAHuffmanTableBufferType:
2524         va_TraceVAHuffmanTableBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2525         break;
2526     case VAEncPictureParameterBufferType:
2527         va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2528         break;
2529     case VAQMatrixBufferType:
2530         va_TraceVAEncQMatrixBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2531         break;
2532     default:
2533         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2534         break;
2535     }
2536 }
2537 
va_TraceMPEG4Buf(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * pbuf)2538 static void va_TraceMPEG4Buf(
2539     VADisplay dpy,
2540     VAContextID context,
2541     VABufferID buffer,
2542     VABufferType type,
2543     unsigned int size,
2544     unsigned int num_elements,
2545     void *pbuf
2546 )
2547 {
2548     switch (type) {
2549     case VAPictureParameterBufferType:
2550         va_TraceVAPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2551         break;
2552     case VAIQMatrixBufferType:
2553         va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2554         break;
2555     case VABitPlaneBufferType:
2556         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2557         break;
2558     case VASliceGroupMapBufferType:
2559         break;
2560     case VASliceParameterBufferType:
2561         va_TraceVASliceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2562         break;
2563     case VASliceDataBufferType:
2564         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2565         break;
2566     case VAMacroblockParameterBufferType:
2567         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2568         break;
2569     case VAResidualDataBufferType:
2570         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2571         break;
2572     case VADeblockingParameterBufferType:
2573         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2574         break;
2575     case VAImageBufferType:
2576         break;
2577     case VAProtectedSliceDataBufferType:
2578         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2579         break;
2580     case VAEncCodedBufferType:
2581         break;
2582     case VAEncSequenceParameterBufferType:
2583         va_TraceVAEncSequenceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2584         break;
2585     case VAEncPictureParameterBufferType:
2586         va_TraceVAEncPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2587         break;
2588     case VAEncSliceParameterBufferType:
2589         va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2590         break;
2591     default:
2592         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2593         break;
2594     }
2595 }
2596 
2597 
va_TraceH264Buf(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * pbuf)2598 static void va_TraceH264Buf(
2599     VADisplay dpy,
2600     VAContextID context,
2601     VABufferID buffer,
2602     VABufferType type,
2603     unsigned int size,
2604     unsigned int num_elements,
2605     void *pbuf
2606 )
2607 {
2608     DPY2TRACECTX(dpy);
2609 
2610     switch (type) {
2611     case VAPictureParameterBufferType:
2612         va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2613         break;
2614     case VAIQMatrixBufferType:
2615         va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2616         break;
2617     case VABitPlaneBufferType:
2618         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2619         break;
2620     case VASliceGroupMapBufferType:
2621         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2622         break;
2623     case VASliceParameterBufferType:
2624         va_TraceVASliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2625         break;
2626     case VASliceDataBufferType:
2627         va_TraceVABuffers(dpy, context, buffer, type, trace_ctx->trace_slice_size, num_elements, pbuf);
2628         break;
2629     case VAMacroblockParameterBufferType:
2630         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2631         break;
2632     case VAResidualDataBufferType:
2633         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2634         break;
2635     case VADeblockingParameterBufferType:
2636         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2637         break;
2638     case VAImageBufferType:
2639         break;
2640     case VAProtectedSliceDataBufferType:
2641         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2642         break;
2643     case VAEncCodedBufferType:
2644         break;
2645     case VAEncSequenceParameterBufferType:
2646         va_TraceVAEncSequenceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2647         break;
2648     case VAEncPictureParameterBufferType:
2649         va_TraceVAEncPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2650         break;
2651     case VAEncSliceParameterBufferType:
2652         if (size == sizeof(VAEncSliceParameterBuffer))
2653             va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2654         else
2655             va_TraceVAEncSliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2656         break;
2657     case VAEncPackedHeaderParameterBufferType:
2658         va_TraceVAEncPackedHeaderParameterBufferType(dpy, context, buffer, type, size, num_elements, pbuf);
2659         break;
2660 
2661     case VAEncMiscParameterBufferType:
2662         va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2663         break;
2664     default:
2665         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2666         break;
2667     }
2668 }
2669 
va_TraceVP8Buf(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * pbuf)2670 static void va_TraceVP8Buf(
2671     VADisplay dpy,
2672     VAContextID context,
2673     VABufferID buffer,
2674     VABufferType type,
2675     unsigned int size,
2676     unsigned int num_elements,
2677     void *pbuf
2678 )
2679 {
2680     DPY2TRACECTX(dpy);
2681 
2682     switch (type) {
2683     case VAPictureParameterBufferType:
2684         va_TraceVAPictureParameterBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2685         break;
2686     case VAIQMatrixBufferType:
2687         va_TraceVAIQMatrixBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2688         break;
2689     case VABitPlaneBufferType:
2690         break;
2691     case VASliceGroupMapBufferType:
2692         break;
2693     case VASliceParameterBufferType:
2694         va_TraceVASliceParameterBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2695         break;
2696     case VASliceDataBufferType:
2697         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2698         break;
2699     case VAProbabilityBufferType:
2700         va_TraceVAProbabilityBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2701         break;
2702     case VAMacroblockParameterBufferType:
2703         break;
2704     case VAResidualDataBufferType:
2705         break;
2706     case VADeblockingParameterBufferType:
2707         break;
2708     case VAImageBufferType:
2709         break;
2710     case VAProtectedSliceDataBufferType:
2711         break;
2712     case VAEncCodedBufferType:
2713         break;
2714     case VAEncSequenceParameterBufferType:
2715         va_TraceVAEncSequenceParameterBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2716         break;
2717     case VAEncPictureParameterBufferType:
2718         va_TraceVAEncPictureParameterBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2719         break;
2720     case VAEncSliceParameterBufferType:
2721         break;
2722     case VAEncPackedHeaderParameterBufferType:
2723         break;
2724     case VAEncMiscParameterBufferType:
2725         va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2726         break;
2727     default:
2728         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2729         break;
2730     }
2731 }
2732 
2733 
va_TraceVC1Buf(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * pbuf)2734 static void va_TraceVC1Buf(
2735     VADisplay dpy,
2736     VAContextID context,
2737     VABufferID buffer,
2738     VABufferType type,
2739     unsigned int size,
2740     unsigned int num_elements,
2741     void *pbuf
2742 )
2743 {
2744     DPY2TRACECTX(dpy);
2745 
2746     switch (type) {
2747     case VAPictureParameterBufferType:
2748         va_TraceVAPictureParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
2749         break;
2750     case VAIQMatrixBufferType:
2751         break;
2752     case VABitPlaneBufferType:
2753         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2754         break;
2755     case VASliceGroupMapBufferType:
2756         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2757         break;
2758     case VASliceParameterBufferType:
2759         va_TraceVASliceParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
2760         break;
2761     case VASliceDataBufferType:
2762         va_TraceVABuffers(dpy, context, buffer, type, trace_ctx->trace_slice_size, num_elements, pbuf);
2763         break;
2764     case VAMacroblockParameterBufferType:
2765         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2766         break;
2767     case VAResidualDataBufferType:
2768         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2769         break;
2770     case VADeblockingParameterBufferType:
2771         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2772         break;
2773     case VAImageBufferType:
2774         break;
2775     case VAProtectedSliceDataBufferType:
2776         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2777         break;
2778     case VAEncCodedBufferType:
2779         break;
2780     case VAEncSequenceParameterBufferType:
2781         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2782         break;
2783     case VAEncPictureParameterBufferType:
2784         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2785         break;
2786     case VAEncSliceParameterBufferType:
2787         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2788         break;
2789     default:
2790         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2791         break;
2792     }
2793 }
2794 
2795 static void
va_TraceProcFilterParameterBufferDeinterlacing(VADisplay dpy,VAContextID __maybe_unused context,VAProcFilterParameterBufferBase * base)2796 va_TraceProcFilterParameterBufferDeinterlacing(
2797     VADisplay dpy,
2798     VAContextID __maybe_unused context,
2799     VAProcFilterParameterBufferBase *base
2800 )
2801 {
2802     VAProcFilterParameterBufferDeinterlacing *deint = (VAProcFilterParameterBufferDeinterlacing *)base;
2803 
2804     DPY2TRACECTX(dpy);
2805 
2806     va_TraceMsg(trace_ctx, "\t    type = %d\n", deint->type);
2807     va_TraceMsg(trace_ctx, "\t    algorithm = %d\n", deint->algorithm);
2808     va_TraceMsg(trace_ctx, "\t    flags = %d\n", deint->flags);
2809 }
2810 
2811 static void
va_TraceProcFilterParameterBufferColorBalance(VADisplay dpy,VAContextID __maybe_unused context,VAProcFilterParameterBufferBase * base)2812 va_TraceProcFilterParameterBufferColorBalance(
2813     VADisplay dpy,
2814     VAContextID __maybe_unused context,
2815     VAProcFilterParameterBufferBase *base
2816 )
2817 {
2818     VAProcFilterParameterBufferColorBalance *color_balance = (VAProcFilterParameterBufferColorBalance *)base;
2819 
2820     DPY2TRACECTX(dpy);
2821 
2822     va_TraceMsg(trace_ctx, "\t    type = %d\n", color_balance->type);
2823     va_TraceMsg(trace_ctx, "\t    attrib = %d\n", color_balance->attrib);
2824     va_TraceMsg(trace_ctx, "\t    value = %f\n", color_balance->value);
2825 }
2826 
2827 static void
va_TraceProcFilterParameterBufferBase(VADisplay dpy,VAContextID context,VAProcFilterParameterBufferBase * base)2828 va_TraceProcFilterParameterBufferBase(
2829     VADisplay dpy,
2830     VAContextID context,
2831     VAProcFilterParameterBufferBase *base
2832 )
2833 {
2834     DPY2TRACECTX(dpy);
2835 
2836     va_TraceMsg(trace_ctx, "\t    type = %d, context = %d\n", base->type, context);
2837 }
2838 
2839 static void
va_TraceProcFilterParameterBuffer(VADisplay dpy,VAContextID context,VABufferID * filters,unsigned int num_filters)2840 va_TraceProcFilterParameterBuffer(
2841     VADisplay dpy,
2842     VAContextID context,
2843     VABufferID *filters,
2844     unsigned int num_filters
2845 )
2846 {
2847     VABufferType type;
2848     unsigned int size;
2849     unsigned int num_elements;
2850     VAProcFilterParameterBufferBase *base_filter = NULL;
2851     unsigned int i;
2852 
2853     DPY2TRACECTX(dpy);
2854 
2855     if (num_filters == 0 || filters == NULL) {
2856         va_TraceMsg(trace_ctx, "\t  num_filters = %d\n", num_filters);
2857         va_TraceMsg(trace_ctx, "\t  filters = %p\n", filters);
2858         return;
2859     }
2860 
2861     va_TraceMsg(trace_ctx, "\t  num_filters = %d\n", num_filters);
2862 
2863     /* get buffer type information */
2864     for (i = 0; i < num_filters; i++) {
2865         vaBufferInfo(dpy, context, filters[i], &type, &size, &num_elements);
2866 
2867         if (type != VAProcFilterParameterBufferType) {
2868             va_TraceMsg(trace_ctx, "\t  filters[%d] = 0x%08x (INVALID)\n", i, filters[i]);
2869             return;
2870         } else {
2871             va_TraceMsg(trace_ctx, "\t  filters[%d] = 0x%08x\n", i, filters[i]);
2872         }
2873 
2874         base_filter = NULL;
2875         vaMapBuffer(dpy, filters[i], (void **)&base_filter);
2876 
2877         if (base_filter == NULL) {
2878             vaUnmapBuffer(dpy, filters[i]);
2879             return;
2880         }
2881 
2882         switch (base_filter->type) {
2883         case VAProcFilterDeinterlacing:
2884             va_TraceProcFilterParameterBufferDeinterlacing(dpy,
2885                                                            context,
2886                                                            base_filter);
2887             break;
2888         case VAProcFilterColorBalance:
2889             va_TraceProcFilterParameterBufferColorBalance(dpy,
2890                                                           context,
2891                                                           base_filter);
2892             break;
2893         default:
2894             va_TraceProcFilterParameterBufferBase(dpy,
2895                                                   context,
2896                                                   base_filter);
2897             break;
2898         }
2899 
2900         vaUnmapBuffer(dpy, filters[i]);
2901     }
2902 }
2903 
2904 static void
va_TraceVAProcPipelineParameterBuffer(VADisplay dpy,VAContextID context,VABufferID __maybe_unused buffer,VABufferType __maybe_unused type,unsigned int __maybe_unused size,unsigned int __maybe_unused num_elements,void * data)2905 va_TraceVAProcPipelineParameterBuffer(
2906     VADisplay dpy,
2907     VAContextID context,
2908     VABufferID __maybe_unused buffer,
2909     VABufferType __maybe_unused type,
2910     unsigned int __maybe_unused size,
2911     unsigned int __maybe_unused num_elements,
2912     void *data
2913 )
2914 {
2915     VAProcPipelineParameterBuffer *p = (VAProcPipelineParameterBuffer *)data;
2916     unsigned int i;
2917 
2918     DPY2TRACECTX(dpy);
2919 
2920     va_TraceMsg(trace_ctx, "\t--VAProcPipelineParameterBuffer\n");
2921 
2922     va_TraceMsg(trace_ctx, "\t  surface = 0x%08x\n", p->surface);
2923 
2924     if (p->surface_region) {
2925         va_TraceMsg(trace_ctx, "\t  surface_region\n");
2926         va_TraceMsg(trace_ctx, "\t    x = %d\n", p->surface_region->x);
2927         va_TraceMsg(trace_ctx, "\t    y = %d\n", p->surface_region->y);
2928         va_TraceMsg(trace_ctx, "\t    width = %d\n", p->surface_region->width);
2929         va_TraceMsg(trace_ctx, "\t    height = %d\n", p->surface_region->height);
2930     } else {
2931         va_TraceMsg(trace_ctx, "\t  surface_region = (NULL)\n");
2932     }
2933 
2934     va_TraceMsg(trace_ctx, "\t  surface_color_standard = %d\n", p->surface_color_standard);
2935 
2936     if (p->output_region) {
2937         va_TraceMsg(trace_ctx, "\t  output_region\n");
2938         va_TraceMsg(trace_ctx, "\t    x = %d\n", p->output_region->x);
2939         va_TraceMsg(trace_ctx, "\t    y = %d\n", p->output_region->y);
2940         va_TraceMsg(trace_ctx, "\t    width = %d\n", p->output_region->width);
2941         va_TraceMsg(trace_ctx, "\t    height = %d\n", p->output_region->height);
2942     } else {
2943         va_TraceMsg(trace_ctx, "\t  output_region = (NULL)\n");
2944     }
2945 
2946     va_TraceMsg(trace_ctx, "\t  output_background_color = 0x%08x\n", p->output_background_color);
2947     va_TraceMsg(trace_ctx, "\t  output_color_standard = %d\n", p->output_color_standard);
2948     va_TraceMsg(trace_ctx, "\t  pipeline_flags = 0x%08x\n", p->pipeline_flags);
2949     va_TraceMsg(trace_ctx, "\t  filter_flags = 0x%08x\n", p->filter_flags);
2950 
2951     va_TraceProcFilterParameterBuffer(dpy, context, p->filters, p->num_filters);
2952 
2953     va_TraceMsg(trace_ctx, "\t  num_forward_references = 0x%08x\n", p->num_forward_references);
2954 
2955     if (p->num_forward_references) {
2956         va_TraceMsg(trace_ctx, "\t  forward_references\n");
2957 
2958         if (p->forward_references) {
2959             /* only dump the first 5 forward references */
2960             for (i = 0; i < p->num_forward_references && i < 5; i++) {
2961                 va_TraceMsg(trace_ctx, "\t    forward_references[%d] = 0x%08x\n", i, p->forward_references[i]);
2962             }
2963         } else {
2964             for (i = 0; i < p->num_forward_references && i < 5; i++) {
2965                 va_TraceMsg(trace_ctx, "\t    forward_references[%d] = (NULL)\n", i);
2966             }
2967         }
2968     }
2969 
2970     va_TraceMsg(trace_ctx, "\t  num_backward_references = 0x%08x\n", p->num_backward_references);
2971 
2972     if (p->num_backward_references) {
2973         va_TraceMsg(trace_ctx, "\t  backward_references\n");
2974 
2975         if (p->backward_references) {
2976             /* only dump the first 5 backward references */
2977             for (i = 0; i < p->num_backward_references && i < 5; i++) {
2978                 va_TraceMsg(trace_ctx, "\t    backward_references[%d] = 0x%08x\n", i, p->backward_references[i]);
2979             }
2980         } else {
2981             for (i = 0; i < p->num_backward_references && i < 5; i++) {
2982                 va_TraceMsg(trace_ctx, "\t    backward_references[%d] = (NULL)\n", i);
2983             }
2984         }
2985     }
2986 
2987     /* FIXME: add other info later */
2988 
2989     va_TraceMsg(trace_ctx, NULL);
2990 }
2991 
2992 static void
va_TraceNoneBuf(VADisplay dpy,VAContextID context,VABufferID buffer,VABufferType type,unsigned int size,unsigned int num_elements,void * pbuf)2993 va_TraceNoneBuf(
2994     VADisplay dpy,
2995     VAContextID context,
2996     VABufferID buffer,
2997     VABufferType type,
2998     unsigned int size,
2999     unsigned int num_elements,
3000     void *pbuf
3001 )
3002 {
3003     DPY2TRACECTX(dpy);
3004 
3005     switch (type) {
3006     case VAProcPipelineParameterBufferType:
3007         va_TraceVAProcPipelineParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
3008         break;
3009     default:
3010         va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
3011         break;
3012     }
3013 }
3014 
va_TraceRenderPicture(VADisplay dpy,VAContextID __maybe_unused context,VABufferID * buffers,int num_buffers)3015 void va_TraceRenderPicture(
3016     VADisplay dpy,
3017     VAContextID __maybe_unused context,
3018     VABufferID *buffers,
3019     int num_buffers
3020 )
3021 {
3022     VABufferType type;
3023     unsigned int size;
3024     unsigned int num_elements;
3025     int i;
3026     DPY2TRACECTX(dpy);
3027 
3028     TRACE_FUNCNAME(idx);
3029 
3030     va_TraceMsg(trace_ctx, "\tnum_buffers = %d\n", num_buffers);
3031     if (buffers == NULL)
3032         return;
3033 
3034     for (i = 0; i < num_buffers; i++) {
3035         unsigned char *pbuf = NULL;
3036         unsigned int j;
3037 
3038         /* get buffer type information */
3039         vaBufferInfo(dpy, context, buffers[i], &type, &size, &num_elements);
3040 
3041         va_TraceMsg(trace_ctx, "\t---------------------------\n");
3042         va_TraceMsg(trace_ctx, "\tbuffers[%d] = 0x%08x\n", i, buffers[i]);
3043         va_TraceMsg(trace_ctx, "\t  type = %s\n", buffer_type_to_string(type));
3044         va_TraceMsg(trace_ctx, "\t  size = %d\n", size);
3045         va_TraceMsg(trace_ctx, "\t  num_elements = %d\n", num_elements);
3046 
3047         vaMapBuffer(dpy, buffers[i], (void **)&pbuf);
3048         if (pbuf == NULL)
3049             continue;
3050 
3051         switch (trace_ctx->trace_profile) {
3052         case VAProfileMPEG2Simple:
3053         case VAProfileMPEG2Main:
3054             for (j=0; j<num_elements; j++) {
3055                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
3056                 va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
3057             }
3058             break;
3059         case VAProfileMPEG4Simple:
3060         case VAProfileMPEG4AdvancedSimple:
3061         case VAProfileMPEG4Main:
3062             for (j=0; j<num_elements; j++) {
3063                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
3064                 va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
3065             }
3066             break;
3067         case VAProfileH264Baseline:
3068         case VAProfileH264Main:
3069         case VAProfileH264High:
3070         case VAProfileH264ConstrainedBaseline:
3071             for (j=0; j<num_elements; j++) {
3072                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
3073 
3074                 va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
3075             }
3076             break;
3077         case VAProfileVC1Simple:
3078         case VAProfileVC1Main:
3079         case VAProfileVC1Advanced:
3080             for (j=0; j<num_elements; j++) {
3081                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
3082 
3083                 va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
3084             }
3085             break;
3086         case VAProfileH263Baseline:
3087             for (j=0; j<num_elements; j++) {
3088                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
3089 
3090                 va_TraceH263Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
3091             }
3092             break;
3093         case VAProfileJPEGBaseline:
3094             for (j=0; j<num_elements; j++) {
3095                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
3096 
3097                 va_TraceJPEGBuf (dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
3098             }
3099             break;
3100         case VAProfileVP8Version0_3:
3101             for (j=0; j<num_elements; j++) {
3102                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
3103 
3104                 va_TraceVP8Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
3105             }
3106             break;
3107         case VAProfileNone:
3108             for (j=0; j<num_elements; j++) {
3109                 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
3110 
3111                 va_TraceNoneBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
3112             }
3113             break;
3114         default:
3115             break;
3116         }
3117 
3118         vaUnmapBuffer(dpy, buffers[i]);
3119     }
3120 
3121     va_TraceMsg(trace_ctx, NULL);
3122 }
3123 
va_TraceEndPicture(VADisplay dpy,VAContextID __maybe_unused context,int __maybe_unused endpic_done)3124 void va_TraceEndPicture(
3125     VADisplay dpy,
3126     VAContextID __maybe_unused context,
3127     int __maybe_unused endpic_done
3128 )
3129 {
3130     int encode, decode, jpeg;
3131     DPY2TRACECTX(dpy);
3132 
3133     TRACE_FUNCNAME(idx);
3134 
3135     va_TraceMsg(trace_ctx, "\trender_targets = 0x%08x\n", trace_ctx->trace_rendertarget);
3136 
3137     /* avoid to create so many empty files */
3138     encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice);
3139     decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD);
3140     jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture);
3141 
3142     /* trace encode source surface, can do it before HW completes rendering */
3143     if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE))||
3144         (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG)))
3145         va_TraceSurface(dpy);
3146 
3147     /* trace decoded surface, do it after HW completes rendering */
3148     if (decode && ((trace_flag & VA_TRACE_FLAG_SURFACE_DECODE))) {
3149         vaSyncSurface(dpy, trace_ctx->trace_rendertarget);
3150         va_TraceSurface(dpy);
3151     }
3152 
3153     va_TraceMsg(trace_ctx, NULL);
3154 }
3155 
3156 
va_TraceSyncSurface(VADisplay dpy,VASurfaceID __maybe_unused render_target)3157 void va_TraceSyncSurface(
3158     VADisplay dpy,
3159     VASurfaceID __maybe_unused render_target
3160 )
3161 {
3162     DPY2TRACECTX(dpy);
3163 
3164     TRACE_FUNCNAME(idx);
3165 
3166     va_TraceMsg(trace_ctx, NULL);
3167 }
3168 
va_TraceQuerySurfaceAttributes(VADisplay dpy,VAConfigID __maybe_unused config,VASurfaceAttrib * attrib_list,unsigned int * num_attribs)3169 void va_TraceQuerySurfaceAttributes(
3170     VADisplay           dpy,
3171     VAConfigID          __maybe_unused config,
3172     VASurfaceAttrib    *attrib_list,
3173     unsigned int       *num_attribs
3174 )
3175 {
3176     DPY2TRACECTX(dpy);
3177 
3178     TRACE_FUNCNAME(idx);
3179     va_TraceSurfaceAttributes(trace_ctx, attrib_list, num_attribs);
3180 
3181     va_TraceMsg(trace_ctx, NULL);
3182 
3183 }
3184 
3185 
va_TraceQuerySurfaceStatus(VADisplay dpy,VASurfaceID __maybe_unused render_target,VASurfaceStatus * status)3186 void va_TraceQuerySurfaceStatus(
3187     VADisplay dpy,
3188     VASurfaceID __maybe_unused render_target,
3189     VASurfaceStatus *status    /* out */
3190 )
3191 {
3192     DPY2TRACECTX(dpy);
3193 
3194     TRACE_FUNCNAME(idx);
3195 
3196     if (status)
3197         va_TraceMsg(trace_ctx, "\tstatus = 0x%08x\n", *status);
3198     va_TraceMsg(trace_ctx, NULL);
3199 }
3200 
3201 
va_TraceQuerySurfaceError(VADisplay dpy,VASurfaceID surface,VAStatus error_status,void ** error_info)3202 void va_TraceQuerySurfaceError(
3203     VADisplay dpy,
3204     VASurfaceID surface,
3205     VAStatus error_status,
3206     void **error_info       /*out*/
3207 )
3208 {
3209     DPY2TRACECTX(dpy);
3210 
3211     TRACE_FUNCNAME(idx);
3212     va_TraceMsg(trace_ctx, "\tsurface = 0x%08x\n", surface);
3213     va_TraceMsg(trace_ctx, "\terror_status = 0x%08x\n", error_status);
3214     if (error_info && (error_status == VA_STATUS_ERROR_DECODING_ERROR)) {
3215         VASurfaceDecodeMBErrors *p = *error_info;
3216         while (p && (p->status != -1)) {
3217             va_TraceMsg(trace_ctx, "\t\tstatus = %d\n", p->status);
3218             va_TraceMsg(trace_ctx, "\t\tstart_mb = %d\n", p->start_mb);
3219             va_TraceMsg(trace_ctx, "\t\tend_mb = %d\n", p->end_mb);
3220             p++; /* next error record */
3221         }
3222     }
3223     va_TraceMsg(trace_ctx, NULL);
3224 }
3225 
va_TraceMaxNumDisplayAttributes(VADisplay dpy,int number)3226 void va_TraceMaxNumDisplayAttributes (
3227     VADisplay dpy,
3228     int number
3229 )
3230 {
3231     DPY2TRACECTX(dpy);
3232 
3233     TRACE_FUNCNAME(idx);
3234 
3235     va_TraceMsg(trace_ctx, "\tmax_display_attributes = %d\n", number);
3236     va_TraceMsg(trace_ctx, NULL);
3237 }
3238 
va_TraceQueryDisplayAttributes(VADisplay dpy,VADisplayAttribute * attr_list,int * num_attributes)3239 void va_TraceQueryDisplayAttributes (
3240     VADisplay dpy,
3241     VADisplayAttribute *attr_list,    /* out */
3242     int *num_attributes               /* out */
3243 )
3244 {
3245     int i;
3246 
3247     DPY2TRACECTX(dpy);
3248 
3249     if (attr_list == NULL || num_attributes == NULL)
3250         return;
3251 
3252     va_TraceMsg(trace_ctx, "\tnum_attributes = %d\n", *num_attributes);
3253 
3254     for (i=0; i<*num_attributes; i++) {
3255         va_TraceMsg(trace_ctx, "\tattr_list[%d] =\n");
3256         va_TraceMsg(trace_ctx, "\t  typ = 0x%08x\n", attr_list[i].type);
3257         va_TraceMsg(trace_ctx, "\t  min_value = %d\n", attr_list[i].min_value);
3258         va_TraceMsg(trace_ctx, "\t  max_value = %d\n", attr_list[i].max_value);
3259         va_TraceMsg(trace_ctx, "\t  value = %d\n", attr_list[i].value);
3260         va_TraceMsg(trace_ctx, "\t  flags = %d\n", attr_list[i].flags);
3261     }
3262     va_TraceMsg(trace_ctx, NULL);
3263 }
3264 
3265 
va_TraceDisplayAttributes(VADisplay dpy,VADisplayAttribute * attr_list,int __maybe_unused num_attributes)3266 static void va_TraceDisplayAttributes (
3267     VADisplay dpy,
3268     VADisplayAttribute *attr_list,
3269     int __maybe_unused num_attributes
3270 )
3271 {
3272     int i;
3273 
3274     DPY2TRACECTX(dpy);
3275 
3276     if (attr_list == NULL)
3277         return;
3278 
3279     for (i=0; i<num_attributes; i++) {
3280         va_TraceMsg(trace_ctx, "\tattr_list[%d] =\n");
3281         va_TraceMsg(trace_ctx, "\t  typ = 0x%08x\n", attr_list[i].type);
3282         va_TraceMsg(trace_ctx, "\t  min_value = %d\n", attr_list[i].min_value);
3283         va_TraceMsg(trace_ctx, "\t  max_value = %d\n", attr_list[i].max_value);
3284         va_TraceMsg(trace_ctx, "\t  value = %d\n", attr_list[i].value);
3285         va_TraceMsg(trace_ctx, "\t  flags = %d\n", attr_list[i].flags);
3286     }
3287     va_TraceMsg(trace_ctx, NULL);
3288 }
3289 
3290 
va_TraceGetDisplayAttributes(VADisplay dpy,VADisplayAttribute * attr_list,int num_attributes)3291 void va_TraceGetDisplayAttributes (
3292     VADisplay dpy,
3293     VADisplayAttribute *attr_list,
3294     int num_attributes
3295 )
3296 {
3297     DPY2TRACECTX(dpy);
3298 
3299     TRACE_FUNCNAME(idx);
3300 
3301     va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
3302 }
3303 
va_TraceSetDisplayAttributes(VADisplay dpy,VADisplayAttribute * attr_list,int num_attributes)3304 void va_TraceSetDisplayAttributes (
3305     VADisplay dpy,
3306     VADisplayAttribute *attr_list,
3307     int num_attributes
3308 )
3309 {
3310     DPY2TRACECTX(dpy);
3311 
3312     TRACE_FUNCNAME(idx);
3313 
3314     va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
3315 }
3316 
3317 
va_TracePutSurface(VADisplay dpy,VASurfaceID surface,void * draw,short srcx,short srcy,unsigned short srcw,unsigned short srch,short destx,short desty,unsigned short destw,unsigned short desth,VARectangle * cliprects,unsigned int number_cliprects,unsigned int flags)3318 void va_TracePutSurface (
3319     VADisplay dpy,
3320     VASurfaceID surface,
3321     void *draw, /* the target Drawable */
3322     short srcx,
3323     short srcy,
3324     unsigned short srcw,
3325     unsigned short srch,
3326     short destx,
3327     short desty,
3328     unsigned short destw,
3329     unsigned short desth,
3330     VARectangle *cliprects, /* client supplied clip list */
3331     unsigned int number_cliprects, /* number of clip rects in the clip list */
3332     unsigned int flags /* de-interlacing flags */
3333 )
3334 {
3335     DPY2TRACECTX(dpy);
3336 
3337     TRACE_FUNCNAME(idx);
3338 
3339     va_TraceMsg(trace_ctx, "\tsurface = 0x%08x\n", surface);
3340     va_TraceMsg(trace_ctx, "\tdraw = 0x%08x\n", draw);
3341     va_TraceMsg(trace_ctx, "\tsrcx = %d\n", srcx);
3342     va_TraceMsg(trace_ctx, "\tsrcy = %d\n", srcy);
3343     va_TraceMsg(trace_ctx, "\tsrcw = %d\n", srcw);
3344     va_TraceMsg(trace_ctx, "\tsrch = %d\n", srch);
3345     va_TraceMsg(trace_ctx, "\tdestx = %d\n", destx);
3346     va_TraceMsg(trace_ctx, "\tdesty = %d\n", desty);
3347     va_TraceMsg(trace_ctx, "\tdestw = %d\n", destw);
3348     va_TraceMsg(trace_ctx, "\tdesth = %d\n", desth);
3349     va_TraceMsg(trace_ctx, "\tcliprects = 0x%08x\n", cliprects);
3350     va_TraceMsg(trace_ctx, "\tnumber_cliprects = %d\n", number_cliprects);
3351     va_TraceMsg(trace_ctx, "\tflags = 0x%08x\n", flags);
3352     va_TraceMsg(trace_ctx, NULL);
3353 }
3354