diff mbox

[2/2] drm/i915: Search again if we cannot find enough space in the aperture

Message ID 1259766931-23967-2-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State Rejected
Headers show

Commit Message

Chris Wilson Dec. 2, 2009, 3:15 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 56fe427..8a647b6 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1276,9 +1276,17 @@  i915_gem_create_mmap_offset(struct drm_gem_object *obj)
 	list->file_offset_node = drm_mm_search_free(&mm->offset_manager,
 						    obj->size / PAGE_SIZE, 0, 0);
 	if (!list->file_offset_node) {
-		DRM_ERROR("failed to allocate offset for bo %d\n", obj->name);
-		ret = -ENOMEM;
-		goto out_free_list;
+		ret = i915_gem_evict_something(dev, obj->size);
+		if (ret)
+			return ret;
+
+		list->file_offset_node = drm_mm_search_free(&mm->offset_manager,
+							    obj->size / PAGE_SIZE, 0, 0);
+		if (!list->file_offset_node) {
+			DRM_ERROR("failed to allocate offset for bo %d\n", obj->name);
+			ret = -ENOSPC;
+			goto out_free_list;
+		}
 	}
 
 	list->file_offset_node = drm_mm_get_block(list->file_offset_node,