• Home
  • Raw
  • Download

Lines Matching refs:bo

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