[Libva] [PATCH v4 intel-driver 07/11] decoder: h264: expose the set of supported MVC profiles.

Gwenole Beauchesne gb.devel at gmail.com
Thu Jun 5 16:46:30 PDT 2014


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 at intel.com>
---
 src/gen6_mfd.c           |  1 +
 src/gen75_mfd.c          |  4 ++++
 src/gen7_mfd.c           |  2 ++
 src/gen8_mfd.c           |  4 ++++
 src/i965_decoder_utils.c |  2 ++
 src/i965_device_info.c   | 10 ++++++++++
 src/i965_drv_video.c     | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 src/i965_drv_video.h     |  1 +
 src/va_backend_compat.h  |  5 +++++
 9 files changed, 76 insertions(+)

diff --git a/src/gen6_mfd.c b/src/gen6_mfd.c
index 113561c..e22e57a 100755
--- a/src/gen6_mfd.c
+++ b/src/gen6_mfd.c
@@ -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;
 
diff --git a/src/gen75_mfd.c b/src/gen75_mfd.c
index b080fb8..3ad8325 100644
--- a/src/gen75_mfd.c
+++ b/src/gen75_mfd.c
@@ -3149,6 +3149,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;
 
@@ -3243,6 +3245,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:
diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c
index 5fffcc9..f2bcd61 100755
--- a/src/gen7_mfd.c
+++ b/src/gen7_mfd.c
@@ -2595,6 +2595,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;
 
@@ -2689,6 +2690,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:
diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c
index 09105a0..f0b5a1a 100644
--- a/src/gen8_mfd.c
+++ b/src/gen8_mfd.c
@@ -3070,6 +3070,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;
 
@@ -3170,6 +3172,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:
diff --git a/src/i965_decoder_utils.c b/src/i965_decoder_utils.c
index 9af57c2..7e3d33a 100644
--- a/src/i965_decoder_utils.c
+++ b/src/i965_decoder_utils.c
@@ -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;
 
diff --git a/src/i965_device_info.c b/src/i965_device_info.c
index 4fad7a4..c7019c1 100644
--- a/src/i965_device_info.c
+++ b/src/i965_device_info.c
@@ -36,6 +36,10 @@
     (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,
@@ -126,6 +131,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,
 
@@ -163,6 +169,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,
 
@@ -204,6 +212,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,
 
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index c7da398..c775e63 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -61,6 +61,13 @@
 #define HAS_H264_DECODING(ctx)  ((ctx)->codec_info->has_h264_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_ENCODING(ctx)  ((ctx)->codec_info->has_h264_encoding && \
                                  (ctx)->intel.has_bsd)
 
@@ -274,6 +281,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;
@@ -332,6 +343,12 @@ i965_QueryConfigEntrypoints(VADriverContextP ctx,
 
         break;
 
+    case VAProfileH264MultiviewHigh:
+    case VAProfileH264StereoHigh:
+        if (HAS_H264_MVC_DECODING(i965))
+            entrypoint_list[n++] = VAEntrypointVLD;
+        break;
+
     case VAProfileVC1Simple:
     case VAProfileVC1Main:
     case VAProfileVC1Advanced:
@@ -396,6 +413,15 @@ i965_validate_config(VADriverContextP ctx, VAProfile profile,
         }
         break;
 
+    case VAProfileH264MultiviewHigh:
+    case VAProfileH264StereoHigh:
+        if (HAS_H264_MVC_DECODING(i965) && entrypoint == VAEntrypointVLD) {
+            va_status = VA_STATUS_SUCCESS;
+        } else {
+            va_status = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+        }
+        break;
+
     case VAProfileVC1Simple:
     case VAProfileVC1Main:
     case VAProfileVC1Advanced:
@@ -453,6 +479,12 @@ i965_get_default_chroma_formats(VADriverContextP ctx, VAProfile profile,
             chroma_formats |= i965->codec_info->h264_dec_chroma_formats;
         break;
 
+    case VAProfileH264MultiviewHigh:
+    case VAProfileH264StereoHigh:
+        if (HAS_H264_MVC_DECODING(i965) && entrypoint == VAEntrypointVLD)
+            chroma_formats |= i965->codec_info->h264_dec_chroma_formats;
+        break;
+
     case VAProfileJPEGBaseline:
         if (HAS_JPEG_DECODING(i965) && entrypoint == VAEntrypointVLD)
             chroma_formats |= i965->codec_info->jpeg_dec_chroma_formats;
@@ -1576,6 +1608,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;
@@ -1988,6 +2026,15 @@ i965_BeginPicture(VADriverContextP ctx,
         vaStatus = VA_STATUS_SUCCESS;
         break;
 
+    case VAProfileH264MultiviewHigh:
+    case VAProfileH264StereoHigh:
+        if (HAS_H264_MVC_DECODING_PROFILE(i965, obj_config->profile)) {
+            vaStatus = VA_STATUS_SUCCESS;
+        } else {
+            ASSERT_RET(0, VA_STATUS_ERROR_UNSUPPORTED_PROFILE);
+        }
+        break;
+
     case VAProfileVC1Simple:
     case VAProfileVC1Main:
     case VAProfileVC1Advanced:
diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h
index e8bbf87..568d05d 100644
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -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;
 
diff --git a/src/va_backend_compat.h b/src/va_backend_compat.h
index 267f1d8..5fcb198 100644
--- a/src/va_backend_compat.h
+++ b/src/va_backend_compat.h
@@ -51,4 +51,9 @@
 
 #endif
 
+#if !VA_CHECK_VERSION(0,35,2)
+# define VAProfileH264MultiviewHigh     15
+# define VAProfileH264StereoHigh        16
+#endif
+
 #endif /* VA_BACKEND_COMPAT_H */
-- 
1.9.1



More information about the Libva mailing list