From e29345cbdc26d5e4c6729100344eb8dbf9e35b65 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 9 May 2014 18:15:23 +0200 Subject: [PATCH] config: fix supported set of chroma formats for JPEG decode. 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 --- src/i965_device_info.c | 11 +++++++++++ src/i965_drv_video.c | 5 +++++ src/i965_drv_video.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/src/i965_device_info.c b/src/i965_device_info.c index f7ce226..1d5d6aa 100644 --- a/src/i965_device_info.c +++ b/src/i965_device_info.c @@ -27,6 +27,11 @@ #include #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, diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index 1d4a65c..4690b62 100755 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -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; } diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h index 44f61bf..a09e071 100644 --- a/src/i965_drv_video.h +++ b/src/i965_drv_video.h @@ -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; -- 2.11.0