radeon/vcn: reuse the dpb buffers when with the same size.

To avoid allocate/deallocate frequently.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12610>
This commit is contained in:
Leo Liu 2021-08-29 12:24:12 -04:00 committed by Marge Bot
parent 2bdc0bb324
commit 6a0cadd8ec
1 changed files with 8 additions and 6 deletions

View File

@ -1358,8 +1358,12 @@ static unsigned rvcn_dec_dynamic_dpb_t2_message(struct radeon_decoder *dec, rvcn
}
}
if (i == dec->ref_codec.ref_size) {
list_del(&d->list);
list_addtail(&d->list, &dec->dpb_unref_list);
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);
} else {
d->index = 0x7f;
}
}
}
@ -1371,11 +1375,9 @@ static unsigned rvcn_dec_dynamic_dpb_t2_message(struct radeon_decoder *dec, rvcn
}
if (!dpb) {
list_for_each_entry_safe(struct rvcn_dec_dynamic_dpb_t2, d, &dec->dpb_unref_list, list) {
if (d->dpb.res->b.b.width0 * d->dpb.res->b.b.height0 == size) {
list_for_each_entry_safe(struct rvcn_dec_dynamic_dpb_t2, d, &dec->dpb_ref_list, list) {
if (d->index == 0x7f) {
d->index = dec->ref_codec.index;
list_del(&d->list);
list_addtail(&d->list, &dec->dpb_ref_list);
dpb = d;
break;
}