summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2021-03-22 10:39:42 -0400
committerMarge Bot <eric+marge@anholt.net>2021-03-30 15:12:58 +0000
commit0ebc13564afda7f9568e8ec4bdc44cd6a4ded72b (patch)
treeb14b62a7823c6d218763e8730b9a1ee97b5dd4d3
parent4a736677afe568220bff07168d2bead728e03979 (diff)
zink: split fence finish func
one part of this will be used to handle tc mechanics, the other part is for internal use Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9885>
-rw-r--r--src/gallium/drivers/zink/zink_context.c8
-rw-r--r--src/gallium/drivers/zink/zink_fence.c23
-rw-r--r--src/gallium/drivers/zink/zink_fence.h7
3 files changed, 22 insertions, 16 deletions
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index bd359fc43c6..01315d10023 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1890,7 +1890,7 @@ zink_flush(struct pipe_context *pctx,
* unknown at this time why this is the case
*/
if (!ctx->first_frame_done)
- zink_fence_finish(zink_screen(pctx->screen), pctx, fence, PIPE_TIMEOUT_INFINITE);
+ zink_vkfence_wait(zink_screen(pctx->screen), fence, PIPE_TIMEOUT_INFINITE);
ctx->first_frame_done = true;
}
}
@@ -1904,7 +1904,7 @@ zink_maybe_flush_or_stall(struct zink_context *ctx)
flush_batch(ctx);
if (ctx->resource_size >= screen->total_mem / 10 || _mesa_hash_table_num_entries(&ctx->batch_states) > 10) {
- zink_fence_finish(zink_screen(ctx->base.screen), &ctx->base, ctx->last_fence, PIPE_TIMEOUT_INFINITE);
+ zink_vkfence_wait(zink_screen(ctx->base.screen), ctx->last_fence, PIPE_TIMEOUT_INFINITE);
zink_batch_reset_all(ctx);
}
}
@@ -1917,7 +1917,7 @@ zink_fence_wait(struct pipe_context *pctx)
if (ctx->batch.has_work)
pctx->flush(pctx, NULL, PIPE_FLUSH_HINT_FINISH);
if (ctx->last_fence) {
- zink_fence_finish(zink_screen(pctx->screen), pctx, ctx->last_fence, PIPE_TIMEOUT_INFINITE);
+ zink_vkfence_wait(zink_screen(pctx->screen), ctx->last_fence, PIPE_TIMEOUT_INFINITE);
zink_batch_reset_all(ctx);
}
}
@@ -1987,7 +1987,7 @@ zink_check_batch_completion(struct zink_context *ctx, uint32_t batch_id)
}
simple_mtx_unlock(&ctx->batch_mtx);
assert(fence);
- return ctx->base.screen->fence_finish(ctx->base.screen, &ctx->base, (struct pipe_fence_handle*)fence, 0);
+ return zink_vkfence_wait(zink_screen(ctx->base.screen), fence, 0);
}
static void
diff --git a/src/gallium/drivers/zink/zink_fence.c b/src/gallium/drivers/zink/zink_fence.c
index 6d98371bb24..188a049ff21 100644
--- a/src/gallium/drivers/zink/zink_fence.c
+++ b/src/gallium/drivers/zink/zink_fence.c
@@ -104,17 +104,11 @@ fence_reference(struct pipe_screen *pscreen,
}
bool
-zink_fence_finish(struct zink_screen *screen, struct pipe_context *pctx, struct zink_fence *fence,
- uint64_t timeout_ns)
+zink_vkfence_wait(struct zink_screen *screen, struct zink_fence *fence, uint64_t timeout_ns)
{
- if (pctx && fence->deferred_ctx == pctx) {
- zink_context(pctx)->batch.has_work = true;
- /* this must be the current batch */
- pctx->flush(pctx, NULL, 0);
- }
-
if (!fence->submitted)
return true;
+
bool success;
if (timeout_ns)
@@ -130,6 +124,19 @@ zink_fence_finish(struct zink_screen *screen, struct pipe_context *pctx, struct
}
static bool
+zink_fence_finish(struct zink_screen *screen, struct pipe_context *pctx, struct zink_fence *fence,
+ uint64_t timeout_ns)
+{
+ if (pctx && fence->deferred_ctx == pctx) {
+ zink_context(pctx)->batch.has_work = true;
+ /* this must be the current batch */
+ pctx->flush(pctx, NULL, 0);
+ }
+
+ return zink_vkfence_wait(screen, fence, timeout_ns);
+}
+
+static bool
fence_finish(struct pipe_screen *pscreen, struct pipe_context *pctx,
struct pipe_fence_handle *pfence, uint64_t timeout_ns)
{
diff --git a/src/gallium/drivers/zink/zink_fence.h b/src/gallium/drivers/zink/zink_fence.h
index 07d7dac7254..ba59de495f7 100644
--- a/src/gallium/drivers/zink/zink_fence.h
+++ b/src/gallium/drivers/zink/zink_fence.h
@@ -60,16 +60,15 @@ zink_fence_reference(struct zink_screen *screen,
struct zink_fence **ptr,
struct zink_fence *fence);
-bool
-zink_fence_finish(struct zink_screen *screen, struct pipe_context *pctx, struct zink_fence *fence,
- uint64_t timeout_ns);
-
void
zink_fence_server_sync(struct pipe_context *pctx, struct pipe_fence_handle *pfence);
void
zink_screen_fence_init(struct pipe_screen *pscreen);
+bool
+zink_vkfence_wait(struct zink_screen *screen, struct zink_fence *fence, uint64_t timeout_ns);
+
void
zink_fence_clear_resources(struct zink_screen *screen, struct zink_fence *fence);
#endif