drm/i915/gtt: Teach restore-gtt to walk the ggtt vma list not the object list
In preparation, for having non-vma objects stored inside the ggtt, to handle restoration of the GGTT following resume, we need to walk over the ggtt address space rebinding vma, as opposed to walking over bound objects looking for ggtt entries. v2: Skip objects only bound for the aliasing_ppgtt Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> Cc: Matthew Auld <matthew.william.auld@gmail.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20180605082856.19221-1-chris@chris-wilson.co.uk
This commit is contained in:
parent
d901e8e673
commit
744799850e
|
@ -3569,7 +3569,7 @@ void i915_ggtt_disable_guc(struct drm_i915_private *i915)
|
|||
void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
struct i915_ggtt *ggtt = &dev_priv->ggtt;
|
||||
struct drm_i915_gem_object *obj, *on;
|
||||
struct i915_vma *vma, *vn;
|
||||
|
||||
i915_check_and_clear_faults(dev_priv);
|
||||
|
||||
|
@ -3579,21 +3579,18 @@ void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
|
|||
ggtt->base.closed = true; /* skip rewriting PTE on VMA unbind */
|
||||
|
||||
/* clflush objects bound into the GGTT and rebind them. */
|
||||
list_for_each_entry_safe(obj, on, &dev_priv->mm.bound_list, mm.link) {
|
||||
bool ggtt_bound = false;
|
||||
struct i915_vma *vma;
|
||||
GEM_BUG_ON(!list_empty(&ggtt->base.active_list));
|
||||
list_for_each_entry_safe(vma, vn, &ggtt->base.inactive_list, vm_link) {
|
||||
struct drm_i915_gem_object *obj = vma->obj;
|
||||
|
||||
for_each_ggtt_vma(vma, obj) {
|
||||
if (!i915_vma_unbind(vma))
|
||||
continue;
|
||||
if (!(vma->flags & I915_VMA_GLOBAL_BIND))
|
||||
continue;
|
||||
|
||||
WARN_ON(i915_vma_bind(vma, obj->cache_level,
|
||||
PIN_UPDATE));
|
||||
ggtt_bound = true;
|
||||
}
|
||||
if (!i915_vma_unbind(vma))
|
||||
continue;
|
||||
|
||||
if (ggtt_bound)
|
||||
WARN_ON(i915_gem_object_set_to_gtt_domain(obj, false));
|
||||
WARN_ON(i915_vma_bind(vma, obj->cache_level, PIN_UPDATE));
|
||||
WARN_ON(i915_gem_object_set_to_gtt_domain(obj, false));
|
||||
}
|
||||
|
||||
ggtt->base.closed = false;
|
||||
|
|
Loading…
Reference in a new issue