Mesa (master): freedreno/ir3: add dummy bary.f(ei) for pre-fs-fetch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 18 22:03:26 UTC 2019


Module: Mesa
Branch: master
Commit: 2b93eb9c76f24785a3fbf4504f0157046041b1bc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b93eb9c76f24785a3fbf4504f0157046041b1bc

Author: Rob Clark <robdclark at chromium.org>
Date:   Wed Oct  9 15:51:01 2019 -0700

freedreno/ir3: add dummy bary.f(ei) for pre-fs-fetch

If the only use of varyings is a pre-shader texture-fetch, we still need
to issue a bary.f with the end-input flag, otherwise we'll block further
VS invocations, as the hw will think varying storage is still busy.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>

---

 src/freedreno/ir3/ir3_legalize.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c
index 9a0c83042a4..76362c4468c 100644
--- a/src/freedreno/ir3/ir3_legalize.c
+++ b/src/freedreno/ir3/ir3_legalize.c
@@ -88,6 +88,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
 	struct ir3_legalize_state prev_state = bd->state;
 	struct ir3_legalize_state *state = &bd->state;
 	bool last_input_needs_ss = false;
+	bool has_tex_prefetch = false;
 
 	/* our input state is the OR of all predecessor blocks' state: */
 	set_foreach(block->predecessors, entry) {
@@ -243,6 +244,8 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
 		if (is_tex(n) || (n->opc == OPC_META_TEX_PREFETCH)) {
 			regmask_set(&state->needs_sy, n->regs[0]);
 			ctx->need_pixlod = true;
+			if (n->opc == OPC_META_TEX_PREFETCH)
+				has_tex_prefetch = true;
 		} else if (n->opc == OPC_RESINFO) {
 			regmask_set(&state->needs_ss, n->regs[0]);
 			ir3_NOP(block)->flags |= IR3_INSTR_SS;
@@ -319,6 +322,22 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
 		last_input->regs[0]->flags |= IR3_REG_EI;
 		if (last_input_needs_ss)
 			last_input->flags |= IR3_INSTR_SS;
+	} else if (has_tex_prefetch) {
+		/* texture prefetch, but *no* inputs.. we need to insert a
+		 * dummy bary.f at the top of the shader to unblock varying
+		 * storage:
+		 */
+		struct ir3_instruction *baryf;
+
+		/* (ss)bary.f (ei)r63.x, 0, r0.x */
+		baryf = ir3_instr_create(block, OPC_BARY_F);
+		ir3_reg_create(baryf, regid(63, 0), 0)->flags |= IR3_REG_EI;
+		ir3_reg_create(baryf, 0, IR3_REG_IMMED)->iim_val = 0;
+		ir3_reg_create(baryf, regid(0, 0), 0);
+
+		/* insert the dummy bary.f at head: */
+		list_delinit(&baryf->node);
+		list_add(&baryf->node, &block->instr_list);
 	}
 
 	if (last_rel)




More information about the mesa-commit mailing list