Am 04.08.20 um 04:55 schrieb Dave Airlie:
From: Dave Airlie <airlied@xxxxxxxxxx>
The disable path is just temporary for now, it will be dropped once has_type
is gone in a later patch.
v2: add docs.
rename to ttm_mem_type_manager namespace
Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>
Reviewed-by: Christian König <christian.koenig@xxxxxxx>
---
drivers/gpu/drm/ttm/ttm_bo.c | 6 ++----
include/drm/ttm/ttm_bo_driver.h | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index af1b1c3f6ed2..127a0b62bf98 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1468,8 +1468,7 @@ int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
return ret;
}
- man->use_type = false;
- man->has_type = false;
+ ttm_mem_type_manager_disable(man);
ret = 0;
if (mem_type > 0) {
@@ -1482,8 +1481,7 @@ int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
ret = (*man->func->takedown)(man);
}
- dma_fence_put(man->move);
- man->move = NULL;
+ ttm_mem_type_manager_cleanup(man);
return ret;
}
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 548c27294c64..41bfa514c29d 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -680,6 +680,32 @@ static inline void ttm_mem_type_manager_set_used(struct ttm_mem_type_manager *ma
man->use_type = used;
}
+/**
+ * ttm_mem_type_manager_disable.
+ *
+ * @man: A memory manager object.
+ *
+ * Indicate the manager is not to be used and deregistered. (temporary during rework).
+ */
+static inline void ttm_mem_type_manager_disable(struct ttm_mem_type_manager *man)
+{
+ man->has_type = false;
+ man->use_type = false;
+}
+
+/**
+ * ttm_mem_type_manager_cleanup
+ *
+ * @man: A memory manager object.
+ *
+ * Cleanup the move fences from the memory manager object.
+ */
+static inline void ttm_mem_type_manager_cleanup(struct ttm_mem_type_manager *man)
+{
+ dma_fence_put(man->move);
+ man->move = NULL;
+}
+
/*
* ttm_bo_util.c
*/
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel