+drm_private extern pthread_mutex_t table_lock;
+
+static void ring_bo_del(struct fd_device *dev, struct fd_bo *bo)
+{
+ int ret;
+
+ pthread_mutex_lock(&table_lock);
+ ret = fd_bo_cache_free(&to_msm_device(dev)->ring_cache, bo);
+ pthread_mutex_unlock(&table_lock);
+
+ if (ret == 0)
+ return;
+
+ fd_bo_del(bo);
+}
+
+static struct fd_bo * ring_bo_new(struct fd_device *dev, uint32_t size)
+{
+ struct fd_bo *bo;
+
+ bo = fd_bo_cache_alloc(&to_msm_device(dev)->ring_cache, &size, 0);
+ if (bo)
+ return bo;
+
+ bo = fd_bo_new(dev, size, 0);
+ if (!bo)
+ return NULL;
+
+ /* keep ringbuffer bo's out of the normal bo cache: */
+ bo->bo_reuse = FALSE;
+
+ return bo;
+}