va_TraceMsg(idx, "\tprofile = %d\n", profile);
va_TraceMsg(idx, "\tentrypoint = %d\n", entrypoint);
va_TraceMsg(idx, "\tnum_attribs = %d\n", num_attribs);
- for (i = 0; i < num_attribs; i++) {
- va_TraceMsg(idx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
- va_TraceMsg(idx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
+ if (attrib_list) {
+ for (i = 0; i < num_attribs; i++) {
+ va_TraceMsg(idx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
+ va_TraceMsg(idx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
+ }
}
va_TraceMsg(idx, NULL);
}
}
+static void va_TraceSurfaceAttributes(
+ int idx,
+ VASurfaceAttrib *attrib_list,
+ unsigned int *num_attribs
+)
+{
+ int i, num;
+ VASurfaceAttrib *p;
+
+ if (!attrib_list || !num_attribs)
+ return;
+
+ p = attrib_list;
+ num = *num_attribs;
+ if (num > VASurfaceAttribCount)
+ num = VASurfaceAttribCount;
+
+ for (i=0; i<num; i++) {
+ va_TraceMsg(idx, "\tattrib_list[%i] =\n", i);
+
+ va_TraceMsg(idx, "\t\ttype = %d\n", p->type);
+ va_TraceMsg(idx, "\t\tflags = %d\n", p->flags);
+ va_TraceMsg(idx, "\t\tvalue.type = %d\n", p->value.type);
+ if (p->value.type == VAGenericValueTypeInteger)
+ va_TraceMsg(idx, "\t\tvalue.value.i = 0x%08x\n", p->value.value.i);
+ else if (p->value.type == VAGenericValueTypeFloat)
+ va_TraceMsg(idx, "\t\tvalue.value.f = %f\n", p->value.value.f);
+ else if (p->value.type == VAGenericValueTypePointer)
+ va_TraceMsg(idx, "\t\tvalue.value.p = %p\n", p->value.value.p);
+ else if (p->value.type == VAGenericValueTypeFunc)
+ va_TraceMsg(idx, "\t\tvalue.value.fn = %p\n", p->value.value.fn);
+
+ p++;
+ }
+}
void va_TraceCreateSurfaces(
VADisplay dpy,
va_TraceMsg(idx, "\tformat = %d\n", format);
va_TraceMsg(idx, "\tnum_surfaces = %d\n", num_surfaces);
- for (i = 0; i < num_surfaces; i++)
- va_TraceMsg(idx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
+ if (surfaces) {
+ for (i = 0; i < num_surfaces; i++)
+ va_TraceMsg(idx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
+ }
+
+ va_TraceSurfaceAttributes(idx, attrib_list, &num_attribs);
va_TraceMsg(idx, NULL);
}
+void va_TraceDestroySurfaces(
+ VADisplay dpy,
+ VASurfaceID *surface_list,
+ int num_surfaces
+)
+{
+ int i;
+ DPY2INDEX(dpy);
+
+ TRACE_FUNCNAME(idx);
+
+ if (surface_list) {
+ for (i = 0; i < num_surfaces; i++)
+ va_TraceMsg(idx, "\t\tsurfaces[%d] = 0x%08x\n", i, surface_list[i]);
+ }
+
+ va_TraceMsg(idx, NULL);
+}
+
+
void va_TraceCreateContext(
VADisplay dpy,
VAConfigID config_id,
DPY2INDEX(dpy);
TRACE_FUNCNAME(idx);
-
+
+ va_TraceMsg(idx, "\tconfig = 0x%08x\n", config_id);
va_TraceMsg(idx, "\twidth = %d\n", picture_width);
va_TraceMsg(idx, "\theight = %d\n", picture_height);
va_TraceMsg(idx, "\tflag = 0x%08x\n", flag);
va_TraceMsg(idx, "\tnum_render_targets = %d\n", num_render_targets);
- for (i=0; i<num_render_targets; i++)
- va_TraceMsg(idx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
- va_TraceMsg(idx, "\tcontext = 0x%08x\n", *context);
- va_TraceMsg(idx, NULL);
-
- trace_context[idx].trace_context = *context;
-
+ if (render_targets) {
+ for (i=0; i<num_render_targets; i++)
+ va_TraceMsg(idx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
+ }
+ if (context) {
+ va_TraceMsg(idx, "\tcontext = 0x%08x\n", *context);
+ trace_context[idx].trace_context = *context;
+ } else
+ trace_context[idx].trace_context = VA_INVALID_ID;
+
trace_context[idx].trace_frame_no = 0;
trace_context[idx].trace_slice_no = 0;
}
}
+void va_TraceCreateBuffer (
+ VADisplay dpy,
+ VAContextID context, /* in */
+ VABufferType type, /* in */
+ unsigned int size, /* in */
+ unsigned int num_elements, /* in */
+ void *data, /* in */
+ VABufferID *buf_id /* out */
+)
+{
+ DPY2INDEX(dpy);
+
+ /* only trace CodedBuffer */
+ if (type != VAEncCodedBufferType)
+ return;
+
+ TRACE_FUNCNAME(idx);
+ va_TraceMsg(idx, "\tbuf_type=%s\n", buffer_type_to_string(type));
+ if (buf_id)
+ va_TraceMsg(idx, "\tbuf_id=0x%x\n", *buf_id);
+ va_TraceMsg(idx, "\tsize=%d\n", size);
+ va_TraceMsg(idx, "\tnum_elements=%d\n", num_elements);
+
+ va_TraceMsg(idx, NULL);
+}
+
+void va_TraceDestroyBuffer (
+ VADisplay dpy,
+ VABufferID buf_id /* in */
+)
+{
+ VABufferType type;
+ unsigned int size;
+ unsigned int num_elements;
+
+ VACodedBufferSegment *buf_list;
+ int i = 0;
+
+ DPY2INDEX(dpy);
+
+ vaBufferInfo(dpy, trace_context[idx].trace_context, buf_id, &type, &size, &num_elements);
+
+ /* only trace CodedBuffer */
+ if (type != VAEncCodedBufferType)
+ return;
+
+ TRACE_FUNCNAME(idx);
+ va_TraceMsg(idx, "\tbuf_type=%s\n", buffer_type_to_string(type));
+ va_TraceMsg(idx, "\tbuf_id=0x%x\n", buf_id);
+ va_TraceMsg(idx, "\tsize=%d\n", size);
+ va_TraceMsg(idx, "\tnum_elements=%d\n", num_elements);
+
+ va_TraceMsg(idx, NULL);
+}
+
+
void va_TraceMapBuffer (
VADisplay dpy,
VABufferID buf_id, /* in */
TRACE_FUNCNAME(idx);
va_TraceMsg(idx, "\tbuf_id=0x%x\n", buf_id);
va_TraceMsg(idx, "\tbuf_type=%s\n", buffer_type_to_string(type));
+ if ((pbuf == NULL) || (*pbuf == NULL))
+ return;
+
buf_list = (VACodedBufferSegment *)(*pbuf);
while (buf_list != NULL) {
va_TraceMsg(idx, "\tCodedbuf[%d] =\n", i++);
va_TraceMsg(idx, "VAEncMiscParameterRateControl\n");
va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
+ va_TraceMsg(idx, "\ttarget_percentage = %d\n", p->target_percentage);
va_TraceMsg(idx, "\twindow_size = %d\n", p->window_size);
va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
break;
}
default:
- va_TraceMsg(idx, "invalid VAEncMiscParameterBuffer type = %d\n", tmp->type);
+ va_TraceMsg(idx, "Unknown VAEncMiscParameterBuffer(type = %d):", tmp->type);
+ va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
break;
}
va_TraceMsg(idx, NULL);
void *data)
{
VAEncPictureParameterBufferJPEG *p = (VAEncPictureParameterBufferJPEG *)data;
+ int i;
+
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAEncPictureParameterBufferJPEG\n");
return;
}
+
static void va_TraceH263Buf(
VADisplay dpy,
VAContextID context,
case VAProtectedSliceDataBufferType:
case VAEncCodedBufferType:
case VAEncSequenceParameterBufferType:
- case VAEncSliceParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break;
+ case VAEncSliceParameterBufferType:
+ va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
+ break;
case VAPictureParameterBufferType:
va_TraceVAPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
break;
va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
va_TraceMsg(idx, "\tnum_buffers = %d\n", num_buffers);
+ if (buffers == NULL)
+ return;
+
for (i = 0; i < num_buffers; i++) {
- unsigned char *pbuf;
+ unsigned char *pbuf = NULL;
unsigned int j;
/* get buffer type information */
va_TraceMsg(idx, "\t num_elements = %d\n", num_elements);
vaMapBuffer(dpy, buffers[i], (void **)&pbuf);
-
+ if (pbuf == NULL)
+ continue;
+
switch (trace_context[idx].trace_profile) {
case VAProfileMPEG2Simple:
case VAProfileMPEG2Main:
va_TraceMsg(idx, NULL);
}
+void va_TraceQuerySurfaceAttributes(
+ VADisplay dpy,
+ VAConfigID config,
+ VASurfaceAttrib *attrib_list,
+ unsigned int *num_attribs
+)
+{
+ DPY2INDEX(dpy);
+
+ TRACE_FUNCNAME(idx);
+ va_TraceMsg(idx, "\tconfig = 0x%08x\n", config);
+ va_TraceSurfaceAttributes(idx, attrib_list, num_attribs);
+
+ va_TraceMsg(idx, NULL);
+
+}
+
void va_TraceQuerySurfaceStatus(
VADisplay dpy,
TRACE_FUNCNAME(idx);
va_TraceMsg(idx, "\trender_target = 0x%08x\n", render_target);
- va_TraceMsg(idx, "\tstatus = 0x%08x\n", *status);
+ if (status)
+ va_TraceMsg(idx, "\tstatus = 0x%08x\n", *status);
va_TraceMsg(idx, NULL);
}
TRACE_FUNCNAME(idx);
va_TraceMsg(idx, "\tsurface = 0x%08x\n", surface);
va_TraceMsg(idx, "\terror_status = 0x%08x\n", error_status);
- if (error_status == VA_STATUS_ERROR_DECODING_ERROR) {
+ if (error_info && (error_status == VA_STATUS_ERROR_DECODING_ERROR)) {
VASurfaceDecodeMBErrors *p = *error_info;
- while (p->status != -1) {
+ while (p && (p->status != -1)) {
va_TraceMsg(idx, "\t\tstatus = %d\n", p->status);
va_TraceMsg(idx, "\t\tstart_mb = %d\n", p->start_mb);
va_TraceMsg(idx, "\t\tend_mb = %d\n", p->end_mb);
DPY2INDEX(dpy);
- va_TraceMsg(idx, "\tnum_attributes = %d\n", *num_attributes);
+ if (attr_list == NULL || num_attributes == NULL)
+ return;
+ va_TraceMsg(idx, "\tnum_attributes = %d\n", *num_attributes);
+
for (i=0; i<*num_attributes; i++) {
va_TraceMsg(idx, "\tattr_list[%d] =\n");
va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);
DPY2INDEX(dpy);
va_TraceMsg(idx, "\tnum_attributes = %d\n", num_attributes);
+ if (attr_list == NULL)
+ return;
+
for (i=0; i<num_attributes; i++) {
va_TraceMsg(idx, "\tattr_list[%d] =\n");
va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);