From: David Weinehall <david.weinehall@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 1/3] drm/i915: Cleanup i915_gem_restore_gtt_mappings()
Date: Fri, 18 Nov 2016 15:36:45 +0200 [thread overview]
Message-ID: <20161118133647.4868-2-david.weinehall@linux.intel.com> (raw)
In-Reply-To: <20161118133647.4868-1-david.weinehall@linux.intel.com>
On resume we unbind+bind our VMA-mappings. This patch simplifies
this a bit by introducing a restore_vma() helper. As a nice side-effect
this also makes the resume callgraph self-documenting.
v2: move the helper to i915_gem_gtt.c since it's only used by
i915_gem_restore_gtt_mappings(), rename to restore_vma(),
and make static (Chris)
Signed-off-by: David Weinehall <david.weinehall@linux.intel.com>
CC: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem_gtt.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index b4bde1452f2a..2711044e3bf2 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3277,6 +3277,16 @@ int i915_ggtt_enable_hw(struct drm_i915_private *dev_priv)
return 0;
}
+static bool restore_vma(struct i915_vma *vma)
+{
+ if (i915_vma_is_pinned(vma)) {
+ WARN_ON(i915_vma_bind(vma, vma->obj->cache_level, PIN_UPDATE));
+ return true;
+ } else {
+ WARN_ON(i915_vma_unbind(vma));
+ return false;
+ }
+}
void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
{
struct i915_ggtt *ggtt = &dev_priv->ggtt;
@@ -3299,12 +3309,7 @@ void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
if (vma->vm != &ggtt->base)
continue;
- if (!i915_vma_unbind(vma))
- continue;
-
- WARN_ON(i915_vma_bind(vma, obj->cache_level,
- PIN_UPDATE));
- ggtt_bound = true;
+ ggtt_bound |= restore_vma(vma);
}
if (ggtt_bound)
--
2.10.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-11-18 13:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-18 13:36 [PATCH v2 0/3] Resume time optimisation David Weinehall
2016-11-18 13:36 ` David Weinehall [this message]
2016-11-18 13:58 ` [PATCH v2 1/3] drm/i915: Cleanup i915_gem_restore_gtt_mappings() Chris Wilson
2016-11-21 12:21 ` David Weinehall
2016-11-21 12:30 ` Chris Wilson
2016-11-28 11:24 ` David Weinehall
2016-11-18 13:36 ` [PATCH v2 2/3] drm/i915: Take runtime pm in i915_gem_resume() David Weinehall
2016-11-18 13:36 ` [PATCH v2 3/3] drm/i915: optimise intel_runtime_pm_{get, put} David Weinehall
2016-11-18 14:00 ` Chris Wilson
2016-11-18 14:15 ` Ville Syrjälä
2016-11-18 15:41 ` Imre Deak
2016-11-18 14:54 ` ✗ Fi.CI.BAT: failure for Resume time optimisation (rev2) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161118133647.4868-2-david.weinehall@linux.intel.com \
--to=david.weinehall@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.