@@ -402,6 +402,9 @@ drm_intel_gem_bo_bucket_for_size(drm_intel_bufmgr_gem *bufmgr_gem,
{
int i;
+ if (!bufmgr_gem->bo_reuse)
+ return NULL;
+
for (i = 0; i < bufmgr_gem->num_buckets - 1; i++) {
if (size >= bufmgr_gem->cache_bucket[i].size &&
size < bufmgr_gem->cache_bucket[i+1].size) {
@@ -1392,7 +1395,7 @@ drm_intel_gem_bo_unreference_final(drm_intel_bo *bo, time_t time)
bucket = drm_intel_gem_bo_bucket_for_size(bufmgr_gem, bo->size);
/* Put the buffer into our internal cache for reuse if we can. */
- if (bufmgr_gem->bo_reuse && bo_gem->reusable && bucket != NULL &&
+ if (bo_gem->reusable && bucket != NULL &&
drm_intel_gem_bo_madvise_internal(bufmgr_gem, bo_gem,
I915_MADV_DONTNEED)) {
bo_gem->free_time = time;