[Libva] [PATCH v3 intel-driver 6/8] config: fix supported set of chroma formats for JPEG decode.

Gwenole Beauchesne gb.devel at gmail.com
Thu May 15 03:07:56 PDT 2014


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 at intel.com>
---
 src/i965_drv_video.c | 16 ++++++++++++++++
 src/i965_drv_video.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index 8e840e9..03a2644 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -214,6 +214,11 @@ get_subpic_format(const VAImageFormat *va_format)
     return NULL;
 }
 
+/* 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 *);
 static struct hw_codec_info g4x_hw_codec_info = {
@@ -278,6 +283,8 @@ static struct hw_codec_info gen7_hw_codec_info = {
     .max_width = 4096,
     .max_height = 4096,
 
+    .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
+
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
     .has_h264_decoding = 1,
@@ -305,6 +312,8 @@ static struct hw_codec_info gen75_hw_codec_info = {
     .max_width = 4096,
     .max_height = 4096,
 
+    .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
+
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
     .has_h264_decoding = 1,
@@ -336,6 +345,8 @@ static struct hw_codec_info gen8_hw_codec_info = {
     .max_width = 4096,
     .max_height = 4096,
 
+    .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
+
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
     .has_h264_decoding = 1,
@@ -592,6 +603,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;
     }
diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h
index 8f2d288..e70852b 100644
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -289,6 +289,8 @@ struct hw_codec_info
     int max_width;
     int max_height;
 
+    unsigned int jpeg_dec_chroma_formats;
+
     unsigned int has_mpeg2_decoding:1;
     unsigned int has_mpeg2_encoding:1;
     unsigned int has_h264_decoding:1;
-- 
1.9.1



More information about the Libva mailing list