drm/i915/buddy: track available visible size
authorMatthew Auld <matthew.auld@intel.com>
Fri, 25 Feb 2022 14:54:59 +0000 (14:54 +0000)
committerMatthew Auld <matthew.auld@intel.com>
Mon, 28 Feb 2022 08:47:34 +0000 (08:47 +0000)
commit26ffcbbef712f6fb52f16e6f7d5cde736b80d8c4
tree560a461363043e9bb9246a8c3b9e7c532d93eb41
parent30b9d1b3ef374403652fc10fa36b9a5f32cc274d
drm/i915/buddy: track available visible size

Track the total amount of available visible memory, and also track
per-resource the amount of used visible memory. For now this is useful
for our debug output, and deciding if it is even worth calling into the
buddy allocator. In the future tracking the per-resource visible usage
will be useful for when deciding if we should attempt to evict certain
buffers.

v2:
 - s/place->lpfn/lpfn/, that way we can avoid scanning the list if the
   entire range is already mappable.
 - Move the end declaration inside the if block(Thomas).
 - Make sure to also account for reserved memory.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Acked-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220225145502.331818-4-matthew.auld@intel.com
drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
drivers/gpu/drm/i915/i915_ttm_buddy_manager.h
drivers/gpu/drm/i915/intel_region_ttm.c