[Intel-gfx] [PATCH] drm/i915: Reject bind_to_gtt() early if object > aperture
Chris Wilson
chris at chris-wilson.co.uk
Thu May 13 10:36:08 CEST 2010
If the object is bigger than the entire aperture, reject it early
before evicting everything in a vain attempt to find space.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: stable at kernel.org
---
drivers/gpu/drm/i915/i915_gem.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9a73b20..f7f2520 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2694,6 +2694,14 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
if (alignment < fence_alignment)
alignment = fence_alignment;
+ /* If the object is bigger than the entire aperture, reject it early
+ * before evicting everything in a vain attempt to find space.
+ */
+ if (obj->size > dev->gtt_total) {
+ DRM_ERROR("Attempting to bind an object larger than the aperture\n");
+ return -ENOSPC;
+ }
+
search_free:
free_space = drm_mm_search_free(&dev_priv->mm.gtt_space,
obj->size, alignment, 0);
--
1.7.1
More information about the Intel-gfx
mailing list