public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 6/5] drm/i915: move more code to __i915_drm_thaw
Date: Thu, 12 Sep 2013 18:06:43 -0300	[thread overview]
Message-ID: <1379020003-1595-1-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <20130912171054.GC12961@nuc-i3427.alporthouse.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

Both callers had code to sanitize the uncore and restore the GTT
mappings just before calling __i915_drm_thaw, so Chris suggested I
should unify the code.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 39 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 25 deletions(-)

I'm not sure if this is really what Chris had in mind, but it's an idea...


diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f6dc6b8..75e7550 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -576,11 +576,20 @@ static void intel_resume_hotplug(struct drm_device *dev)
 	drm_helper_hpd_irq_event(dev);
 }
 
-static int __i915_drm_thaw(struct drm_device *dev)
+static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int error = 0;
 
+	intel_uncore_sanitize(dev);
+
+	if (drm_core_check_feature(dev, DRIVER_MODESET) &&
+	    restore_gtt_mappings) {
+		mutex_lock(&dev->struct_mutex);
+		i915_gem_restore_gtt_mappings(dev);
+		mutex_unlock(&dev->struct_mutex);
+	}
+
 	i915_restore_state(dev);
 	intel_opregion_setup(dev);
 
@@ -640,19 +649,7 @@ static int __i915_drm_thaw(struct drm_device *dev)
 
 static int i915_drm_thaw(struct drm_device *dev)
 {
-	int error = 0;
-
-	intel_uncore_sanitize(dev);
-
-	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-		mutex_lock(&dev->struct_mutex);
-		i915_gem_restore_gtt_mappings(dev);
-		mutex_unlock(&dev->struct_mutex);
-	}
-
-	error = __i915_drm_thaw(dev);
-
-	return error;
+	return __i915_drm_thaw(dev, true);
 }
 
 int i915_resume(struct drm_device *dev)
@@ -668,20 +665,12 @@ int i915_resume(struct drm_device *dev)
 
 	pci_set_master(dev->pdev);
 
-	intel_uncore_sanitize(dev);
-
 	/*
 	 * Platforms with opregion should have sane BIOS, older ones (gen3 and
-	 * earlier) need this since the BIOS might clear all our scratch PTEs.
+	 * earlier) need to restore the GTT mappings since the BIOS might clear
+	 * all our scratch PTEs.
 	 */
-	if (drm_core_check_feature(dev, DRIVER_MODESET) &&
-	    !dev_priv->opregion.header) {
-		mutex_lock(&dev->struct_mutex);
-		i915_gem_restore_gtt_mappings(dev);
-		mutex_unlock(&dev->struct_mutex);
-	}
-
-	ret = __i915_drm_thaw(dev);
+	ret = __i915_drm_thaw(dev, !dev_priv->opregion.header);
 	if (ret)
 		return ret;
 
-- 
1.8.3.1

  reply	other threads:[~2013-09-12 21:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 16:58 [PATCH 1/5] drm/i915: don't save/restore LBB on Gen5+ Paulo Zanoni
2013-09-12 16:58 ` [PATCH 2/5] drm/i915: WARN if the DP aux read is too big Paulo Zanoni
2013-09-12 17:15   ` Chris Wilson
2013-09-12 21:03     ` [PATCH 2/5] drm/i915: fix intel_dp_aux_native_read's reply array size Paulo Zanoni
2013-09-13  9:21       ` Jani Nikula
2013-09-13 12:53         ` Damien Lespiau
2013-09-13 13:41           ` Jani Nikula
2013-09-13 13:50             ` Damien Lespiau
2013-09-16 19:26               ` Paulo Zanoni
2013-09-12 16:58 ` [PATCH 3/5] drm/i915: check for more ASLC interrupts Paulo Zanoni
2013-09-13 10:23   ` Jani Nikula
2013-09-12 16:58 ` [PATCH 4/5] drm/i915: clear opregon->lid_state after we unmap it Paulo Zanoni
2013-09-13 13:53   ` Rodrigo Vivi
2013-09-12 16:58 ` [PATCH 5/5] drm/i915: check for errors on i915_drm_thaw Paulo Zanoni
2013-09-12 17:10   ` Chris Wilson
2013-09-12 21:06     ` Paulo Zanoni [this message]
2013-09-12 21:44       ` [PATCH 6/5] drm/i915: move more code to __i915_drm_thaw Chris Wilson
2013-09-13  9:40         ` Daniel Vetter
2013-09-12 17:36 ` [PATCH 1/5] drm/i915: don't save/restore LBB on Gen5+ Ville Syrjälä
2013-09-13  9:41   ` Daniel Vetter

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=1379020003-1595-1-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox