• Home
  • Raw
  • Download

Lines Matching refs:bo

33 drm_private void bo_del(struct fd_bo *bo);
36 static void set_name(struct fd_bo *bo, uint32_t name) in set_name() argument
38 bo->name = name; in set_name()
40 drmHashInsert(bo->dev->name_table, name, bo); in set_name()
46 struct fd_bo *bo = NULL; in lookup_bo() local
47 if (!drmHashLookup(tbl, key, (void **)&bo)) { in lookup_bo()
49 bo = fd_bo_ref(bo); in lookup_bo()
52 list_delinit(&bo->list); in lookup_bo()
54 return bo; in lookup_bo()
61 struct fd_bo *bo; in bo_from_handle() local
63 bo = dev->funcs->bo_from_handle(dev, size, handle); in bo_from_handle()
64 if (!bo) { in bo_from_handle()
71 bo->dev = fd_device_ref(dev); in bo_from_handle()
72 bo->size = size; in bo_from_handle()
73 bo->handle = handle; in bo_from_handle()
74 atomic_set(&bo->refcnt, 1); in bo_from_handle()
75 list_inithead(&bo->list); in bo_from_handle()
77 drmHashInsert(dev->handle_table, handle, bo); in bo_from_handle()
78 return bo; in bo_from_handle()
84 struct fd_bo *bo = NULL; in fd_bo_new() local
88 bo = fd_bo_cache_alloc(&dev->bo_cache, &size, flags); in fd_bo_new()
89 if (bo) in fd_bo_new()
90 return bo; in fd_bo_new()
97 bo = bo_from_handle(dev, size, handle); in fd_bo_new()
98 bo->bo_reuse = TRUE; in fd_bo_new()
101 VG_BO_ALLOC(bo); in fd_bo_new()
103 return bo; in fd_bo_new()
109 struct fd_bo *bo = NULL; in fd_bo_from_handle() local
113 bo = lookup_bo(dev->handle_table, handle); in fd_bo_from_handle()
114 if (bo) in fd_bo_from_handle()
117 bo = bo_from_handle(dev, size, handle); in fd_bo_from_handle()
119 VG_BO_ALLOC(bo); in fd_bo_from_handle()
124 return bo; in fd_bo_from_handle()
132 struct fd_bo *bo; in fd_bo_from_dmabuf() local
141 bo = lookup_bo(dev->handle_table, handle); in fd_bo_from_dmabuf()
142 if (bo) in fd_bo_from_dmabuf()
149 bo = bo_from_handle(dev, size, handle); in fd_bo_from_dmabuf()
151 VG_BO_ALLOC(bo); in fd_bo_from_dmabuf()
156 return bo; in fd_bo_from_dmabuf()
164 struct fd_bo *bo; in fd_bo_from_name() local
169 bo = lookup_bo(dev->name_table, name); in fd_bo_from_name()
170 if (bo) in fd_bo_from_name()
178 bo = lookup_bo(dev->handle_table, req.handle); in fd_bo_from_name()
179 if (bo) in fd_bo_from_name()
182 bo = bo_from_handle(dev, req.size, req.handle); in fd_bo_from_name()
183 if (bo) { in fd_bo_from_name()
184 set_name(bo, name); in fd_bo_from_name()
185 VG_BO_ALLOC(bo); in fd_bo_from_name()
191 return bo; in fd_bo_from_name()
194 uint64_t fd_bo_get_iova(struct fd_bo *bo) in fd_bo_get_iova() argument
196 return bo->funcs->iova(bo); in fd_bo_get_iova()
199 void fd_bo_put_iova(struct fd_bo *bo) in fd_bo_put_iova() argument
204 struct fd_bo * fd_bo_ref(struct fd_bo *bo) in fd_bo_ref() argument
206 atomic_inc(&bo->refcnt); in fd_bo_ref()
207 return bo; in fd_bo_ref()
210 void fd_bo_del(struct fd_bo *bo) in fd_bo_del() argument
212 struct fd_device *dev = bo->dev; in fd_bo_del()
214 if (!atomic_dec_and_test(&bo->refcnt)) in fd_bo_del()
219 if (bo->bo_reuse && (fd_bo_cache_free(&dev->bo_cache, bo) == 0)) in fd_bo_del()
222 bo_del(bo); in fd_bo_del()
229 drm_private void bo_del(struct fd_bo *bo) in bo_del() argument
231 VG_BO_FREE(bo); in bo_del()
233 if (bo->map) in bo_del()
234 drm_munmap(bo->map, bo->size); in bo_del()
240 if (bo->handle) { in bo_del()
242 .handle = bo->handle, in bo_del()
244 drmHashDelete(bo->dev->handle_table, bo->handle); in bo_del()
245 if (bo->name) in bo_del()
246 drmHashDelete(bo->dev->name_table, bo->name); in bo_del()
247 drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_CLOSE, &req); in bo_del()
250 bo->funcs->destroy(bo); in bo_del()
253 int fd_bo_get_name(struct fd_bo *bo, uint32_t *name) in fd_bo_get_name() argument
255 if (!bo->name) { in fd_bo_get_name()
257 .handle = bo->handle, in fd_bo_get_name()
261 ret = drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_FLINK, &req); in fd_bo_get_name()
267 set_name(bo, req.name); in fd_bo_get_name()
269 bo->bo_reuse = FALSE; in fd_bo_get_name()
272 *name = bo->name; in fd_bo_get_name()
277 uint32_t fd_bo_handle(struct fd_bo *bo) in fd_bo_handle() argument
279 return bo->handle; in fd_bo_handle()
282 int fd_bo_dmabuf(struct fd_bo *bo) in fd_bo_dmabuf() argument
286 ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC, in fd_bo_dmabuf()
293 bo->bo_reuse = FALSE; in fd_bo_dmabuf()
298 uint32_t fd_bo_size(struct fd_bo *bo) in fd_bo_size() argument
300 return bo->size; in fd_bo_size()
303 void * fd_bo_map(struct fd_bo *bo) in fd_bo_map() argument
305 if (!bo->map) { in fd_bo_map()
309 ret = bo->funcs->offset(bo, &offset); in fd_bo_map()
314 bo->map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, in fd_bo_map()
315 bo->dev->fd, offset); in fd_bo_map()
316 if (bo->map == MAP_FAILED) { in fd_bo_map()
318 bo->map = NULL; in fd_bo_map()
321 return bo->map; in fd_bo_map()
325 int fd_bo_cpu_prep(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op) in fd_bo_cpu_prep() argument
327 return bo->funcs->cpu_prep(bo, pipe, op); in fd_bo_cpu_prep()
330 void fd_bo_cpu_fini(struct fd_bo *bo) in fd_bo_cpu_fini() argument
332 bo->funcs->cpu_fini(bo); in fd_bo_cpu_fini()