i965/eu: Add codegen support for the Gen9+ render target read message.
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 22 Jul 2016 02:13:55 +0000 (19:13 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 26 Aug 2016 01:36:08 +0000 (18:36 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_eu.h
src/mesa/drivers/dri/i965/brw_eu_emit.c

index f2994cb8ebd0930b2b0d740dd6ec8dbc786fdf31..222ff8fdc3bb81b531ecc0350478c5c3485b08c9 100644 (file)
@@ -1777,6 +1777,10 @@ enum brw_message_target {
 #define HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP_SIMD4X2             12
 #define HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_WRITE                   13
 
+/* GEN9 */
+#define GEN9_DATAPORT_RC_RENDER_TARGET_WRITE                        12
+#define GEN9_DATAPORT_RC_RENDER_TARGET_READ                         13
+
 /* Dataport special binding table indices: */
 #define BRW_BTI_STATELESS                255
 #define GEN7_BTI_SLM                     254
index 09f51dbffbd0c5747dae336707658b59d4ddc01d..aeb1a767b921d234cd3f9d6b9673199636946edd 100644 (file)
@@ -292,6 +292,14 @@ void brw_fb_WRITE(struct brw_codegen *p,
                   bool last_render_target,
                   bool header_present);
 
+brw_inst *gen9_fb_READ(struct brw_codegen *p,
+                       struct brw_reg dst,
+                       struct brw_reg payload,
+                       unsigned binding_table_index,
+                       unsigned msg_length,
+                       unsigned response_length,
+                       bool per_sample);
+
 void brw_SAMPLE(struct brw_codegen *p,
                struct brw_reg dest,
                unsigned msg_reg_nr,
index 8850173513f4cc19a04ee266e25f2823357c063f..31fe040fe02293a18d2c9fede103356f42b6e095 100644 (file)
@@ -2408,6 +2408,34 @@ void brw_fb_WRITE(struct brw_codegen *p,
                            0 /* send_commit_msg */);
 }
 
+brw_inst *
+gen9_fb_READ(struct brw_codegen *p,
+             struct brw_reg dst,
+             struct brw_reg payload,
+             unsigned binding_table_index,
+             unsigned msg_length,
+             unsigned response_length,
+             bool per_sample)
+{
+   const struct brw_device_info *devinfo = p->devinfo;
+   assert(devinfo->gen >= 9);
+   const unsigned msg_subtype =
+      brw_inst_exec_size(devinfo, p->current) == BRW_EXECUTE_16 ? 0 : 1;
+   brw_inst *insn = next_insn(p, BRW_OPCODE_SENDC);
+
+   brw_set_dest(p, insn, dst);
+   brw_set_src0(p, insn, payload);
+   brw_set_dp_read_message(p, insn, binding_table_index,
+                           per_sample << 5 | msg_subtype,
+                           GEN9_DATAPORT_RC_RENDER_TARGET_READ,
+                           BRW_DATAPORT_READ_TARGET_RENDER_CACHE,
+                           msg_length, true /* header_present */,
+                           response_length);
+   brw_inst_set_rt_slot_group(devinfo, insn,
+                              brw_inst_qtr_control(devinfo, p->current) / 2);
+
+   return insn;
+}
 
 /**
  * Texture sample instruction.