Re: [PATCH 55/59] drm/ttm: drop type manager has_type

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

 



Am 04.08.20 um 04:56 schrieb Dave Airlie:
From: Dave Airlie <airlied@xxxxxxxxxx>

under driver control, this flag isn't needed anymore,
remove the API that used to access it, and consoldiate
with the used api.

Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>

Reviewed-by: Christian König <christian.koenig@xxxxxxx>

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c   |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c  |  2 +-
  drivers/gpu/drm/nouveau/nouveau_ttm.c         |  4 ++--
  drivers/gpu/drm/ttm/ttm_bo.c                  |  8 +++-----
  drivers/gpu/drm/ttm/ttm_bo_manager.c          |  2 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c |  2 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_thp.c           |  2 +-
  include/drm/ttm/ttm_bo_driver.h               | 17 -----------------
  8 files changed, 10 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
index 9fc3d876ed38..71461d652fcc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
@@ -146,7 +146,7 @@ void amdgpu_gtt_mgr_fini(struct amdgpu_device *adev)
  	struct amdgpu_gtt_mgr *mgr = to_gtt_mgr(man);
  	int ret;
- ttm_mem_type_manager_disable(man);
+	ttm_mem_type_manager_set_used(man, false);
ret = ttm_mem_type_manager_force_list_clean(&adev->mman.bdev, man);
  	if (ret)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 684698cdf772..8cc44c3d2fdd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -223,7 +223,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
  	struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
  	int ret;
- ttm_mem_type_manager_disable(man);
+	ttm_mem_type_manager_set_used(man, false);
ret = ttm_mem_type_manager_force_list_clean(&adev->mman.bdev, man);
  	if (ret)
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index d408e1485cce..22185a8dcfa1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -194,7 +194,7 @@ nouveau_ttm_fini_vram(struct nouveau_drm *drm)
  	struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM);
if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
-		ttm_mem_type_manager_disable(man);
+		ttm_mem_type_manager_set_used(man, false);
  		ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man);
  		ttm_mem_type_manager_cleanup(man);
  		ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_VRAM, NULL);
@@ -253,7 +253,7 @@ nouveau_ttm_fini_gtt(struct nouveau_drm *drm)
  	    drm->agp.bridge)
  		ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_TT);
  	else {
-		ttm_mem_type_manager_disable(man);
+		ttm_mem_type_manager_set_used(man, false);
  		ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man);
  		ttm_mem_type_manager_cleanup(man);
  		ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_TT, NULL);
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 12abe46bfbc1..cda33b4af681 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -80,7 +80,6 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
  void ttm_mem_type_manager_debug(struct ttm_mem_type_manager *man,
  				struct drm_printer *p)
  {
-	drm_printf(p, "    has_type: %d\n", man->has_type);
  	drm_printf(p, "    use_type: %d\n", man->use_type);
  	drm_printf(p, "    use_tt: %d\n", man->use_tt);
  	drm_printf(p, "    size: %llu\n", man->size);
@@ -1003,7 +1002,7 @@ static int ttm_bo_mem_placement(struct ttm_buffer_object *bo,
  		return ret;
man = ttm_manager_type(bdev, mem_type);
-	if (!man->has_type || !man->use_type)
+	if (!man || !man->use_type)
  		return -EBUSY;
if (!ttm_bo_mt_compatible(man, mem_type, place, &cur_flags))
@@ -1462,7 +1461,7 @@ int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type)
  		return -EINVAL;
  	}
- if (!man->has_type) {
+	if (!man) {
  		pr_err("Memory type %u has not been initialized\n", mem_type);
  		return 0;
  	}
@@ -1476,7 +1475,6 @@ void ttm_mem_type_manager_init(struct ttm_mem_type_manager *man,
  {
  	unsigned i;
- BUG_ON(man->has_type);
  	man->use_io_reserve_lru = false;
  	mutex_init(&man->io_reserve_mutex);
  	spin_lock_init(&man->move_lock);
@@ -1557,7 +1555,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev)
  	struct ttm_mem_type_manager *man;
man = ttm_manager_type(bdev, TTM_PL_SYSTEM);
-	ttm_mem_type_manager_disable(man);
+	ttm_mem_type_manager_set_used(man, false);
  	ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL);
mutex_lock(&ttm_global_mutex);
diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
index 1b7245ce3356..6679dc11934f 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
@@ -152,7 +152,7 @@ int ttm_range_man_fini(struct ttm_bo_device *bdev,
  	struct drm_mm *mm = &rman->mm;
  	int ret;
- ttm_mem_type_manager_disable(man);
+	ttm_mem_type_manager_set_used(man, false);
ret = ttm_mem_type_manager_force_list_clean(bdev, man);
  	if (ret)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
index c3fa25161fd0..ca5037184814 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
@@ -143,7 +143,7 @@ void vmw_gmrid_man_fini(struct vmw_private *dev_priv, int type)
  	struct ttm_mem_type_manager *man = ttm_manager_type(&dev_priv->bdev, type);
  	struct vmwgfx_gmrid_man *gman = to_gmrid_manager(man);
- ttm_mem_type_manager_disable(man);
+	ttm_mem_type_manager_set_used(man, false);
ttm_mem_type_manager_force_list_clean(&dev_priv->bdev, man); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c b/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
index 0b9c29249393..4110e8309188 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
@@ -152,7 +152,7 @@ void vmw_thp_fini(struct vmw_private *dev_priv)
  	struct drm_mm *mm = &rman->mm;
  	int ret;
- ttm_mem_type_manager_disable(man);
+	ttm_mem_type_manager_set_used(man, false);
ret = ttm_mem_type_manager_force_list_clean(&dev_priv->bdev, man);
  	if (ret)
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index d5646d7cac60..300934289e64 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -111,7 +111,6 @@ struct ttm_mem_type_manager_func {
  /**
   * struct ttm_mem_type_manager
   *
- * @has_type: The memory type has been initialized.
   * @use_type: The memory type is enabled.
   * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory
   * managed by this memory type.
@@ -141,8 +140,6 @@ struct ttm_mem_type_manager {
  	/*
  	 * No protection. Constant from start.
  	 */
-
-	bool has_type;
  	bool use_type;
  	bool use_tt;
  	uint64_t size;
@@ -678,23 +675,9 @@ static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
   */
  static inline void ttm_mem_type_manager_set_used(struct ttm_mem_type_manager *man, bool used)
  {
-	man->has_type = true;
  	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
   *

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[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