summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-06-09 12:36:55 -0700
committerKenneth Graunke <[email protected]>2016-06-24 15:03:55 -0700
commitc4a6b0d2d222667944f78a7688936534b2be0e96 (patch)
tree35ffa7e349a2938b63e4a853262c81e623c1811e
parent192813e50ee8888a9012f5adce3003d0ca2aee22 (diff)
i965: Validate a few SEND-from-GRF requirements.
We recently had a mistake where we emitted SEND instructions with EOT set, but from g107 rather than g112-g127. Adding validation code should prevent these sorts of problems from slipping back in. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_validate.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_eu_validate.c b/src/mesa/drivers/dri/i965/brw_eu_validate.c
index dbf75e4ef35..15fc25b126a 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_validate.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_validate.c
@@ -68,6 +68,12 @@ src1_is_null(const struct brw_device_info *devinfo, const brw_inst *inst)
brw_inst_src1_da_reg_nr(devinfo, inst) == BRW_ARF_NULL;
}
+static bool
+src0_is_grf(const struct brw_device_info *devinfo, const brw_inst *inst)
+{
+ return brw_inst_src0_reg_file(devinfo, inst) == BRW_GENERAL_REGISTER_FILE;
+}
+
static unsigned
num_sources_from_inst(const struct brw_device_info *devinfo,
const brw_inst *inst)
@@ -157,6 +163,18 @@ brw_validate_instructions(const struct brw_codegen *p, int start_offset,
ERROR_IF(is_unsupported_inst(devinfo, inst),
"Instruction not supported on this Gen");
+ if (brw_inst_opcode(devinfo, inst) == BRW_OPCODE_SEND) {
+ ERROR_IF(brw_inst_src0_address_mode(devinfo, inst) !=
+ BRW_ADDRESS_DIRECT, "send must use direct addressing");
+
+ if (devinfo->gen >= 7) {
+ ERROR_IF(!src0_is_grf(devinfo, inst), "send from non-GRF");
+ ERROR_IF(brw_inst_eot(devinfo, inst) &&
+ brw_inst_src0_da_reg_nr(devinfo, inst) < 112,
+ "send with EOT must use g112-g127");
+ }
+ }
+
if (error_msg.str && annotation) {
annotation_insert_error(annotation, src_offset, error_msg.str);
}