• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/libva


Commit MetaInfo

修订版94ca3377019b57f6558641de45750adaa7a8c34a (tree)
时间2014-03-17 10:27:29
作者Austin Yuan <shengquan.yuan@inte...>
CommiterXiang, Haihao

Log Message

vatrace: trace vaQuerySurfaceAttributes

Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
(cherry picked from commit e468728f9e49603f91ccbce3a232aa3bd98d1fd4)
[Haihao: Remove JPEG encode from this commit]
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>

更改概述

差异

--- a/va/va.c
+++ b/va/va.c
@@ -827,11 +827,14 @@ vaQuerySurfaceAttributes(
827827 return VA_STATUS_ERROR_INVALID_DISPLAY;
828828
829829 if (!ctx->vtable->vaQuerySurfaceAttributes)
830- return va_impl_query_surface_attributes(ctx, config,
831- attrib_list, num_attribs);
830+ vaStatus = va_impl_query_surface_attributes(ctx, config,
831+ attrib_list, num_attribs);
832+ else
833+ vaStatus = ctx->vtable->vaQuerySurfaceAttributes(ctx, config,
834+ attrib_list, num_attribs);
835+
836+ VA_TRACE_LOG(va_TraceQuerySurfaceAttributes, dpy, config, attrib_list, num_attribs);
832837
833- vaStatus = ctx->vtable->vaQuerySurfaceAttributes(ctx, config,
834- attrib_list, num_attribs);
835838 return vaStatus;
836839 }
837840
@@ -856,16 +859,14 @@ vaCreateSurfaces(
856859 return VA_STATUS_ERROR_INVALID_DISPLAY;
857860
858861 if (ctx->vtable->vaCreateSurfaces2)
859- return ctx->vtable->vaCreateSurfaces2(ctx, format, width, height,
862+ vaStatus = ctx->vtable->vaCreateSurfaces2(ctx, format, width, height,
860863 surfaces, num_surfaces,
861864 attrib_list, num_attribs);
862-
863- if (attrib_list && num_attribs > 0)
864- return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
865-
866- vaStatus = ctx->vtable->vaCreateSurfaces(ctx, width, height, format,
867- num_surfaces, surfaces);
868-
865+ else if (attrib_list && num_attribs > 0)
866+ vaStatus = VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
867+ else
868+ vaStatus = ctx->vtable->vaCreateSurfaces(ctx, width, height, format,
869+ num_surfaces, surfaces);
869870 VA_TRACE_LOG(va_TraceCreateSurfaces,
870871 dpy, width, height, format, num_surfaces, surfaces,
871872 attrib_list, num_attribs);
@@ -881,10 +882,17 @@ VAStatus vaDestroySurfaces (
881882 )
882883 {
883884 VADriverContextP ctx;
885+ VAStatus vaStatus;
886+
884887 CHECK_DISPLAY(dpy);
885888 ctx = CTX(dpy);
886889
887- return ctx->vtable->vaDestroySurfaces( ctx, surface_list, num_surfaces );
890+ VA_TRACE_LOG(va_TraceDestroySurfaces,
891+ dpy, surface_list, num_surfaces);
892+
893+ vaStatus = ctx->vtable->vaDestroySurfaces( ctx, surface_list, num_surfaces );
894+
895+ return vaStatus;
888896 }
889897
890898 VAStatus vaCreateContext (
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -475,9 +475,11 @@ void va_TraceCreateConfig(
475475 va_TraceMsg(idx, "\tprofile = %d\n", profile);
476476 va_TraceMsg(idx, "\tentrypoint = %d\n", entrypoint);
477477 va_TraceMsg(idx, "\tnum_attribs = %d\n", num_attribs);
478- for (i = 0; i < num_attribs; i++) {
479- va_TraceMsg(idx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
480- va_TraceMsg(idx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
478+ if (attrib_list) {
479+ for (i = 0; i < num_attribs; i++) {
480+ va_TraceMsg(idx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
481+ va_TraceMsg(idx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
482+ }
481483 }
482484 va_TraceMsg(idx, NULL);
483485
@@ -519,6 +521,41 @@ void va_TraceCreateConfig(
519521 }
520522 }
521523
524+static void va_TraceSurfaceAttributes(
525+ int idx,
526+ VASurfaceAttrib *attrib_list,
527+ unsigned int *num_attribs
528+)
529+{
530+ int i, num;
531+ VASurfaceAttrib *p;
532+
533+ if (!attrib_list || !num_attribs)
534+ return;
535+
536+ p = attrib_list;
537+ num = *num_attribs;
538+ if (num > VASurfaceAttribCount)
539+ num = VASurfaceAttribCount;
540+
541+ for (i=0; i<num; i++) {
542+ va_TraceMsg(idx, "\tattrib_list[%i] =\n", i);
543+
544+ va_TraceMsg(idx, "\t\ttype = %d\n", p->type);
545+ va_TraceMsg(idx, "\t\tflags = %d\n", p->flags);
546+ va_TraceMsg(idx, "\t\tvalue.type = %d\n", p->value.type);
547+ if (p->value.type == VAGenericValueTypeInteger)
548+ va_TraceMsg(idx, "\t\tvalue.value.i = 0x%08x\n", p->value.value.i);
549+ else if (p->value.type == VAGenericValueTypeFloat)
550+ va_TraceMsg(idx, "\t\tvalue.value.f = %f\n", p->value.value.f);
551+ else if (p->value.type == VAGenericValueTypePointer)
552+ va_TraceMsg(idx, "\t\tvalue.value.p = %p\n", p->value.value.p);
553+ else if (p->value.type == VAGenericValueTypeFunc)
554+ va_TraceMsg(idx, "\t\tvalue.value.fn = %p\n", p->value.value.fn);
555+
556+ p++;
557+ }
558+}
522559
523560 void va_TraceCreateSurfaces(
524561 VADisplay dpy,
@@ -541,9 +578,33 @@ void va_TraceCreateSurfaces(
541578 va_TraceMsg(idx, "\tformat = %d\n", format);
542579 va_TraceMsg(idx, "\tnum_surfaces = %d\n", num_surfaces);
543580
544- for (i = 0; i < num_surfaces; i++)
545- va_TraceMsg(idx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
581+ if (surfaces) {
582+ for (i = 0; i < num_surfaces; i++)
583+ va_TraceMsg(idx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
584+ }
585+
586+ va_TraceSurfaceAttributes(idx, attrib_list, &num_attribs);
587+
588+ va_TraceMsg(idx, NULL);
589+}
590+
591+
592+void va_TraceDestroySurfaces(
593+ VADisplay dpy,
594+ VASurfaceID *surface_list,
595+ int num_surfaces
596+)
597+{
598+ int i;
599+ DPY2INDEX(dpy);
600+
601+ TRACE_FUNCNAME(idx);
546602
603+ if (surface_list) {
604+ for (i = 0; i < num_surfaces; i++)
605+ va_TraceMsg(idx, "\t\tsurfaces[%d] = 0x%08x\n", i, surface_list[i]);
606+ }
607+
547608 va_TraceMsg(idx, NULL);
548609 }
549610
@@ -563,18 +624,22 @@ void va_TraceCreateContext(
563624 DPY2INDEX(dpy);
564625
565626 TRACE_FUNCNAME(idx);
566-
627+
628+ va_TraceMsg(idx, "\tconfig = 0x%08x\n", config_id);
567629 va_TraceMsg(idx, "\twidth = %d\n", picture_width);
568630 va_TraceMsg(idx, "\theight = %d\n", picture_height);
569631 va_TraceMsg(idx, "\tflag = 0x%08x\n", flag);
570632 va_TraceMsg(idx, "\tnum_render_targets = %d\n", num_render_targets);
571- for (i=0; i<num_render_targets; i++)
572- va_TraceMsg(idx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
573- va_TraceMsg(idx, "\tcontext = 0x%08x\n", *context);
574- va_TraceMsg(idx, NULL);
575-
576- trace_context[idx].trace_context = *context;
577-
633+ if (render_targets) {
634+ for (i=0; i<num_render_targets; i++)
635+ va_TraceMsg(idx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
636+ }
637+ if (context) {
638+ va_TraceMsg(idx, "\tcontext = 0x%08x\n", *context);
639+ trace_context[idx].trace_context = *context;
640+ } else
641+ trace_context[idx].trace_context = VA_INVALID_ID;
642+
578643 trace_context[idx].trace_frame_no = 0;
579644 trace_context[idx].trace_slice_no = 0;
580645
@@ -637,7 +702,8 @@ void va_TraceCreateBuffer (
637702
638703 TRACE_FUNCNAME(idx);
639704 va_TraceMsg(idx, "\tbuf_type=%s\n", buffer_type_to_string(type));
640- va_TraceMsg(idx, "\tbuf_id=0x%x\n", *buf_id);
705+ if (buf_id)
706+ va_TraceMsg(idx, "\tbuf_id=0x%x\n", *buf_id);
641707 va_TraceMsg(idx, "\tsize=%d\n", size);
642708 va_TraceMsg(idx, "\tnum_elements=%d\n", num_elements);
643709
@@ -698,6 +764,9 @@ void va_TraceMapBuffer (
698764 TRACE_FUNCNAME(idx);
699765 va_TraceMsg(idx, "\tbuf_id=0x%x\n", buf_id);
700766 va_TraceMsg(idx, "\tbuf_type=%s\n", buffer_type_to_string(type));
767+ if ((pbuf == NULL) || (*pbuf == NULL))
768+ return;
769+
701770 buf_list = (VACodedBufferSegment *)(*pbuf);
702771 while (buf_list != NULL) {
703772 va_TraceMsg(idx, "\tCodedbuf[%d] =\n", i++);
@@ -2011,6 +2080,8 @@ static void va_TraceVAEncPictureParameterBufferJPEG(
20112080 void *data)
20122081 {
20132082 VAEncPictureParameterBufferJPEG *p = (VAEncPictureParameterBufferJPEG *)data;
2083+ int i;
2084+
20142085 DPY2INDEX(dpy);
20152086
20162087 va_TraceMsg(idx, "VAEncPictureParameterBufferJPEG\n");
@@ -2064,6 +2135,7 @@ static void va_TraceVAEncQMatrixBufferJPEG(
20642135 return;
20652136 }
20662137
2138+
20672139 static void va_TraceH263Buf(
20682140 VADisplay dpy,
20692141 VAContextID context,
@@ -2148,9 +2220,11 @@ static void va_TraceJPEGBuf(
21482220 case VAProtectedSliceDataBufferType:
21492221 case VAEncCodedBufferType:
21502222 case VAEncSequenceParameterBufferType:
2151- case VAEncSliceParameterBufferType:
21522223 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
21532224 break;
2225+ case VAEncSliceParameterBufferType:
2226+ va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2227+ break;
21542228 case VAPictureParameterBufferType:
21552229 va_TraceVAPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
21562230 break;
@@ -2386,8 +2460,11 @@ void va_TraceRenderPicture(
23862460
23872461 va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
23882462 va_TraceMsg(idx, "\tnum_buffers = %d\n", num_buffers);
2463+ if (buffers == NULL)
2464+ return;
2465+
23892466 for (i = 0; i < num_buffers; i++) {
2390- unsigned char *pbuf;
2467+ unsigned char *pbuf = NULL;
23912468 unsigned int j;
23922469
23932470 /* get buffer type information */
@@ -2400,7 +2477,9 @@ void va_TraceRenderPicture(
24002477 va_TraceMsg(idx, "\t num_elements = %d\n", num_elements);
24012478
24022479 vaMapBuffer(dpy, buffers[i], (void **)&pbuf);
2403-
2480+ if (pbuf == NULL)
2481+ continue;
2482+
24042483 switch (trace_context[idx].trace_profile) {
24052484 case VAProfileMPEG2Simple:
24062485 case VAProfileMPEG2Main:
@@ -2513,6 +2592,23 @@ void va_TraceSyncSurface(
25132592 va_TraceMsg(idx, NULL);
25142593 }
25152594
2595+void va_TraceQuerySurfaceAttributes(
2596+ VADisplay dpy,
2597+ VAConfigID config,
2598+ VASurfaceAttrib *attrib_list,
2599+ unsigned int *num_attribs
2600+)
2601+{
2602+ DPY2INDEX(dpy);
2603+
2604+ TRACE_FUNCNAME(idx);
2605+ va_TraceMsg(idx, "\tconfig = 0x%08x\n", config);
2606+ va_TraceSurfaceAttributes(idx, attrib_list, num_attribs);
2607+
2608+ va_TraceMsg(idx, NULL);
2609+
2610+}
2611+
25162612
25172613 void va_TraceQuerySurfaceStatus(
25182614 VADisplay dpy,
@@ -2525,7 +2621,8 @@ void va_TraceQuerySurfaceStatus(
25252621 TRACE_FUNCNAME(idx);
25262622
25272623 va_TraceMsg(idx, "\trender_target = 0x%08x\n", render_target);
2528- va_TraceMsg(idx, "\tstatus = 0x%08x\n", *status);
2624+ if (status)
2625+ va_TraceMsg(idx, "\tstatus = 0x%08x\n", *status);
25292626 va_TraceMsg(idx, NULL);
25302627 }
25312628
@@ -2542,9 +2639,9 @@ void va_TraceQuerySurfaceError(
25422639 TRACE_FUNCNAME(idx);
25432640 va_TraceMsg(idx, "\tsurface = 0x%08x\n", surface);
25442641 va_TraceMsg(idx, "\terror_status = 0x%08x\n", error_status);
2545- if (error_status == VA_STATUS_ERROR_DECODING_ERROR) {
2642+ if (error_info && (error_status == VA_STATUS_ERROR_DECODING_ERROR)) {
25462643 VASurfaceDecodeMBErrors *p = *error_info;
2547- while (p->status != -1) {
2644+ while (p && (p->status != -1)) {
25482645 va_TraceMsg(idx, "\t\tstatus = %d\n", p->status);
25492646 va_TraceMsg(idx, "\t\tstart_mb = %d\n", p->start_mb);
25502647 va_TraceMsg(idx, "\t\tend_mb = %d\n", p->end_mb);
@@ -2578,7 +2675,9 @@ void va_TraceQueryDisplayAttributes (
25782675 DPY2INDEX(dpy);
25792676
25802677 va_TraceMsg(idx, "\tnum_attributes = %d\n", *num_attributes);
2581-
2678+ if (attr_list == NULL || num_attributes == NULL)
2679+ return;
2680+
25822681 for (i=0; i<*num_attributes; i++) {
25832682 va_TraceMsg(idx, "\tattr_list[%d] =\n");
25842683 va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);
@@ -2602,6 +2701,9 @@ static void va_TraceDisplayAttributes (
26022701 DPY2INDEX(dpy);
26032702
26042703 va_TraceMsg(idx, "\tnum_attributes = %d\n", num_attributes);
2704+ if (attr_list == NULL)
2705+ return;
2706+
26052707 for (i=0; i<num_attributes; i++) {
26062708 va_TraceMsg(idx, "\tattr_list[%d] =\n");
26072709 va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);
--- a/va/va_trace.h
+++ b/va/va_trace.h
@@ -142,6 +142,13 @@ void va_TraceSyncSurface(
142142 VASurfaceID render_target
143143 );
144144
145+void va_TraceQuerySurfaceAttributes(
146+ VADisplay dpy,
147+ VAConfigID config,
148+ VASurfaceAttrib *attrib_list,
149+ unsigned int *num_attribs
150+);
151+
145152 void va_TraceQuerySurfaceStatus(
146153 VADisplay dpy,
147154 VASurfaceID render_target,