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>
(cherry picked from commit 2ef3a34f1a)
This commit is contained in:
David Rosca 2024-05-05 09:22:21 +02:00 committed by Eric Engestrom
parent 7adccd14fa
commit 285aed315f
2 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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);