@@ -256,3 +256,22 @@ void intel_region_ttm_resource_free(struct intel_memory_region *mem,
man->func->free(man, res);
}
+
+/**
+ * intel_region_ttm_range_busy - check whether range has any allocations
+ * @mem: The region to check
+ * @start: the start of the range to check
+ * @end: the end of the range to check
+ *
+ * Return: true if something is alloceted within the region, false otherwise.
+ */
+bool intel_region_ttm_range_busy(struct intel_memory_region *mem,
+ u64 start, u64 end)
+{
+ struct ttm_resource_manager *man = mem->region_private;
+
+ /* currently only supported for range allocator */
+ GEM_BUG_ON(!mem->is_range_manager);
+
+ return ttm_range_man_range_busy(man, PFN_DOWN(start), PFN_UP(end));
+}
@@ -29,6 +29,9 @@ intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem,
void intel_region_ttm_resource_free(struct intel_memory_region *mem,
struct ttm_resource *res);
+bool intel_region_ttm_range_busy(struct intel_memory_region *mem,
+ u64 start, u64 end);
+
int intel_region_to_ttm_type(const struct intel_memory_region *mem);
struct ttm_device_funcs *i915_ttm_driver(void);
RFC: should this become a generic interface in intel_memory_region_ops? RFC: would we prefer an different interface? e.g. for_each_obj_in_range Signed-off-by: Robert Beckett <bob.beckett@collabora.com> --- drivers/gpu/drm/i915/intel_region_ttm.c | 19 +++++++++++++++++++ drivers/gpu/drm/i915/intel_region_ttm.h | 3 +++ 2 files changed, 22 insertions(+)