[39/59] drm/nouveau/ttm: use wrapper to access memory managers
diff mbox series

Message ID 20200804025632.3868079-40-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/nouveau/nouveau_ttm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Ben Skeggs Aug. 5, 2020, 5:48 a.m. UTC | #1
On Tue, 4 Aug 2020 at 12:58, Dave Airlie <airlied@gmail.com> wrote:
>
> From: Dave Airlie <airlied@redhat.com>
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>

> ---
>  drivers/gpu/drm/nouveau/nouveau_ttm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
> index bb310719e3f5..cc6cf04553dd 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
> @@ -156,7 +156,7 @@ nouveau_ttm_init_host(struct nouveau_drm *drm, u8 kind)
>  static int
>  nouveau_ttm_init_vram(struct nouveau_drm *drm)
>  {
> -       struct ttm_mem_type_manager *man = &drm->ttm.bdev.man[TTM_PL_VRAM];
> +       struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM);
>         struct nvif_mmu *mmu = &drm->client.mmu;
>
>         man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
> @@ -186,7 +186,7 @@ nouveau_ttm_init_vram(struct nouveau_drm *drm)
>  static void
>  nouveau_ttm_fini_vram(struct nouveau_drm *drm)
>  {
> -       struct ttm_mem_type_manager *man = &drm->ttm.bdev.man[TTM_PL_VRAM];
> +       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);
> @@ -199,7 +199,7 @@ nouveau_ttm_fini_vram(struct nouveau_drm *drm)
>  static int
>  nouveau_ttm_init_gtt(struct nouveau_drm *drm)
>  {
> -       struct ttm_mem_type_manager *man = &drm->ttm.bdev.man[TTM_PL_TT];
> +       struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_TT);
>         unsigned long size_pages = drm->gem.gart_available >> PAGE_SHIFT;
>         man->use_tt = true;
>         if (drm->agp.bridge) {
> @@ -228,7 +228,7 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
>  static void
>  nouveau_ttm_fini_gtt(struct nouveau_drm *drm)
>  {
> -       struct ttm_mem_type_manager *man = &drm->ttm.bdev.man[TTM_PL_TT];
> +       struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_TT);
>
>         if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA &&
>             drm->agp.bridge)
> --
> 2.26.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox series

diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index bb310719e3f5..cc6cf04553dd 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -156,7 +156,7 @@  nouveau_ttm_init_host(struct nouveau_drm *drm, u8 kind)
 static int
 nouveau_ttm_init_vram(struct nouveau_drm *drm)
 {
-	struct ttm_mem_type_manager *man = &drm->ttm.bdev.man[TTM_PL_VRAM];
+	struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM);
 	struct nvif_mmu *mmu = &drm->client.mmu;
 
 	man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
@@ -186,7 +186,7 @@  nouveau_ttm_init_vram(struct nouveau_drm *drm)
 static void
 nouveau_ttm_fini_vram(struct nouveau_drm *drm)
 {
-	struct ttm_mem_type_manager *man = &drm->ttm.bdev.man[TTM_PL_VRAM];
+	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);
@@ -199,7 +199,7 @@  nouveau_ttm_fini_vram(struct nouveau_drm *drm)
 static int
 nouveau_ttm_init_gtt(struct nouveau_drm *drm)
 {
-	struct ttm_mem_type_manager *man = &drm->ttm.bdev.man[TTM_PL_TT];
+	struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_TT);
 	unsigned long size_pages = drm->gem.gart_available >> PAGE_SHIFT;
 	man->use_tt = true;
 	if (drm->agp.bridge) {
@@ -228,7 +228,7 @@  nouveau_ttm_init_gtt(struct nouveau_drm *drm)
 static void
 nouveau_ttm_fini_gtt(struct nouveau_drm *drm)
 {
-	struct ttm_mem_type_manager *man = &drm->ttm.bdev.man[TTM_PL_TT];
+	struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_TT);
 
 	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA &&
 	    drm->agp.bridge)