zink: call clear() instead of reset() for batch states on context destroy

this avoids (future) issues with desync due to long-lived fences which
may not yet have completed at the time the context is destroyed

upcoming changes will not allow resetting uncompleted batch states, so
this avoids any sort of conflict as such changes are introduced

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9765>
This commit is contained in:
Mike Blumenkrantz
2020-11-08 13:02:35 -05:00
committed by Marge Bot
parent e89f674c83
commit fcf0eab8a0

View File

@@ -302,16 +302,16 @@ zink_context_destroy(struct pipe_context *pctx)
for (unsigned i = 0; i < ZINK_QUEUE_ANY; i++) { for (unsigned i = 0; i < ZINK_QUEUE_ANY; i++) {
struct zink_fence *fence = zink_fence(&ctx->batches[i].state); struct zink_fence *fence = zink_fence(&ctx->batches[i].state);
zink_reset_batch_state(ctx, ctx->batches[i].state); zink_clear_batch_state(ctx, ctx->batches[i].state);
zink_fence_reference(zink_screen(pctx->screen), &fence, NULL); zink_fence_reference(zink_screen(pctx->screen), &fence, NULL);
hash_table_foreach(&ctx->batch_states[i], entry) { hash_table_foreach(&ctx->batch_states[i], entry) {
fence = entry->data; fence = entry->data;
zink_reset_batch_state(ctx, entry->data); zink_clear_batch_state(ctx, entry->data);
zink_fence_reference(zink_screen(pctx->screen), &fence, NULL); zink_fence_reference(zink_screen(pctx->screen), &fence, NULL);
} }
util_dynarray_foreach(&ctx->free_batch_states[i], struct zink_batch_state*, bs) { util_dynarray_foreach(&ctx->free_batch_states[i], struct zink_batch_state*, bs) {
fence = zink_fence(*bs); fence = zink_fence(*bs);
zink_reset_batch_state(ctx, *bs); zink_clear_batch_state(ctx, *bs);
zink_fence_reference(zink_screen(pctx->screen), &fence, NULL); zink_fence_reference(zink_screen(pctx->screen), &fence, NULL);
} }
} }