From 948e1eb8e9c166ad5b74abc630d0760768ce78c9 Mon Sep 17 00:00:00 2001 From: Fredrik Höglund Date: Tue, 29 Mar 2011 19:43:59 +0200 Subject: r600g: implement the pipe_screen fence functions v2: Allocate the fences from a single shared buffer object. v3: Allocate the r600_fence structs in blocks of 16. Spin a few times before calling sched_yield in r600_fence_finish(). --- src/gallium/winsys/r600/drm/r600_hw_context.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/gallium/winsys/r600') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index a7c21784e51..48bce819b81 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -1188,6 +1188,29 @@ void r600_context_flush(struct r600_context *ctx) } } +void r600_context_emit_fence(struct r600_context *ctx, struct r600_bo *fence_bo, unsigned offset, unsigned value) +{ + unsigned ndwords = 10; + + if (((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) || + (ctx->creloc >= (ctx->nreloc - 1))) { + /* need to flush */ + r600_context_flush(ctx); + } + + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0, 0); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | EVENT_INDEX(4); + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE_EOP, 4, 0); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT) | EVENT_INDEX(5); + ctx->pm4[ctx->pm4_cdwords++] = offset << 2; /* ADDRESS_LO */ + ctx->pm4[ctx->pm4_cdwords++] = (1 << 29) | (0 << 24); /* DATA_SEL | INT_EN | ADDRESS_HI */ + ctx->pm4[ctx->pm4_cdwords++] = value; /* DATA_LO */ + ctx->pm4[ctx->pm4_cdwords++] = 0; /* DATA_HI */ + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], fence_bo); +} + void r600_context_dump_bof(struct r600_context *ctx, const char *file) { bof_t *bcs, *blob, *array, *bo, *size, *handle, *device_id, *root; -- cgit v1.2.3