summaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-12-30 18:53:04 -0500
committerAlyssa Rosenzweig <[email protected]>2019-12-31 03:26:24 +0000
commit02f503ef008f22786e7466a20b33b6d13dbc7ce7 (patch)
treeddbbb9d01a01dfe5b416eb4ca3cad4ae44525b39 /src/panfrost/midgard
parent84b82f8cd1c9d0a03e68af3a68fb0b009be70780 (diff)
pan/midgard: Convert fragment writeout to proper branches
This eliminates the only use of prepacked_branch, which is a such a hack anyway. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r--src/panfrost/midgard/midgard_compile.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 0c7d60cd675..412e5b01c5b 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -1378,15 +1378,18 @@ emit_fragment_store(compiler_context *ctx, unsigned src, unsigned rt)
emit_explicit_constant(ctx, src, src);
struct midgard_instruction ins =
- v_alu_br_compact_cond(midgard_jmp_writeout_op_writeout, TAG_ALU_8, 0, midgard_condition_always);
+ v_branch(false, false);
+
+ ins.writeout = true;
/* Add dependencies */
ins.src[0] = src;
ins.constants[0] = rt * 0x100;
/* Emit the branch */
- emit_mir_instruction(ctx, ins);
+ midgard_instruction *br = emit_mir_instruction(ctx, ins);
schedule_barrier(ctx);
+ br->branch.target_block = ctx->block_count - 1;
emit_fragment_epilogue(ctx, rt);
}
@@ -2330,7 +2333,13 @@ emit_fragment_epilogue(compiler_context *ctx, unsigned rt)
emit_mir_instruction(ctx, rt_move);
}
- EMIT(alu_br_compact_cond, midgard_jmp_writeout_op_writeout, TAG_ALU_8, -2, midgard_condition_always);
+ /* Loop to ourselves */
+
+ struct midgard_instruction ins = v_branch(false, false);
+ ins.writeout = true;
+ ins.branch.target_block = ctx->block_count - 1;
+ emit_mir_instruction(ctx, ins);
+
ctx->current_block->epilogue = true;
schedule_barrier(ctx);
}
@@ -2750,6 +2759,7 @@ midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool is_bl
bool is_conditional = ins->branch.conditional;
bool is_inverted = ins->branch.invert_conditional;
bool is_discard = ins->branch.target_type == TARGET_DISCARD;
+ bool is_writeout = ins->writeout;
/* Determine the block we're jumping to */
int target_number = ins->branch.target_block;
@@ -2799,6 +2809,7 @@ midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool is_bl
midgard_jmp_writeout_op op =
is_discard ? midgard_jmp_writeout_op_discard :
+ is_writeout ? midgard_jmp_writeout_op_writeout :
(is_compact && !is_conditional) ? midgard_jmp_writeout_op_branch_uncond :
midgard_jmp_writeout_op_branch_cond;