summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Bornecrantz <wallbraker@gmail.com>2009-01-19 02:22:34 +0100
committerJakob Bornecrantz <wallbraker@gmail.com>2009-01-19 02:22:34 +0100
commit353f824379259f899142b106d6f642fbe46207f4 (patch)
tree4760ede8a20eff48a99539795233d71c9001c90c
parente082923af66a2b4c3fa7b3f104930addd8d6ac5b (diff)
i915: Make gem submit commands
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c26
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_context.c1
2 files changed, 22 insertions, 5 deletions
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c b/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
index af5c027748..e83a4c42cd 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
@@ -68,13 +68,10 @@ intel_be_offset_relocation(struct intel_be_batchbuffer *batch,
offset = (unsigned)(batch->base.ptr - batch->base.map);
batch->base.ptr += 4;
-/*
- TODO: Enable this when we submit batch buffers to HW
ret = drm_intel_bo_emit_reloc(bo, pre_add,
batch->bo, offset,
read_domains,
write_domain);
-*/
if (!ret)
batch->base.relocs++;
@@ -87,10 +84,31 @@ intel_be_batchbuffer_flush(struct intel_be_batchbuffer *batch,
struct intel_be_fence **fence)
{
struct i915_batchbuffer *i915 = &batch->base;
+ unsigned used = 0;
+ int ret = 0;
assert(i915_batchbuffer_space(i915) >= 0);
- /* TODO: submit stuff to HW */
+ used = batch->base.ptr - batch->base.map;
+ assert((used & 3) == 0);
+
+ if (used & 4) {
+ ((uint32_t *) batch->base.ptr)[0] = ((0<<29)|(4<<23)); // MI_FLUSH;
+ ((uint32_t *) batch->base.ptr)[1] = 0;
+ ((uint32_t *) batch->base.ptr)[2] = (0xA<<23); // MI_BATCH_BUFFER_END;
+ batch->base.ptr += 12;
+ } else {
+ ((uint32_t *) batch->base.ptr)[0] = ((0<<29)|(4<<23)); // MI_FLUSH;
+ ((uint32_t *) batch->base.ptr)[1] = (0xA<<23); // MI_BATCH_BUFFER_END;
+ batch->base.ptr += 8;
+ }
+
+ used = batch->base.ptr - batch->base.map;
+
+ drm_intel_bo_subdata(batch->bo, 0, used, batch->base.map);
+ ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0);
+
+ assert(ret == 0);
intel_be_batchbuffer_reset(batch);
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_context.c b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
index 92fc2dd767..3e472e1e43 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
@@ -30,7 +30,6 @@ intel_be_batch_reloc(struct i915_winsys *sws,
if (access_flags & I915_BUFFER_ACCESS_READ) {
read = I915_GEM_DOMAIN_SAMPLER |
- I915_GEM_DOMAIN_INSTRUCTION |
I915_GEM_DOMAIN_VERTEX;
}