drm/ttm: initialize globals during device init (v2)
Make sure that the global BO state is always correctly initialized. This allows removing all the device code to initialize it. v2: fix up vbox (Alex) Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Этот коммит содержится в:

коммит произвёл
Alex Deucher

родитель
62b53b37e4
Коммит
a64f784bb1
@@ -146,7 +146,6 @@ struct nouveau_drm {
|
||||
|
||||
/* TTM interface support */
|
||||
struct {
|
||||
struct ttm_bo_global_ref bo_global_ref;
|
||||
struct ttm_bo_device bdev;
|
||||
atomic_t validate_sequence;
|
||||
int (*move)(struct nouveau_channel *,
|
||||
|
@@ -174,38 +174,6 @@ nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
return ttm_bo_mmap(filp, vma, &drm->ttm.bdev);
|
||||
}
|
||||
|
||||
int
|
||||
nouveau_ttm_global_init(struct nouveau_drm *drm)
|
||||
{
|
||||
struct drm_global_reference *global_ref;
|
||||
int ret;
|
||||
|
||||
global_ref = &drm->ttm.bo_global_ref.ref;
|
||||
global_ref->global_type = DRM_GLOBAL_TTM_BO;
|
||||
global_ref->size = sizeof(struct ttm_bo_global);
|
||||
global_ref->init = &ttm_bo_global_ref_init;
|
||||
global_ref->release = &ttm_bo_global_ref_release;
|
||||
|
||||
ret = drm_global_item_ref(global_ref);
|
||||
if (unlikely(ret != 0)) {
|
||||
DRM_ERROR("Failed setting up TTM BO subsystem\n");
|
||||
drm->ttm.bo_global_ref.ref.release = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_ttm_global_release(struct nouveau_drm *drm)
|
||||
{
|
||||
if (drm->ttm.bo_global_ref.ref.release == NULL)
|
||||
return;
|
||||
|
||||
drm_global_item_unref(&drm->ttm.bo_global_ref.ref);
|
||||
drm->ttm.bo_global_ref.ref.release = NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_ttm_init_host(struct nouveau_drm *drm, u8 kind)
|
||||
{
|
||||
@@ -268,12 +236,7 @@ nouveau_ttm_init(struct nouveau_drm *drm)
|
||||
drm->agp.cma = pci->agp.cma;
|
||||
}
|
||||
|
||||
ret = nouveau_ttm_global_init(drm);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ttm_bo_device_init(&drm->ttm.bdev,
|
||||
drm->ttm.bo_global_ref.ref.object,
|
||||
&nouveau_bo_driver,
|
||||
dev->anon_inode->i_mapping,
|
||||
DRM_FILE_PAGE_OFFSET,
|
||||
@@ -328,8 +291,6 @@ nouveau_ttm_fini(struct nouveau_drm *drm)
|
||||
|
||||
ttm_bo_device_release(&drm->ttm.bdev);
|
||||
|
||||
nouveau_ttm_global_release(drm);
|
||||
|
||||
arch_phys_wc_del(drm->ttm.mtrr);
|
||||
drm->ttm.mtrr = 0;
|
||||
arch_io_free_memtype_wc(device->func->resource_addr(device, 1),
|
||||
|
Ссылка в новой задаче
Block a user