diff options
author | Bruce Cherniak <[email protected]> | 2016-12-12 19:24:59 -0600 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2016-12-16 11:29:02 -0600 |
commit | 79b66ec05e2745e5d19838dcfd83f905afa82b6c (patch) | |
tree | 5893ed8d0e3dc45248e2a4b14be64f91ec33b753 /src/gallium/drivers/swr/swr_fence.cpp | |
parent | 3421b3f5a35f5cf29934f74c30850c4d04ba0237 (diff) |
swr: Implement fence attached work queues for deferred deletion.
Work can now be added to fences and triggered by fence completion. This
allows for deferred resource deletion, and other asynchronous tasks.
Reviewed-by: George Kyriazis <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_fence.cpp')
-rw-r--r-- | src/gallium/drivers/swr/swr_fence.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gallium/drivers/swr/swr_fence.cpp b/src/gallium/drivers/swr/swr_fence.cpp index 7fe24700bfa..c73bbbf2708 100644 --- a/src/gallium/drivers/swr/swr_fence.cpp +++ b/src/gallium/drivers/swr/swr_fence.cpp @@ -38,10 +38,13 @@ * to SwrSync call. */ static void -swr_sync_cb(uint64_t userData, uint64_t userData2, uint64_t userData3) +swr_fence_cb(uint64_t userData, uint64_t userData2, uint64_t userData3) { struct swr_fence *fence = (struct swr_fence *)userData; + /* Complete all work attached to the fence */ + swr_fence_do_work(fence); + /* Correct value is in SwrSync data, and not the fence write field. */ fence->read = userData2; } @@ -56,7 +59,7 @@ swr_fence_submit(struct swr_context *ctx, struct pipe_fence_handle *fh) fence->write++; fence->pending = TRUE; - SwrSync(ctx->swrContext, swr_sync_cb, (uint64_t)fence, fence->write, 0); + SwrSync(ctx->swrContext, swr_fence_cb, (uint64_t)fence, fence->write, 0); } /* @@ -72,6 +75,7 @@ swr_fence_create() pipe_reference_init(&fence->reference, 1); fence->id = fence_id++; + fence->work.tail = &fence->work.head; return (struct pipe_fence_handle *)fence; } @@ -80,6 +84,8 @@ swr_fence_create() static void swr_fence_destroy(struct swr_fence *fence) { + /* Complete any work left if fence was not submitted */ + swr_fence_do_work(fence); FREE(fence); } @@ -101,8 +107,10 @@ swr_fence_reference(struct pipe_screen *screen, old = NULL; } - if (pipe_reference(&old->reference, &fence->reference)) + if (pipe_reference(&old->reference, &fence->reference)) { + swr_fence_finish(screen, NULL, (struct pipe_fence_handle *) old, 0); swr_fence_destroy(old); + } } |