[Mesa-dev] [PATCH 1/2] i965: Add Gen8 assembly support for DP Scratch messages.

Kenneth Graunke kenneth at whitecape.org
Wed Feb 5 20:45:20 PST 2014


The new accessors will make it easy to do Gen7-style scratch messages.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/gen8_instruction.c | 23 +++++++++++++++++++++++
 src/mesa/drivers/dri/i965/gen8_instruction.h | 23 +++++++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/gen8_instruction.c b/src/mesa/drivers/dri/i965/gen8_instruction.c
index 476b3a9..1a5d453 100644
--- a/src/mesa/drivers/dri/i965/gen8_instruction.c
+++ b/src/mesa/drivers/dri/i965/gen8_instruction.c
@@ -431,3 +431,26 @@ gen8_set_dp_message(const struct brw_context *brw,
    gen8_set_dp_message_type(inst, msg_type);
    gen8_set_dp_message_control(inst, msg_control);
 }
+
+void
+gen8_set_dp_scratch_message(const struct brw_context *brw,
+                            struct gen8_instruction *inst,
+                            bool write,
+                            bool dword,
+                            bool invalidate_after_read,
+                            unsigned num_regs,
+                            unsigned addr_offset,
+                            unsigned mlen,
+                            unsigned rlen,
+                            bool header_present,
+                            bool end_of_thread)
+{
+   gen8_set_message_descriptor(brw, inst, GEN7_SFID_DATAPORT_DATA_CACHE,
+                               mlen, rlen, header_present, end_of_thread);
+   gen8_set_dp_category(inst, 1); /* Scratch Block Read/Write messages */
+   gen8_set_scratch_read_write(inst, write);
+   gen8_set_scratch_type(inst, dword);
+   gen8_set_scratch_invalidate_after_read(inst, invalidate_after_read);
+   gen8_set_scratch_block_size(inst, ffs(num_regs) - 1);
+   gen8_set_scratch_addr_offset(inst, addr_offset);
+}
diff --git a/src/mesa/drivers/dri/i965/gen8_instruction.h b/src/mesa/drivers/dri/i965/gen8_instruction.h
index 7d8b605..89f2364 100644
--- a/src/mesa/drivers/dri/i965/gen8_instruction.h
+++ b/src/mesa/drivers/dri/i965/gen8_instruction.h
@@ -204,6 +204,17 @@ MD(dp_message_control,  13,   8)
 /** @} */
 
 /**
+ * Scratch message bits:
+ *  @{
+ */
+MD(scratch_read_write,  17,  17) /* 0 = read,  1 = write */
+MD(scratch_type,        16,  16) /* 0 = OWord, 1 = DWord */
+MD(scratch_invalidate_after_read, 15, 15)
+MD(scratch_block_size,  13,  12)
+MD(scratch_addr_offset, 11,   0)
+/** @} */
+
+/**
  * Render Target message function control bits:
  *  @{
  */
@@ -343,6 +354,18 @@ void gen8_set_dp_message(const struct brw_context *brw,
                          bool header_present,
                          bool end_of_thread);
 
+void gen8_set_dp_scratch_message(const struct brw_context *brw,
+                                 struct gen8_instruction *inst,
+                                 bool write,
+                                 bool dword,
+                                 bool invalidate_after_read,
+                                 unsigned num_regs,
+                                 unsigned addr_offset,
+                                 unsigned msg_length,
+                                 unsigned response_length,
+                                 bool header_present,
+                                 bool end_of_thread);
+
 /** Disassemble the instruction. */
 int gen8_disassemble(FILE *file, struct gen8_instruction *inst, int gen);
 
-- 
1.8.4.2



More information about the mesa-dev mailing list