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,