[41/59] drm/radeon/ttm: use wrapper to access memory manager
diff mbox series

Message ID 20200804025632.3868079-42-airlied@gmail.com
State New
Headers show
Series
  • ttm misc cleanups, mem refactoring, rename objects. (v2)
Related show

Commit Message

Dave Airlie Aug. 4, 2020, 2:56 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/radeon/radeon_gem.c |  2 +-
 drivers/gpu/drm/radeon/radeon_ttm.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Christian König Aug. 4, 2020, 11:29 a.m. UTC | #1
Am 04.08.20 um 04:56 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

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

> ---
>   drivers/gpu/drm/radeon/radeon_gem.c |  2 +-
>   drivers/gpu/drm/radeon/radeon_ttm.c | 12 ++++++------
>   2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
> index 44157ada9b0e..3ec028dba739 100644
> --- a/drivers/gpu/drm/radeon/radeon_gem.c
> +++ b/drivers/gpu/drm/radeon/radeon_gem.c
> @@ -226,7 +226,7 @@ int radeon_gem_info_ioctl(struct drm_device *dev, void *data,
>   	struct drm_radeon_gem_info *args = data;
>   	struct ttm_mem_type_manager *man;
>   
> -	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
> +	man = ttm_manager_type(&rdev->mman.bdev, TTM_PL_VRAM);
>   
>   	args->vram_size = (u64)man->size << PAGE_SHIFT;
>   	args->vram_visible = rdev->mc.visible_vram_size;
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 76b409af9476..03c0a24e74c4 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -68,7 +68,7 @@ struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)
>   
>   static int radeon_ttm_init_vram(struct radeon_device *rdev)
>   {
> -	struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_VRAM];
> +	struct ttm_mem_type_manager *man = ttm_manager_type(&rdev->mman.bdev, TTM_PL_VRAM);
>   
>   	man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
>   	man->default_caching = TTM_PL_FLAG_WC;
> @@ -79,7 +79,7 @@ static int radeon_ttm_init_vram(struct radeon_device *rdev)
>   
>   static int radeon_ttm_init_gtt(struct radeon_device *rdev)
>   {
> -	struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_TT];
> +	struct ttm_mem_type_manager *man = ttm_manager_type(&rdev->mman.bdev, TTM_PL_TT);
>   
>   	man->available_caching = TTM_PL_MASK_CACHING;
>   	man->default_caching = TTM_PL_FLAG_CACHED;
> @@ -825,8 +825,8 @@ void radeon_ttm_fini(struct radeon_device *rdev)
>   		}
>   		radeon_bo_unref(&rdev->stolen_vga_memory);
>   	}
> -	ttm_range_man_fini(&rdev->mman.bdev, &rdev->mman.bdev.man[TTM_PL_VRAM]);
> -	ttm_range_man_fini(&rdev->mman.bdev, &rdev->mman.bdev.man[TTM_PL_TT]);
> +	ttm_range_man_fini(&rdev->mman.bdev, ttm_manager_type(&rdev->mman.bdev, TTM_PL_VRAM));
> +	ttm_range_man_fini(&rdev->mman.bdev, ttm_manager_type(&rdev->mman.bdev, TTM_PL_TT));
>   	ttm_bo_device_release(&rdev->mman.bdev);
>   	radeon_gart_fini(rdev);
>   	rdev->mman.initialized = false;
> @@ -842,7 +842,7 @@ void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size)
>   	if (!rdev->mman.initialized)
>   		return;
>   
> -	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
> +	man = ttm_manager_type(&rdev->mman.bdev, TTM_PL_VRAM);
>   	/* this just adjusts TTM size idea, which sets lpfn to the correct value */
>   	man->size = size >> PAGE_SHIFT;
>   }
> @@ -896,7 +896,7 @@ static int radeon_mm_dump_table(struct seq_file *m, void *data)
>   	unsigned ttm_pl = *(int*)node->info_ent->data;
>   	struct drm_device *dev = node->minor->dev;
>   	struct radeon_device *rdev = dev->dev_private;
> -	struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[ttm_pl];
> +	struct ttm_mem_type_manager *man = ttm_manager_type(&rdev->mman.bdev, ttm_pl);
>   	struct drm_printer p = drm_seq_file_printer(m);
>   
>   	man->func->debug(man, &p);

Patch
diff mbox series

diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 44157ada9b0e..3ec028dba739 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -226,7 +226,7 @@  int radeon_gem_info_ioctl(struct drm_device *dev, void *data,
 	struct drm_radeon_gem_info *args = data;
 	struct ttm_mem_type_manager *man;
 
-	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
+	man = ttm_manager_type(&rdev->mman.bdev, TTM_PL_VRAM);
 
 	args->vram_size = (u64)man->size << PAGE_SHIFT;
 	args->vram_visible = rdev->mc.visible_vram_size;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 76b409af9476..03c0a24e74c4 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -68,7 +68,7 @@  struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)
 
 static int radeon_ttm_init_vram(struct radeon_device *rdev)
 {
-	struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_VRAM];
+	struct ttm_mem_type_manager *man = ttm_manager_type(&rdev->mman.bdev, TTM_PL_VRAM);
 
 	man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
 	man->default_caching = TTM_PL_FLAG_WC;
@@ -79,7 +79,7 @@  static int radeon_ttm_init_vram(struct radeon_device *rdev)
 
 static int radeon_ttm_init_gtt(struct radeon_device *rdev)
 {
-	struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[TTM_PL_TT];
+	struct ttm_mem_type_manager *man = ttm_manager_type(&rdev->mman.bdev, TTM_PL_TT);
 
 	man->available_caching = TTM_PL_MASK_CACHING;
 	man->default_caching = TTM_PL_FLAG_CACHED;
@@ -825,8 +825,8 @@  void radeon_ttm_fini(struct radeon_device *rdev)
 		}
 		radeon_bo_unref(&rdev->stolen_vga_memory);
 	}
-	ttm_range_man_fini(&rdev->mman.bdev, &rdev->mman.bdev.man[TTM_PL_VRAM]);
-	ttm_range_man_fini(&rdev->mman.bdev, &rdev->mman.bdev.man[TTM_PL_TT]);
+	ttm_range_man_fini(&rdev->mman.bdev, ttm_manager_type(&rdev->mman.bdev, TTM_PL_VRAM));
+	ttm_range_man_fini(&rdev->mman.bdev, ttm_manager_type(&rdev->mman.bdev, TTM_PL_TT));
 	ttm_bo_device_release(&rdev->mman.bdev);
 	radeon_gart_fini(rdev);
 	rdev->mman.initialized = false;
@@ -842,7 +842,7 @@  void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size)
 	if (!rdev->mman.initialized)
 		return;
 
-	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
+	man = ttm_manager_type(&rdev->mman.bdev, TTM_PL_VRAM);
 	/* this just adjusts TTM size idea, which sets lpfn to the correct value */
 	man->size = size >> PAGE_SHIFT;
 }
@@ -896,7 +896,7 @@  static int radeon_mm_dump_table(struct seq_file *m, void *data)
 	unsigned ttm_pl = *(int*)node->info_ent->data;
 	struct drm_device *dev = node->minor->dev;
 	struct radeon_device *rdev = dev->dev_private;
-	struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[ttm_pl];
+	struct ttm_mem_type_manager *man = ttm_manager_type(&rdev->mman.bdev, ttm_pl);
 	struct drm_printer p = drm_seq_file_printer(m);
 
 	man->func->debug(man, &p);