diff options
author | Jordan Justen <[email protected]> | 2016-04-19 09:38:50 -0700 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2016-05-04 11:23:17 -0700 |
commit | 357ff9135973a43233c2fe7e758a1840b906af39 (patch) | |
tree | f4b957175c1d117b48115bb01ec90bdb026da826 | |
parent | 959e1e9e6668f9b0e7c480febcaab1e2995fb54b (diff) |
i965/gen6+: Add load register immediate helper functions
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_batchbuffer.c | 32 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index ba42aa95b09..6625f9dee70 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1452,6 +1452,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 33927af2a6a..98b94854c27 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 |