mirror of https://gitee.com/openkylin/linux.git
drm/nouveau: use new cleanup paths
Reviewed-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-31-airlied@gmail.com
This commit is contained in:
parent
cff099e70c
commit
058b5e34d8
|
@ -31,12 +31,6 @@
|
|||
|
||||
#include <core/tegra.h>
|
||||
|
||||
static int
|
||||
nouveau_manager_fini(struct ttm_mem_type_manager *man)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_manager_del(struct ttm_mem_type_manager *man, struct ttm_mem_reg *reg)
|
||||
{
|
||||
|
@ -70,7 +64,6 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
|
|||
}
|
||||
|
||||
const struct ttm_mem_type_manager_func nouveau_vram_manager = {
|
||||
.takedown = nouveau_manager_fini,
|
||||
.get_node = nouveau_vram_manager_new,
|
||||
.put_node = nouveau_manager_del,
|
||||
};
|
||||
|
@ -94,7 +87,6 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man,
|
|||
}
|
||||
|
||||
const struct ttm_mem_type_manager_func nouveau_gart_manager = {
|
||||
.takedown = nouveau_manager_fini,
|
||||
.get_node = nouveau_gart_manager_new,
|
||||
.put_node = nouveau_manager_del,
|
||||
};
|
||||
|
@ -127,7 +119,6 @@ nv04_gart_manager_new(struct ttm_mem_type_manager *man,
|
|||
}
|
||||
|
||||
const struct ttm_mem_type_manager_func nv04_gart_manager = {
|
||||
.takedown = nouveau_manager_fini,
|
||||
.get_node = nv04_gart_manager_new,
|
||||
.put_node = nouveau_manager_del,
|
||||
};
|
||||
|
@ -192,6 +183,19 @@ 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];
|
||||
|
||||
if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
|
||||
ttm_mem_type_manager_disable(man);
|
||||
ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man);
|
||||
ttm_mem_type_manager_cleanup(man);
|
||||
} else
|
||||
ttm_range_man_fini(&drm->ttm.bdev, man);
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_ttm_init_gtt(struct nouveau_drm *drm)
|
||||
{
|
||||
|
@ -221,6 +225,21 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_ttm_fini_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 &&
|
||||
drm->agp.bridge)
|
||||
ttm_range_man_fini(&drm->ttm.bdev, man);
|
||||
else {
|
||||
ttm_mem_type_manager_disable(man);
|
||||
ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man);
|
||||
ttm_mem_type_manager_cleanup(man);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
nouveau_ttm_init(struct nouveau_drm *drm)
|
||||
{
|
||||
|
@ -310,8 +329,8 @@ nouveau_ttm_fini(struct nouveau_drm *drm)
|
|||
{
|
||||
struct nvkm_device *device = nvxx_device(&drm->client.device);
|
||||
|
||||
ttm_bo_clean_mm(&drm->ttm.bdev, TTM_PL_VRAM);
|
||||
ttm_bo_clean_mm(&drm->ttm.bdev, TTM_PL_TT);
|
||||
nouveau_ttm_fini_vram(drm);
|
||||
nouveau_ttm_fini_gtt(drm);
|
||||
|
||||
ttm_bo_device_release(&drm->ttm.bdev);
|
||||
|
||||
|
|
Loading…
Reference in New Issue