radv/winsys: do not count visible VRAM buffers twice in the budget
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 30 Apr 2020 16:42:27 +0000 (18:42 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 06:58:24 +0000 (06:58 +0000)
commitf457e1b6d5814e51cb9e0ae47e8fd5936139f42f
tree37c050f76b6aeb08bff421c0d06ba08135f8365c
parentf3e37f5d262606f1a0f5a3073835ac0ecc41f629
radv/winsys: do not count visible VRAM buffers twice in the budget

The VRAM size returned to apps is computed as follows:
vram_size = real_hw_vram_size - visible_vram_size.

Visible VRAM buffers should be counted only in the visible VRAM
counter and not twice. Buffers with the NO_CPU_ACCESS flag are
known to not be mappable, so they are counted in the VRAM counter.

Other buffers, with the CPU_ACCESS flag, or without any of both
(imported buffers) are counted in the visible VRAM counter because
they are mappable.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4834>
src/amd/vulkan/radv_radeon_winsys.h
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c