Mesa (main): radeon/vcn: add a handling of error for incorrect reference lists
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 31 15:56:02 UTC 2021
Module: Mesa
Branch: main
Commit: f4b61e90617f19ca1b8a3cfe046bac5801081057
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4b61e90617f19ca1b8a3cfe046bac5801081057
Author: Leo Liu <leo.liu at amd.com>
Date: Sun Aug 29 13:28:51 2021 -0400
radeon/vcn: add a handling of error for incorrect reference lists
Use the first dpb buffer instead of the NULL pointer sent to hardware.
Signed-off-by: Leo Liu <leo.liu at amd.com>
Reviewed-by: James Zhu <James.Zhu at amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12610>
---
src/gallium/drivers/radeon/radeon_vcn_dec.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/radeon/radeon_vcn_dec.c b/src/gallium/drivers/radeon/radeon_vcn_dec.c
index 66169faadf2..dbe600ee0d4 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_dec.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_dec.c
@@ -1336,7 +1336,7 @@ static void rvcn_dec_message_create(struct radeon_decoder *dec)
static unsigned rvcn_dec_dynamic_dpb_t2_message(struct radeon_decoder *dec, rvcn_dec_message_decode_t *decode,
rvcn_dec_message_dynamic_dpb_t2_t *dynamic_dpb_t2)
{
- struct rvcn_dec_dynamic_dpb_t2 *dpb = NULL;
+ struct rvcn_dec_dynamic_dpb_t2 *dpb = NULL, *dummy = NULL;
unsigned width, height, size;
uint64_t addr;
int i;
@@ -1350,7 +1350,14 @@ static unsigned rvcn_dec_dynamic_dpb_t2_message(struct radeon_decoder *dec, rvcn
list_for_each_entry_safe(struct rvcn_dec_dynamic_dpb_t2, d, &dec->dpb_ref_list, list) {
for (i = 0; i < dec->ref_codec.ref_size; ++i) {
if ((dec->ref_codec.ref_list[i] != 0x7f) && (d->index == (dec->ref_codec.ref_list[i] & 0x7f))) {
+ if (!dummy)
+ dummy = d;
+
addr = dec->ws->buffer_get_virtual_address(d->dpb.res->buf);
+ if (!addr && dummy) {
+ RVID_ERR("Ref list from application is incorrect, using dummy buffer instead.\n");
+ addr = dec->ws->buffer_get_virtual_address(dummy->dpb.res->buf);
+ }
dynamic_dpb_t2->dpbAddrLo[i] = addr;
dynamic_dpb_t2->dpbAddrHi[i] = addr >> 32;
++dynamic_dpb_t2->dpbArraySize;
More information about the mesa-commit
mailing list