config: fix supported set of chroma formats for JPEG decode.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 9 May 2014 16:15:23 +0000 (18:15 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 2 Jun 2014 17:30:43 +0000 (19:30 +0200)
If the hardware supports JPEG decoding, then we have to expose the
right set of chroma formats for the output (decoded) VA surface. In
particular, we could support YUV 4:0:0, 4:1:0, 4:2:2 and 4:4:4.

v2: export support for YUV 4:0:0 (grayscale) too [Haihao]

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
src/i965_device_info.c
src/i965_drv_video.c
src/i965_drv_video.h

index f7ce226..1d5d6aa 100644 (file)
 #include <stdlib.h>
 #include "i965_drv_video.h"
 
+/* Extra set of chroma formats supported for JPEG decoding (beyond YUV 4:2:0) */
+#define EXTRA_JPEG_DEC_CHROMA_FORMATS \
+    (VA_RT_FORMAT_YUV400 | VA_RT_FORMAT_YUV411 | VA_RT_FORMAT_YUV422 | \
+     VA_RT_FORMAT_YUV444)
+
 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);
@@ -115,6 +120,8 @@ static const struct hw_codec_info ivb_hw_codec_info = {
     .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
+    .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
+
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
     .has_h264_decoding = 1,
@@ -149,6 +156,8 @@ static const struct hw_codec_info hsw_hw_codec_info = {
     .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
+    .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
+
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
     .has_h264_decoding = 1,
@@ -187,6 +196,8 @@ static const struct hw_codec_info bdw_hw_codec_info = {
     .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
+    .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
+
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
     .has_h264_decoding = 1,
index 1d4a65c..4690b62 100755 (executable)
@@ -446,6 +446,11 @@ i965_get_default_chroma_formats(VADriverContextP ctx, VAProfile profile,
     uint32_t chroma_formats = VA_RT_FORMAT_YUV420;
 
     switch (profile) {
+    case VAProfileJPEGBaseline:
+        if (HAS_JPEG_DECODING(i965) && entrypoint == VAEntrypointVLD)
+            chroma_formats |= i965->codec_info->jpeg_dec_chroma_formats;
+        break;
+
     default:
         break;
     }
index 44f61bf..a09e071 100644 (file)
@@ -294,6 +294,8 @@ struct hw_codec_info
     int min_linear_wpitch;
     int min_linear_hpitch;
 
+    unsigned int jpeg_dec_chroma_formats;
+
     unsigned int has_mpeg2_decoding:1;
     unsigned int has_mpeg2_encoding:1;
     unsigned int has_h264_decoding:1;