zink: move semaphore reset handling to submit

this is the earliest place the batch_id is available now, so check it
here since ctx->curr_batch isn't actually a thing anymore

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13247>
This commit is contained in:
Mike Blumenkrantz 2021-10-06 09:18:56 -04:00 committed by Marge Bot
parent df1e18fb5f
commit d1e0a9a4ff
1 changed files with 7 additions and 9 deletions

View File

@ -288,15 +288,6 @@ get_batch_state(struct zink_context *ctx, struct zink_batch *batch)
void
zink_reset_batch(struct zink_context *ctx, struct zink_batch *batch)
{
struct zink_screen *screen = zink_screen(ctx->base.screen);
if (ctx->have_timelines && screen->last_finished > ctx->curr_batch && ctx->curr_batch == 1) {
if (!zink_screen_init_semaphore(screen)) {
debug_printf("timeline init failed, things are about to go dramatically wrong.");
ctx->have_timelines = false;
}
}
batch->state = get_batch_state(ctx, batch);
assert(batch->state);
@ -360,6 +351,13 @@ submit_queue(void *data, void *gdata, int thread_index)
bs->usage.unflushed = false;
simple_mtx_unlock(&ctx->batch_mtx);
if (ctx->have_timelines && screen->last_finished > bs->fence.batch_id && bs->fence.batch_id == 1) {
if (!zink_screen_init_semaphore(screen)) {
debug_printf("timeline init failed, things are about to go dramatically wrong.");
ctx->have_timelines = false;
}
}
VKSCR(ResetFences)(screen->dev, 1, &bs->fence.fence);
uint64_t batch_id = bs->fence.batch_id;