From d4757ea67e527fa4537b543aba07bb44073979b6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 3 May 2023 16:10:08 -0400 Subject: [PATCH] aux/pipebuffer: add a return to pb_cache_release_all_buffers() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/pipebuffer/pb_cache.c | 5 ++++- src/gallium/auxiliary/pipebuffer/pb_cache.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_cache.c b/src/gallium/auxiliary/pipebuffer/pb_cache.c index 11e411b3459..a15e2cd3c80 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_cache.c @@ -223,11 +223,12 @@ pb_cache_reclaim_buffer(struct pb_cache *mgr, pb_size size, /** * Empty the cache. Useful when there is not enough memory. */ -void +unsigned pb_cache_release_all_buffers(struct pb_cache *mgr) { struct list_head *curr, *next; struct pb_cache_entry *buf; + unsigned num_reclaims = 0; unsigned i; simple_mtx_lock(&mgr->mutex); @@ -239,11 +240,13 @@ pb_cache_release_all_buffers(struct pb_cache *mgr) while (curr != cache) { buf = list_entry(curr, struct pb_cache_entry, head); destroy_buffer_locked(buf); + num_reclaims++; curr = next; next = curr->next; } } simple_mtx_unlock(&mgr->mutex); + return num_reclaims; } void diff --git a/src/gallium/auxiliary/pipebuffer/pb_cache.h b/src/gallium/auxiliary/pipebuffer/pb_cache.h index c5d62c7f9fc..f38d7d31092 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_cache.h +++ b/src/gallium/auxiliary/pipebuffer/pb_cache.h @@ -71,7 +71,7 @@ void pb_cache_add_buffer(struct pb_cache_entry *entry); struct pb_buffer *pb_cache_reclaim_buffer(struct pb_cache *mgr, pb_size size, unsigned alignment, unsigned usage, unsigned bucket_index); -void pb_cache_release_all_buffers(struct pb_cache *mgr); +unsigned pb_cache_release_all_buffers(struct pb_cache *mgr); void pb_cache_init_entry(struct pb_cache *mgr, struct pb_cache_entry *entry, struct pb_buffer *buf, unsigned bucket_index); void pb_cache_init(struct pb_cache *mgr, uint num_heaps,