I am looking for a way to read the GPU memory usage of my Game (process) on the Mali GPUs on Android platform.
On some other GPU's I can read the entries in /proc/<pid>/smaps and calculate the GPU memory usage from the page mapping
entries, but on Mali devices they don't seem to add up to the actual memory usage in my test app (uploads 1k by 1k textures, 32bpp, and renders
every texture in every frame).
I've read that for Mali GPU's ion is used to allocate memory, but I can't seem to find a way to get the GPU memory usage. Ideally, I would like to
somehow find these numbers:
- how much graphics memory can be allocated until we run out of memory?
- how much of graphics memory is currently being used by the process in terms of actually allocated (dirty) memory pages?
- if memory is allocated as a dedicated heap of 4K pages as a large chunk, how much of that heap is actually currently allocated?
The use case is for internal development (I work for a mobile game studio) work, but ideally it should be usable without rooting or
otherwise modifying the device (code can be inserted into the game to read it, but it runs with user rights).
how much graphics memory can be allocated until we run out of memory?
In most platforms graphics memory is just normal system RAM, so there isn't normally anything special about graphics memory (all Mali GPUs support an MMU and can map arbitrary 4KB pages).
The only special case is the window framebuffers which are allocated via Ion / Gralloc, because these may have more restrictive requirements (e.g. using larger physically contiguous chunks, which some display controllers require). These may not be accounted against the process, as the memory is actually owned by the windowing system, not the application.
how much of graphics memory is currently being used by the process in terms of actually allocated (dirty) memory pages?
Memory allocated by the Mali Graphics Driver is accounted against the process allocating the memory; so it should show up in normal memory reporting tools such as "top".
View all questions in Graphics and Gaming forum