Module: Mesa Branch: master Commit: 330b5b351b79ad9d1f9cee1d5d71353c7a308675 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=330b5b351b79ad9d1f9cee1d5d71353c7a308675
Author: Mike Blumenkrantz <[email protected]> Date: Mon Sep 28 10:51:06 2020 -0400 zink: track resource mem usage per batch we want to be able to track this so we can check whether a given batch is going wild with memory usage for resources that might be pending free once the batch finishes Reviewed-by: Erik Faye-Lund <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9274> --- src/gallium/drivers/zink/zink_batch.c | 6 +++++- src/gallium/drivers/zink/zink_batch.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index cb83a1153b7..972f88c7af8 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -73,6 +73,7 @@ zink_reset_batch(struct zink_context *ctx, struct zink_batch *batch) if (vkResetCommandPool(screen->dev, batch->cmdpool, 0) != VK_SUCCESS) fprintf(stderr, "vkResetCommandPool failed\n"); batch->submitted = batch->has_work = false; + batch->resource_size = 0; } void @@ -170,8 +171,11 @@ zink_batch_reference_resource_rw(struct zink_batch *batch, struct zink_resource if (!entry) { entry = _mesa_set_add(batch->resources, res); pipe_reference(NULL, &res->base.reference); - if (stencil) + batch->resource_size += res->size; + if (stencil) { pipe_reference(NULL, &stencil->base.reference); + batch->resource_size += stencil->size; + } } /* multiple array entries are fine */ if (res->persistent_maps) diff --git a/src/gallium/drivers/zink/zink_batch.h b/src/gallium/drivers/zink/zink_batch.h index 83def45a1ca..dd9d97a6f39 100644 --- a/src/gallium/drivers/zink/zink_batch.h +++ b/src/gallium/drivers/zink/zink_batch.h @@ -62,6 +62,9 @@ struct zink_batch { struct util_dynarray zombie_samplers; struct set *active_queries; /* zink_query objects which were active at some point in this batch */ + + VkDeviceSize resource_size; + bool has_work; bool submitted; bool in_rp; //renderpass is currently active _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
