aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drv.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.c86
1 files changed, 9 insertions, 77 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
index db150d9e0cd4..2294cb8848f7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
@@ -35,7 +35,6 @@
35#include "nouveau_fbcon.h" 35#include "nouveau_fbcon.h"
36#include "nouveau_fence.h" 36#include "nouveau_fence.h"
37#include "nouveau_pm.h" 37#include "nouveau_pm.h"
38#include <engine/fifo.h>
39#include "nv50_display.h" 38#include "nv50_display.h"
40 39
41#include "drm_pciids.h" 40#include "drm_pciids.h"
@@ -68,14 +67,6 @@ MODULE_PARM_DESC(ignorelid, "Ignore ACPI lid status");
68int nouveau_ignorelid = 0; 67int nouveau_ignorelid = 0;
69module_param_named(ignorelid, nouveau_ignorelid, int, 0400); 68module_param_named(ignorelid, nouveau_ignorelid, int, 0400);
70 69
71MODULE_PARM_DESC(noaccel, "Disable all acceleration");
72int nouveau_noaccel = -1;
73module_param_named(noaccel, nouveau_noaccel, int, 0400);
74
75MODULE_PARM_DESC(nofbaccel, "Disable fbcon acceleration");
76int nouveau_nofbaccel = 0;
77module_param_named(nofbaccel, nouveau_nofbaccel, int, 0400);
78
79MODULE_PARM_DESC(force_post, "Force POST"); 70MODULE_PARM_DESC(force_post, "Force POST");
80int nouveau_force_post = 0; 71int nouveau_force_post = 0;
81module_param_named(force_post, nouveau_force_post, int, 0400); 72module_param_named(force_post, nouveau_force_post, int, 0400);
@@ -148,19 +139,11 @@ int
148nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state) 139nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
149{ 140{
150 struct drm_device *dev = pci_get_drvdata(pdev); 141 struct drm_device *dev = pci_get_drvdata(pdev);
151 struct drm_nouveau_private *dev_priv = dev->dev_private;
152 struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
153 struct nouveau_fence_priv *fence = dev_priv->fence.func;
154 struct nouveau_channel *chan;
155 struct drm_crtc *crtc; 142 struct drm_crtc *crtc;
156 int ret, i, e;
157 143
158 NV_INFO(dev, "Disabling display...\n"); 144 NV_INFO(dev, "Disabling display...\n");
159 nouveau_display_fini(dev); 145 nouveau_display_fini(dev);
160 146
161 NV_INFO(dev, "Disabling fbcon...\n");
162 nouveau_fbcon_set_suspend(dev, 1);
163
164 NV_INFO(dev, "Unpinning framebuffer(s)...\n"); 147 NV_INFO(dev, "Unpinning framebuffer(s)...\n");
165 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 148 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
166 struct nouveau_framebuffer *nouveau_fb; 149 struct nouveau_framebuffer *nouveau_fb;
@@ -179,74 +162,23 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
179 nouveau_bo_unpin(nv_crtc->cursor.nvbo); 162 nouveau_bo_unpin(nv_crtc->cursor.nvbo);
180 } 163 }
181 164
182 NV_INFO(dev, "Evicting buffers...\n");
183 ttm_bo_evict_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM);
184
185 NV_INFO(dev, "Idling channels...\n");
186 for (i = 0; i < (pfifo ? pfifo->channels : 0); i++) {
187 chan = dev_priv->channels.ptr[i];
188
189 if (chan && chan->pushbuf_bo)
190 nouveau_channel_idle(chan);
191 }
192
193 if (fence->suspend) {
194 if (!fence->suspend(dev))
195 return -ENOMEM;
196 }
197
198 for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
199 if (!dev_priv->eng[e])
200 continue;
201
202 ret = dev_priv->eng[e]->fini(dev, e, true);
203 if (ret) {
204 NV_ERROR(dev, "... engine %d failed: %d\n", e, ret);
205 goto out_abort;
206 }
207 }
208
209 return 0; 165 return 0;
210
211out_abort:
212 NV_INFO(dev, "Re-enabling acceleration..\n");
213 for (e = e + 1; e < NVOBJ_ENGINE_NR; e++) {
214 if (dev_priv->eng[e])
215 dev_priv->eng[e]->init(dev, e);
216 }
217 return ret;
218} 166}
219 167
220int 168int
221nouveau_pci_resume(struct pci_dev *pdev) 169nouveau_pci_resume(struct pci_dev *pdev)
222{ 170{
223 struct drm_device *dev = pci_get_drvdata(pdev); 171 struct drm_device *dev = pci_get_drvdata(pdev);
224 struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
225 struct drm_nouveau_private *dev_priv = dev->dev_private;
226 struct nouveau_fence_priv *fence = dev_priv->fence.func;
227 struct nouveau_engine *engine = &dev_priv->engine;
228 struct drm_crtc *crtc; 172 struct drm_crtc *crtc;
229 int ret, i; 173 int ret;
230
231 /* Make the CRTCs accessible */
232 engine->display.early_init(dev);
233 174
234 NV_INFO(dev, "POSTing device...\n");
235 ret = nouveau_run_vbios_init(dev); 175 ret = nouveau_run_vbios_init(dev);
236 if (ret) 176 if (ret)
237 return ret; 177 return ret;
238 178
239 NV_INFO(dev, "Reinitialising engines...\n");
240 for (i = 0; i < NVOBJ_ENGINE_NR; i++) {
241 if (dev_priv->eng[i])
242 dev_priv->eng[i]->init(dev, i);
243 }
244
245 if (fence->resume)
246 fence->resume(dev);
247
248 nouveau_irq_postinstall(dev); 179 nouveau_irq_postinstall(dev);
249 180
181#if 0
250 /* Re-write SKIPS, they'll have been lost over the suspend */ 182 /* Re-write SKIPS, they'll have been lost over the suspend */
251 if (nouveau_vram_pushbuf) { 183 if (nouveau_vram_pushbuf) {
252 struct nouveau_channel *chan; 184 struct nouveau_channel *chan;
@@ -261,6 +193,7 @@ nouveau_pci_resume(struct pci_dev *pdev)
261 nouveau_bo_wr32(chan->pushbuf_bo, i, 0); 193 nouveau_bo_wr32(chan->pushbuf_bo, i, 0);
262 } 194 }
263 } 195 }
196#endif
264 197
265 nouveau_pm_resume(dev); 198 nouveau_pm_resume(dev);
266 199
@@ -343,6 +276,9 @@ static const struct file_operations nouveau_driver_fops = {
343 276
344int nouveau_drm_load(struct drm_device *, unsigned long); 277int nouveau_drm_load(struct drm_device *, unsigned long);
345int nouveau_drm_unload(struct drm_device *); 278int nouveau_drm_unload(struct drm_device *);
279int nouveau_drm_open(struct drm_device *, struct drm_file *);
280void nouveau_drm_preclose(struct drm_device *dev, struct drm_file *);
281void nouveau_drm_postclose(struct drm_device *, struct drm_file *);
346 282
347static struct drm_driver driver = { 283static struct drm_driver driver = {
348 .driver_features = 284 .driver_features =
@@ -353,13 +289,9 @@ static struct drm_driver driver = {
353 .firstopen = nouveau_firstopen, 289 .firstopen = nouveau_firstopen,
354 .lastclose = nouveau_lastclose, 290 .lastclose = nouveau_lastclose,
355 .unload = nouveau_drm_unload, 291 .unload = nouveau_drm_unload,
356 .open = nouveau_open, 292 .open = nouveau_drm_open,
357 .preclose = nouveau_preclose, 293 .preclose = nouveau_drm_preclose,
358 .postclose = nouveau_postclose, 294 .postclose = nouveau_drm_postclose,
359#if defined(CONFIG_DRM_NOUVEAU_DEBUG)
360 .debugfs_init = nouveau_debugfs_init,
361 .debugfs_cleanup = nouveau_debugfs_takedown,
362#endif
363 .irq_preinstall = nouveau_irq_preinstall, 295 .irq_preinstall = nouveau_irq_preinstall,
364 .irq_postinstall = nouveau_irq_postinstall, 296 .irq_postinstall = nouveau_irq_postinstall,
365 .irq_uninstall = nouveau_irq_uninstall, 297 .irq_uninstall = nouveau_irq_uninstall,