From c3f11a4011a56f74cb1e4656e1c7d794b93d99d6 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 898b19aedbf..bf855dace04 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -564,7 +564,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 a33e52ff6b3..cbb9272300e 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);