i965: Add 'wait' instruction support
authorZhenyu Wang <zhenyuw@linux.intel.com>
Fri, 25 Jun 2010 08:05:24 +0000 (16:05 +0800)
committerEric Anholt <eric@anholt.net>
Thu, 8 Jul 2010 19:50:53 +0000 (12:50 -0700)
When EU executes 'wait' instruction, it stalls and sets notification
register state. Host can issue MMIO write to clear notification
register state to allow EU continue on executing again.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
src/mesa/drivers/dri/i965/brw_eu.h
src/mesa/drivers/dri/i965/brw_eu_emit.c

index a6fcd832f7daf9600b2b8bfe3085852287086e11..3a0100024cf750135e26556d6abe43f7e106e0db 100644 (file)
@@ -520,6 +520,20 @@ static INLINE struct brw_reg brw_acc_reg( void )
                       0);
 }
 
+static INLINE struct brw_reg brw_notification_1_reg(void)
+{
+
+   return brw_reg(BRW_ARCHITECTURE_REGISTER_FILE,
+                 BRW_ARF_NOTIFICATION_COUNT,
+                 1,
+                 BRW_REGISTER_TYPE_UD,
+                 BRW_VERTICAL_STRIDE_0,
+                 BRW_WIDTH_1,
+                 BRW_HORIZONTAL_STRIDE_0,
+                 BRW_SWIZZLE_XXXX,
+                 WRITEMASK_X);
+}
+
 
 static INLINE struct brw_reg brw_flag_reg( void )
 {
@@ -919,6 +933,8 @@ void brw_land_fwd_jump(struct brw_compile *p,
 
 void brw_NOP(struct brw_compile *p);
 
+void brw_WAIT(struct brw_compile *p);
+
 /* Special case: there is never a destination, execution size will be
  * taken from src0:
  */
index 34dfe10cb930f429a280ed4b8b0c7868bccbc3ef..10e9ebc3b0ecddaaec24717ba107bc0b6071d4c9 100644 (file)
@@ -906,6 +906,20 @@ void brw_CMP(struct brw_compile *p,
    }
 }
 
+/* Issue 'wait' instruction for n1, host could program MMIO
+   to wake up thread. */
+void brw_WAIT (struct brw_compile *p)
+{
+   struct brw_instruction *insn = next_insn(p, BRW_OPCODE_WAIT);
+   struct brw_reg src = brw_notification_1_reg();
+
+   brw_set_dest(insn, src);
+   brw_set_src0(insn, src);
+   brw_set_src1(insn, brw_null_reg());
+   insn->header.execution_size = 0; /* must */
+   insn->header.predicate_control = 0;
+   insn->header.compression_control = 0;
+}
 
 
 /***********************************************************************