This will be used to implement the barrier function.

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
Reviewed-by: Chris Forbes <chr...@ijw.co.nz>
---
 src/mesa/drivers/dri/i965/brw_eu.h      |  2 ++
 src/mesa/drivers/dri/i965/brw_eu_emit.c | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
b/src/mesa/drivers/dri/i965/brw_eu.h
index f8fd155..5e86591 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -360,6 +360,8 @@ brw_jump_scale(const struct brw_context *brw)
    return 1;
 }
 
+void brw_wait(struct brw_compile *p);
+
 /* If/else/endif.  Works by manipulating the execution flags on each
  * channel.
  */
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 1fe9e7b..d9572b5 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -2950,3 +2950,26 @@ void brw_shader_time_add(struct brw_compile *p,
                                      0 /* response length */,
                                      false /* header present */);
 }
+
+
+/**
+ * Emit the wait instruction for a barrier
+ */
+void
+brw_wait(struct brw_compile *p)
+{
+   struct brw_context *brw = p->brw;
+   struct brw_inst *insn;
+
+   assert(brw->gen >= 7);
+
+   struct brw_reg src = brw_notification_reg();
+
+   insn = next_insn(p, BRW_OPCODE_WAIT);
+   brw_set_dest(p, insn, brw_null_reg());
+   brw_set_src0(p, insn, src);
+   brw_set_src1(p, insn, brw_null_reg());
+
+   brw_inst_set_exec_size(p->brw, insn, BRW_EXECUTE_1);
+   brw_inst_set_mask_control(brw, insn, BRW_MASK_DISABLE);
+}
-- 
2.1.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to