Mesa (master): pan/mdg: Emit a tilebuffer wait loop when needed

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 13 14:04:07 UTC 2020


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

Author: Icecream95 <ixn at keemail.me>
Date:   Wed Jul  8 13:15:09 2020 +1200

pan/mdg: Emit a tilebuffer wait loop when needed

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

---

 src/panfrost/midgard/midgard_compile.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index c312fcc5e49..a432fabc1aa 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -2478,7 +2478,7 @@ emit_fragment_epilogue(compiler_context *ctx, unsigned rt)
 }
 
 static midgard_block *
-emit_block(compiler_context *ctx, nir_block *block)
+emit_block_init(compiler_context *ctx)
 {
         midgard_block *this_block = ctx->after_block;
         ctx->after_block = NULL;
@@ -2495,6 +2495,14 @@ emit_block(compiler_context *ctx, nir_block *block)
         list_inithead(&this_block->base.instructions);
         ctx->current_block = this_block;
 
+        return this_block;
+}
+
+static midgard_block *
+emit_block(compiler_context *ctx, nir_block *block)
+{
+        midgard_block *this_block = emit_block_init(ctx);
+
         nir_foreach_instr(instr, block) {
                 emit_instr(ctx, instr);
                 ++ctx->instruction_count;
@@ -2791,6 +2799,17 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b
                 ctx->func = func;
                 ctx->already_emitted = calloc(BITSET_WORDS(func->impl->ssa_alloc), sizeof(BITSET_WORD));
 
+                if (nir->info.outputs_read && !is_blend) {
+                        emit_block_init(ctx);
+
+                        struct midgard_instruction wait = v_branch(false, false);
+                        wait.branch.target_type = TARGET_TILEBUF_WAIT;
+
+                        emit_mir_instruction(ctx, wait);
+
+                        ++ctx->instruction_count;
+                }
+
                 emit_cf_list(ctx, &func->impl->body);
                 free(ctx->already_emitted);
                 break; /* TODO: Multi-function shaders */



More information about the mesa-commit mailing list