Lines Matching refs:bo
94 struct rockchip_bo *bo; in rockchip_bo_create() local
105 bo = calloc(1, sizeof(*bo)); in rockchip_bo_create()
106 if (!bo) { in rockchip_bo_create()
112 bo->dev = dev; in rockchip_bo_create()
120 bo->handle = req.handle; in rockchip_bo_create()
121 bo->size = size; in rockchip_bo_create()
122 bo->flags = flags; in rockchip_bo_create()
124 return bo; in rockchip_bo_create()
127 free(bo); in rockchip_bo_create()
135 struct rockchip_bo *bo; in rockchip_bo_from_handle() local
142 bo = calloc(1, sizeof(*bo)); in rockchip_bo_from_handle()
143 if (!bo) { in rockchip_bo_from_handle()
149 bo->dev = dev; in rockchip_bo_from_handle()
150 bo->handle = handle; in rockchip_bo_from_handle()
151 bo->size = size; in rockchip_bo_from_handle()
152 bo->flags = flags; in rockchip_bo_from_handle()
154 return bo; in rockchip_bo_from_handle()
162 void rockchip_bo_destroy(struct rockchip_bo *bo) in rockchip_bo_destroy() argument
164 if (!bo) in rockchip_bo_destroy()
167 if (bo->vaddr) in rockchip_bo_destroy()
168 munmap(bo->vaddr, bo->size); in rockchip_bo_destroy()
170 if (bo->handle) { in rockchip_bo_destroy()
172 .handle = bo->handle, in rockchip_bo_destroy()
175 drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_CLOSE, &req); in rockchip_bo_destroy()
178 free(bo); in rockchip_bo_destroy()
197 struct rockchip_bo *bo; in rockchip_bo_from_name() local
202 bo = calloc(1, sizeof(*bo)); in rockchip_bo_from_name()
203 if (!bo) { in rockchip_bo_from_name()
215 bo->dev = dev; in rockchip_bo_from_name()
216 bo->name = name; in rockchip_bo_from_name()
217 bo->handle = req.handle; in rockchip_bo_from_name()
219 return bo; in rockchip_bo_from_name()
222 free(bo); in rockchip_bo_from_name()
237 int rockchip_bo_get_name(struct rockchip_bo *bo, uint32_t *name) in rockchip_bo_get_name() argument
239 if (!bo->name) { in rockchip_bo_get_name()
241 .handle = bo->handle, in rockchip_bo_get_name()
245 ret = drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_FLINK, &req); in rockchip_bo_get_name()
252 bo->name = req.name; in rockchip_bo_get_name()
255 *name = bo->name; in rockchip_bo_get_name()
260 uint32_t rockchip_bo_handle(struct rockchip_bo *bo) in rockchip_bo_handle() argument
262 return bo->handle; in rockchip_bo_handle()
273 void *rockchip_bo_map(struct rockchip_bo *bo) in rockchip_bo_map() argument
275 if (!bo->vaddr) { in rockchip_bo_map()
276 struct rockchip_device *dev = bo->dev; in rockchip_bo_map()
278 .handle = bo->handle, in rockchip_bo_map()
289 bo->vaddr = mmap(0, bo->size, PROT_READ | PROT_WRITE, in rockchip_bo_map()
291 if (bo->vaddr == MAP_FAILED) { in rockchip_bo_map()
298 return bo->vaddr; in rockchip_bo_map()