winsys/amdgpu,radeonsi: add HUD counters for how much memory is wasted by slabs
authorMarek Olšák <marek.olsak@amd.com>
Sat, 23 Jan 2021 22:21:44 +0000 (17:21 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 3 Feb 2021 21:53:33 +0000 (21:53 +0000)
commit965c6445ad419aa49302f75db1d99345708c5aae
tree88f750bf149ee32e74ebbe221b14953ede3e31c0
parent7e47fe9a940f3989caf98024fdc584641601fa2e
winsys/amdgpu,radeonsi: add HUD counters for how much memory is wasted by slabs

Slabs always allocate the next power of two size from their pools. This
wastes memory if the size is not a power of two.

bo->base.size is overwritten because the default is the allocated power of
two size, but we need the real size to compute the wasted size in
amdgpu_bo_slab_destroy. entry_size is added to the hole in pb_slab_entry
to hold the real entry size.

Like other memory stats, no atomics are used.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8683>
src/gallium/auxiliary/pipebuffer/pb_slab.h
src/gallium/drivers/radeon/radeon_winsys.h
src/gallium/drivers/radeonsi/si_query.c
src/gallium/drivers/radeonsi/si_query.h
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
src/gallium/winsys/radeon/drm/radeon_drm_bo.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c