From 143da5f2e4b821da792c62d244631ca3abc1389d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 12 May 2023 12:11:12 -0400 Subject: [PATCH] zink: move zink_batch_state::submit_count to zink_batch_usage no functional changes Part-of: --- src/gallium/drivers/zink/zink_batch.c | 4 ++-- src/gallium/drivers/zink/zink_context.c | 2 +- src/gallium/drivers/zink/zink_fence.c | 2 +- src/gallium/drivers/zink/zink_types.h | 5 ++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 3ba9017bc80..ff77b7fc0d9 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -167,7 +167,7 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs) bs->has_barriers = false; if (bs->fence.batch_id) zink_screen_update_last_finished(screen, bs->fence.batch_id); - bs->submit_count++; + bs->usage.submit_count++; bs->fence.batch_id = 0; bs->usage.usage = 0; bs->next = NULL; @@ -608,7 +608,7 @@ submit_queue(void *data, void *gdata, int thread_index) bs->is_device_lost = true; } simple_mtx_unlock(&screen->queue_lock); - bs->submit_count++; + bs->usage.submit_count++; end: cnd_broadcast(&bs->usage.flush); diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 455655a3eac..5c17250e36b 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -3626,7 +3626,7 @@ zink_flush(struct pipe_context *pctx, tc_driver_internal_flush_notify(ctx->tc); } else { fence = &batch->state->fence; - submit_count = batch->state->submit_count; + submit_count = batch->state->usage.submit_count; if (deferred && !(flags & PIPE_FLUSH_FENCE_FD) && pfence) deferred_fence = true; else diff --git a/src/gallium/drivers/zink/zink_fence.c b/src/gallium/drivers/zink/zink_fence.c index 33ad8322db6..5b7c9321fad 100644 --- a/src/gallium/drivers/zink/zink_fence.c +++ b/src/gallium/drivers/zink/zink_fence.c @@ -178,7 +178,7 @@ zink_fence_finish(struct zink_screen *screen, struct pipe_context *pctx, struct struct zink_fence *fence = mfence->fence; - unsigned submit_diff = zink_batch_state(mfence->fence)->submit_count - mfence->submit_count; + unsigned submit_diff = zink_batch_state(mfence->fence)->usage.submit_count - mfence->submit_count; /* this batch is known to have finished because it has been submitted more than 1 time * since the tc fence last saw it */ diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 483bc3af160..818aaf3e5de 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -542,6 +542,8 @@ struct zink_batch_descriptor_data { */ struct zink_batch_usage { uint32_t usage; + /* this is a monotonic int used to disambiguate internal fences from their tc fence references */ + uint32_t submit_count; cnd_t flush; mtx_t mtx; bool unflushed; @@ -605,9 +607,6 @@ struct zink_batch_state { VkDeviceSize resource_size; - /* this is a monotonic int used to disambiguate internal fences from their tc fence references */ - unsigned submit_count; - bool is_device_lost; bool has_barriers; };