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 <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29055>
This commit is contained in:
David Rosca
2024-05-05 09:22:21 +02:00
committed by Marge Bot
parent 47b6ca47d0
commit 2ef3a34f1a

View File

@@ -1832,6 +1832,7 @@ static unsigned rvcn_dec_dynamic_dpb_t2_message(struct radeon_decoder *dec, rvcn
size = dec->dpb_version == DPB_VERSION_VCN5 ? size * 2 : 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)
@@ -1845,10 +1846,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);