diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index f8b3df0926c0..0692622ee2b3 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -27,6 +27,7 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/device.h> | ||
30 | #include "drmP.h" | 31 | #include "drmP.h" |
31 | #include "drm.h" | 32 | #include "drm.h" |
32 | #include "i915_drm.h" | 33 | #include "i915_drm.h" |
@@ -66,6 +67,12 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
66 | 67 | ||
67 | i915_save_state(dev); | 68 | i915_save_state(dev); |
68 | 69 | ||
70 | /* If KMS is active, we do the leavevt stuff here */ | ||
71 | if (drm_core_check_feature(dev, DRIVER_MODESET) && i915_gem_idle(dev)) { | ||
72 | dev_err(&dev->pdev->dev, "GEM idle failed, aborting suspend\n"); | ||
73 | return -EBUSY; | ||
74 | } | ||
75 | |||
69 | intel_opregion_free(dev); | 76 | intel_opregion_free(dev); |
70 | 77 | ||
71 | if (state.event == PM_EVENT_SUSPEND) { | 78 | if (state.event == PM_EVENT_SUSPEND) { |
@@ -79,6 +86,9 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
79 | 86 | ||
80 | static int i915_resume(struct drm_device *dev) | 87 | static int i915_resume(struct drm_device *dev) |
81 | { | 88 | { |
89 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
90 | int ret = 0; | ||
91 | |||
82 | pci_set_power_state(dev->pdev, PCI_D0); | 92 | pci_set_power_state(dev->pdev, PCI_D0); |
83 | pci_restore_state(dev->pdev); | 93 | pci_restore_state(dev->pdev); |
84 | if (pci_enable_device(dev->pdev)) | 94 | if (pci_enable_device(dev->pdev)) |
@@ -89,11 +99,24 @@ static int i915_resume(struct drm_device *dev) | |||
89 | 99 | ||
90 | intel_opregion_init(dev); | 100 | intel_opregion_init(dev); |
91 | 101 | ||
92 | return 0; | 102 | /* KMS EnterVT equivalent */ |
103 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | ||
104 | mutex_lock(&dev->struct_mutex); | ||
105 | dev_priv->mm.suspended = 0; | ||
106 | |||
107 | ret = i915_gem_init_ringbuffer(dev); | ||
108 | if (ret != 0) | ||
109 | ret = -1; | ||
110 | mutex_unlock(&dev->struct_mutex); | ||
111 | } | ||
112 | |||
113 | return ret; | ||
93 | } | 114 | } |
94 | 115 | ||
95 | static struct vm_operations_struct i915_gem_vm_ops = { | 116 | static struct vm_operations_struct i915_gem_vm_ops = { |
96 | .fault = i915_gem_fault, | 117 | .fault = i915_gem_fault, |
118 | .open = drm_gem_vm_open, | ||
119 | .close = drm_gem_vm_close, | ||
97 | }; | 120 | }; |
98 | 121 | ||
99 | static struct drm_driver driver = { | 122 | static struct drm_driver driver = { |
@@ -112,7 +135,6 @@ static struct drm_driver driver = { | |||
112 | .suspend = i915_suspend, | 135 | .suspend = i915_suspend, |
113 | .resume = i915_resume, | 136 | .resume = i915_resume, |
114 | .device_is_agp = i915_driver_device_is_agp, | 137 | .device_is_agp = i915_driver_device_is_agp, |
115 | .get_vblank_counter = i915_get_vblank_counter, | ||
116 | .enable_vblank = i915_enable_vblank, | 138 | .enable_vblank = i915_enable_vblank, |
117 | .disable_vblank = i915_disable_vblank, | 139 | .disable_vblank = i915_disable_vblank, |
118 | .irq_preinstall = i915_driver_irq_preinstall, | 140 | .irq_preinstall = i915_driver_irq_preinstall, |