Commit 43e28f09 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Bail if we attempt to allocate pages for a purged object

Move the existing checking inside bind_to_gtt() to the more appropriate
layer in order to prevent recreation of the pages after they have been
explicitly truncated.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent dd624afd
...@@ -1828,6 +1828,11 @@ i915_gem_object_get_pages(struct drm_i915_gem_object *obj) ...@@ -1828,6 +1828,11 @@ i915_gem_object_get_pages(struct drm_i915_gem_object *obj)
if (obj->pages) if (obj->pages)
return 0; return 0;
if (obj->madv != I915_MADV_WILLNEED) {
DRM_ERROR("Attempting to obtain a purgeable object\n");
return -EINVAL;
}
BUG_ON(obj->pages_pin_count); BUG_ON(obj->pages_pin_count);
ret = ops->get_pages(obj); ret = ops->get_pages(obj);
...@@ -2440,7 +2445,7 @@ int ...@@ -2440,7 +2445,7 @@ int
i915_gem_object_unbind(struct drm_i915_gem_object *obj) i915_gem_object_unbind(struct drm_i915_gem_object *obj)
{ {
drm_i915_private_t *dev_priv = obj->base.dev->dev_private; drm_i915_private_t *dev_priv = obj->base.dev->dev_private;
int ret = 0; int ret;
if (obj->gtt_space == NULL) if (obj->gtt_space == NULL)
return 0; return 0;
...@@ -2880,11 +2885,6 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj, ...@@ -2880,11 +2885,6 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
bool mappable, fenceable; bool mappable, fenceable;
int ret; int ret;
if (obj->madv != I915_MADV_WILLNEED) {
DRM_ERROR("Attempting to bind a purgeable object\n");
return -EINVAL;
}
fence_size = i915_gem_get_gtt_size(dev, fence_size = i915_gem_get_gtt_size(dev,
obj->base.size, obj->base.size,
obj->tiling_mode); obj->tiling_mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment