Lines Matching refs:bo
165 struct gralloc_drm_bo_t *bo; in validate_handle() local
175 bo = drm->drv->alloc(drm->drv, handle); in validate_handle()
177 bo = NULL; in validate_handle()
178 if (bo) { in validate_handle()
179 bo->drm = drm; in validate_handle()
180 bo->imported = 1; in validate_handle()
181 bo->handle = handle; in validate_handle()
182 bo->refcount = 1; in validate_handle()
186 handle->data = bo; in validate_handle()
205 struct gralloc_drm_bo_t *bo; in gralloc_drm_handle_unregister() local
207 bo = validate_handle(handle, NULL); in gralloc_drm_handle_unregister()
208 if (!bo) in gralloc_drm_handle_unregister()
211 if (bo->imported) in gralloc_drm_handle_unregister()
212 gralloc_drm_bo_decref(bo); in gralloc_drm_handle_unregister()
249 struct gralloc_drm_bo_t *bo; in gralloc_drm_bo_create() local
256 bo = drm->drv->alloc(drm->drv, handle); in gralloc_drm_bo_create()
257 if (!bo) { in gralloc_drm_bo_create()
262 bo->drm = drm; in gralloc_drm_bo_create()
263 bo->imported = 0; in gralloc_drm_bo_create()
264 bo->handle = handle; in gralloc_drm_bo_create()
265 bo->fb_id = 0; in gralloc_drm_bo_create()
266 bo->refcount = 1; in gralloc_drm_bo_create()
269 handle->data = bo; in gralloc_drm_bo_create()
271 return bo; in gralloc_drm_bo_create()
277 static void gralloc_drm_bo_destroy(struct gralloc_drm_bo_t *bo) in gralloc_drm_bo_destroy() argument
279 struct gralloc_drm_handle_t *handle = bo->handle; in gralloc_drm_bo_destroy()
280 int imported = bo->imported; in gralloc_drm_bo_destroy()
283 if (bo->refcount) in gralloc_drm_bo_destroy()
286 bo->drm->drv->free(bo->drm->drv, bo); in gralloc_drm_bo_destroy()
299 void gralloc_drm_bo_decref(struct gralloc_drm_bo_t *bo) in gralloc_drm_bo_decref() argument
301 if (!--bo->refcount) in gralloc_drm_bo_decref()
302 gralloc_drm_bo_destroy(bo); in gralloc_drm_bo_decref()
316 buffer_handle_t gralloc_drm_bo_get_handle(struct gralloc_drm_bo_t *bo, int *stride) in gralloc_drm_bo_get_handle() argument
319 *stride = bo->handle->stride; in gralloc_drm_bo_get_handle()
320 return &bo->handle->base; in gralloc_drm_bo_get_handle()
330 struct gralloc_drm_bo_t *bo = handle->data; in gralloc_drm_resolve_format() local
331 struct gralloc_drm_t *drm = bo->drm; in gralloc_drm_resolve_format()
335 drm->drv->resolve_format(drm->drv, bo, in gralloc_drm_resolve_format()
342 int gralloc_drm_bo_lock(struct gralloc_drm_bo_t *bo, in gralloc_drm_bo_lock() argument
346 if ((bo->handle->usage & usage) != usage) { in gralloc_drm_bo_lock()
349 if (!(bo->handle->usage & GRALLOC_USAGE_HW_FB) in gralloc_drm_bo_lock()
350 && !(bo->handle->usage & GRALLOC_USAGE_HW_TEXTURE)) { in gralloc_drm_bo_lock()
352 ,bo->handle->usage,usage); in gralloc_drm_bo_lock()
358 if (bo->lock_count && (bo->locked_for & usage) != usage) in gralloc_drm_bo_lock()
361 usage |= bo->locked_for; in gralloc_drm_bo_lock()
367 int err = bo->drm->drv->map(bo->drm->drv, bo, in gralloc_drm_bo_lock()
376 bo->lock_count++; in gralloc_drm_bo_lock()
377 bo->locked_for |= usage; in gralloc_drm_bo_lock()
385 void gralloc_drm_bo_unlock(struct gralloc_drm_bo_t *bo) in gralloc_drm_bo_unlock() argument
387 int mapped = bo->locked_for & in gralloc_drm_bo_unlock()
390 if (!bo->lock_count) in gralloc_drm_bo_unlock()
394 bo->drm->drv->unmap(bo->drm->drv, bo); in gralloc_drm_bo_unlock()
396 bo->lock_count--; in gralloc_drm_bo_unlock()
397 if (!bo->lock_count) in gralloc_drm_bo_unlock()
398 bo->locked_for = 0; in gralloc_drm_bo_unlock()