Skip to content

Commit 2c3d998

Browse files
tursulindanvet
authored andcommitted
drm/i915: Restore all GGTT VMAs on resume
When rotated and partial views were added no one spotted the resume path which assumes only one GGTT VMA per object and hence is now skipping rebind of alternative views. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 0d7b6b1 commit 2c3d998

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

drivers/gpu/drm/i915/i915_gem_gtt.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,6 +2546,8 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
25462546
struct drm_i915_private *dev_priv = dev->dev_private;
25472547
struct drm_i915_gem_object *obj;
25482548
struct i915_address_space *vm;
2549+
struct i915_vma *vma;
2550+
bool flush;
25492551

25502552
i915_check_and_clear_faults(dev);
25512553

@@ -2555,16 +2557,23 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
25552557
dev_priv->gtt.base.total,
25562558
true);
25572559

2560+
/* Cache flush objects bound into GGTT and rebind them. */
2561+
vm = &dev_priv->gtt.base;
25582562
list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
2559-
struct i915_vma *vma = i915_gem_obj_to_vma(obj,
2560-
&dev_priv->gtt.base);
2561-
if (!vma)
2562-
continue;
2563+
flush = false;
2564+
list_for_each_entry(vma, &obj->vma_list, vma_link) {
2565+
if (vma->vm != vm)
2566+
continue;
25632567

2564-
i915_gem_clflush_object(obj, obj->pin_display);
2565-
WARN_ON(i915_vma_bind(vma, obj->cache_level, PIN_UPDATE));
2566-
}
2568+
WARN_ON(i915_vma_bind(vma, obj->cache_level,
2569+
PIN_UPDATE));
25672570

2571+
flush = true;
2572+
}
2573+
2574+
if (flush)
2575+
i915_gem_clflush_object(obj, obj->pin_display);
2576+
}
25682577

25692578
if (INTEL_INFO(dev)->gen >= 8) {
25702579
if (IS_CHERRYVIEW(dev) || IS_BROXTON(dev))

0 commit comments

Comments
 (0)