~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/gpu/drm/nouveau/nouveau_drv.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
        struct drm_device *dev = pci_get_drvdata(pdev);
163
163
        struct drm_nouveau_private *dev_priv = dev->dev_private;
164
164
        struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem;
165
 
        struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
166
165
        struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
167
166
        struct nouveau_channel *chan;
168
167
        struct drm_crtc *crtc;
169
 
        int ret, i;
 
168
        int ret, i, e;
170
169
 
171
170
        if (pm_state.event == PM_EVENT_PRETHAW)
172
171
                return 0;
206
205
                        nouveau_channel_idle(chan);
207
206
        }
208
207
 
209
 
        pgraph->fifo_access(dev, false);
210
 
        nouveau_wait_for_idle(dev);
211
208
        pfifo->reassign(dev, false);
212
209
        pfifo->disable(dev);
213
210
        pfifo->unload_context(dev);
214
 
        pgraph->unload_context(dev);
 
211
 
 
212
        for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
 
213
                if (dev_priv->eng[e]) {
 
214
                        ret = dev_priv->eng[e]->fini(dev, e);
 
215
                        if (ret)
 
216
                                goto out_abort;
 
217
                }
 
218
        }
215
219
 
216
220
        ret = pinstmem->suspend(dev);
217
221
        if (ret) {
242
246
 
243
247
out_abort:
244
248
        NV_INFO(dev, "Re-enabling acceleration..\n");
 
249
        for (e = e + 1; e < NVOBJ_ENGINE_NR; e++) {
 
250
                if (dev_priv->eng[e])
 
251
                        dev_priv->eng[e]->init(dev, e);
 
252
        }
245
253
        pfifo->enable(dev);
246
254
        pfifo->reassign(dev, true);
247
 
        pgraph->fifo_access(dev, true);
248
255
        return ret;
249
256
}
250
257
 
299
306
        engine->mc.init(dev);
300
307
        engine->timer.init(dev);
301
308
        engine->fb.init(dev);
302
 
        engine->graph.init(dev);
303
 
        engine->crypt.init(dev);
 
309
        for (i = 0; i < NVOBJ_ENGINE_NR; i++) {
 
310
                if (dev_priv->eng[i])
 
311
                        dev_priv->eng[i]->init(dev, i);
 
312
        }
304
313
        engine->fifo.init(dev);
305
314
 
306
315
        nouveau_irq_postinstall(dev);
408
417
#endif
409
418
                .llseek = noop_llseek,
410
419
        },
411
 
        .pci_driver = {
412
 
                .name = DRIVER_NAME,
413
 
                .id_table = pciidlist,
414
 
                .probe = nouveau_pci_probe,
415
 
                .remove = nouveau_pci_remove,
416
 
                .suspend = nouveau_pci_suspend,
417
 
                .resume = nouveau_pci_resume
418
 
        },
419
420
 
420
421
        .gem_init_object = nouveau_gem_object_new,
421
422
        .gem_free_object = nouveau_gem_object_del,
432
433
        .patchlevel = DRIVER_PATCHLEVEL,
433
434
};
434
435
 
 
436
static struct pci_driver nouveau_pci_driver = {
 
437
                .name = DRIVER_NAME,
 
438
                .id_table = pciidlist,
 
439
                .probe = nouveau_pci_probe,
 
440
                .remove = nouveau_pci_remove,
 
441
                .suspend = nouveau_pci_suspend,
 
442
                .resume = nouveau_pci_resume
 
443
};
 
444
 
435
445
static int __init nouveau_init(void)
436
446
{
437
447
        driver.num_ioctls = nouveau_max_ioctl;
449
459
                return 0;
450
460
 
451
461
        nouveau_register_dsm_handler();
452
 
        return drm_init(&driver);
 
462
        return drm_pci_init(&driver, &nouveau_pci_driver);
453
463
}
454
464
 
455
465
static void __exit nouveau_exit(void)
457
467
        if (!nouveau_modeset)
458
468
                return;
459
469
 
460
 
        drm_exit(&driver);
 
470
        drm_pci_exit(&driver, &nouveau_pci_driver);
461
471
        nouveau_unregister_dsm_handler();
462
472
}
463
473