summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/i915_ttm_buddy_manager.h
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2022-02-25 14:54:59 +0000
committerMatthew Auld <matthew.auld@intel.com>2022-02-28 08:47:34 +0000
commit26ffcbbef712f6fb52f16e6f7d5cde736b80d8c4 (patch)
tree560a461363043e9bb9246a8c3b9e7c532d93eb41 /drivers/gpu/drm/i915/i915_ttm_buddy_manager.h
parent30b9d1b3ef374403652fc10fa36b9a5f32cc274d (diff)
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
Diffstat (limited to 'drivers/gpu/drm/i915/i915_ttm_buddy_manager.h')
-rw-r--r--drivers/gpu/drm/i915/i915_ttm_buddy_manager.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.h b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.h
index 72c90b432e87..35fe03a6a78c 100644
--- a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.h
+++ b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.h
@@ -21,6 +21,8 @@ struct drm_buddy;
* @base: struct ttm_resource base class we extend
* @blocks: the list of struct i915_buddy_block for this resource/allocation
* @flags: DRM_BUDDY_*_ALLOCATION flags
+ * @used_visible_size: How much of this resource, if any, uses the CPU visible
+ * portion, in pages.
* @mm: the struct i915_buddy_mm for this resource
*
* Extends the struct ttm_resource to manage an address space allocation with
@@ -30,6 +32,7 @@ struct i915_ttm_buddy_resource {
struct ttm_resource base;
struct list_head blocks;
unsigned long flags;
+ unsigned long used_visible_size;
struct drm_buddy *mm;
};
@@ -48,11 +51,14 @@ to_ttm_buddy_resource(struct ttm_resource *res)
int i915_ttm_buddy_man_init(struct ttm_device *bdev,
unsigned type, bool use_tt,
- u64 size, u64 default_page_size, u64 chunk_size);
+ u64 size, u64 visible_size,
+ u64 default_page_size, u64 chunk_size);
int i915_ttm_buddy_man_fini(struct ttm_device *bdev,
unsigned int type);
int i915_ttm_buddy_man_reserve(struct ttm_resource_manager *man,
u64 start, u64 size);
+u64 i915_ttm_buddy_man_visible_size(struct ttm_resource_manager *man);
+
#endif