From 2fe4eaa3d01651c26a070d16d1027dfa90ed5394 Mon Sep 17 00:00:00 2001 From: "David (Ming Qiang) Wu" Date: Thu, 13 Apr 2023 14:29:35 -0400 Subject: [PATCH] radeonsi/vcn: add an exception of field case for h264 decoding This is an error case where the I field has no reference, however the reference list contains some reference, which resulting in not be able to find its reference, and it is a correct behavior, should not enter the correction code. Just add this exception to prevent such a case, if more exceptions found, they will be treated indiviually in the future. Cc: mesa-stable closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8740 Signed-off-by: Ruijing Dong Signed-off-by: David (Ming Qiang) Wu Reviewed-by: Leo Liu Part-of: (cherry picked from commit bfce57c7a5ba62d8e6f65addb2df136cab603a68) --- .pick_status.json | 2 +- src/gallium/drivers/radeonsi/radeon_vcn_dec.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 49bf42d9ff9..097ad28f07f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -409,7 +409,7 @@ "description": "radeonsi/vcn: add an exception of field case for h264 decoding", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c index c57228d10ed..5f6f0d8a892 100644 --- a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c +++ b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c @@ -280,7 +280,9 @@ static rvcn_dec_message_avc_t get_h264_msg(struct radeon_decoder *dec, /* if reference picture exists, however no reference picture found at the end curr_pic_ref_frame_num == 0, which is not reasonable, should be corrected. */ - if (result.used_for_reference_flags && (result.curr_pic_ref_frame_num == 0)) { + /* one exeption for I frames which is valid situation and should be skipped. */ + if ((result.curr_field_order_cnt_list[0] == result.curr_field_order_cnt_list[1]) + && result.used_for_reference_flags && (result.curr_pic_ref_frame_num == 0)) { for (i = 0; i < ARRAY_SIZE(result.ref_frame_list); i++) { result.ref_frame_list[i] = pic->ref[i] ? (uintptr_t)vl_video_buffer_get_associated_data(pic->ref[i], &dec->base) : 0xff;