• 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

Revisión0c1319692f8be32e90afd80861c40a449df160a2 (tree)
Tiempo2016-05-09 17:52:22
AutorXiang, Haihao <haihao.xiang@inte...>
CommiterXiang, Haihao

Log Message

Add support for VAEntrypointEncSliceLP

VAEntrypointEncSliceLP is used to expose low power variant of slice level
encoding entrypoint and we will implement low power encoding on SKL

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-By: Sean V Kelley <sean.v.kelley@intel.com>

Cambiar Resumen

Diferencia incremental

--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -67,6 +67,9 @@
6767 #define HAS_H264_ENCODING(ctx) ((ctx)->codec_info->has_h264_encoding && \
6868 (ctx)->intel.has_bsd)
6969
70+#define HAS_LP_H264_ENCODING(ctx) ((ctx)->codec_info->has_lp_h264_encoding && \
71+ (ctx)->intel.has_bsd)
72+
7073 #define HAS_VC1_DECODING(ctx) ((ctx)->codec_info->has_vc1_decoding && \
7174 (ctx)->intel.has_bsd)
7275
@@ -559,7 +562,8 @@ i965_QueryConfigProfiles(VADriverContextP ctx,
559562 }
560563
561564 if (HAS_H264_DECODING(i965) ||
562- HAS_H264_ENCODING(i965)) {
565+ HAS_H264_ENCODING(i965) ||
566+ HAS_LP_H264_ENCODING(i965)) {
563567 profile_list[i++] = VAProfileH264ConstrainedBaseline;
564568 profile_list[i++] = VAProfileH264Main;
565569 profile_list[i++] = VAProfileH264High;
@@ -663,6 +667,9 @@ i965_QueryConfigEntrypoints(VADriverContextP ctx,
663667 if (HAS_H264_ENCODING(i965))
664668 entrypoint_list[n++] = VAEntrypointEncSlice;
665669
670+ if (HAS_LP_H264_ENCODING(i965))
671+ entrypoint_list[n++] = VAEntrypointEncSliceLP;
672+
666673 break;
667674 case VAProfileH264MultiviewHigh:
668675 case VAProfileH264StereoHigh:
@@ -770,7 +777,8 @@ i965_validate_config(VADriverContextP ctx, VAProfile profile,
770777 case VAProfileH264Main:
771778 case VAProfileH264High:
772779 if ((HAS_H264_DECODING(i965) && entrypoint == VAEntrypointVLD) ||
773- (HAS_H264_ENCODING(i965) && entrypoint == VAEntrypointEncSlice)) {
780+ (HAS_H264_ENCODING(i965) && entrypoint == VAEntrypointEncSlice) ||
781+ (HAS_LP_H264_ENCODING(i965) && entrypoint == VAEntrypointEncSliceLP)) {
774782 va_status = VA_STATUS_SUCCESS;
775783 } else {
776784 va_status = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
@@ -941,11 +949,24 @@ i965_GetConfigAttributes(VADriverContextP ctx,
941949 profile != VAProfileMPEG2Simple)
942950 attrib_list[i].value |= VA_RC_CBR;
943951 break;
944- }
952+ } else if (entrypoint == VAEntrypointEncSliceLP) {
953+ struct i965_driver_data * const i965 = i965_driver_data(ctx);
954+
955+ /* Support low power encoding for H.264 only by now */
956+ if (profile == VAProfileH264ConstrainedBaseline ||
957+ profile == VAProfileH264Main ||
958+ profile == VAProfileH264High)
959+ attrib_list[i].value = i965->codec_info->lp_h264_brc_mode;
960+ else
961+ attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
962+ } else
963+ attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
964+
945965 break;
946966
947967 case VAConfigAttribEncPackedHeaders:
948- if (entrypoint == VAEntrypointEncSlice) {
968+ if (entrypoint == VAEntrypointEncSlice ||
969+ entrypoint == VAEntrypointEncSliceLP) {
949970 attrib_list[i].value = VA_ENC_PACKED_HEADER_SEQUENCE | VA_ENC_PACKED_HEADER_PICTURE | VA_ENC_PACKED_HEADER_MISC;
950971 if (profile == VAProfileH264ConstrainedBaseline ||
951972 profile == VAProfileH264Main ||
@@ -965,14 +986,23 @@ i965_GetConfigAttributes(VADriverContextP ctx,
965986 break;
966987
967988 case VAConfigAttribEncMaxRefFrames:
968- if (entrypoint == VAEntrypointEncSlice) {
989+ if (entrypoint == VAEntrypointEncSlice)
969990 attrib_list[i].value = (1 << 16) | (1 << 0);
970- break;
991+ else if (entrypoint == VAEntrypointEncSliceLP) {
992+ /* Don't support B frame for low power mode */
993+ if (profile == VAProfileH264ConstrainedBaseline ||
994+ profile == VAProfileH264Main ||
995+ profile == VAProfileH264High)
996+ attrib_list[i].value = (1 << 0);
997+ else
998+ attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
971999 }
1000+
9721001 break;
9731002
9741003 case VAConfigAttribEncQualityRange:
975- if (entrypoint == VAEntrypointEncSlice) {
1004+ if (entrypoint == VAEntrypointEncSlice ||
1005+ entrypoint == VAEntrypointEncSliceLP) {
9761006 attrib_list[i].value = 1;
9771007 if (profile == VAProfileH264ConstrainedBaseline ||
9781008 profile == VAProfileH264Main ||
@@ -1000,6 +1030,17 @@ i965_GetConfigAttributes(VADriverContextP ctx,
10001030 attrib_list[i].value = VA_DEC_SLICE_MODE_NORMAL;
10011031 break;
10021032
1033+ case VAConfigAttribEncROI:
1034+ if ((entrypoint == VAEntrypointEncSliceLP) &&
1035+ (profile == VAProfileH264ConstrainedBaseline ||
1036+ profile == VAProfileH264Main ||
1037+ profile == VAProfileH264High))
1038+ attrib_list[i].value = 3;
1039+ else
1040+ attrib_list[i].value = 0;
1041+
1042+ break;
1043+
10031044 default:
10041045 /* Do nothing */
10051046 attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
@@ -2142,7 +2183,8 @@ i965_CreateContext(VADriverContextP ctx,
21422183 assert(i965->codec_info->proc_hw_context_init);
21432184 obj_context->hw_context = i965->codec_info->proc_hw_context_init(ctx, obj_config);
21442185 } else if ((VAEntrypointEncSlice == obj_config->entrypoint) ||
2145- (VAEntrypointEncPicture == obj_config->entrypoint)) { /*encode routine only*/
2186+ (VAEntrypointEncPicture == obj_config->entrypoint) ||
2187+ (VAEntrypointEncSliceLP == obj_config->entrypoint)) {
21462188 VAConfigAttrib *packed_attrib;
21472189 obj_context->codec_type = CODEC_ENC;
21482190 memset(&obj_context->codec_state.encode, 0, sizeof(obj_context->codec_state.encode));
@@ -3361,7 +3403,8 @@ i965_RenderPicture(VADriverContextP ctx,
33613403 if (VAEntrypointVideoProc == obj_config->entrypoint) {
33623404 vaStatus = i965_proc_render_picture(ctx, context, buffers, num_buffers);
33633405 } else if ((VAEntrypointEncSlice == obj_config->entrypoint ) ||
3364- (VAEntrypointEncPicture == obj_config->entrypoint)) {
3406+ (VAEntrypointEncPicture == obj_config->entrypoint) ||
3407+ (VAEntrypointEncSliceLP == obj_config->entrypoint)) {
33653408 vaStatus = i965_encoder_render_picture(ctx, context, buffers, num_buffers);
33663409 } else {
33673410 vaStatus = i965_decoder_render_picture(ctx, context, buffers, num_buffers);
@@ -3384,7 +3427,10 @@ i965_EndPicture(VADriverContextP ctx, VAContextID context)
33843427 if (obj_context->codec_type == CODEC_PROC) {
33853428 ASSERT_RET(VAEntrypointVideoProc == obj_config->entrypoint, VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT);
33863429 } else if (obj_context->codec_type == CODEC_ENC) {
3387- ASSERT_RET(((VAEntrypointEncSlice == obj_config->entrypoint) || (VAEntrypointEncPicture == obj_config->entrypoint)), VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT);
3430+ ASSERT_RET(((VAEntrypointEncSlice == obj_config->entrypoint) ||
3431+ (VAEntrypointEncPicture == obj_config->entrypoint) ||
3432+ (VAEntrypointEncSliceLP == obj_config->entrypoint)),
3433+ VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT);
33883434
33893435 if (obj_context->codec_state.encode.num_packed_header_params_ext !=
33903436 obj_context->codec_state.encode.num_packed_header_data_ext) {
@@ -5318,7 +5364,8 @@ i965_GetSurfaceAttributes(
53185364 IS_GEN8(i965->intel.device_info) ||
53195365 IS_GEN9(i965->intel.device_info)) {
53205366 if (obj_config->entrypoint == VAEntrypointEncSlice ||
5321- obj_config->entrypoint == VAEntrypointVideoProc) {
5367+ obj_config->entrypoint == VAEntrypointVideoProc ||
5368+ obj_config->entrypoint == VAEntrypointEncSliceLP) {
53225369 switch (attrib_list[i].value.value.i) {
53235370 case VA_FOURCC_NV12:
53245371 case VA_FOURCC_I420:
@@ -5668,7 +5715,8 @@ i965_QuerySurfaceAttributes(VADriverContextP ctx,
56685715 i++;
56695716 }
56705717 } else if (obj_config->entrypoint == VAEntrypointEncSlice || /* encode */
5671- obj_config->entrypoint == VAEntrypointVideoProc) { /* vpp */
5718+ obj_config->entrypoint == VAEntrypointVideoProc ||
5719+ obj_config->entrypoint == VAEntrypointEncSliceLP) {
56725720
56735721 if (obj_config->profile == VAProfileHEVCMain10) {
56745722 attribs[i].type = VASurfaceAttribPixelFormat;
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -73,6 +73,8 @@
7373 #define ENCODER_HIGH_QUALITY ENCODER_DEFAULT_QUALITY
7474 #define ENCODER_LOW_QUALITY 2
7575
76+#define ENCODER_LP_QUALITY_RANGE 8
77+
7678 struct i965_surface
7779 {
7880 struct object_base *base;
@@ -396,6 +398,9 @@ struct hw_codec_info
396398 unsigned int has_hevc10_decoding:1;
397399 unsigned int has_vp9_decoding:1;
398400 unsigned int has_vpp_p010:1;
401+ unsigned int has_lp_h264_encoding:1;
402+
403+ unsigned int lp_h264_brc_mode;
399404
400405 unsigned int num_filters;
401406 struct i965_filter filters[VAProcFilterCount];
--- a/src/i965_encoder.c
+++ b/src/i965_encoder.c
@@ -694,6 +694,7 @@ intel_enc_hw_context_init(VADriverContextP ctx,
694694 encoder_context->base.batch = intel_batchbuffer_new(intel, I915_EXEC_RENDER, 0);
695695 encoder_context->input_yuv_surface = VA_INVALID_SURFACE;
696696 encoder_context->is_tmp_id = 0;
697+ encoder_context->low_power_mode = 0;
697698 encoder_context->rate_control_mode = VA_RC_NONE;
698699 encoder_context->quality_level = ENCODER_DEFAULT_QUALITY;
699700 encoder_context->quality_range = 1;
@@ -708,7 +709,11 @@ intel_enc_hw_context_init(VADriverContextP ctx,
708709 case VAProfileH264Main:
709710 case VAProfileH264High:
710711 encoder_context->codec = CODEC_H264;
711- encoder_context->quality_range = ENCODER_QUALITY_RANGE;
712+
713+ if (obj_config->entrypoint == VAEntrypointEncSliceLP)
714+ encoder_context->quality_range = ENCODER_LP_QUALITY_RANGE;
715+ else
716+ encoder_context->quality_range = ENCODER_QUALITY_RANGE;
712717 break;
713718
714719 case VAProfileH264StereoHigh:
@@ -748,11 +753,16 @@ intel_enc_hw_context_init(VADriverContextP ctx,
748753 }
749754 }
750755
751- vme_context_init(ctx, encoder_context);
752- if(obj_config->profile != VAProfileJPEGBaseline) {
753- assert(encoder_context->vme_context);
754- assert(encoder_context->vme_context_destroy);
755- assert(encoder_context->vme_pipeline);
756+ if (vme_context_init) {
757+ vme_context_init(ctx, encoder_context);
758+
759+ if (obj_config->profile != VAProfileJPEGBaseline) {
760+ assert(encoder_context->vme_context);
761+ assert(encoder_context->vme_context_destroy);
762+ assert(encoder_context->vme_pipeline);
763+ }
764+ } else {
765+ encoder_context->low_power_mode = 1;
756766 }
757767
758768 mfc_context_init(ctx, encoder_context);
--- a/src/i965_encoder.h
+++ b/src/i965_encoder.h
@@ -41,12 +41,15 @@ struct intel_encoder_context
4141 struct hw_context base;
4242 int codec;
4343 VASurfaceID input_yuv_surface;
44- int is_tmp_id;
4544 unsigned int rate_control_mode;
4645 unsigned int quality_level;
4746 unsigned int quality_range;
4847 void *vme_context;
4948 void *mfc_context;
49+
50+ unsigned int is_tmp_id:1;
51+ unsigned int low_power_mode:1;
52+
5053 void (*vme_context_destroy)(void *vme_context);
5154 VAStatus (*vme_pipeline)(VADriverContextP ctx,
5255 VAProfile profile,