mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
util/vma: Add function to get max continuous free size
Useful to find out what's the biggest allocation we could make. Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28276>
This commit is contained in:
parent
bcf793306f
commit
df3ba95a24
2 changed files with 12 additions and 0 deletions
|
|
@ -352,6 +352,16 @@ util_vma_heap_free(struct util_vma_heap *heap,
|
|||
util_vma_heap_validate(heap);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
util_vma_heap_get_max_free_continuous_size(struct util_vma_heap *heap)
|
||||
{
|
||||
if (list_is_empty(&heap->holes))
|
||||
return 0;
|
||||
|
||||
struct util_vma_hole *top_hole = list_first_entry(&heap->holes, struct util_vma_hole, link);
|
||||
return top_hole->size;
|
||||
}
|
||||
|
||||
void
|
||||
util_vma_heap_print(struct util_vma_heap *heap, FILE *fp,
|
||||
const char *tab, uint64_t total_size)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ bool util_vma_heap_alloc_addr(struct util_vma_heap *heap,
|
|||
void util_vma_heap_free(struct util_vma_heap *heap,
|
||||
uint64_t offset, uint64_t size);
|
||||
|
||||
uint64_t util_vma_heap_get_max_free_continuous_size(struct util_vma_heap *heap);
|
||||
|
||||
void util_vma_heap_print(struct util_vma_heap *heap, FILE *fp,
|
||||
const char *tab, uint64_t total_size);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue