summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorFredrik Höglund <[email protected]>2011-03-29 19:43:59 +0200
committerJerome Glisse <[email protected]>2011-03-29 16:37:04 -0400
commit948e1eb8e9c166ad5b74abc630d0760768ce78c9 (patch)
tree147111549a95b7406919945ec34546980e99b887 /src/gallium/winsys
parenta99e80d795f7c6aec0e73369a31d1728577b9727 (diff)
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().
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/r600/drm/r600_hw_context.c23
1 files changed, 23 insertions, 0 deletions
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;