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

« back to all changes in this revision

Viewing changes to drivers/gpu/drm/nouveau/nouveau_channel.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:
35
35
        struct drm_nouveau_private *dev_priv = dev->dev_private;
36
36
        struct nouveau_bo *pb = chan->pushbuf_bo;
37
37
        struct nouveau_gpuobj *pushbuf = NULL;
38
 
        int ret;
 
38
        int ret = 0;
39
39
 
40
40
        if (dev_priv->card_type >= NV_50) {
41
41
                if (dev_priv->card_type < NV_C0) {
90
90
        else
91
91
                location = TTM_PL_FLAG_TT;
92
92
 
93
 
        ret = nouveau_bo_new(dev, NULL, 65536, 0, location, 0, 0x0000, false,
94
 
                             true, &pushbuf);
 
93
        ret = nouveau_bo_new(dev, NULL, 65536, 0, location, 0, 0x0000, &pushbuf);
95
94
        if (ret) {
96
95
                NV_ERROR(dev, "error allocating DMA push buffer: %d\n", ret);
97
96
                return NULL;
201
200
        /* disable the fifo caches */
202
201
        pfifo->reassign(dev, false);
203
202
 
204
 
        /* Construct inital RAMFC for new channel */
 
203
        /* Construct initial RAMFC for new channel */
205
204
        ret = pfifo->create_context(chan);
206
205
        if (ret) {
207
206
                nouveau_channel_put(&chan);
269
268
        struct drm_device *dev = chan->dev;
270
269
        struct drm_nouveau_private *dev_priv = dev->dev_private;
271
270
        struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
272
 
        struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
273
 
        struct nouveau_crypt_engine *pcrypt = &dev_priv->engine.crypt;
274
271
        unsigned long flags;
 
272
        int i;
275
273
 
276
274
        /* decrement the refcount, and we're done if there's still refs */
277
275
        if (likely(!atomic_dec_and_test(&chan->users))) {
279
277
                return;
280
278
        }
281
279
 
282
 
        /* noone wants the channel anymore */
 
280
        /* no one wants the channel anymore */
283
281
        NV_DEBUG(dev, "freeing channel %d\n", chan->id);
284
282
        nouveau_debugfs_channel_fini(chan);
285
283
 
295
293
        /* boot it off the hardware */
296
294
        pfifo->reassign(dev, false);
297
295
 
298
 
        /* We want to give pgraph a chance to idle and get rid of all
299
 
         * potential errors. We need to do this without the context
300
 
         * switch lock held, otherwise the irq handler is unable to
301
 
         * process them.
302
 
         */
303
 
        if (pgraph->channel(dev) == chan)
304
 
                nouveau_wait_for_idle(dev);
305
 
 
306
296
        /* destroy the engine specific contexts */
307
297
        pfifo->destroy_context(chan);
308
 
        pgraph->destroy_context(chan);
309
 
        if (pcrypt->destroy_context)
310
 
                pcrypt->destroy_context(chan);
 
298
        for (i = 0; i < NVOBJ_ENGINE_NR; i++) {
 
299
                if (chan->engctx[i])
 
300
                        dev_priv->eng[i]->context_del(chan, i);
 
301
        }
311
302
 
312
303
        pfifo->reassign(dev, true);
313
304
 
415
406
        struct nouveau_channel *chan;
416
407
        int ret;
417
408
 
418
 
        if (dev_priv->engine.graph.accel_blocked)
 
409
        if (!dev_priv->eng[NVOBJ_ENGINE_GR])
419
410
                return -ENODEV;
420
411
 
421
412
        if (init->fb_ctxdma_handle == ~0 || init->tt_ctxdma_handle == ~0)