i915: Make gem submit commands
authorJakob Bornecrantz <wallbraker@gmail.com>
Mon, 19 Jan 2009 01:22:34 +0000 (02:22 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Mon, 19 Jan 2009 01:22:34 +0000 (02:22 +0100)
src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
src/gallium/winsys/drm/intel/gem/intel_be_context.c

index af5c0277484bf9246839bfdf4ee0f34a4367937f..e83a4c42cd039cc41b044d7ccf559027c1e58bf1 100644 (file)
@@ -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);
 
index 92fc2dd76796571bd5e3168d6306830ab967ee51..3e472e1e433cb29a82a5b6d2eff501b841943cba 100644 (file)
@@ -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;
        }