intel/fs: Pull FB write implied headers from src[0]
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 18 May 2018 01:47:19 +0000 (18:47 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 28 Jun 2018 20:19:38 +0000 (13:19 -0700)
Now that we have the implied header in src[0] for tracking purposes, we
may as well use it in the generator.  This makes things a tiny bit more
general.

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/intel/compiler/brw_fs_generator.cpp

index 09839d0b4dacebde4eb519175bd235f390eceb34..f72139d43c8df0535330374ee6c37b1de892f097 100644 (file)
@@ -267,7 +267,8 @@ fs_generator::fire_fb_write(fs_inst *inst,
       brw_set_default_mask_control(p, BRW_MASK_DISABLE);
       brw_set_default_predicate_control(p, BRW_PREDICATE_NONE);
       brw_set_default_compression_control(p, BRW_COMPRESSION_NONE);
-      brw_MOV(p, offset(payload, 1), brw_vec8_grf(1, 0));
+      brw_MOV(p, offset(retype(payload, BRW_REGISTER_TYPE_UD), 1),
+              offset(retype(implied_header, BRW_REGISTER_TYPE_UD), 1));
       brw_pop_insn_state(p);
    }
 
@@ -291,7 +292,7 @@ fs_generator::fire_fb_write(fs_inst *inst,
 
    brw_fb_WRITE(p,
                 payload,
-                implied_header,
+                retype(implied_header, BRW_REGISTER_TYPE_UW),
                 msg_control,
                 surf_index,
                 nr,
@@ -308,12 +309,14 @@ fs_generator::generate_fb_write(fs_inst *inst, struct brw_reg payload)
 {
    struct brw_wm_prog_data *prog_data = brw_wm_prog_data(this->prog_data);
    const brw_wm_prog_key * const key = (brw_wm_prog_key * const) this->key;
-   struct brw_reg implied_header;
 
    if (devinfo->gen < 8 && !devinfo->is_haswell) {
       brw_set_default_predicate_control(p, BRW_PREDICATE_NONE);
    }
 
+   const struct brw_reg implied_header =
+      devinfo->gen < 6 ? payload : brw_null_reg();
+
    if (inst->base_mrf >= 0)
       payload = brw_message_reg(inst->base_mrf);
 
@@ -375,15 +378,9 @@ fs_generator::generate_fb_write(fs_inst *inst, struct brw_reg payload)
                    vec1(retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD)),
                    brw_imm_ud(0x1 << 14));
          }
-
-        implied_header = brw_null_reg();
-      } else {
-        implied_header = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW);
       }
 
       brw_pop_insn_state(p);
-   } else {
-      implied_header = brw_null_reg();
    }
 
    if (!runtime_check_aads_emit) {