Commit dc8cd1e7 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Only perform set-to-gtt domain for objects bound to the global gtt

If an object is not bound into the global GTT, then it cannot be
accessed via the GTT. This restores the original code that was muddled
by ppGTT. In the process, we remove a WARN that had long outlived its
usefulness and was simply being coded around instead.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent d6699dd3
...@@ -3592,11 +3592,12 @@ int ...@@ -3592,11 +3592,12 @@ int
i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write) i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
{ {
struct drm_i915_private *dev_priv = obj->base.dev->dev_private; struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
struct i915_vma *vma = i915_gem_obj_to_ggtt(obj);
uint32_t old_write_domain, old_read_domains; uint32_t old_write_domain, old_read_domains;
int ret; int ret;
/* Not valid to be called on unbound objects. */ /* Not valid to be called on unbound objects. */
if (!i915_gem_obj_bound_any(obj)) if (vma == NULL)
return -EINVAL; return -EINVAL;
if (obj->base.write_domain == I915_GEM_DOMAIN_GTT) if (obj->base.write_domain == I915_GEM_DOMAIN_GTT)
...@@ -3638,14 +3639,10 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write) ...@@ -3638,14 +3639,10 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
old_write_domain); old_write_domain);
/* And bump the LRU for this access */ /* And bump the LRU for this access */
if (i915_gem_object_is_inactive(obj)) { if (i915_gem_object_is_inactive(obj))
struct i915_vma *vma = i915_gem_obj_to_ggtt(obj);
if (vma)
list_move_tail(&vma->mm_list, list_move_tail(&vma->mm_list,
&dev_priv->gtt.base.inactive_list); &dev_priv->gtt.base.inactive_list);
}
return 0; return 0;
} }
...@@ -3808,9 +3805,6 @@ static bool is_pin_display(struct drm_i915_gem_object *obj) ...@@ -3808,9 +3805,6 @@ static bool is_pin_display(struct drm_i915_gem_object *obj)
{ {
struct i915_vma *vma; struct i915_vma *vma;
if (list_empty(&obj->vma_list))
return false;
vma = i915_gem_obj_to_ggtt(obj); vma = i915_gem_obj_to_ggtt(obj);
if (!vma) if (!vma)
return false; return false;
...@@ -5253,12 +5247,6 @@ struct i915_vma *i915_gem_obj_to_ggtt(struct drm_i915_gem_object *obj) ...@@ -5253,12 +5247,6 @@ struct i915_vma *i915_gem_obj_to_ggtt(struct drm_i915_gem_object *obj)
{ {
struct i915_vma *vma; struct i915_vma *vma;
/* This WARN has probably outlived its usefulness (callers already
* WARN if they don't find the GGTT vma they expect). When removing,
* remember to remove the pre-check in is_pin_display() as well */
if (WARN_ON(list_empty(&obj->vma_list)))
return NULL;
vma = list_first_entry(&obj->vma_list, typeof(*vma), vma_link); vma = list_first_entry(&obj->vma_list, typeof(*vma), vma_link);
if (vma->vm != obj_to_ggtt(obj)) if (vma->vm != obj_to_ggtt(obj))
return NULL; return NULL;
......
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