Message ID | 1351880042-24935-4-git-send-email-jbarnes@virtuousgeek.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Nov 02, 2012 at 11:14:02AM -0700, Jesse Barnes wrote: > 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) > v4: use a better check for opregion (Chris) > > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Merged, with some bikeshed applied, and the less-than-careful locking switch in patch 3 fixed. Please check whether I haven't botched it up. Thanks, Daniel
On Fri, 2 Nov 2012 23:55:04 +0100 Daniel Vetter <daniel@ffwll.ch> wrote: > On Fri, Nov 02, 2012 at 11:14:02AM -0700, Jesse Barnes wrote: > > 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) > > v4: use a better check for opregion (Chris) > > > > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> > > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> > > Merged, with some bikeshed applied, and the less-than-careful locking > switch in patch 3 fixed. Please check whether I haven't botched it up. Hm I even changed the name of the rps struct to catch all the cases at compile time. Maybe I sent out an old version or forgot a git add... thanks for fixing it up.
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 1ce7e49..622f910 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1594,6 +1594,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) intel_setup_gmbus(dev); intel_opregion_setup(dev); + /* Gen3+ should have saner BIOSes (we hope) */ + if (!dev_priv->opregion.header) + 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 dd4e43f..26a0165 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); @@ -584,8 +576,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) @@ -596,7 +606,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;