drm/i915: move more code to __i915_drm_thaw
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> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
68c8c17f52
commit
9d49c0ef40
|
@ -576,11 +576,20 @@ static void intel_resume_hotplug(struct drm_device *dev)
|
||||||
drm_helper_hpd_irq_event(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;
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||||
int error = 0;
|
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);
|
i915_restore_state(dev);
|
||||||
intel_opregion_setup(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)
|
static int i915_drm_thaw(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int error = 0;
|
return __i915_drm_thaw(dev, true);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
__i915_drm_thaw(dev);
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int i915_resume(struct drm_device *dev)
|
int i915_resume(struct drm_device *dev)
|
||||||
|
@ -668,20 +665,12 @@ int i915_resume(struct drm_device *dev)
|
||||||
|
|
||||||
pci_set_master(dev->pdev);
|
pci_set_master(dev->pdev);
|
||||||
|
|
||||||
intel_uncore_sanitize(dev);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Platforms with opregion should have sane BIOS, older ones (gen3 and
|
* 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) &&
|
ret = __i915_drm_thaw(dev, !dev_priv->opregion.header);
|
||||||
!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);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue