summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-11-09 11:38:14 -0800
committerEric Anholt <[email protected]>2012-12-04 16:27:53 -0800
commit8f05b2f2b022cb80c9e49d2ceb212d3b4f23905b (patch)
treea93e3400f1b3ee81b9981fdee16359769630460f /src/mesa/drivers/dri
parentfb6d901ad2589b393b3ed2f53e735c281af0cf50 (diff)
i965/gen7: Add some safety checks for send messages from GRFs.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_emit.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index eada9d99e96..72fb5c5ae2c 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -236,11 +236,26 @@ void
brw_set_src0(struct brw_compile *p, struct brw_instruction *insn,
struct brw_reg reg)
{
+ struct brw_context *brw = p->brw;
+ struct intel_context *intel = &brw->intel;
+
if (reg.type != BRW_ARCHITECTURE_REGISTER_FILE)
assert(reg.nr < 128);
gen7_convert_mrf_to_grf(p, &reg);
+ if (intel->gen >= 6 && (insn->header.opcode == BRW_OPCODE_SEND ||
+ insn->header.opcode == BRW_OPCODE_SENDC)) {
+ /* Any source modifiers or regions will be ignored, since this just
+ * identifies the MRF/GRF to start reading the message contents from.
+ * Check for some likely failures.
+ */
+ assert(!reg.negate);
+ assert(!reg.abs);
+ assert(reg.address_mode == BRW_ADDRESS_DIRECT);
+ assert(reg.vstride != BRW_VERTICAL_STRIDE_0);
+ }
+
validate_reg(insn, reg);
insn->bits1.da1.src0_reg_file = reg.file;