Lines Matching refs:bo
43 struct bo
57 static struct bo *
61 struct bo *bo;
64 bo = calloc(1, sizeof(*bo));
65 if (bo == NULL) {
79 free(bo);
83 bo->fd = fd;
84 bo->handle = arg.handle;
85 bo->size = arg.size;
86 bo->pitch = arg.pitch;
88 return bo;
91 static int bo_map(struct bo *bo, void **out)
98 arg.handle = bo->handle;
100 ret = drmIoctl(bo->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
104 map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
105 bo->fd, arg.offset);
109 bo->ptr = map;
115 static void bo_unmap(struct bo *bo)
117 if (!bo->ptr)
120 drm_munmap(bo->ptr, bo->size);
121 bo->ptr = NULL;
124 struct bo *
131 struct bo *bo;
227 bo = bo_create_dumb(fd, width, virtual_height, bpp);
228 if (!bo)
231 ret = bo_map(bo, &virtual);
235 bo_destroy(bo);
248 handles[0] = bo->handle;
249 pitches[0] = bo->pitch;
259 handles[0] = bo->handle;
260 pitches[0] = bo->pitch;
263 handles[1] = bo->handle;
272 handles[0] = bo->handle;
273 pitches[0] = bo->pitch;
276 handles[1] = bo->handle;
279 handles[2] = bo->handle;
328 handles[0] = bo->handle;
329 pitches[0] = bo->pitch;
336 bo_unmap(bo);
338 return bo;
341 void bo_destroy(struct bo *bo)
347 arg.handle = bo->handle;
349 ret = drmIoctl(bo->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);
354 free(bo);