• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

hardware/intel/intel-driver


Commit MetaInfo

Revision282d501e9d3092039415031442b22112c4b303d4 (tree)
Time2015-09-06 16:13:58
AuthorZhao Yakui <yakui.zhao@inte...>
CommiterXiang, Haihao

Log Message

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)

Change Summary

Incremental Difference

--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -2626,6 +2626,20 @@ i965_BeginPicture(VADriverContextP ctx,
26262626
26272627 obj_context->codec_state.decode.num_slice_params = 0;
26282628 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+ }
26292643 }
26302644
26312645 return vaStatus;
@@ -2676,6 +2690,117 @@ DEF_RENDER_DECODE_SINGLE_BUFFER_FUNC(probability_data, probability_data)
26762690 DEF_RENDER_DECODE_MULTI_BUFFER_FUNC(slice_parameter, slice_params)
26772691 DEF_RENDER_DECODE_MULTI_BUFFER_FUNC(slice_data, slice_datas)
26782692
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+
26792804 static VAStatus
26802805 i965_decoder_render_picture(VADriverContextP ctx,
26812806 VAContextID context,
@@ -2730,6 +2855,10 @@ i965_decoder_render_picture(VADriverContextP ctx,
27302855 }
27312856 }
27322857
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+
27332862 return vaStatus;
27342863 }
27352864
@@ -3153,6 +3282,18 @@ i965_EndPicture(VADriverContextP ctx, VAContextID context)
31533282 obj_context->codec_state.decode.num_slice_datas) {
31543283 return VA_STATUS_ERROR_INVALID_PARAMETER;
31553284 }
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+ }
31563297 }
31573298
31583299 ASSERT_RET(obj_context->hw_context->run, VA_STATUS_ERROR_OPERATION_FAILED);