i965: Add brw_barrier to emit a Gateway Barrier SEND
authorJordan Justen <jordan.l.justen@intel.com>
Wed, 5 Nov 2014 02:11:37 +0000 (18:11 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Fri, 12 Jun 2015 22:12:40 +0000 (15:12 -0700)
This will be used to implement the Gateway Barrier SEND needed to implement
the barrier function.

v2:
 * notify => gateway_notify (Ken)
 * combine short lines of brw_barrier proto/decl (mattst88)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/drivers/dri/i965/brw_eu.h
src/mesa/drivers/dri/i965/brw_eu_emit.c

index 0eaab2f1d1f644d18b1c1d73f05b9613c10adfa1..761aa0ec5fa892aa5115588be8b0c3058f2bd9dd 100644 (file)
@@ -361,6 +361,8 @@ brw_jump_scale(const struct brw_device_info *devinfo)
    return 1;
 }
 
+void brw_barrier(struct brw_codegen *p, struct brw_reg src);
+
 /* If/else/endif.  Works by manipulating the execution flags on each
  * channel.
  */
index 61fc1abf897a21e7fc8c0ef8964700149f21d87e..0f536046f6f5cf296fb37d9152f11bf934d97704 100644 (file)
@@ -3408,6 +3408,36 @@ void brw_shader_time_add(struct brw_codegen *p,
 }
 
 
+/**
+ * Emit the SEND message for a barrier
+ */
+void
+brw_barrier(struct brw_codegen *p, struct brw_reg src)
+{
+   const struct brw_device_info *devinfo = p->devinfo;
+   struct brw_inst *inst;
+
+   assert(devinfo->gen >= 7);
+
+   inst = next_insn(p, BRW_OPCODE_SEND);
+   brw_set_dest(p, inst, brw_null_reg());
+   brw_set_src0(p, inst, src);
+   brw_set_src1(p, inst, brw_null_reg());
+
+   brw_set_message_descriptor(p, inst, BRW_SFID_MESSAGE_GATEWAY,
+                              1 /* msg_length */,
+                              0 /* response_length */,
+                              false /* header_present */,
+                              false /* end_of_thread */);
+
+   brw_inst_set_gateway_notify(devinfo, inst, 1);
+   brw_inst_set_gateway_subfuncid(devinfo, inst,
+                                  BRW_MESSAGE_GATEWAY_SFID_BARRIER_MSG);
+
+   brw_inst_set_mask_control(devinfo, inst, BRW_MASK_DISABLE);
+}
+
+
 /**
  * Emit the wait instruction for a barrier
  */