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 <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9274>
This commit is contained in:
Mike Blumenkrantz 2020-09-28 10:51:06 -04:00 committed by Marge Bot
parent 6a3e340288
commit 330b5b351b
2 changed files with 8 additions and 1 deletions

View file

@ -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)

View file

@ -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