pan/bi: Add bi_schedule_barrier helper
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 6 Mar 2020 14:26:20 +0000 (09:26 -0500)
committerMarge Bot <eric+marge@anholt.net>
Sat, 7 Mar 2020 00:37:39 +0000 (00:37 +0000)
Copypaste from Midgard.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4097>

src/panfrost/bifrost/bifrost_compile.c

index 6be08947d78df65d4c18ff491480c4a1b4c01992..6a57adc4e53f0a2c1b2f37d930e23504e51839ab 100644 (file)
@@ -39,6 +39,7 @@
 static bi_block *emit_cf_list(bi_context *ctx, struct exec_list *list);
 static bi_instruction *bi_emit_branch(bi_context *ctx);
 static void bi_block_add_successor(bi_block *block, bi_block *successor);
+static void bi_schedule_barrier(bi_context *ctx);
 
 static void
 emit_jump(bi_context *ctx, nir_jump_instr *instr)
@@ -180,6 +181,18 @@ bi_block_add_successor(bi_block *block, bi_block *successor)
         unreachable("Too many successors");
 }
 
+static void
+bi_schedule_barrier(bi_context *ctx)
+{
+        bi_block *temp = ctx->after_block;
+        ctx->after_block = create_empty_block(ctx);
+        list_addtail(&ctx->after_block->link, &ctx->blocks);
+        list_inithead(&ctx->after_block->instructions);
+        bi_block_add_successor(ctx->current_block, ctx->after_block);
+        ctx->current_block = ctx->after_block;
+        ctx->after_block = temp;
+}
+
 static bi_block *
 emit_block(bi_context *ctx, nir_block *block)
 {