broadcom/simulator: add a helper to get the amount of free heap memory

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18483>
This commit is contained in:
Iago Toral Quiroga 2022-09-08 13:02:55 +02:00 committed by Marge Bot
parent 861fff6339
commit a1e723cace
2 changed files with 11 additions and 0 deletions

View file

@ -831,6 +831,16 @@ v3d_simulator_get_mem_size(void)
return sim_state.mem_size;
}
uint32_t
v3d_simulator_get_mem_free(void)
{
uint32_t total_free = 0;
struct mem_block *p;
for (p = sim_state.heap->next_free; p != sim_state.heap; p = p->next_free)
total_free += p->size;
return total_free;
}
static void
v3d_simulator_init_global()
{

View file

@ -40,6 +40,7 @@ uint32_t v3d_simulator_get_spill(uint32_t spill_size);
int v3d_simulator_ioctl(int fd, unsigned long request, void *arg);
void v3d_simulator_open_from_handle(int fd, int handle, uint32_t size);
uint32_t v3d_simulator_get_mem_size(void);
uint32_t v3d_simulator_get_mem_free(void);
#ifdef v3dX
# include "v3dx_simulator.h"