hardware/intel/intel-driver
Revision | 282d501e9d3092039415031442b22112c4b303d4 (tree) |
---|---|
Time | 2015-09-06 16:13:58 |
Author | Zhao Yakui <yakui.zhao@inte...> |
Commiter | Xiang, Haihao |
Call the wrapped backend driver for the given decoding
The wrapped vaBeginPicture/vaRenderPicture/vaEndPicture are called.
Currently the wrapper is for the VP9 decoding.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Sean V Kelley <seanvk@posteo.de>
(cherry picked from commit 12a09a2efe213af350f29f342da6842d66dab63e)
@@ -2626,6 +2626,20 @@ i965_BeginPicture(VADriverContextP ctx, | ||
2626 | 2626 | |
2627 | 2627 | obj_context->codec_state.decode.num_slice_params = 0; |
2628 | 2628 | obj_context->codec_state.decode.num_slice_datas = 0; |
2629 | + | |
2630 | + if ((obj_context->wrapper_context != VA_INVALID_ID) && | |
2631 | + i965->wrapper_pdrvctx) { | |
2632 | + if (obj_surface->wrapper_surface == VA_INVALID_ID) | |
2633 | + vaStatus = i965_surface_wrapper(ctx, render_target); | |
2634 | + | |
2635 | + if (vaStatus != VA_STATUS_SUCCESS) | |
2636 | + return vaStatus; | |
2637 | + | |
2638 | + CALL_VTABLE(i965->wrapper_pdrvctx, vaStatus, | |
2639 | + vaBeginPicture(i965->wrapper_pdrvctx, | |
2640 | + obj_context->wrapper_context, | |
2641 | + obj_surface->wrapper_surface)); | |
2642 | + } | |
2629 | 2643 | } |
2630 | 2644 | |
2631 | 2645 | return vaStatus; |
@@ -2676,6 +2690,117 @@ DEF_RENDER_DECODE_SINGLE_BUFFER_FUNC(probability_data, probability_data) | ||
2676 | 2690 | DEF_RENDER_DECODE_MULTI_BUFFER_FUNC(slice_parameter, slice_params) |
2677 | 2691 | DEF_RENDER_DECODE_MULTI_BUFFER_FUNC(slice_data, slice_datas) |
2678 | 2692 | |
2693 | + | |
2694 | +static VAStatus | |
2695 | +i965_decoder_vp9_wrapper_picture(VADriverContextP ctx, | |
2696 | + VABufferID *buffers, | |
2697 | + int num_buffers) | |
2698 | +{ | |
2699 | + struct i965_driver_data *i965 = i965_driver_data(ctx); | |
2700 | + VAStatus vaStatus = VA_STATUS_SUCCESS; | |
2701 | + int i; | |
2702 | + VADecPictureParameterBufferVP9 *pVp9PicParams; | |
2703 | + VADriverContextP pdrvctx; | |
2704 | + struct object_buffer *obj_buffer; | |
2705 | + | |
2706 | + pdrvctx = i965->wrapper_pdrvctx; | |
2707 | + /* do the conversion of VADecPictureParameterBufferVP9 */ | |
2708 | + for (i = 0; i < num_buffers; i++) { | |
2709 | + obj_buffer = BUFFER(buffers[i]); | |
2710 | + | |
2711 | + if (!obj_buffer) | |
2712 | + continue; | |
2713 | + | |
2714 | + if (obj_buffer->wrapper_buffer == VA_INVALID_ID) | |
2715 | + continue; | |
2716 | + | |
2717 | + if (obj_buffer->type == VAPictureParameterBufferType) { | |
2718 | + int j; | |
2719 | + VASurfaceID surface_id; | |
2720 | + struct object_surface *obj_surface; | |
2721 | + | |
2722 | + pdrvctx = i965->wrapper_pdrvctx; | |
2723 | + | |
2724 | + CALL_VTABLE(pdrvctx, vaStatus, | |
2725 | + vaMapBuffer(pdrvctx, obj_buffer->wrapper_buffer, | |
2726 | + (void **)(&pVp9PicParams))); | |
2727 | + | |
2728 | + if (vaStatus != VA_STATUS_SUCCESS) | |
2729 | + return vaStatus; | |
2730 | + | |
2731 | + for (j = 0; j < 8; j++) { | |
2732 | + surface_id = pVp9PicParams->reference_frames[j]; | |
2733 | + obj_surface = SURFACE(surface_id); | |
2734 | + | |
2735 | + if (!obj_surface) | |
2736 | + continue; | |
2737 | + | |
2738 | + if (obj_surface->wrapper_surface == VA_INVALID_ID) { | |
2739 | + vaStatus = i965_surface_wrapper(ctx, surface_id); | |
2740 | + if (vaStatus != VA_STATUS_SUCCESS) { | |
2741 | + pdrvctx->vtable->vaUnmapBuffer(pdrvctx, | |
2742 | + obj_buffer->wrapper_buffer); | |
2743 | + goto fail_out; | |
2744 | + } | |
2745 | + } | |
2746 | + | |
2747 | + pVp9PicParams->reference_frames[j] = obj_surface->wrapper_surface; | |
2748 | + } | |
2749 | + CALL_VTABLE(pdrvctx, vaStatus, | |
2750 | + vaUnmapBuffer(pdrvctx, obj_buffer->wrapper_buffer)); | |
2751 | + break; | |
2752 | + } | |
2753 | + } | |
2754 | + | |
2755 | + return VA_STATUS_SUCCESS; | |
2756 | + | |
2757 | +fail_out: | |
2758 | + return vaStatus; | |
2759 | +} | |
2760 | + | |
2761 | +static VAStatus | |
2762 | +i965_decoder_wrapper_picture(VADriverContextP ctx, | |
2763 | + VAContextID context, | |
2764 | + VABufferID *buffers, | |
2765 | + int num_buffers) | |
2766 | +{ | |
2767 | + struct i965_driver_data *i965 = i965_driver_data(ctx); | |
2768 | + struct object_context *obj_context = CONTEXT(context); | |
2769 | + VAStatus vaStatus = VA_STATUS_SUCCESS; | |
2770 | + int i; | |
2771 | + VADriverContextP pdrvctx; | |
2772 | + struct object_buffer *obj_buffer; | |
2773 | + | |
2774 | + /* When it is not wrapped context, continue the normal flowchart */ | |
2775 | + if (obj_context->wrapper_context == VA_INVALID_ID) | |
2776 | + return vaStatus; | |
2777 | + | |
2778 | + if (obj_context->obj_config && | |
2779 | + (obj_context->obj_config->profile == VAProfileVP9Profile0)) { | |
2780 | + vaStatus = i965_decoder_vp9_wrapper_picture(ctx, buffers, num_buffers); | |
2781 | + } else | |
2782 | + return VA_STATUS_ERROR_INVALID_PARAMETER; | |
2783 | + | |
2784 | + pdrvctx = i965->wrapper_pdrvctx; | |
2785 | + | |
2786 | + for (i = 0; i < num_buffers && vaStatus == VA_STATUS_SUCCESS; i++) { | |
2787 | + obj_buffer = BUFFER(buffers[i]); | |
2788 | + | |
2789 | + if (!obj_buffer) | |
2790 | + continue; | |
2791 | + | |
2792 | + if (obj_buffer->wrapper_buffer == VA_INVALID_ID) { | |
2793 | + vaStatus = VA_STATUS_ERROR_INVALID_BUFFER; | |
2794 | + break; | |
2795 | + } | |
2796 | + | |
2797 | + CALL_VTABLE(pdrvctx, vaStatus, | |
2798 | + vaRenderPicture(pdrvctx, obj_context->wrapper_context, | |
2799 | + &(obj_buffer->wrapper_buffer), 1)); | |
2800 | + } | |
2801 | + return vaStatus; | |
2802 | +} | |
2803 | + | |
2679 | 2804 | static VAStatus |
2680 | 2805 | i965_decoder_render_picture(VADriverContextP ctx, |
2681 | 2806 | VAContextID context, |
@@ -2730,6 +2855,10 @@ i965_decoder_render_picture(VADriverContextP ctx, | ||
2730 | 2855 | } |
2731 | 2856 | } |
2732 | 2857 | |
2858 | + if ((vaStatus == VA_STATUS_SUCCESS) && | |
2859 | + (obj_context->wrapper_context != VA_INVALID_ID)) | |
2860 | + vaStatus = i965_decoder_wrapper_picture(ctx, context, buffers, num_buffers); | |
2861 | + | |
2733 | 2862 | return vaStatus; |
2734 | 2863 | } |
2735 | 2864 |
@@ -3153,6 +3282,18 @@ i965_EndPicture(VADriverContextP ctx, VAContextID context) | ||
3153 | 3282 | obj_context->codec_state.decode.num_slice_datas) { |
3154 | 3283 | return VA_STATUS_ERROR_INVALID_PARAMETER; |
3155 | 3284 | } |
3285 | + | |
3286 | + if (obj_context->wrapper_context != VA_INVALID_ID) { | |
3287 | + /* call the vaEndPicture of wrapped driver */ | |
3288 | + VADriverContextP pdrvctx; | |
3289 | + VAStatus va_status; | |
3290 | + | |
3291 | + pdrvctx = i965->wrapper_pdrvctx; | |
3292 | + CALL_VTABLE(pdrvctx, va_status, | |
3293 | + vaEndPicture(pdrvctx, obj_context->wrapper_context)); | |
3294 | + | |
3295 | + return va_status; | |
3296 | + } | |
3156 | 3297 | } |
3157 | 3298 | |
3158 | 3299 | ASSERT_RET(obj_context->hw_context->run, VA_STATUS_ERROR_OPERATION_FAILED); |