decoder: h264: expose the set of supported MVC profiles.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Tue, 3 Jun 2014 15:30:11 +0000 (17:30 +0200)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 16 Jun 2014 03:53:35 +0000 (11:53 +0800)
H.264 MVC decoding support is defined as follows:
- Stereo High profile on Sandybridge and newer ;
- Multiview High profile on Haswell and newer.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 1f244834dedb7b46863b315a898d8649d01c5f58)

Conflicts:
src/i965_device_info.c
src/i965_drv_video.c
src/va_backend_compat.h

src/gen6_mfd.c
src/gen75_mfd.c
src/gen7_mfd.c
src/gen8_mfd.c
src/i965_decoder_utils.c
src/i965_device_info.c
src/i965_drv_video.c
src/i965_drv_video.h
src/va_backend_compat.h

index 113561c..e22e57a 100755 (executable)
@@ -1858,6 +1858,7 @@ gen6_mfd_decode_picture(VADriverContextP ctx,
     case VAProfileH264ConstrainedBaseline:
     case VAProfileH264Main:
     case VAProfileH264High:
+    case VAProfileH264StereoHigh:
         gen6_mfd_avc_decode_picture(ctx, decode_state, gen6_mfd_context);
         break;
 
index bab5df4..aaee807 100644 (file)
@@ -3141,6 +3141,8 @@ gen75_mfd_decode_picture(VADriverContextP ctx,
     case VAProfileH264ConstrainedBaseline:
     case VAProfileH264Main:
     case VAProfileH264High:
+    case VAProfileH264StereoHigh:
+    case VAProfileH264MultiviewHigh:
         gen75_mfd_avc_decode_picture(ctx, decode_state, gen7_mfd_context);
         break;
 
@@ -3235,6 +3237,8 @@ gen75_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config
     case VAProfileH264ConstrainedBaseline:
     case VAProfileH264Main:
     case VAProfileH264High:
+    case VAProfileH264StereoHigh:
+    case VAProfileH264MultiviewHigh:
         gen75_mfd_avc_context_init(ctx, gen7_mfd_context);
         break;
     default:
index e7f188c..db35abf 100755 (executable)
@@ -2612,6 +2612,7 @@ gen7_mfd_decode_picture(VADriverContextP ctx,
     case VAProfileH264ConstrainedBaseline:
     case VAProfileH264Main:
     case VAProfileH264High:
+    case VAProfileH264StereoHigh:
         gen7_mfd_avc_decode_picture(ctx, decode_state, gen7_mfd_context);
         break;
 
@@ -2706,6 +2707,7 @@ gen7_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config)
     case VAProfileH264ConstrainedBaseline:
     case VAProfileH264Main:
     case VAProfileH264High:
+    case VAProfileH264StereoHigh:
         gen7_mfd_avc_context_init(ctx, gen7_mfd_context);
         break;
     default:
index 0b39dac..4e24f55 100644 (file)
@@ -3062,6 +3062,8 @@ gen8_mfd_decode_picture(VADriverContextP ctx,
     case VAProfileH264ConstrainedBaseline:
     case VAProfileH264Main:
     case VAProfileH264High:
+    case VAProfileH264StereoHigh:
+    case VAProfileH264MultiviewHigh:
         gen8_mfd_avc_decode_picture(ctx, decode_state, gen7_mfd_context);
         break;
 
@@ -3162,6 +3164,8 @@ gen8_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config)
     case VAProfileH264ConstrainedBaseline:
     case VAProfileH264Main:
     case VAProfileH264High:
+    case VAProfileH264StereoHigh:
+    case VAProfileH264MultiviewHigh:
         gen8_mfd_avc_context_init(ctx, gen7_mfd_context);
         break;
     default:
index 9af57c2..7e3d33a 100644 (file)
@@ -919,6 +919,8 @@ intel_decoder_sanity_check_input(VADriverContextP ctx,
     case VAProfileH264ConstrainedBaseline:
     case VAProfileH264Main:
     case VAProfileH264High:
+    case VAProfileH264StereoHigh:
+    case VAProfileH264MultiviewHigh:
         vaStatus = intel_decoder_check_avc_parameter(ctx, profile, decode_state);
         break;
 
index c0b26e8..9573b7d 100644 (file)
     (VA_RT_FORMAT_YUV400 | VA_RT_FORMAT_YUV411 | VA_RT_FORMAT_YUV422 | \
      VA_RT_FORMAT_YUV444)
 
+/* Defines VA profile as a 32-bit unsigned integer mask */
+#define VA_PROFILE_MASK(PROFILE) \
+    (1U << VAProfile##PROFILE)
+
 extern struct hw_context *i965_proc_context_init(VADriverContextP, struct object_config *);
 extern struct hw_context *g4x_dec_hw_context_init(VADriverContextP, struct object_config *);
 extern bool genx_render_init(VADriverContextP);
@@ -94,6 +98,7 @@ static const struct hw_codec_info snb_hw_codec_info = {
     .min_linear_wpitch = 16,
     .min_linear_hpitch = 16,
 
+    .h264_mvc_dec_profiles = VA_PROFILE_MASK(H264StereoHigh),
     .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
 
     .has_mpeg2_decoding = 1,
@@ -127,6 +132,7 @@ static const struct hw_codec_info ivb_hw_codec_info = {
     .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
+    .h264_mvc_dec_profiles = VA_PROFILE_MASK(H264StereoHigh),
     .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
     .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
 
@@ -164,6 +170,8 @@ static const struct hw_codec_info hsw_hw_codec_info = {
     .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
+    .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
+                              VA_PROFILE_MASK(H264MultiviewHigh)),
     .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
     .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
 
@@ -179,7 +187,6 @@ static const struct hw_codec_info hsw_hw_codec_info = {
     .has_tiled_surface = 1,
     .has_di_motion_adptive = 1,
     .has_di_motion_compensated = 1,
-    .has_h264_mvc_decoding = 1,
     .has_h264_mvc_encoding = 1,
 
     .num_filters = 5,
@@ -207,6 +214,8 @@ static const struct hw_codec_info bdw_hw_codec_info = {
     .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
+    .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
+                              VA_PROFILE_MASK(H264MultiviewHigh)),
     .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
     .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
 
@@ -223,7 +232,6 @@ static const struct hw_codec_info bdw_hw_codec_info = {
     .has_di_motion_adptive = 1,
     .has_di_motion_compensated = 1,
     .has_vp8_decoding = 1,
-    .has_h264_mvc_decoding = 1,
     .has_h264_mvc_encoding = 1,
 
     .num_filters = 5,
index f23b449..403acde 100755 (executable)
 #define HAS_VP8_ENCODING(ctx)   ((ctx)->codec_info->has_vp8_encoding && \
                                  (ctx)->intel.has_bsd)
 
-#define HAS_H264_MVC_DECODING(ctx)  ((ctx)->codec_info->has_h264_mvc_decoding && \
-                                     (ctx)->intel.has_bsd)
+#define HAS_H264_MVC_DECODING(ctx) \
+    (HAS_H264_DECODING(ctx) && (ctx)->codec_info->h264_mvc_dec_profiles)
+
+#define HAS_H264_MVC_DECODING_PROFILE(ctx, profile)                     \
+    (HAS_H264_MVC_DECODING(ctx) &&                                      \
+     ((ctx)->codec_info->h264_mvc_dec_profiles & (1U << profile)))
 
 #define HAS_H264_MVC_ENCODING(ctx)  ((ctx)->codec_info->has_h264_mvc_encoding && \
                                      (ctx)->intel.has_bsd)
@@ -390,6 +394,10 @@ i965_QueryConfigProfiles(VADriverContextP ctx,
         profile_list[i++] = VAProfileH264Main;
         profile_list[i++] = VAProfileH264High;
     }
+    if (HAS_H264_MVC_DECODING_PROFILE(i965, VAProfileH264MultiviewHigh))
+        profile_list[i++] = VAProfileH264MultiviewHigh;
+    if (HAS_H264_MVC_DECODING_PROFILE(i965, VAProfileH264StereoHigh))
+        profile_list[i++] = VAProfileH264StereoHigh;
 
     if (HAS_VC1_DECODING(i965)) {
         profile_list[i++] = VAProfileVC1Simple;
@@ -410,8 +418,7 @@ i965_QueryConfigProfiles(VADriverContextP ctx,
         profile_list[i++] = VAProfileVP8Version0_3;
     }
 
-    if (HAS_H264_MVC_DECODING(i965) ||
-        HAS_H264_MVC_ENCODING(i965)) {
+    if (HAS_H264_MVC_ENCODING(i965)) {
         profile_list[i++] = VAProfileH264MultiviewHigh;
         profile_list[i++] = VAProfileH264StereoHigh;
     }
@@ -455,7 +462,7 @@ i965_QueryConfigEntrypoints(VADriverContextP ctx,
         break;
    case VAProfileH264MultiviewHigh:
    case VAProfileH264StereoHigh:
-       if (HAS_H264_MVC_DECODING(i965))
+       if (HAS_H264_MVC_DECODING_PROFILE(i965, profile))
             entrypoint_list[n++] = VAEntrypointVLD;
 
        if (HAS_H264_MVC_ENCODING(i965))
@@ -563,8 +570,9 @@ i965_validate_config(VADriverContextP ctx, VAProfile profile,
 
     case VAProfileH264MultiviewHigh:
     case VAProfileH264StereoHigh:
-        if ((HAS_H264_MVC_DECODING(i965) && VAEntrypointVLD == entrypoint) ||
-            (HAS_H264_MVC_ENCODING(i965) && VAEntrypointEncSlice == entrypoint)) {
+        if ((HAS_H264_MVC_DECODING_PROFILE(i965, profile) &&
+             entrypoint == VAEntrypointVLD) ||
+            (HAS_H264_MVC_ENCODING(i965) && entrypoint == VAEntrypointEncSlice)) {
             va_status = VA_STATUS_SUCCESS;
         } else {
             va_status = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
@@ -1695,6 +1703,12 @@ i965_CreateContext(VADriverContextP ctx,
             return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
         render_state->interleaved_uv = 1;
         break;
+    case VAProfileH264MultiviewHigh:
+    case VAProfileH264StereoHigh:
+        if (!HAS_H264_MVC_DECODING(i965))
+            return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+        render_state->interleaved_uv = 1;
+        break;
     default:
         render_state->interleaved_uv = !!(IS_GEN6(i965->intel.device_info) || IS_GEN7(i965->intel.device_info) || IS_GEN8(i965->intel.device_info));
         break;
@@ -2105,9 +2119,17 @@ i965_BeginPicture(VADriverContextP ctx,
     case VAProfileH264ConstrainedBaseline:
     case VAProfileH264Main:
     case VAProfileH264High:
+        vaStatus = VA_STATUS_SUCCESS;
+        break;
+
     case VAProfileH264MultiviewHigh:
     case VAProfileH264StereoHigh:
-         vaStatus = VA_STATUS_SUCCESS;
+        if (HAS_H264_MVC_DECODING_PROFILE(i965, obj_config->profile) ||
+            HAS_H264_MVC_ENCODING(i965)) {
+            vaStatus = VA_STATUS_SUCCESS;
+        } else {
+            ASSERT_RET(0, VA_STATUS_ERROR_UNSUPPORTED_PROFILE);
+        }
         break;
 
     case VAProfileVC1Simple:
index 75c66e9..e25b9c8 100644 (file)
@@ -302,6 +302,7 @@ struct hw_codec_info
     int min_linear_wpitch;
     int min_linear_hpitch;
 
+    unsigned int h264_mvc_dec_profiles;
     unsigned int h264_dec_chroma_formats;
     unsigned int jpeg_dec_chroma_formats;
 
@@ -321,7 +322,6 @@ struct hw_codec_info
     unsigned int has_di_motion_compensated:1;
     unsigned int has_vp8_decoding:1;
     unsigned int has_vp8_encoding:1;
-    unsigned int has_h264_mvc_decoding:1;
     unsigned int has_h264_mvc_encoding:1;
 
     unsigned int num_filters;
index 5fcb198..8767153 100644 (file)
 # define VA_DRM_AUTH_CUSTOM     VA_DUMMY
 #endif
 
-#if !VA_CHECK_VERSION(0,35,1)
-
-#define VAProcFilterSkinToneEnhancement         5
-
-#endif
-
 #if !VA_CHECK_VERSION(0,35,2)
 # define VAProfileH264MultiviewHigh     15
 # define VAProfileH264StereoHigh        16