Home | History | Annotate | Download | only in radeon

Lines Matching defs:bo

39     struct rbo *bo;
42 bo = calloc(1, sizeof(*bo));
43 if (bo == NULL) {
46 list_inithead(&bo->list);
47 bo->fd = fd;
48 bo->size = size;
49 bo->handle = handle;
50 bo->refcount = 1;
51 bo->alignment = alignment;
60 free(bo);
63 bo->handle = open_arg.handle;
74 bo->handle = args.handle;
79 free(bo);
84 if (rbo_map(bo)) {
85 fprintf(stderr, "%s failed to copy data into bo\n", __func__);
86 return rbo_decref(bo);
88 memcpy(bo->data, ptr, size);
89 rbo_unmap(bo);
91 return bo;
94 int rbo_map(struct rbo *bo)
100 if (bo->mapcount++ != 0) {
105 args.handle = bo->handle;
107 args.size = (uint64_t)bo->size;
108 r = drmCommandWriteRead(bo->fd, DRM_RADEON_GEM_MMAP,
112 bo, bo->handle, r);
115 ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, bo->fd, args.addr_ptr);
117 fprintf(stderr, "%s failed to map bo\n", __func__);
120 bo->data = ptr;
124 void rbo_unmap(struct rbo *bo)
126 if (--bo->mapcount > 0) {
129 munmap(bo->data, bo->size);
130 bo->data = NULL;
133 struct rbo *rbo_incref(struct rbo *bo)
135 bo->refcount++;
136 return bo;
139 struct rbo *rbo_decref(struct rbo *bo)
143 if (bo == NULL)
145 if (--bo->refcount > 0) {
149 munmap(bo->data, bo->size);
151 args.handle = bo->handle;
152 drmIoctl(bo->fd, DRM_IOCTL_GEM_CLOSE, &args);
153 memset(bo, 0, sizeof(struct rbo));
154 free(bo);
158 int rbo_wait(struct rbo *bo)
165 args.handle = bo->handle;
167 ret = drmCommandWriteRead(bo->fd, DRM_RADEON_GEM_WAIT_IDLE,