From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/4] drm/i915: don't rewrite the GTT on resume v3
Date: Wed, 31 Oct 2012 15:41:05 -0700 [thread overview]
Message-ID: <1351723265-4086-4-git-send-email-jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1351723265-4086-1-git-send-email-jbarnes@virtuousgeek.org>
The BIOS shouldn't be touching this memory across suspend/resume, so
just leave it alone. This saves us ~6ms on resume on my T420 (retested
with write combined PTEs).
v2: change gtt restore default on pre-gen4 (Chris)
move needs_gtt_restore flag into dev_priv
v3: make sure we restore GTT on resume from hibernate (Daniel)
use opregion support as the cutoff for restore from resume (Chris)
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
drivers/gpu/drm/i915/i915_dma.c | 8 +++++++-
drivers/gpu/drm/i915/i915_drv.c | 39 +++++++++++++++++++++++++++++----------
drivers/gpu/drm/i915/i915_drv.h | 2 ++
3 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 1ce7e49..69ac4a5 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1467,6 +1467,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
struct intel_device_info *info;
int ret = 0, mmio_bar, mmio_size;
uint32_t aperture_size;
+ bool opregion_supported = false;
info = (struct intel_device_info *) flags;
@@ -1592,7 +1593,12 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
/* Try to make sure MCHBAR is enabled before poking at it */
intel_setup_mchbar(dev);
intel_setup_gmbus(dev);
- intel_opregion_setup(dev);
+ if (!intel_opregion_setup(dev))
+ opregion_supported = true;
+
+ /* Gen3+ should have saner BIOSes (we hope) */
+ if (!opregion_supported)
+ dev_priv->needs_gtt_restore = true;
/* Make sure the bios did its job and set up vital registers */
intel_setup_bios(dev);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 9feedb4..1ea70ec 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -533,19 +533,11 @@ void intel_console_resume(struct work_struct *work)
console_unlock();
}
-static int i915_drm_thaw(struct drm_device *dev)
+static int __i915_drm_thaw(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
int error = 0;
- intel_gt_reset(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);
- }
-
i915_restore_state(dev);
intel_opregion_setup(dev);
@@ -574,8 +566,26 @@ static int i915_drm_thaw(struct drm_device *dev)
return error;
}
+static int i915_drm_thaw(struct drm_device *dev)
+{
+ int error = 0;
+
+ intel_gt_reset(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);
+ }
+
+ __i915_drm_thaw(dev);
+
+ return error;
+}
+
int i915_resume(struct drm_device *dev)
{
+ struct drm_i915_private *dev_priv = dev->dev_private;
int ret;
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
@@ -586,7 +596,16 @@ int i915_resume(struct drm_device *dev)
pci_set_master(dev->pdev);
- ret = i915_drm_thaw(dev);
+ intel_gt_reset(dev);
+
+ if (drm_core_check_feature(dev, DRIVER_MODESET) &&
+ dev_priv->needs_gtt_restore) {
+ mutex_lock(&dev->struct_mutex);
+ i915_gem_restore_gtt_mappings(dev);
+ mutex_unlock(&dev->struct_mutex);
+ }
+
+ ret = __i915_drm_thaw(dev);
if (ret)
return ret;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b41a90b..df65e48 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -881,6 +881,8 @@ typedef struct drm_i915_private {
struct delayed_work gen6_power_work;
+ bool needs_gtt_restore;
+
enum no_fbc_reason no_fbc_reason;
struct drm_mm_node *compressed_fb;
--
1.7.9.5
next prev parent reply other threads:[~2012-10-31 22:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-31 22:41 [PATCH 1/4] drm/i915: don't block resume on fb console resume Jesse Barnes
2012-10-31 22:41 ` [PATCH 2/4] drm/i915: put ring frequency and turbo setup into a work queue v3 Jesse Barnes
2012-11-02 13:37 ` Chris Wilson
2012-10-31 22:41 ` [PATCH 3/4] drm/i915: protect RPS/RC6 related accesses (including PCU) with a new mutex Jesse Barnes
2012-11-02 13:38 ` Chris Wilson
2012-10-31 22:41 ` Jesse Barnes [this message]
2012-11-02 15:16 ` [PATCH 4/4] drm/i915: don't rewrite the GTT on resume v3 Chris Wilson
2012-11-02 16:40 ` Jesse Barnes
2012-11-02 13:35 ` [PATCH 1/4] drm/i915: don't block resume on fb console resume Chris Wilson
2012-11-04 21:16 ` Paul Menzel
2012-11-04 23:12 ` Jesse Barnes
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=1351723265-4086-4-git-send-email-jbarnes@virtuousgeek.org \
--to=jbarnes@virtuousgeek.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).