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