summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_batchbuffer.c
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2016-04-18 16:19:34 -0700
committerJordan Justen <[email protected]>2016-05-04 11:23:17 -0700
commitaad14a22cb220aeda1337ed6f72409ad3ef64dcf (patch)
tree0f9acad87481cbfdbb25765032ecca2bed31b0d8 /src/mesa/drivers/dri/i965/intel_batchbuffer.c
parentac0bbf9ef39b14e53045431ef7817a5b37807328 (diff)
i965/gen6+: Add support for storing immediate data into a buffer
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_batchbuffer.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_batchbuffer.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 03a31b69184..334be0c427d 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -600,3 +600,48 @@ brw_store_register_mem64(struct brw_context *brw,
ADVANCE_BATCH();
}
}
+
+/*
+ * Write 32-bits of immediate data to a GPU memory buffer.
+ */
+void
+brw_store_data_imm32(struct brw_context *brw, drm_intel_bo *bo,
+ uint32_t offset, uint32_t imm)
+{
+ const int len = brw->gen >= 8 ? 4 : 3;
+ assert(brw->gen >= 6);
+
+ BEGIN_BATCH(len);
+ OUT_BATCH(MI_STORE_DATA_IMM | (len - 2));
+ if (len > 3)
+ OUT_RELOC64(bo, I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
+ offset);
+ else
+ OUT_RELOC(bo, I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
+ offset);
+ OUT_BATCH(imm);
+ ADVANCE_BATCH();
+}
+
+/*
+ * Write 64-bits of immediate data to a GPU memory buffer.
+ */
+void
+brw_store_data_imm64(struct brw_context *brw, drm_intel_bo *bo,
+ uint32_t offset, uint64_t imm)
+{
+ const int len = brw->gen >= 8 ? 5 : 4;
+ assert(brw->gen >= 6);
+
+ BEGIN_BATCH(len);
+ OUT_BATCH(MI_STORE_DATA_IMM | (len - 2));
+ if (len > 4)
+ OUT_RELOC64(bo, I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
+ offset);
+ else
+ OUT_RELOC(bo, I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
+ offset);
+ OUT_BATCH(imm & 0xffffffffu);
+ OUT_BATCH(imm >> 32);
+ ADVANCE_BATCH();
+}