From 285aed315fa01d804ecf57e898d763347f9b8143 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 5 May 2024 09:22:21 +0200 Subject: [PATCH] radeonsi/vcn: Allow duplicate buffers in DPB In case of missing frames (eg. when decoding corrupted streams), there will be duplicate buffers and all of them needs to be in DPB to keep the layout correct for decoding. Cc: mesa-stable Reviewed-by: Leo Liu Part-of: (cherry picked from commit 2ef3a34f1a2d404ee28b2edd9007aeb203419e24) --- .pick_status.json | 2 +- src/gallium/drivers/radeonsi/radeon_vcn_dec.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 44666196678..461b17a6b02 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -554,7 +554,7 @@ "description": "radeonsi/vcn: Allow duplicate buffers in DPB", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c index 9c308c3da98..b9d28c5b1e5 100644 --- a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c +++ b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c @@ -1829,6 +1829,7 @@ static unsigned rvcn_dec_dynamic_dpb_t2_message(struct radeon_decoder *dec, rvcn size = size * 3 / 2; list_for_each_entry_safe(struct rvcn_dec_dynamic_dpb_t2, d, &dec->dpb_ref_list, list) { + bool found = false; for (i = 0; i < dec->ref_codec.ref_size; ++i) { if (((dec->ref_codec.ref_list[i] & 0x7f) != 0x7f) && (d->index == (dec->ref_codec.ref_list[i] & 0x7f))) { if (!dummy) @@ -1842,10 +1843,10 @@ static unsigned rvcn_dec_dynamic_dpb_t2_message(struct radeon_decoder *dec, rvcn dynamic_dpb_t2->dpbAddrLo[i] = addr; dynamic_dpb_t2->dpbAddrHi[i] = addr >> 32; ++dynamic_dpb_t2->dpbArraySize; - break; + found = true; } } - if (i == dec->ref_codec.ref_size) { + if (!found) { if (d->dpb.res->b.b.width0 * d->dpb.res->b.b.height0 != size) { list_del(&d->list); list_addtail(&d->list, &dec->dpb_unref_list);