Module: Mesa Branch: master Commit: 820d272a21fb90fbc1b414653ca924208d83d576 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=820d272a21fb90fbc1b414653ca924208d83d576
Author: Erik Faye-Lund <[email protected]> Date: Tue Dec 15 10:33:58 2020 +0100 zink: factor out zink_batch_release-helper This will be useful for making sure everything has gotten cleaned up properly. Reviewed-By: Mike Blumenkrantz <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099> --- src/gallium/drivers/zink/zink_batch.c | 26 ++++++++++++++++---------- src/gallium/drivers/zink/zink_batch.h | 5 +++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 33e69b5665d..d7fc1220360 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -13,17 +13,9 @@ #include "util/u_debug.h" #include "util/set.h" -static void -reset_batch(struct zink_context *ctx, struct zink_batch *batch) +void +zink_batch_release(struct zink_screen *screen, struct zink_batch *batch) { - struct zink_screen *screen = zink_screen(ctx->base.screen); - batch->descs_left = ZINK_BATCH_DESC_SIZE; - - // cmdbuf hasn't been submitted before - if (!batch->fence) - return; - - zink_fence_finish(screen, batch->fence, PIPE_TIMEOUT_INFINITE); zink_fence_reference(screen, &batch->fence, NULL); zink_render_pass_reference(screen, &batch->rp, NULL); @@ -52,6 +44,20 @@ reset_batch(struct zink_context *ctx, struct zink_batch *batch) vkDestroySampler(screen->dev, *samp, NULL); } util_dynarray_clear(&batch->zombie_samplers); +} + +static void +reset_batch(struct zink_context *ctx, struct zink_batch *batch) +{ + struct zink_screen *screen = zink_screen(ctx->base.screen); + batch->descs_left = ZINK_BATCH_DESC_SIZE; + + // cmdbuf hasn't been submitted before + if (!batch->fence) + return; + + zink_fence_finish(screen, batch->fence, PIPE_TIMEOUT_INFINITE); + zink_batch_release(screen, batch); if (vkResetDescriptorPool(screen->dev, batch->descpool, 0) != VK_SUCCESS) fprintf(stderr, "vkResetDescriptorPool failed\n"); diff --git a/src/gallium/drivers/zink/zink_batch.h b/src/gallium/drivers/zink/zink_batch.h index 9bb3294e871..c7578f4f9a2 100644 --- a/src/gallium/drivers/zink/zink_batch.h +++ b/src/gallium/drivers/zink/zink_batch.h @@ -35,6 +35,7 @@ struct zink_framebuffer; struct zink_gfx_program; struct zink_render_pass; struct zink_resource; +struct zink_screen; struct zink_sampler_view; #define ZINK_BATCH_DESC_SIZE 1000 @@ -58,6 +59,10 @@ struct zink_batch { struct set *active_queries; /* zink_query objects which were active at some point in this batch */ }; +/* release all resources attached to batch */ +void +zink_batch_release(struct zink_screen *screen, struct zink_batch *batch); + void zink_start_batch(struct zink_context *ctx, struct zink_batch *batch); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
