summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2014-08-27 11:33:25 -0700
committerJordan Justen <jordan.l.justen@intel.com>2015-05-02 00:34:28 -0700
commit2a4df9c524f05e2ee3d01ba03f21310b23f8e395 (patch)
tree809437a470ef8b8f949e73f10881aa5460c542b5 /src/mesa/drivers/dri/i965/brw_fs_generator.cpp
parentdff4a426766f08a9073ab235f74d96b4b23c6981 (diff)
downloadexternal_mesa3d-2a4df9c524f05e2ee3d01ba03f21310b23f8e395.zip
external_mesa3d-2a4df9c524f05e2ee3d01ba03f21310b23f8e395.tar.gz
external_mesa3d-2a4df9c524f05e2ee3d01ba03f21310b23f8e395.tar.bz2
i965/cs: Add generator support for CS_OPCODE_CS_TERMINATE
v2: * Don't rely on brw_eu* to generate the send instruction. We now generate the send here, and drop the "i965/cs: Add support for the SEND message that terminates a CS thread" brw_eu* patch. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_generator.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_generator.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 3bfee7e..9ddba3a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -370,6 +370,37 @@ fs_generator::generate_urb_write(fs_inst *inst, struct brw_reg payload)
}
void
+fs_generator::generate_cs_terminate(fs_inst *inst, struct brw_reg payload)
+{
+ struct brw_inst *insn;
+
+ insn = brw_next_insn(p, BRW_OPCODE_SEND);
+
+ brw_set_dest(p, insn, brw_null_reg());
+ brw_set_src0(p, insn, payload);
+ brw_set_src1(p, insn, brw_imm_d(0));
+
+ /* Terminate a compute shader by sending a message to the thread spawner.
+ */
+ brw_inst_set_sfid(devinfo, insn, BRW_SFID_THREAD_SPAWNER);
+ brw_inst_set_mlen(devinfo, insn, 1);
+ brw_inst_set_rlen(devinfo, insn, 0);
+ brw_inst_set_eot(devinfo, insn, inst->eot);
+ brw_inst_set_header_present(devinfo, insn, false);
+
+ brw_inst_set_ts_opcode(devinfo, insn, 0); /* Dereference resource */
+ brw_inst_set_ts_request_type(devinfo, insn, 0); /* Root thread */
+
+ /* Note that even though the thread has a URB resource associated with it,
+ * we set the "do not dereference URB" bit, because the URB resource is
+ * managed by the fixed-function unit, so it will free it automatically.
+ */
+ brw_inst_set_ts_resource_select(devinfo, insn, 1); /* Do not dereference URB */
+
+ brw_inst_set_mask_control(devinfo, insn, BRW_MASK_DISABLE);
+}
+
+void
fs_generator::generate_blorp_fb_write(fs_inst *inst)
{
brw_fb_WRITE(p,
@@ -2074,6 +2105,10 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
GEN7_PIXEL_INTERPOLATOR_LOC_PER_SLOT_OFFSET);
break;
+ case CS_OPCODE_CS_TERMINATE:
+ generate_cs_terminate(inst, src[0]);
+ break;
+
default:
unreachable("Unsupported opcode");