From 5621ce10a699a135991a725a8b4def2f457f48f1 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 16 Dec 2024 17:26:09 +0100 Subject: [PATCH] radeonsi/vcn: Return error when decoding 12bit VP9 and 4:2:2/4:4:4 AV1 This is not supported by VCN. We indicate this limitation by not reporting YUV420_12 RT format supported for VP9, and not reporting YUV422 and YUV444 for AV1. Most applications however simply ignore this, and will pick some other format that is supported, which obviously won't work. Reviewed-by: Ruijing Dong Part-of: --- src/gallium/drivers/radeonsi/radeon_vcn_dec.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c index e4a8006908d..a4948730b30 100644 --- a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c +++ b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c @@ -2401,6 +2401,30 @@ static void radeon_dec_begin_frame(struct pipe_video_codec *decoder, assert(decoder); + switch (dec->stream_type) { + case RDECODE_CODEC_VP9: { + struct pipe_vp9_picture_desc *pic = (struct pipe_vp9_picture_desc *)picture; + /* Only 10 bit is supported for Profile 2 */ + if (pic->picture_parameter.bit_depth > 10) { + dec->error = true; + return; + } + break; + } + case RDECODE_CODEC_AV1: { + struct pipe_av1_picture_desc *pic = (struct pipe_av1_picture_desc *)picture; + /* Only 4:2:0 is supported for Profile 2 */ + if (!pic->picture_parameter.seq_info_fields.subsampling_x || + !pic->picture_parameter.seq_info_fields.subsampling_y) { + dec->error = true; + return; + } + break; + } + default: + break; + } + frame = ++dec->frame_number; if (dec->stream_type != RDECODE_CODEC_VP9 && dec->stream_type != RDECODE_CODEC_AV1 && dec->stream_type != RDECODE_CODEC_H264_PERF)