Lines Matching refs:bo
20 int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm) in lima_heap_alloc() argument
23 struct address_space *mapping = bo->base.base.filp->f_mapping; in lima_heap_alloc()
24 struct device *dev = bo->base.base.dev->dev; in lima_heap_alloc()
25 size_t old_size = bo->heap_size; in lima_heap_alloc()
26 size_t new_size = bo->heap_size ? bo->heap_size * 2 : in lima_heap_alloc()
31 if (bo->heap_size >= bo->base.base.size) in lima_heap_alloc()
34 new_size = min(new_size, bo->base.base.size); in lima_heap_alloc()
36 mutex_lock(&bo->base.pages_lock); in lima_heap_alloc()
38 if (bo->base.pages) { in lima_heap_alloc()
39 pages = bo->base.pages; in lima_heap_alloc()
41 pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT, in lima_heap_alloc()
44 mutex_unlock(&bo->base.pages_lock); in lima_heap_alloc()
48 bo->base.pages = pages; in lima_heap_alloc()
49 bo->base.pages_use_count = 1; in lima_heap_alloc()
58 mutex_unlock(&bo->base.pages_lock); in lima_heap_alloc()
64 mutex_unlock(&bo->base.pages_lock); in lima_heap_alloc()
71 if (bo->base.sgt) { in lima_heap_alloc()
72 dma_unmap_sgtable(dev, bo->base.sgt, DMA_BIDIRECTIONAL, 0); in lima_heap_alloc()
73 sg_free_table(bo->base.sgt); in lima_heap_alloc()
75 bo->base.sgt = kmalloc(sizeof(*bo->base.sgt), GFP_KERNEL); in lima_heap_alloc()
76 if (!bo->base.sgt) { in lima_heap_alloc()
85 kfree(bo->base.sgt); in lima_heap_alloc()
86 bo->base.sgt = NULL; in lima_heap_alloc()
90 *bo->base.sgt = sgt; in lima_heap_alloc()
93 ret = lima_vm_map_bo(vm, bo, old_size >> PAGE_SHIFT); in lima_heap_alloc()
98 bo->heap_size = new_size; in lima_heap_alloc()
109 struct lima_bo *bo; in lima_gem_create_handle() local
125 bo = to_lima_bo(obj); in lima_gem_create_handle()
126 err = lima_heap_alloc(bo, NULL); in lima_gem_create_handle()
149 struct lima_bo *bo = to_lima_bo(obj); in lima_gem_free_object() local
151 if (!list_empty(&bo->va)) in lima_gem_free_object()
159 struct lima_bo *bo = to_lima_bo(obj); in lima_gem_object_open() local
163 return lima_vm_bo_add(vm, bo, true); in lima_gem_object_open()
168 struct lima_bo *bo = to_lima_bo(obj); in lima_gem_object_close() local
172 lima_vm_bo_del(vm, bo); in lima_gem_object_close()
177 struct lima_bo *bo = to_lima_bo(obj); in lima_gem_pin() local
179 if (bo->heap_size) in lima_gem_pin()
187 struct lima_bo *bo = to_lima_bo(obj); in lima_gem_vmap() local
189 if (bo->heap_size) in lima_gem_vmap()
197 struct lima_bo *bo = to_lima_bo(obj); in lima_gem_mmap() local
199 if (bo->heap_size) in lima_gem_mmap()
220 struct lima_bo *bo; in lima_gem_create_object() local
222 bo = kzalloc(sizeof(*bo), GFP_KERNEL); in lima_gem_create_object()
223 if (!bo) in lima_gem_create_object()
226 mutex_init(&bo->lock); in lima_gem_create_object()
227 INIT_LIST_HEAD(&bo->va); in lima_gem_create_object()
228 bo->base.map_wc = true; in lima_gem_create_object()
229 bo->base.base.funcs = &lima_gem_funcs; in lima_gem_create_object()
231 return &bo->base.base; in lima_gem_create_object()
237 struct lima_bo *bo; in lima_gem_get_info() local
245 bo = to_lima_bo(obj); in lima_gem_get_info()
247 *va = lima_vm_get_va(vm, bo); in lima_gem_get_info()
255 static int lima_gem_sync_bo(struct lima_sched_task *task, struct lima_bo *bo, in lima_gem_sync_bo() argument
261 err = dma_resv_reserve_shared(lima_bo_resv(bo), 1); in lima_gem_sync_bo()
271 &bo->base.base, in lima_gem_sync_bo()
318 struct lima_bo *bo; in lima_gem_submit() local
326 bo = to_lima_bo(obj); in lima_gem_submit()
331 err = lima_vm_bo_add(vm, bo, false); in lima_gem_submit()
337 bos[i] = bo; in lima_gem_submit()