[PATCH 09/49] drm/nouveau: use new memory manager init paths
Dave Airlie
airlied at gmail.com
Fri Jul 31 04:04:40 UTC 2020
From: Dave Airlie <airlied at redhat.com>
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
drivers/gpu/drm/nouveau/nouveau_ttm.c | 43 ++++++++++++---------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index b0012021ae12..e3c57c612765 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -31,12 +31,6 @@
#include <core/tegra.h>
-static int
-nouveau_manager_init(struct ttm_mem_type_manager *man, unsigned long psize)
-{
- return 0;
-}
-
static int
nouveau_manager_fini(struct ttm_mem_type_manager *man)
{
@@ -82,7 +76,6 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
}
const struct ttm_mem_type_manager_func nouveau_vram_manager = {
- .init = nouveau_manager_init,
.takedown = nouveau_manager_fini,
.get_node = nouveau_vram_manager_new,
.put_node = nouveau_manager_del,
@@ -108,7 +101,6 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man,
}
const struct ttm_mem_type_manager_func nouveau_gart_manager = {
- .init = nouveau_manager_init,
.takedown = nouveau_manager_fini,
.get_node = nouveau_gart_manager_new,
.put_node = nouveau_manager_del,
@@ -143,7 +135,6 @@ nv04_gart_manager_new(struct ttm_mem_type_manager *man,
}
const struct ttm_mem_type_manager_func nv04_gart_manager = {
- .init = nouveau_manager_init,
.takedown = nouveau_manager_fini,
.get_node = nv04_gart_manager_new,
.put_node = nouveau_manager_del,
@@ -200,27 +191,21 @@ nouveau_ttm_init_vram(struct nouveau_drm *drm)
man->func = &nouveau_vram_manager;
man->use_io_reserve_lru = true;
+ ttm_bo_init_mm_base(&drm->ttm.bdev, man,
+ drm->gem.vram_available >> PAGE_SHIFT);
+ ttm_bo_use_mm(man);
+ return 0;
} else {
- man->func = &ttm_bo_manager_func;
+ return ttm_bo_man_init(&drm->ttm.bdev, man,
+ drm->gem.vram_available >> PAGE_SHIFT);
}
-
- return ttm_bo_init_mm(&drm->ttm.bdev, TTM_PL_VRAM,
- drm->gem.vram_available >> PAGE_SHIFT);
}
static int
nouveau_ttm_init_gtt(struct nouveau_drm *drm)
{
struct ttm_mem_type_manager *man = &drm->ttm.bdev.man[TTM_PL_TT];
-
- if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)
- man->func = &nouveau_gart_manager;
- else
- if (!drm->agp.bridge)
- man->func = &nv04_gart_manager;
- else
- man->func = &ttm_bo_manager_func;
-
+ unsigned long size_pages = drm->gem.gart_available >> PAGE_SHIFT;
man->use_tt = true;
if (drm->agp.bridge) {
man->available_caching = TTM_PL_FLAG_UNCACHED |
@@ -231,8 +216,18 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
man->default_caching = TTM_PL_FLAG_CACHED;
}
- return ttm_bo_init_mm(&drm->ttm.bdev, TTM_PL_TT,
- drm->gem.gart_available >> PAGE_SHIFT);
+ if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)
+ man->func = &nouveau_gart_manager;
+ else if (!drm->agp.bridge)
+ man->func = &nv04_gart_manager;
+ else
+ return ttm_bo_man_init(&drm->ttm.bdev, man,
+ size_pages);
+
+ ttm_bo_init_mm_base(&drm->ttm.bdev, man,
+ size_pages);
+ ttm_bo_use_mm(man);
+ return 0;
}
int
--
2.26.2
More information about the dri-devel
mailing list