Lines Matching refs:nvbo
42 struct nouveau_bo *nvbo = nouveau_gem_object(gem); in nouveau_gem_object_del() local
43 struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); in nouveau_gem_object_del()
52 drm_prime_gem_destroy(gem, nvbo->bo.sg); in nouveau_gem_object_del()
54 ttm_bo_put(&nvbo->bo); in nouveau_gem_object_del()
64 struct nouveau_bo *nvbo = nouveau_gem_object(gem); in nouveau_gem_object_open() local
65 struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); in nouveau_gem_object_open()
74 ret = ttm_bo_reserve(&nvbo->bo, false, false, NULL); in nouveau_gem_object_open()
82 ret = nouveau_vma_new(nvbo, vmm, &vma); in nouveau_gem_object_open()
86 ttm_bo_unreserve(&nvbo->bo); in nouveau_gem_object_open()
112 nouveau_gem_object_unmap(struct nouveau_bo *nvbo, struct nouveau_vma *vma) in nouveau_gem_object_unmap() argument
139 struct nouveau_bo *nvbo = nouveau_gem_object(gem); in nouveau_gem_object_close() local
140 struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); in nouveau_gem_object_close()
149 ret = ttm_bo_reserve(&nvbo->bo, false, false, NULL); in nouveau_gem_object_close()
153 vma = nouveau_vma_find(nvbo, vmm); in nouveau_gem_object_close()
158 nouveau_gem_object_unmap(nvbo, vma); in nouveau_gem_object_close()
164 ttm_bo_unreserve(&nvbo->bo); in nouveau_gem_object_close()
173 struct nouveau_bo *nvbo; in nouveau_gem_new() local
187 nvbo = nouveau_bo_alloc(cli, &size, &align, flags, tile_mode, in nouveau_gem_new()
189 if (IS_ERR(nvbo)) in nouveau_gem_new()
190 return PTR_ERR(nvbo); in nouveau_gem_new()
194 ret = drm_gem_object_init(drm->dev, &nvbo->bo.base, size); in nouveau_gem_new()
196 nouveau_bo_ref(NULL, &nvbo); in nouveau_gem_new()
200 ret = nouveau_bo_init(nvbo, size, align, flags, NULL, NULL); in nouveau_gem_new()
202 nouveau_bo_ref(NULL, &nvbo); in nouveau_gem_new()
210 nvbo->valid_domains = NOUVEAU_GEM_DOMAIN_VRAM | in nouveau_gem_new()
213 nvbo->valid_domains &= domain; in nouveau_gem_new()
215 nvbo->bo.persistent_swap_storage = nvbo->bo.base.filp; in nouveau_gem_new()
216 *pnvbo = nvbo; in nouveau_gem_new()
225 struct nouveau_bo *nvbo = nouveau_gem_object(gem); in nouveau_gem_info() local
229 if (is_power_of_2(nvbo->valid_domains)) in nouveau_gem_info()
230 rep->domain = nvbo->valid_domains; in nouveau_gem_info()
231 else if (nvbo->bo.mem.mem_type == TTM_PL_TT) in nouveau_gem_info()
235 rep->offset = nvbo->bo.offset; in nouveau_gem_info()
237 vma = nouveau_vma_find(nvbo, vmm); in nouveau_gem_info()
244 rep->size = nvbo->bo.mem.num_pages << PAGE_SHIFT; in nouveau_gem_info()
245 rep->map_handle = drm_vma_node_offset_addr(&nvbo->bo.base.vma_node); in nouveau_gem_info()
246 rep->tile_mode = nvbo->mode; in nouveau_gem_info()
247 rep->tile_flags = nvbo->contig ? 0 : NOUVEAU_GEM_TILE_NONCONTIG; in nouveau_gem_info()
249 rep->tile_flags |= nvbo->kind << 8; in nouveau_gem_info()
252 rep->tile_flags |= nvbo->kind << 8 | nvbo->comp << 16; in nouveau_gem_info()
254 rep->tile_flags |= nvbo->zeta; in nouveau_gem_info()
264 struct nouveau_bo *nvbo = NULL; in nouveau_gem_ioctl_new() local
269 req->info.tile_flags, &nvbo); in nouveau_gem_ioctl_new()
273 ret = drm_gem_handle_create(file_priv, &nvbo->bo.base, in nouveau_gem_ioctl_new()
276 ret = nouveau_gem_info(file_priv, &nvbo->bo.base, &req->info); in nouveau_gem_ioctl_new()
282 drm_gem_object_put_unlocked(&nvbo->bo.base); in nouveau_gem_ioctl_new()
290 struct nouveau_bo *nvbo = nouveau_gem_object(gem); in nouveau_gem_set_domain() local
291 struct ttm_buffer_object *bo = &nvbo->bo; in nouveau_gem_set_domain()
292 uint32_t domains = valid_domains & nvbo->valid_domains & in nouveau_gem_set_domain()
319 nouveau_bo_placement_set(nvbo, pref_flags, valid_flags); in nouveau_gem_set_domain()
334 struct nouveau_bo *nvbo; in validate_fini_no_ticket() local
338 nvbo = list_entry(op->list.next, struct nouveau_bo, entry); in validate_fini_no_ticket()
339 b = &pbbo[nvbo->pbbo_index]; in validate_fini_no_ticket()
342 nouveau_bo_fence(nvbo, fence, !!b->write_domains); in validate_fini_no_ticket()
353 if (unlikely(nvbo->validate_mapped)) { in validate_fini_no_ticket()
354 ttm_bo_kunmap(&nvbo->kmap); in validate_fini_no_ticket()
355 nvbo->validate_mapped = false; in validate_fini_no_ticket()
358 list_del(&nvbo->entry); in validate_fini_no_ticket()
359 nvbo->reserved_by = NULL; in validate_fini_no_ticket()
360 ttm_bo_unreserve(&nvbo->bo); in validate_fini_no_ticket()
361 drm_gem_object_put_unlocked(&nvbo->bo.base); in validate_fini_no_ticket()
397 struct nouveau_bo *nvbo; in validate_init() local
405 nvbo = nouveau_gem_object(gem); in validate_init()
406 if (nvbo == res_bo) { in validate_init()
412 if (nvbo->reserved_by && nvbo->reserved_by == file_priv) { in validate_init()
420 ret = ttm_bo_reserve(&nvbo->bo, true, false, &op->ticket); in validate_init()
427 ret = ttm_bo_reserve_slowpath(&nvbo->bo, true, in validate_init()
430 res_bo = nvbo; in validate_init()
441 struct nouveau_vma *vma = nouveau_vma_find(nvbo, vmm); in validate_init()
450 b->user_priv = (uint64_t)(unsigned long)nvbo; in validate_init()
453 nvbo->reserved_by = file_priv; in validate_init()
454 nvbo->pbbo_index = i; in validate_init()
457 list_add_tail(&nvbo->entry, &both_list); in validate_init()
460 list_add_tail(&nvbo->entry, &vram_list); in validate_init()
463 list_add_tail(&nvbo->entry, &gart_list); in validate_init()
467 list_add_tail(&nvbo->entry, &both_list); in validate_init()
471 if (nvbo == res_bo) in validate_init()
493 struct nouveau_bo *nvbo; in validate_list() local
496 list_for_each_entry(nvbo, list, entry) { in validate_list()
497 struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; in validate_list()
499 ret = nouveau_gem_set_domain(&nvbo->bo.base, b->read_domains, in validate_list()
507 ret = nouveau_bo_validate(nvbo, true, false); in validate_list()
514 ret = nouveau_fence_sync(nvbo, chan, !!b->write_domains, true); in validate_list()
522 if (nvbo->bo.offset == b->presumed.offset && in validate_list()
523 ((nvbo->bo.mem.mem_type == TTM_PL_VRAM && in validate_list()
525 (nvbo->bo.mem.mem_type == TTM_PL_TT && in validate_list()
529 if (nvbo->bo.mem.mem_type == TTM_PL_TT) in validate_list()
533 b->presumed.offset = nvbo->bo.offset; in validate_list()
537 if (copy_to_user(&upbbo[nvbo->pbbo_index].presumed, in validate_list()
621 struct nouveau_bo *nvbo; in nouveau_gem_pushbuf_reloc_apply() local
639 nvbo = (void *)(unsigned long)bo[r->reloc_bo_index].user_priv; in nouveau_gem_pushbuf_reloc_apply()
642 nvbo->bo.mem.num_pages << PAGE_SHIFT)) { in nouveau_gem_pushbuf_reloc_apply()
648 if (!nvbo->kmap.virtual) { in nouveau_gem_pushbuf_reloc_apply()
649 ret = ttm_bo_kmap(&nvbo->bo, 0, nvbo->bo.mem.num_pages, in nouveau_gem_pushbuf_reloc_apply()
650 &nvbo->kmap); in nouveau_gem_pushbuf_reloc_apply()
655 nvbo->validate_mapped = true; in nouveau_gem_pushbuf_reloc_apply()
673 ret = ttm_bo_wait(&nvbo->bo, false, false); in nouveau_gem_pushbuf_reloc_apply()
679 nouveau_bo_wr32(nvbo, r->reloc_bo_offset >> 2, data); in nouveau_gem_pushbuf_reloc_apply()
798 struct nouveau_bo *nvbo = (void *)(unsigned long) in nouveau_gem_ioctl_pushbuf() local
801 OUT_RING(chan, (nvbo->bo.offset + push[i].offset) | 2); in nouveau_gem_ioctl_pushbuf()
812 struct nouveau_bo *nvbo = (void *)(unsigned long) in nouveau_gem_ioctl_pushbuf() local
819 if (!nvbo->kmap.virtual) { in nouveau_gem_ioctl_pushbuf()
820 ret = ttm_bo_kmap(&nvbo->bo, 0, in nouveau_gem_ioctl_pushbuf()
821 nvbo->bo.mem. in nouveau_gem_ioctl_pushbuf()
823 &nvbo->kmap); in nouveau_gem_ioctl_pushbuf()
828 nvbo->validate_mapped = true; in nouveau_gem_ioctl_pushbuf()
831 nouveau_bo_wr32(nvbo, (push[i].offset + in nouveau_gem_ioctl_pushbuf()
836 (nvbo->bo.offset + push[i].offset)); in nouveau_gem_ioctl_pushbuf()
881 struct nouveau_bo *nvbo; in nouveau_gem_ioctl_cpu_prep() local
890 nvbo = nouveau_gem_object(gem); in nouveau_gem_ioctl_cpu_prep()
892 lret = dma_resv_wait_timeout_rcu(nvbo->bo.base.resv, write, true, in nouveau_gem_ioctl_cpu_prep()
901 nouveau_bo_sync_for_cpu(nvbo); in nouveau_gem_ioctl_cpu_prep()
913 struct nouveau_bo *nvbo; in nouveau_gem_ioctl_cpu_fini() local
918 nvbo = nouveau_gem_object(gem); in nouveau_gem_ioctl_cpu_fini()
920 nouveau_bo_sync_for_device(nvbo); in nouveau_gem_ioctl_cpu_fini()