aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-05-27 08:18:21 -0400
committerEric Anholt <eric@anholt.net>2010-05-28 13:52:15 -0400
commit654fc6073f68efa3b6c466825749e73e7fbb92cd (patch)
treeb6b0c3905dd1777a3412c855cec3b0db0785dbc7
parent85cd4612fdab4e837d7eea048a697c75d0477d3b (diff)
drm/i915: Reject bind_to_gtt() early if object > aperture
If the object is bigger than the entire aperture, reject it early before evicting everything in a vain attempt to find space. v2: Use E2BIG as suggested by Owain G. Ainsworth. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: stable@kernel.org Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c8
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 b87945db1021..f84c8e982dcb 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2648,6 +2648,14 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
2648 return -EINVAL; 2648 return -EINVAL;
2649 } 2649 }
2650 2650
2651 /* If the object is bigger than the entire aperture, reject it early
2652 * before evicting everything in a vain attempt to find space.
2653 */
2654 if (obj->size > dev->gtt_total) {
2655 DRM_ERROR("Attempting to bind an object larger than the aperture\n");
2656 return -E2BIG;
2657 }
2658
2651 search_free: 2659 search_free:
2652 free_space = drm_mm_search_free(&dev_priv->mm.gtt_space, 2660 free_space = drm_mm_search_free(&dev_priv->mm.gtt_space,
2653 obj->size, alignment, 0); 2661 obj->size, alignment, 0);