From 0598fc441997baf63d7dd87cf37da4da47d0c60c Mon Sep 17 00:00:00 2001 From: "Eric R. Smith" Date: Sun, 11 Aug 2024 18:28:57 +0000 Subject: [PATCH] panfrost: fix crash when disassembling shader for trace During disassembly triggered by PAN_MESA_DEBUG=trace, the upper bits of the blend shader address are set from the passed in frag_shader. However, this is 0 for some blend shaders. In this case, skip the blend shader disassembly. This fixes a failing assert at line 86 of panfrost/lib/genxml/decode.h. Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/lib/genxml/decode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/panfrost/lib/genxml/decode.c b/src/panfrost/lib/genxml/decode.c index 002a9de1c96..965e7955f8c 100644 --- a/src/panfrost/lib/genxml/decode.c +++ b/src/panfrost/lib/genxml/decode.c @@ -213,6 +213,12 @@ GENX(pandecode_blend)(struct pandecode_context *ctx, void *descs, int rt_no, #if PAN_ARCH >= 6 if (b.internal.mode != MALI_BLEND_MODE_SHADER) return 0; + /* If we don't have a frag shader, we can't extract the LSB of the blend + * shader so return NULL in that case. It doesn't matter, because the + * blend shader won't be executed anyway, so disassembling is not + * super useful. */ + if (!frag_shader) + return 0; return (frag_shader & 0xFFFFFFFF00000000ULL) | b.internal.shader.pc; #else