freedreno/ir3: fix crash with samgq workaround

Need to list_delinit() before we clone the instruction to split it into
individual samgpN instructions, otherwise we get list corruption.

Tested-by: Eduardo Lima Mitev <elima@igalia.com>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3989>
This commit is contained in:
Rob Clark 2020-02-25 16:37:26 -08:00 committed by Marge Bot
parent 56565b7bba
commit 4b8e198fd2
1 changed files with 2 additions and 1 deletions

View File

@ -215,13 +215,14 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
ctx->type == MESA_SHADER_VERTEX && n->opc == OPC_SAMGQ) {
struct ir3_instruction *samgp;
list_delinit(&n->node);
for (i = 0; i < 4; i++) {
samgp = ir3_instr_clone(n);
samgp->opc = OPC_SAMGP0 + i;
if (i > 1)
samgp->flags |= IR3_INSTR_SY;
}
list_delinit(&n->node);
} else {
list_addtail(&n->node, &block->instr_list);
}