aux/pipebuffer: add a return to pb_cache_release_all_buffers()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23073>
This commit is contained in:
Mike Blumenkrantz 2023-05-03 16:10:08 -04:00 committed by Marge Bot
parent d065304367
commit d4757ea67e
2 changed files with 5 additions and 2 deletions

View file

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

View file

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