Skip to content

Commit 95c778d

Browse files
committed
drm/i915: Apply the full CPU domain markup before freezing
Let's not take any chances by using a shortcut to mark the objects as in the CPU domain upon freezing (all pages will be written to disk and so on restore all objects will start from the CPU domain). Currently, we simply mark the objects as being in the CPU domain, bypassing the flushes. Let's call the full domain transfer function so that we have less special case code (and symmetry with the suspend path) even though it will be mostly redundant. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180601144125.18026-2-chris@chris-wilson.co.uk
1 parent 9776f47 commit 95c778d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5718,16 +5718,17 @@ int i915_gem_freeze(struct drm_i915_private *dev_priv)
57185718
return 0;
57195719
}
57205720

5721-
int i915_gem_freeze_late(struct drm_i915_private *dev_priv)
5721+
int i915_gem_freeze_late(struct drm_i915_private *i915)
57225722
{
57235723
struct drm_i915_gem_object *obj;
57245724
struct list_head *phases[] = {
5725-
&dev_priv->mm.unbound_list,
5726-
&dev_priv->mm.bound_list,
5725+
&i915->mm.unbound_list,
5726+
&i915->mm.bound_list,
57275727
NULL
5728-
}, **p;
5728+
}, **phase;
57295729

5730-
/* Called just before we write the hibernation image.
5730+
/*
5731+
* Called just before we write the hibernation image.
57315732
*
57325733
* We need to update the domain tracking to reflect that the CPU
57335734
* will be accessing all the pages to create and restore from the
@@ -5741,15 +5742,15 @@ int i915_gem_freeze_late(struct drm_i915_private *dev_priv)
57415742
* the objects as well, see i915_gem_freeze()
57425743
*/
57435744

5744-
i915_gem_shrink(dev_priv, -1UL, NULL, I915_SHRINK_UNBOUND);
5745-
i915_gem_drain_freed_objects(dev_priv);
5745+
i915_gem_shrink(i915, -1UL, NULL, I915_SHRINK_UNBOUND);
5746+
i915_gem_drain_freed_objects(i915);
57465747

5747-
spin_lock(&dev_priv->mm.obj_lock);
5748-
for (p = phases; *p; p++) {
5749-
list_for_each_entry(obj, *p, mm.link)
5750-
__start_cpu_write(obj);
5748+
mutex_lock(&i915->drm.struct_mutex);
5749+
for (phase = phases; *phase; phase++) {
5750+
list_for_each_entry(obj, *phase, mm.link)
5751+
WARN_ON(i915_gem_object_set_to_cpu_domain(obj, true));
57515752
}
5752-
spin_unlock(&dev_priv->mm.obj_lock);
5753+
mutex_unlock(&i915->drm.struct_mutex);
57535754

57545755
return 0;
57555756
}

0 commit comments

Comments
 (0)