[Mesa-dev] [PATCH 7/9] i965/gen6+: Add load register immediate helper functions
Jordan Justen
jordan.l.justen at intel.com
Fri Apr 22 05:18:47 UTC 2016
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/mesa/drivers/dri/i965/brw_context.h | 4 ++++
src/mesa/drivers/dri/i965/intel_batchbuffer.c | 32 +++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 921f462..5a4e42b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1450,6 +1450,10 @@ void brw_store_register_mem32(struct brw_context *brw,
drm_intel_bo *bo, uint32_t reg, uint32_t offset);
void brw_store_register_mem64(struct brw_context *brw,
drm_intel_bo *bo, uint32_t reg, uint32_t offset);
+void brw_load_register_imm32(struct brw_context *brw,
+ uint32_t reg, uint32_t imm);
+void brw_load_register_imm64(struct brw_context *brw,
+ uint32_t reg, uint64_t imm);
void brw_load_register_reg(struct brw_context *brw, uint32_t src,
uint32_t dest);
void brw_store_data_imm32(struct brw_context *brw, drm_intel_bo *bo,
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 33927af..98b9485 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -602,6 +602,38 @@ brw_store_register_mem64(struct brw_context *brw,
}
/*
+ * Write a 32-bit register using immediate data.
+ */
+void
+brw_load_register_imm32(struct brw_context *brw, uint32_t reg, uint32_t imm)
+{
+ assert(brw->gen >= 6);
+
+ BEGIN_BATCH(3);
+ OUT_BATCH(MI_LOAD_REGISTER_IMM | (3 - 2));
+ OUT_BATCH(reg);
+ OUT_BATCH(imm);
+ ADVANCE_BATCH();
+}
+
+/*
+ * Write a 64-bit register using immediate data.
+ */
+void
+brw_load_register_imm64(struct brw_context *brw, uint32_t reg, uint64_t imm)
+{
+ assert(brw->gen >= 6);
+
+ BEGIN_BATCH(5);
+ OUT_BATCH(MI_LOAD_REGISTER_IMM | (5 - 2));
+ OUT_BATCH(reg);
+ OUT_BATCH(imm & 0xffffffff);
+ OUT_BATCH(reg + 4);
+ OUT_BATCH(imm >> 32);
+ ADVANCE_BATCH();
+}
+
+/*
* Copies a 32-bit register.
*/
void
--
2.8.0.rc3
More information about the mesa-dev
mailing list