hardware/intel/libva
修订版 | 94ca3377019b57f6558641de45750adaa7a8c34a (tree) |
---|---|
时间 | 2014-03-17 10:27:29 |
作者 | Austin Yuan <shengquan.yuan@inte...> |
Commiter | Xiang, Haihao |
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>
@@ -827,11 +827,14 @@ vaQuerySurfaceAttributes( | ||
827 | 827 | return VA_STATUS_ERROR_INVALID_DISPLAY; |
828 | 828 | |
829 | 829 | 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); | |
832 | 837 | |
833 | - vaStatus = ctx->vtable->vaQuerySurfaceAttributes(ctx, config, | |
834 | - attrib_list, num_attribs); | |
835 | 838 | return vaStatus; |
836 | 839 | } |
837 | 840 |
@@ -856,16 +859,14 @@ vaCreateSurfaces( | ||
856 | 859 | return VA_STATUS_ERROR_INVALID_DISPLAY; |
857 | 860 | |
858 | 861 | if (ctx->vtable->vaCreateSurfaces2) |
859 | - return ctx->vtable->vaCreateSurfaces2(ctx, format, width, height, | |
862 | + vaStatus = ctx->vtable->vaCreateSurfaces2(ctx, format, width, height, | |
860 | 863 | surfaces, num_surfaces, |
861 | 864 | 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); | |
869 | 870 | VA_TRACE_LOG(va_TraceCreateSurfaces, |
870 | 871 | dpy, width, height, format, num_surfaces, surfaces, |
871 | 872 | attrib_list, num_attribs); |
@@ -881,10 +882,17 @@ VAStatus vaDestroySurfaces ( | ||
881 | 882 | ) |
882 | 883 | { |
883 | 884 | VADriverContextP ctx; |
885 | + VAStatus vaStatus; | |
886 | + | |
884 | 887 | CHECK_DISPLAY(dpy); |
885 | 888 | ctx = CTX(dpy); |
886 | 889 | |
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; | |
888 | 896 | } |
889 | 897 | |
890 | 898 | VAStatus vaCreateContext ( |
@@ -475,9 +475,11 @@ void va_TraceCreateConfig( | ||
475 | 475 | va_TraceMsg(idx, "\tprofile = %d\n", profile); |
476 | 476 | va_TraceMsg(idx, "\tentrypoint = %d\n", entrypoint); |
477 | 477 | 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 | + } | |
481 | 483 | } |
482 | 484 | va_TraceMsg(idx, NULL); |
483 | 485 |
@@ -519,6 +521,41 @@ void va_TraceCreateConfig( | ||
519 | 521 | } |
520 | 522 | } |
521 | 523 | |
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 | +} | |
522 | 559 | |
523 | 560 | void va_TraceCreateSurfaces( |
524 | 561 | VADisplay dpy, |
@@ -541,9 +578,33 @@ void va_TraceCreateSurfaces( | ||
541 | 578 | va_TraceMsg(idx, "\tformat = %d\n", format); |
542 | 579 | va_TraceMsg(idx, "\tnum_surfaces = %d\n", num_surfaces); |
543 | 580 | |
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); | |
546 | 602 | |
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 | + | |
547 | 608 | va_TraceMsg(idx, NULL); |
548 | 609 | } |
549 | 610 |
@@ -563,18 +624,22 @@ void va_TraceCreateContext( | ||
563 | 624 | DPY2INDEX(dpy); |
564 | 625 | |
565 | 626 | TRACE_FUNCNAME(idx); |
566 | - | |
627 | + | |
628 | + va_TraceMsg(idx, "\tconfig = 0x%08x\n", config_id); | |
567 | 629 | va_TraceMsg(idx, "\twidth = %d\n", picture_width); |
568 | 630 | va_TraceMsg(idx, "\theight = %d\n", picture_height); |
569 | 631 | va_TraceMsg(idx, "\tflag = 0x%08x\n", flag); |
570 | 632 | 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 | + | |
578 | 643 | trace_context[idx].trace_frame_no = 0; |
579 | 644 | trace_context[idx].trace_slice_no = 0; |
580 | 645 |
@@ -637,7 +702,8 @@ void va_TraceCreateBuffer ( | ||
637 | 702 | |
638 | 703 | TRACE_FUNCNAME(idx); |
639 | 704 | 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); | |
641 | 707 | va_TraceMsg(idx, "\tsize=%d\n", size); |
642 | 708 | va_TraceMsg(idx, "\tnum_elements=%d\n", num_elements); |
643 | 709 |
@@ -698,6 +764,9 @@ void va_TraceMapBuffer ( | ||
698 | 764 | TRACE_FUNCNAME(idx); |
699 | 765 | va_TraceMsg(idx, "\tbuf_id=0x%x\n", buf_id); |
700 | 766 | va_TraceMsg(idx, "\tbuf_type=%s\n", buffer_type_to_string(type)); |
767 | + if ((pbuf == NULL) || (*pbuf == NULL)) | |
768 | + return; | |
769 | + | |
701 | 770 | buf_list = (VACodedBufferSegment *)(*pbuf); |
702 | 771 | while (buf_list != NULL) { |
703 | 772 | va_TraceMsg(idx, "\tCodedbuf[%d] =\n", i++); |
@@ -2011,6 +2080,8 @@ static void va_TraceVAEncPictureParameterBufferJPEG( | ||
2011 | 2080 | void *data) |
2012 | 2081 | { |
2013 | 2082 | VAEncPictureParameterBufferJPEG *p = (VAEncPictureParameterBufferJPEG *)data; |
2083 | + int i; | |
2084 | + | |
2014 | 2085 | DPY2INDEX(dpy); |
2015 | 2086 | |
2016 | 2087 | va_TraceMsg(idx, "VAEncPictureParameterBufferJPEG\n"); |
@@ -2064,6 +2135,7 @@ static void va_TraceVAEncQMatrixBufferJPEG( | ||
2064 | 2135 | return; |
2065 | 2136 | } |
2066 | 2137 | |
2138 | + | |
2067 | 2139 | static void va_TraceH263Buf( |
2068 | 2140 | VADisplay dpy, |
2069 | 2141 | VAContextID context, |
@@ -2148,9 +2220,11 @@ static void va_TraceJPEGBuf( | ||
2148 | 2220 | case VAProtectedSliceDataBufferType: |
2149 | 2221 | case VAEncCodedBufferType: |
2150 | 2222 | case VAEncSequenceParameterBufferType: |
2151 | - case VAEncSliceParameterBufferType: | |
2152 | 2223 | va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); |
2153 | 2224 | break; |
2225 | + case VAEncSliceParameterBufferType: | |
2226 | + va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf); | |
2227 | + break; | |
2154 | 2228 | case VAPictureParameterBufferType: |
2155 | 2229 | va_TraceVAPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf); |
2156 | 2230 | break; |
@@ -2386,8 +2460,11 @@ void va_TraceRenderPicture( | ||
2386 | 2460 | |
2387 | 2461 | va_TraceMsg(idx, "\tcontext = 0x%08x\n", context); |
2388 | 2462 | va_TraceMsg(idx, "\tnum_buffers = %d\n", num_buffers); |
2463 | + if (buffers == NULL) | |
2464 | + return; | |
2465 | + | |
2389 | 2466 | for (i = 0; i < num_buffers; i++) { |
2390 | - unsigned char *pbuf; | |
2467 | + unsigned char *pbuf = NULL; | |
2391 | 2468 | unsigned int j; |
2392 | 2469 | |
2393 | 2470 | /* get buffer type information */ |
@@ -2400,7 +2477,9 @@ void va_TraceRenderPicture( | ||
2400 | 2477 | va_TraceMsg(idx, "\t num_elements = %d\n", num_elements); |
2401 | 2478 | |
2402 | 2479 | vaMapBuffer(dpy, buffers[i], (void **)&pbuf); |
2403 | - | |
2480 | + if (pbuf == NULL) | |
2481 | + continue; | |
2482 | + | |
2404 | 2483 | switch (trace_context[idx].trace_profile) { |
2405 | 2484 | case VAProfileMPEG2Simple: |
2406 | 2485 | case VAProfileMPEG2Main: |
@@ -2513,6 +2592,23 @@ void va_TraceSyncSurface( | ||
2513 | 2592 | va_TraceMsg(idx, NULL); |
2514 | 2593 | } |
2515 | 2594 | |
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 | + | |
2516 | 2612 | |
2517 | 2613 | void va_TraceQuerySurfaceStatus( |
2518 | 2614 | VADisplay dpy, |
@@ -2525,7 +2621,8 @@ void va_TraceQuerySurfaceStatus( | ||
2525 | 2621 | TRACE_FUNCNAME(idx); |
2526 | 2622 | |
2527 | 2623 | 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); | |
2529 | 2626 | va_TraceMsg(idx, NULL); |
2530 | 2627 | } |
2531 | 2628 |
@@ -2542,9 +2639,9 @@ void va_TraceQuerySurfaceError( | ||
2542 | 2639 | TRACE_FUNCNAME(idx); |
2543 | 2640 | va_TraceMsg(idx, "\tsurface = 0x%08x\n", surface); |
2544 | 2641 | 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)) { | |
2546 | 2643 | VASurfaceDecodeMBErrors *p = *error_info; |
2547 | - while (p->status != -1) { | |
2644 | + while (p && (p->status != -1)) { | |
2548 | 2645 | va_TraceMsg(idx, "\t\tstatus = %d\n", p->status); |
2549 | 2646 | va_TraceMsg(idx, "\t\tstart_mb = %d\n", p->start_mb); |
2550 | 2647 | va_TraceMsg(idx, "\t\tend_mb = %d\n", p->end_mb); |
@@ -2578,7 +2675,9 @@ void va_TraceQueryDisplayAttributes ( | ||
2578 | 2675 | DPY2INDEX(dpy); |
2579 | 2676 | |
2580 | 2677 | va_TraceMsg(idx, "\tnum_attributes = %d\n", *num_attributes); |
2581 | - | |
2678 | + if (attr_list == NULL || num_attributes == NULL) | |
2679 | + return; | |
2680 | + | |
2582 | 2681 | for (i=0; i<*num_attributes; i++) { |
2583 | 2682 | va_TraceMsg(idx, "\tattr_list[%d] =\n"); |
2584 | 2683 | va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type); |
@@ -2602,6 +2701,9 @@ static void va_TraceDisplayAttributes ( | ||
2602 | 2701 | DPY2INDEX(dpy); |
2603 | 2702 | |
2604 | 2703 | va_TraceMsg(idx, "\tnum_attributes = %d\n", num_attributes); |
2704 | + if (attr_list == NULL) | |
2705 | + return; | |
2706 | + | |
2605 | 2707 | for (i=0; i<num_attributes; i++) { |
2606 | 2708 | va_TraceMsg(idx, "\tattr_list[%d] =\n"); |
2607 | 2709 | va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type); |
@@ -142,6 +142,13 @@ void va_TraceSyncSurface( | ||
142 | 142 | VASurfaceID render_target |
143 | 143 | ); |
144 | 144 | |
145 | +void va_TraceQuerySurfaceAttributes( | |
146 | + VADisplay dpy, | |
147 | + VAConfigID config, | |
148 | + VASurfaceAttrib *attrib_list, | |
149 | + unsigned int *num_attribs | |
150 | +); | |
151 | + | |
145 | 152 | void va_TraceQuerySurfaceStatus( |
146 | 153 | VADisplay dpy, |
147 | 154 | VASurfaceID render_target, |