Lines Matching full:drm
28 #include <drm/ttm/ttm_range_manager.h>
29 #include <drm/drm_cache.h>
70 struct nouveau_drm *drm = nouveau_bdev(bo->bdev); in nouveau_vram_manager_new() local
73 if (drm->client.device.info.ram_size == 0) in nouveau_vram_manager_new()
76 ret = nouveau_mem_new(drm, nvbo->kind, nvbo->comp, res); in nouveau_vram_manager_new()
105 struct nouveau_drm *drm = nouveau_bdev(bo->bdev); in nouveau_gart_manager_new() local
108 ret = nouveau_mem_new(drm, nvbo->kind, nvbo->comp, res); in nouveau_gart_manager_new()
131 struct nouveau_drm *drm = nouveau_bdev(bo->bdev); in nv04_gart_manager_new() local
135 ret = nouveau_mem_new(drm, nvbo->kind, nvbo->comp, res); in nv04_gart_manager_new()
141 ret = nvif_vmm_get(&drm->client.vmm.vmm, PTES, false, 12, 0, in nv04_gart_manager_new()
160 nouveau_ttm_init_host(struct nouveau_drm *drm, u8 kind) in nouveau_ttm_init_host() argument
162 struct nvif_mmu *mmu = &drm->client.mmu; in nouveau_ttm_init_host()
170 drm->ttm.type_host[!!kind] = typei; in nouveau_ttm_init_host()
176 drm->ttm.type_ncoh[!!kind] = typei; in nouveau_ttm_init_host()
181 nouveau_ttm_init_vram(struct nouveau_drm *drm) in nouveau_ttm_init_vram() argument
183 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) { in nouveau_ttm_init_vram()
191 ttm_resource_manager_init(man, &drm->ttm.bdev, in nouveau_ttm_init_vram()
192 drm->gem.vram_available >> PAGE_SHIFT); in nouveau_ttm_init_vram()
193 ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_VRAM, man); in nouveau_ttm_init_vram()
197 return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_VRAM, false, in nouveau_ttm_init_vram()
198 drm->gem.vram_available >> PAGE_SHIFT); in nouveau_ttm_init_vram()
203 nouveau_ttm_fini_vram(struct nouveau_drm *drm) in nouveau_ttm_fini_vram() argument
205 struct ttm_resource_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM); in nouveau_ttm_fini_vram()
207 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) { in nouveau_ttm_fini_vram()
209 ttm_resource_manager_evict_all(&drm->ttm.bdev, man); in nouveau_ttm_fini_vram()
211 ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_VRAM, NULL); in nouveau_ttm_fini_vram()
214 ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_VRAM); in nouveau_ttm_fini_vram()
218 nouveau_ttm_init_gtt(struct nouveau_drm *drm) in nouveau_ttm_init_gtt() argument
221 unsigned long size_pages = drm->gem.gart_available >> PAGE_SHIFT; in nouveau_ttm_init_gtt()
224 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) in nouveau_ttm_init_gtt()
226 else if (!drm->agp.bridge) in nouveau_ttm_init_gtt()
229 return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_TT, true, in nouveau_ttm_init_gtt()
238 ttm_resource_manager_init(man, &drm->ttm.bdev, size_pages); in nouveau_ttm_init_gtt()
239 ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_TT, man); in nouveau_ttm_init_gtt()
245 nouveau_ttm_fini_gtt(struct nouveau_drm *drm) in nouveau_ttm_fini_gtt() argument
247 struct ttm_resource_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_TT); in nouveau_ttm_fini_gtt()
249 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA && in nouveau_ttm_fini_gtt()
250 drm->agp.bridge) in nouveau_ttm_fini_gtt()
251 ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_TT); in nouveau_ttm_fini_gtt()
254 ttm_resource_manager_evict_all(&drm->ttm.bdev, man); in nouveau_ttm_fini_gtt()
256 ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_TT, NULL); in nouveau_ttm_fini_gtt()
262 nouveau_ttm_init(struct nouveau_drm *drm) in nouveau_ttm_init() argument
264 struct nvkm_device *device = nvxx_device(drm); in nouveau_ttm_init()
266 struct nvif_mmu *mmu = &drm->client.mmu; in nouveau_ttm_init()
267 struct drm_device *dev = drm->dev; in nouveau_ttm_init()
270 ret = nouveau_ttm_init_host(drm, 0); in nouveau_ttm_init()
274 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA && in nouveau_ttm_init()
275 drm->client.device.info.chipset != 0x50) { in nouveau_ttm_init()
276 ret = nouveau_ttm_init_host(drm, NVIF_MEM_KIND); in nouveau_ttm_init()
281 if (drm->client.device.info.platform != NV_DEVICE_INFO_V0_SOC && in nouveau_ttm_init()
282 drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) { in nouveau_ttm_init()
290 drm->ttm.type_vram = typei; in nouveau_ttm_init()
292 drm->ttm.type_vram = -1; in nouveau_ttm_init()
296 drm->agp.bridge = pci->agp.bridge; in nouveau_ttm_init()
297 drm->agp.base = pci->agp.base; in nouveau_ttm_init()
298 drm->agp.size = pci->agp.size; in nouveau_ttm_init()
299 drm->agp.cma = pci->agp.cma; in nouveau_ttm_init()
302 ret = ttm_device_init(&drm->ttm.bdev, &nouveau_bo_driver, drm->dev->dev, in nouveau_ttm_init()
305 drm_need_swiotlb(drm->client.mmu.dmabits), in nouveau_ttm_init()
306 drm->client.mmu.dmabits <= 32); in nouveau_ttm_init()
308 NV_ERROR(drm, "error initialising bo driver, %d\n", ret); in nouveau_ttm_init()
313 drm->gem.vram_available = drm->client.device.info.ram_user; in nouveau_ttm_init()
318 ret = nouveau_ttm_init_vram(drm); in nouveau_ttm_init()
320 NV_ERROR(drm, "VRAM mm init failed, %d\n", ret); in nouveau_ttm_init()
324 drm->ttm.mtrr = arch_phys_wc_add(device->func->resource_addr(device, 1), in nouveau_ttm_init()
328 if (!drm->agp.bridge) { in nouveau_ttm_init()
329 drm->gem.gart_available = drm->client.vmm.vmm.limit; in nouveau_ttm_init()
331 drm->gem.gart_available = drm->agp.size; in nouveau_ttm_init()
334 ret = nouveau_ttm_init_gtt(drm); in nouveau_ttm_init()
336 NV_ERROR(drm, "GART mm init failed, %d\n", ret); in nouveau_ttm_init()
340 mutex_init(&drm->ttm.io_reserve_mutex); in nouveau_ttm_init()
341 INIT_LIST_HEAD(&drm->ttm.io_reserve_lru); in nouveau_ttm_init()
343 NV_INFO(drm, "VRAM: %d MiB\n", (u32)(drm->gem.vram_available >> 20)); in nouveau_ttm_init()
344 NV_INFO(drm, "GART: %d MiB\n", (u32)(drm->gem.gart_available >> 20)); in nouveau_ttm_init()
349 nouveau_ttm_fini(struct nouveau_drm *drm) in nouveau_ttm_fini() argument
351 struct nvkm_device *device = nvxx_device(drm); in nouveau_ttm_fini()
353 nouveau_ttm_fini_vram(drm); in nouveau_ttm_fini()
354 nouveau_ttm_fini_gtt(drm); in nouveau_ttm_fini()
356 ttm_device_fini(&drm->ttm.bdev); in nouveau_ttm_fini()
358 arch_phys_wc_del(drm->ttm.mtrr); in nouveau_ttm_fini()
359 drm->ttm.mtrr = 0; in nouveau_ttm_fini()