From patchwork Thu Feb 7 09:37:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 2109841 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 8F4BA3FCD5 for ; Thu, 7 Feb 2013 09:38:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 888AFE6101 for ; Thu, 7 Feb 2013 01:38:50 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (smtp.fireflyinternet.com [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id 6EB1CE5D59 for ; Thu, 7 Feb 2013 01:38:41 -0800 (PST) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.73.22; Received: from arrandale.alporthouse.com (unverified [78.156.73.22]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 128749301-1500050 for multiple; Thu, 07 Feb 2013 09:38:32 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 7 Feb 2013 09:37:53 +0000 Message-Id: <1360229873-24149-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.7.10.4 X-Originating-IP: 78.156.73.22 Subject: [Intel-gfx] [PATCH] drm/i915: After hibernation, discard the unbound list X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org 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 --- drivers/gpu/drm/i915/i915_gem_gtt.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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); }