diff mbox

drm/i915: After hibernation, discard the unbound list

Message ID 1360229873-24149-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Feb. 7, 2013, 9:37 a.m. UTC
The unbound list is an optimisation to track objects that have been
evicted from the GTT but remain untouched by the CPU. After hibernation,
all memory is in the CPU domain (having been restored from a disk image)
and so we need to restore the domain tracking upon the objects. However,
for the unbound list we can simply discard those objects and lazily wait
for them to be reused.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 368c821..5b49496 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -404,8 +404,17 @@  void i915_gem_restore_gtt_mappings(struct drm_device *dev)
 		i915_gem_gtt_bind_object(obj, obj->cache_level);
 	}
 
-	list_for_each_entry(obj, &dev_priv->mm.unbound_list, gtt_list)
-		i915_gem_clflush_object(obj);
+	/* Discard any unpinned unbound objects after they have been
+	 * polluted by the hibernation. For pinned objects, we need
+	 * to restore them back to the GTT domain.
+	 */
+	list_for_each_entry(obj, &dev_priv->mm.unbound_list, gtt_list) {
+		/* Update the domains after being touched during hibernate */
+		obj->base.read_domains = I915_GEM_DOMAIN_CPU;
+		obj->base.write_domain = I915_GEM_DOMAIN_CPU;
+		if (i915_gem_object_put_pages(obj))
+			i915_gem_object_set_to_gtt_domain(obj, true);
+	}
 
 	i915_gem_chipset_flush(dev);
 }