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:1:0, 4:2:2 and 4:4:4.

Signed-off-by: Gwenole Beauchesne <gwenole.beauche...@intel.com>
---
 src/i965_drv_video.c | 15 +++++++++++++++
 src/i965_drv_video.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index 20c2ac7..5e1adfc 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -214,6 +214,10 @@ 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_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 +282,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 +311,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 +344,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 +602,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 922d680..c66712f 100644
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -285,6 +285,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

_______________________________________________
Libva mailing list
Libva@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libva

Reply via email to