From: Vasily Khoruzhick Date: Sat, 25 Jan 2020 21:31:53 +0000 (-0800) Subject: lima: ppir: always create move and update ld_tex successors for all blocks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=650c68054536ceefb8d085e343b82f907127a56d;p=mesa.git lima: ppir: always create move and update ld_tex successors for all blocks Always create a mov for ld_tex since we can't rely on ppir_node_has_single_src_succ() if we have multiple blocks. And since ld_tex successor can be in a different block we have to update their ppir_src as well. Reviewed-by: Erico Nunes Signed-off-by: Vasily Khoruzhick Tested-by: Marge Bot Part-of: --- diff --git a/src/gallium/drivers/lima/ir/pp/lower.c b/src/gallium/drivers/lima/ir/pp/lower.c index 034425c97a7..f7c61df2b0a 100644 --- a/src/gallium/drivers/lima/ir/pp/lower.c +++ b/src/gallium/drivers/lima/ir/pp/lower.c @@ -185,29 +185,8 @@ static bool ppir_lower_texture(ppir_block *block, ppir_node *node) load_tex->src[0].type = load->dest.type = ppir_target_pipeline; load_tex->src[0].pipeline = load->dest.pipeline = ppir_pipeline_reg_discard; - if (ppir_node_has_single_src_succ(node)) { - ppir_node *succ = ppir_node_first_succ(node); - switch (succ->type) { - case ppir_node_type_alu: - case ppir_node_type_branch: { - for (int i = 0; i < ppir_node_get_src_num(succ); i++) { - ppir_src *src = ppir_node_get_src(succ, i); - if (src->node == node) { - /* Can consume samplers directly */ - src->type = dest->type = ppir_target_pipeline; - src->pipeline = dest->pipeline = ppir_pipeline_reg_sampler; - } - } - return true; - } - default: - /* Create mov for everyone else */ - break; - } - } - - /* Create move node */ - ppir_node *move = ppir_node_insert_mov(node); + /* Always create move node since there can be successors in other blocks */ + ppir_node *move = ppir_node_insert_mov_all_blocks(node); if (unlikely(!move)) return false; diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c index e646a395ca7..1a822b89032 100644 --- a/src/gallium/drivers/lima/ir/pp/node.c +++ b/src/gallium/drivers/lima/ir/pp/node.c @@ -732,6 +732,27 @@ ppir_node *ppir_node_insert_mov(ppir_node *node) return move; } +ppir_node *ppir_node_insert_mov_all_blocks(ppir_node *old) +{ + ppir_node *move = ppir_node_insert_mov(old); + ppir_compiler *comp = old->block->comp; + + list_for_each_entry(ppir_block, block, &comp->block_list, list) { + if (old->block == block) + continue; + list_for_each_entry_safe(ppir_node, node, &block->node_list, list) { + for (int i = 0; i < ppir_node_get_src_num(node); i++){ + ppir_src *src = ppir_node_get_src(node, i); + if (!src) + continue; + if (src->node == old) + ppir_node_target_assign(src, move); + } + } + } + + return move; +} bool ppir_node_has_single_src_succ(ppir_node *node) { if (list_is_singular(&node->succ_list) && diff --git a/src/gallium/drivers/lima/ir/pp/ppir.h b/src/gallium/drivers/lima/ir/pp/ppir.h index 2b4629bcaab..357fcada8b7 100644 --- a/src/gallium/drivers/lima/ir/pp/ppir.h +++ b/src/gallium/drivers/lima/ir/pp/ppir.h @@ -412,6 +412,7 @@ ppir_dep *ppir_dep_for_pred(ppir_node *node, ppir_node *pred); ppir_node *ppir_node_clone(ppir_block *block, ppir_node *node); /* Assumes that node successors are in the same block */ ppir_node *ppir_node_insert_mov(ppir_node *node); +ppir_node *ppir_node_insert_mov_all_blocks(ppir_node *node); static inline bool ppir_node_is_root(ppir_node *node) {