static int i915_sw_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch, struct i915_winsys_buffer *buffer, enum i915_winsys_buffer_usage usage, unsigned pre_add, boolean fenced) { struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch); int ret = 0; if (usage == I915_USAGE_SAMPLER) { } else if (usage == I915_USAGE_RENDER) { } else if (usage == I915_USAGE_2D_TARGET) { } else if (usage == I915_USAGE_2D_SOURCE) { } else if (usage == I915_USAGE_VERTEX) { } else { assert(0); return -1; } ((uint32_t*)batch->base.ptr)[0] = 0; batch->base.ptr += 4; if (!ret) batch->base.relocs++; return ret; }
static void i915_sw_batchbuffer_destroy(struct i915_winsys_batchbuffer *ibatch) { struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch); FREE(batch->base.map); FREE(batch); }
static void i915_sw_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch, struct pipe_fence_handle **fence) { struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch); unsigned used = 0; int i; assert(i915_winsys_batchbuffer_space(ibatch) >= 0); used = batch->base.ptr - batch->base.map; assert((used & 3) == 0); #ifdef INTEL_ALWAYS_FLUSH /* MI_FLUSH | FLUSH_MAP_CACHE */ i915_winsys_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0)); used += 4; #endif if ((used & 4) == 0) { /* MI_NOOP */ i915_winsys_batchbuffer_dword(ibatch, 0); } /* MI_BATCH_BUFFER_END */ i915_winsys_batchbuffer_dword(ibatch, (0xA<<23)); used = batch->base.ptr - batch->base.map; assert((used & 4) == 0); if (i915_sw_winsys(ibatch->iws)->dump_cmd) { unsigned *ptr = (unsigned *)batch->base.map; debug_printf("%s:\n", __func__); for (i = 0; i < used / 4; i++, ptr++) { debug_printf("\t%08x: %08x\n", i*4, *ptr); } } if (fence) { ibatch->iws->fence_reference(ibatch->iws, fence, NULL); (*fence) = i915_sw_fence_create(); } i915_sw_batchbuffer_reset(batch); }
static void i915_sw_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch, struct pipe_fence_handle **fence) { struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch); unsigned used = 0; assert(i915_winsys_batchbuffer_space(ibatch) >= 0); used = batch->base.ptr - batch->base.map; assert((used & 3) == 0); #ifdef INTEL_ALWAYS_FLUSH /* MI_FLUSH | FLUSH_MAP_CACHE */ i915_winsys_batchbuffer_dword_unchecked(ibatch, (0x4<<23)|(1<<0)); used += 4; #endif if ((used & 4) == 0) { /* MI_NOOP */ i915_winsys_batchbuffer_dword_unchecked(ibatch, 0); } /* MI_BATCH_BUFFER_END */ i915_winsys_batchbuffer_dword_unchecked(ibatch, (0xA<<23)); used = batch->base.ptr - batch->base.map; assert((used & 4) == 0); if (i915_sw_winsys(ibatch->iws)->dump_cmd) { i915_dump_batchbuffer(ibatch); } if (fence) { ibatch->iws->fence_reference(ibatch->iws, fence, NULL); (*fence) = i915_sw_fence_create(); } i915_sw_batchbuffer_reset(batch); }