void fd_bo_del(struct fd_bo *bo) { struct fd_device *dev = bo->dev; if (!atomic_dec_and_test(&bo->refcnt)) return; pthread_mutex_lock(&table_lock); if (bo->bo_reuse) { struct fd_bo_bucket *bucket = get_bucket(dev, bo->size); /* see if we can be green and recycle: */ if (bucket) { struct timespec time; clock_gettime(CLOCK_MONOTONIC, &time); bo->free_time = time.tv_sec; list_addtail(&bo->list, &bucket->list); fd_cleanup_bo_cache(dev, time.tv_sec); /* bo's in the bucket cache don't have a ref and * don't hold a ref to the dev: */ goto out; } } bo_del(bo); out: fd_device_del_locked(dev); pthread_mutex_unlock(&table_lock); }
static void fd_device_del_impl(struct fd_device *dev) { fd_cleanup_bo_cache(dev, 0); drmHashDestroy(dev->handle_table); drmHashDestroy(dev->name_table); if (dev->closefd) close(dev->fd); dev->funcs->destroy(dev); }