diff mbox series

[RFC,06/11] drm/ttm: Set lru manager to ttm resource manager

Message ID 20231102043306.2931989-7-oak.zeng@intel.com (mailing list archive)
State New, archived
Headers show
Series Introduce drm evictable lru | expand

Commit Message

Oak Zeng Nov. 2, 2023, 4:33 a.m. UTC
Add a weak reference of lru manager to ttm resource manager,
and add a function to set lru manager for ttm resource manager.

Signed-off-by: Oak Zeng <oak.zeng@intel.com>
---
 include/drm/ttm/ttm_resource.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff mbox series

Patch

diff --git a/include/drm/ttm/ttm_resource.h b/include/drm/ttm/ttm_resource.h
index 92241c2374fa..e4fc1ada5236 100644
--- a/include/drm/ttm/ttm_resource.h
+++ b/include/drm/ttm/ttm_resource.h
@@ -46,6 +46,7 @@  struct iosys_map;
 struct io_mapping;
 struct sg_table;
 struct scatterlist;
+struct drm_lru_mgr;
 
 struct ttm_resource_manager_func {
 	/**
@@ -172,6 +173,12 @@  struct ttm_resource_manager {
 	 * bdev->lru_lock.
 	 */
 	uint64_t usage;
+
+	/**
+	 * @lru_mgr: weak reference of the lru manager that manages lru
+	 * list for this ttm resource manager.
+	 */
+	struct drm_lru_mgr *lru_mgr;
 };
 
 /**
@@ -326,6 +333,18 @@  static inline bool ttm_resource_manager_used(struct ttm_resource_manager *man)
 	return man->use_type;
 }
 
+/**
+ * ttm_resource_manager_set_lru_mgr
+ *
+ * @man: ttm resource manager
+ * @mgr: pointing to lru manager
+ */
+static inline void
+ttm_resource_manager_set_lru_mgr(struct ttm_resource_manager *man, struct drm_lru_mgr *mgr)
+{
+	man->lru_mgr = mgr;
+}
+
 /**
  * ttm_resource_manager_cleanup
  *