From b10f4eda70d372e6955c2cefa9196678da42ce6d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 25 Feb 2021 11:51:05 -0800 Subject: [PATCH] freedreno/cffdec: Fix decode on pixel 2 blob's COMPUTE_CHECKPOINT dEQP-GLES31.functional.image_load_store.buffer.image_size.writeonly_7 produces: t7 opcode: CP_COMPUTE_CHECKPOINT (6e) (8 dwords) { ADDR_0_LO = 0x15000 } { ADDR_0_HI = 0x5 } 0x18 { ADDR_1_LEN = 3 } 0xf { ADDR_1_LO = 0x2e010 } { ADDR_1_HI = 0x5 } and it was asserting due to sizedwords==7. Without the assert, we were dereffing a len past the end of the packet. This len value we were loading is also suspiciously not the location of the ADDR_1_LEN field in the packet's XML. But then, the command stream at ADDR_1 was clearly 0xf long, and that puts ADDR_1_LEN at the spot we would expect compared to SET_RENDER_MODE's ADDR_1. Part-of: --- src/freedreno/decode/cffdec.c | 14 +++++++++----- src/freedreno/registers/adreno/adreno_pm4.xml | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/freedreno/decode/cffdec.c b/src/freedreno/decode/cffdec.c index 57d8a66..17b43ec 100644 --- a/src/freedreno/decode/cffdec.c +++ b/src/freedreno/decode/cffdec.c @@ -2764,11 +2764,15 @@ cp_compute_checkpoint(uint32_t *dwords, uint32_t sizedwords, int level) assert(is_64b()); assert(options->gpu_id >= 500); - assert(sizedwords == 8); - - addr = dwords[5]; - addr |= ((uint64_t)dwords[6]) << 32; - len = dwords[7]; + if (sizedwords == 8) { + addr = dwords[5]; + addr |= ((uint64_t)dwords[6]) << 32; + len = dwords[7]; + } else { + addr = dwords[5]; + addr |= ((uint64_t)dwords[6]) << 32; + len = dwords[4]; + } printl(3, "%saddr: 0x%016" PRIx64 "\n", levels[level], addr); printl(3, "%slen: 0x%x\n", levels[level], len); diff --git a/src/freedreno/registers/adreno/adreno_pm4.xml b/src/freedreno/registers/adreno/adreno_pm4.xml index 2450929..0857c5a 100644 --- a/src/freedreno/registers/adreno/adreno_pm4.xml +++ b/src/freedreno/registers/adreno/adreno_pm4.xml @@ -1580,11 +1580,11 @@ opcode: CP_LOAD_STATE4 (30) (4 dwords) + - + - -- 2.7.4