]> Git Repo - J-linux.git/blobdiff - drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
Merge tag 'ucount-rlimits-cleanups-for-v5.19' of git://git.kernel.org/pub/scm/linux...
[J-linux.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_gtt_mgr.c
index 8c6b2284cf56d69b85d6fb51f7d7e6a8367e79fa..1f3302aebeffc1c4ae5bb7c5eb267bd1f93d4056 100644 (file)
@@ -204,6 +204,42 @@ void amdgpu_gtt_mgr_recover(struct amdgpu_gtt_mgr *mgr)
        amdgpu_gart_invalidate_tlb(adev);
 }
 
+/**
+ * amdgpu_gtt_mgr_intersects - test for intersection
+ *
+ * @man: Our manager object
+ * @res: The resource to test
+ * @place: The place for the new allocation
+ * @size: The size of the new allocation
+ *
+ * Simplified intersection test, only interesting if we need GART or not.
+ */
+static bool amdgpu_gtt_mgr_intersects(struct ttm_resource_manager *man,
+                                     struct ttm_resource *res,
+                                     const struct ttm_place *place,
+                                     size_t size)
+{
+       return !place->lpfn || amdgpu_gtt_mgr_has_gart_addr(res);
+}
+
+/**
+ * amdgpu_gtt_mgr_compatible - test for compatibility
+ *
+ * @man: Our manager object
+ * @res: The resource to test
+ * @place: The place for the new allocation
+ * @size: The size of the new allocation
+ *
+ * Simplified compatibility test.
+ */
+static bool amdgpu_gtt_mgr_compatible(struct ttm_resource_manager *man,
+                                     struct ttm_resource *res,
+                                     const struct ttm_place *place,
+                                     size_t size)
+{
+       return !place->lpfn || amdgpu_gtt_mgr_has_gart_addr(res);
+}
+
 /**
  * amdgpu_gtt_mgr_debug - dump VRAM table
  *
@@ -225,6 +261,8 @@ static void amdgpu_gtt_mgr_debug(struct ttm_resource_manager *man,
 static const struct ttm_resource_manager_func amdgpu_gtt_mgr_func = {
        .alloc = amdgpu_gtt_mgr_new,
        .free = amdgpu_gtt_mgr_del,
+       .intersects = amdgpu_gtt_mgr_intersects,
+       .compatible = amdgpu_gtt_mgr_compatible,
        .debug = amdgpu_gtt_mgr_debug
 };
 
This page took 0.033684 seconds and 4 git commands to generate.