Lines Matching refs:dev
39 mem_device_destroy(struct vugbm_device *dev) in mem_device_destroy() argument
113 *fd = ioctl(buf->dev->fd, UDMABUF_CREATE, &create); in udmabuf_get_fd()
125 udmabuf_device_destroy(struct vugbm_device *dev) in udmabuf_device_destroy() argument
127 close(dev->fd); in udmabuf_device_destroy()
135 struct gbm_device *dev = buf->dev->dev; in alloc_bo() local
139 buf->bo = gbm_bo_create(dev, buf->width, buf->height, in alloc_bo()
186 device_destroy(struct vugbm_device *dev) in device_destroy() argument
188 gbm_device_destroy(dev->dev); in device_destroy()
193 vugbm_device_destroy(struct vugbm_device *dev) in vugbm_device_destroy() argument
195 if (!dev->inited) { in vugbm_device_destroy()
199 dev->device_destroy(dev); in vugbm_device_destroy()
203 vugbm_device_init(struct vugbm_device *dev, int fd) in vugbm_device_init() argument
205 assert(!dev->inited); in vugbm_device_init()
209 dev->dev = gbm_create_device(fd); in vugbm_device_init()
211 if (dev->dev != NULL) { in vugbm_device_init()
212 dev->fd = fd; in vugbm_device_init()
213 dev->alloc_bo = alloc_bo; in vugbm_device_init()
214 dev->free_bo = free_bo; in vugbm_device_init()
215 dev->get_fd = get_fd; in vugbm_device_init()
216 dev->map_bo = map_bo; in vugbm_device_init()
217 dev->unmap_bo = unmap_bo; in vugbm_device_init()
218 dev->device_destroy = device_destroy; in vugbm_device_init()
219 dev->inited = true; in vugbm_device_init()
223 if (!dev->inited && g_file_test("/dev/udmabuf", G_FILE_TEST_EXISTS)) { in vugbm_device_init()
224 dev->fd = open("/dev/udmabuf", O_RDWR); in vugbm_device_init()
225 if (dev->fd >= 0) { in vugbm_device_init()
227 dev->alloc_bo = udmabuf_alloc_bo; in vugbm_device_init()
228 dev->free_bo = udmabuf_free_bo; in vugbm_device_init()
229 dev->get_fd = udmabuf_get_fd; in vugbm_device_init()
230 dev->map_bo = udmabuf_map_bo; in vugbm_device_init()
231 dev->unmap_bo = udmabuf_unmap_bo; in vugbm_device_init()
232 dev->device_destroy = udmabuf_device_destroy; in vugbm_device_init()
233 dev->inited = true; in vugbm_device_init()
237 if (!dev->inited) { in vugbm_device_init()
239 dev->alloc_bo = mem_alloc_bo; in vugbm_device_init()
240 dev->free_bo = mem_free_bo; in vugbm_device_init()
241 dev->map_bo = mem_map_bo; in vugbm_device_init()
242 dev->unmap_bo = mem_unmap_bo; in vugbm_device_init()
243 dev->device_destroy = mem_device_destroy; in vugbm_device_init()
244 dev->inited = true; in vugbm_device_init()
246 assert(dev->inited); in vugbm_device_init()
252 struct vugbm_device *dev = buf->dev; in vugbm_buffer_map() local
254 return dev->map_bo(buf); in vugbm_buffer_map()
260 struct vugbm_device *dev = buf->dev; in vugbm_buffer_unmap() local
262 dev->unmap_bo(buf); in vugbm_buffer_unmap()
268 if (!buffer->dev->get_fd) { in vugbm_buffer_can_get_dmabuf_fd()
279 !buffer->dev->get_fd(buffer, fd)) { in vugbm_buffer_get_dmabuf_fd()
293 vugbm_buffer_create(struct vugbm_buffer *buffer, struct vugbm_device *dev, in vugbm_buffer_create() argument
296 buffer->dev = dev; in vugbm_buffer_create()
301 if (!dev->alloc_bo(buffer)) { in vugbm_buffer_create()
314 dev->free_bo(buffer); in vugbm_buffer_create()
321 struct vugbm_device *dev = buffer->dev; in vugbm_buffer_destroy() local
324 dev->free_bo(buffer); in vugbm_buffer_destroy()