• Home
  • Raw
  • Download

Lines Matching refs:bo

38 static void drm_tegra_bo_free(struct drm_tegra_bo *bo)  in drm_tegra_bo_free()  argument
40 struct drm_tegra *drm = bo->drm; in drm_tegra_bo_free()
43 if (bo->map) in drm_tegra_bo_free()
44 munmap(bo->map, bo->size); in drm_tegra_bo_free()
47 args.handle = bo->handle; in drm_tegra_bo_free()
51 free(bo); in drm_tegra_bo_free()
108 struct drm_tegra_bo *bo; in drm_tegra_bo_new() local
114 bo = calloc(1, sizeof(*bo)); in drm_tegra_bo_new()
115 if (!bo) in drm_tegra_bo_new()
118 atomic_set(&bo->ref, 1); in drm_tegra_bo_new()
119 bo->flags = flags; in drm_tegra_bo_new()
120 bo->size = size; in drm_tegra_bo_new()
121 bo->drm = drm; in drm_tegra_bo_new()
131 free(bo); in drm_tegra_bo_new()
135 bo->handle = args.handle; in drm_tegra_bo_new()
137 *bop = bo; in drm_tegra_bo_new()
145 struct drm_tegra_bo *bo; in drm_tegra_bo_wrap() local
150 bo = calloc(1, sizeof(*bo)); in drm_tegra_bo_wrap()
151 if (!bo) in drm_tegra_bo_wrap()
154 atomic_set(&bo->ref, 1); in drm_tegra_bo_wrap()
155 bo->handle = handle; in drm_tegra_bo_wrap()
156 bo->flags = flags; in drm_tegra_bo_wrap()
157 bo->size = size; in drm_tegra_bo_wrap()
158 bo->drm = drm; in drm_tegra_bo_wrap()
160 *bop = bo; in drm_tegra_bo_wrap()
168 struct drm_tegra_bo *bo; in drm_tegra_bo_name_ref() local
197 int drm_tegra_bo_name_get(struct drm_tegra_bo *bo, uint32_t *name) in drm_tegra_bo_name_get() argument
202 args.handle = bo->handle; in drm_tegra_bo_name_get()
204 *name = bo->name; in drm_tegra_bo_name_get()
208 ret = drmIoctl(bo->drm->fd, DRM_IOCTL_GEM_FLINK, &args); in drm_tegra_bo_name_get()
214 bo->name = args.name; in drm_tegra_bo_name_get()
215 *name = bo->name; in drm_tegra_bo_name_get()
220 struct drm_tegra_bo *drm_tegra_bo_ref(struct drm_tegra_bo *bo) in drm_tegra_bo_ref() argument
222 if (bo) in drm_tegra_bo_ref()
223 atomic_inc(&bo->ref); in drm_tegra_bo_ref()
225 return bo; in drm_tegra_bo_ref()
228 void drm_tegra_bo_unref(struct drm_tegra_bo *bo) in drm_tegra_bo_unref() argument
230 if (bo && atomic_dec_and_test(&bo->ref)) in drm_tegra_bo_unref()
231 drm_tegra_bo_free(bo); in drm_tegra_bo_unref()
234 int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle) in drm_tegra_bo_get_handle() argument
236 if (!bo || !handle) in drm_tegra_bo_get_handle()
239 *handle = bo->handle; in drm_tegra_bo_get_handle()
244 int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr) in drm_tegra_bo_map() argument
246 struct drm_tegra *drm = bo->drm; in drm_tegra_bo_map()
248 if (!bo->map) { in drm_tegra_bo_map()
253 args.handle = bo->handle; in drm_tegra_bo_map()
260 bo->offset = args.offset; in drm_tegra_bo_map()
262 bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, in drm_tegra_bo_map()
263 drm->fd, bo->offset); in drm_tegra_bo_map()
264 if (bo->map == MAP_FAILED) { in drm_tegra_bo_map()
265 bo->map = NULL; in drm_tegra_bo_map()
271 *ptr = bo->map; in drm_tegra_bo_map()
276 int drm_tegra_bo_unmap(struct drm_tegra_bo *bo) in drm_tegra_bo_unmap() argument
278 if (!bo) in drm_tegra_bo_unmap()
281 if (!bo->map) in drm_tegra_bo_unmap()
284 if (munmap(bo->map, bo->size)) in drm_tegra_bo_unmap()
287 bo->map = NULL; in drm_tegra_bo_unmap()
292 int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags) in drm_tegra_bo_get_flags() argument
295 struct drm_tegra *drm = bo->drm; in drm_tegra_bo_get_flags()
298 if (!bo) in drm_tegra_bo_get_flags()
302 args.handle = bo->handle; in drm_tegra_bo_get_flags()
315 int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags) in drm_tegra_bo_set_flags() argument
318 struct drm_tegra *drm = bo->drm; in drm_tegra_bo_set_flags()
321 if (!bo) in drm_tegra_bo_set_flags()
325 args.handle = bo->handle; in drm_tegra_bo_set_flags()
336 int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo, in drm_tegra_bo_get_tiling() argument
340 struct drm_tegra *drm = bo->drm; in drm_tegra_bo_get_tiling()
343 if (!bo) in drm_tegra_bo_get_tiling()
347 args.handle = bo->handle; in drm_tegra_bo_get_tiling()
362 int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo, in drm_tegra_bo_set_tiling() argument
366 struct drm_tegra *drm = bo->drm; in drm_tegra_bo_set_tiling()
369 if (!bo) in drm_tegra_bo_set_tiling()
373 args.handle = bo->handle; in drm_tegra_bo_set_tiling()