From 92d3f1fe5998d64ae0154ed912c291229cc764b7 Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Sat, 6 Jun 2020 15:08:06 +1200 Subject: [PATCH] pan/mdg: Replace writeout booleans with a single value A single value is easier to deal with than three separate booleans. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/compiler.h | 8 +++++--- src/panfrost/midgard/midgard_compile.c | 11 +++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 7e2a453584c..daaa8a59c5d 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -70,6 +70,10 @@ typedef struct midgard_branch { }; } midgard_branch; +#define PAN_WRITEOUT_C 1 +#define PAN_WRITEOUT_Z 2 +#define PAN_WRITEOUT_S 4 + /* Generic in-memory data type repesenting a single logical instruction, rather * than a single instruction group. This is the preferred form for code gen. * Multiple midgard_insturctions will later be combined during scheduling, @@ -142,9 +146,7 @@ typedef struct midgard_instruction { bool has_inline_constant; bool compact_branch; - bool writeout; - bool writeout_depth; - bool writeout_stencil; + uint8_t writeout; bool last_writeout; /* Masks in a saneish format. One bit per channel, not packed fancy. diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 010ecd203fb..8865bda0973 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -1307,13 +1307,14 @@ emit_fragment_store(compiler_context *ctx, unsigned src, enum midgard_rt_id rt) struct midgard_instruction ins = v_branch(false, false); - ins.writeout = true; + bool depth_only = (rt == MIDGARD_ZS_RT); + + ins.writeout = depth_only ? PAN_WRITEOUT_Z : PAN_WRITEOUT_C; /* Add dependencies */ ins.src[0] = src; ins.src_types[0] = nir_type_uint32; - ins.constants.u32[0] = rt == MIDGARD_ZS_RT ? - 0xFF : (rt - MIDGARD_COLOR_RT0) * 0x100; + ins.constants.u32[0] = depth_only ? 0xFF : (rt - MIDGARD_COLOR_RT0) * 0x100; for (int i = 0; i < 4; ++i) ins.swizzle[0][i] = i; @@ -2233,9 +2234,7 @@ emit_fragment_epilogue(compiler_context *ctx, unsigned rt) /* Loop to ourselves */ midgard_instruction *br = ctx->writeout_branch[rt]; struct midgard_instruction ins = v_branch(false, false); - ins.writeout = true; - ins.writeout_depth = br->writeout_depth; - ins.writeout_stencil = br->writeout_stencil; + ins.writeout = br->writeout; ins.branch.target_block = ctx->block_count - 1; ins.constants.u32[0] = br->constants.u32[0]; memcpy(&ins.src_types, &br->src_types, sizeof(ins.src_types)); -- 2.30.2