Re: [PATCH v2 5/6] drm/i915/ttm: switch over to ttm_buddy_man

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 6/8/21 10:44 AM, Matthew Auld wrote:
Move back to the buddy allocator for managing device local memory, and
restore the lost mock selftests. Keep around the range manager related
bits, since we likely need this for managing stolen at some point. For
stolen we also don't need to reserve anything so no need to support a
generic reserve interface.

v2(Thomas):
     - bo->page_alignment is in page units, not bytes

Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx>
Cc: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>
Reviewed-by: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>
---
  drivers/gpu/drm/i915/gem/i915_gem_ttm.c       |  26 +--
  drivers/gpu/drm/i915/intel_memory_region.c    |  55 +-----
  drivers/gpu/drm/i915/intel_memory_region.h    |  17 --
  drivers/gpu/drm/i915/intel_region_ttm.c       | 100 +++--------
  .../drm/i915/selftests/intel_memory_region.c  | 170 ++++++++++++------
  drivers/gpu/drm/i915/selftests/mock_region.c  |  15 +-
  6 files changed, 168 insertions(+), 215 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index c612275c36c9..5bf1d1945dd6 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -181,11 +181,7 @@ static bool i915_ttm_eviction_valuable(struct ttm_buffer_object *bo,
  	struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
/* Will do for now. Our pinned objects are still on TTM's LRU lists */
-	if (!i915_gem_object_evictable(obj))
-		return false;
-
-	/* This isn't valid with a buddy allocator */
-	return ttm_bo_eviction_valuable(bo, place);
+	return i915_gem_object_evictable(obj);
  }
static void i915_ttm_evict_flags(struct ttm_buffer_object *bo,
@@ -328,11 +324,15 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *obj,
  	struct ttm_buffer_object *bo = i915_gem_to_ttm(obj);
  	struct ttm_resource_manager *man =
  		ttm_manager_type(bo->bdev, res->mem_type);
+	struct intel_memory_region *mr = obj->mm.region;
if (man->use_tt)
  		return i915_ttm_tt_get_st(bo->ttm);
- return intel_region_ttm_node_to_st(obj->mm.region, res->mm_node);
+	if (mr->is_range_manager)

Did you look at moving this test into intel_region_ttm_node_to_st())

+		return intel_region_ttm_node_to_st(mr, res);
+	else
+		return i915_sg_from_buddy_resource(res, mr->region.start);
  }

Thanks,

Thomas





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux