Mesa (master): vc4: Track the last block we emitted at the top level.

Eric Anholt anholt at kemper.freedesktop.org
Sat Feb 25 01:03:56 UTC 2017


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

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Feb 24 12:00:38 2017 -0800

vc4: Track the last block we emitted at the top level.

This will be used for delaying our VPM reads (which must be unconditional)
until just before they're used.

---

 src/gallium/drivers/vc4/vc4_program.c | 13 ++++++++-----
 src/gallium/drivers/vc4/vc4_qir.c     |  1 +
 src/gallium/drivers/vc4/vc4_qir.h     |  1 +
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index e613170..164257e 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1956,11 +1956,12 @@ ntq_emit_if(struct vc4_compile *c, nir_if *if_stmt)
         qir_link_blocks(c->cur_block, after_block);
 
         qir_set_emit_block(c, after_block);
-        if (was_top_level)
+        if (was_top_level) {
                 c->execute = c->undef;
-        else
+                c->last_top_block = c->cur_block;
+        } else {
                 ntq_activate_execute_for_block(c);
-
+        }
 }
 
 static void
@@ -2084,10 +2085,12 @@ ntq_emit_loop(struct vc4_compile *c, nir_loop *loop)
         qir_link_blocks(c->cur_block, c->loop_break_block);
 
         qir_set_emit_block(c, c->loop_break_block);
-        if (was_top_level)
+        if (was_top_level) {
                 c->execute = c->undef;
-        else
+                c->last_top_block = c->cur_block;
+        } else {
                 ntq_activate_execute_for_block(c);
+        }
 
         c->loop_break_block = save_loop_break_block;
         c->loop_cont_block = save_loop_cont_block;
diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c
index ed76c64..c829e7f 100644
--- a/src/gallium/drivers/vc4/vc4_qir.c
+++ b/src/gallium/drivers/vc4/vc4_qir.c
@@ -646,6 +646,7 @@ qir_compile_init(void)
 
         list_inithead(&c->blocks);
         qir_set_emit_block(c, qir_new_block(c));
+        c->last_top_block = c->cur_block;
 
         c->output_position_index = -1;
         c->output_color_index = -1;
diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h
index daeb52b..6469e51 100644
--- a/src/gallium/drivers/vc4/vc4_qir.h
+++ b/src/gallium/drivers/vc4/vc4_qir.h
@@ -506,6 +506,7 @@ struct vc4_compile {
         struct qblock *cur_block;
         struct qblock *loop_cont_block;
         struct qblock *loop_break_block;
+        struct qblock *last_top_block;
 
         struct list_head qpu_inst_list;
 




More information about the mesa-commit mailing list