[Intel-gfx] [PATCH 2/2] drm/i915: Search again if we cannot find enough space in the aperture
Chris Wilson
chris at chris-wilson.co.uk
Wed Dec 2 16:15:31 CET 2009
If we fail to find a single region large enough to map the object into
the aperture, evict something and search. If we still fail to find
enough space, return ENOSPC to distinguish the error from a normal
memory allocation failure.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
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,
--
1.6.5.3
More information about the Intel-gfx
mailing list