summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorLeo Liu <leo.liu@amd.com>2021-08-29 13:28:51 -0400
committerMarge Bot <eric+marge@anholt.net>2021-08-31 15:43:21 +0000
commitf4b61e90617f19ca1b8a3cfe046bac5801081057 (patch)
treebabcf04e6c043ae45685871d1820fe1c9b8b7386 /src/gallium/drivers
parent6a0cadd8ec7725cf09efc4d76c3f60a5729000eb (diff)
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@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>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeon/radeon_vcn_dec.c9
1 files changed, 8 insertions, 1 deletions
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;