diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-05-04 00:01:52 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-05-24 02:56:16 -0400 |
commit | d1b167e168bdac0b6af11e7a8c601773639fc419 (patch) | |
tree | 84af7888dc726609901bbf00ec179a77dfef6c26 /drivers/gpu/drm/nouveau/nouveau_state.c | |
parent | 78df3a1c585c8c95fd9a472125f0cd406e8617ce (diff) |
drm/nouveau/ttm: untangle code to support accelerated buffer moves
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_state.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 63 |
1 files changed, 3 insertions, 60 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index e4e73a13a2b2..9b4c900a3f30 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -509,73 +509,16 @@ nouveau_card_channel_init(struct drm_device *dev) | |||
509 | { | 509 | { |
510 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 510 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
511 | struct nouveau_channel *chan; | 511 | struct nouveau_channel *chan; |
512 | int ret, oclass; | 512 | int ret; |
513 | 513 | ||
514 | ret = nouveau_channel_alloc(dev, &chan, NULL, NvDmaFB, NvDmaTT); | 514 | ret = nouveau_channel_alloc(dev, &chan, NULL, NvDmaFB, NvDmaTT); |
515 | dev_priv->channel = chan; | 515 | dev_priv->channel = chan; |
516 | if (ret) | 516 | if (ret) |
517 | return ret; | 517 | return ret; |
518 | |||
519 | mutex_unlock(&dev_priv->channel->mutex); | 518 | mutex_unlock(&dev_priv->channel->mutex); |
520 | 519 | ||
521 | if (dev_priv->card_type <= NV_50) { | 520 | nouveau_bo_move_init(chan); |
522 | if (dev_priv->card_type < NV_50) | 521 | return 0; |
523 | oclass = 0x0039; | ||
524 | else | ||
525 | oclass = 0x5039; | ||
526 | |||
527 | ret = nouveau_gpuobj_gr_new(chan, NvM2MF, oclass); | ||
528 | if (ret) | ||
529 | goto error; | ||
530 | |||
531 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfe0, 0x1000, | ||
532 | &chan->m2mf_ntfy); | ||
533 | if (ret) | ||
534 | goto error; | ||
535 | |||
536 | ret = RING_SPACE(chan, 6); | ||
537 | if (ret) | ||
538 | goto error; | ||
539 | |||
540 | BEGIN_NV04(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_NAME, 1); | ||
541 | OUT_RING (chan, NvM2MF); | ||
542 | BEGIN_NV04(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 3); | ||
543 | OUT_RING (chan, NvNotify0); | ||
544 | OUT_RING (chan, chan->vram_handle); | ||
545 | OUT_RING (chan, chan->gart_handle); | ||
546 | } else | ||
547 | if (dev_priv->card_type <= NV_D0) { | ||
548 | ret = nouveau_gpuobj_gr_new(chan, 0x9039, 0x9039); | ||
549 | if (ret) | ||
550 | goto error; | ||
551 | |||
552 | ret = RING_SPACE(chan, 2); | ||
553 | if (ret) | ||
554 | goto error; | ||
555 | |||
556 | BEGIN_NVC0(chan, NvSubM2MF, 0x0000, 1); | ||
557 | OUT_RING (chan, 0x00009039); | ||
558 | } else | ||
559 | if (dev_priv->card_type <= NV_E0) { | ||
560 | /* not used, but created to get a graph context */ | ||
561 | ret = nouveau_gpuobj_gr_new(chan, 0xa040, 0xa040); | ||
562 | if (ret) | ||
563 | goto error; | ||
564 | |||
565 | /* bind strange copy engine to subchannel 4 (fixed...) */ | ||
566 | ret = RING_SPACE(chan, 2); | ||
567 | if (ret) | ||
568 | goto error; | ||
569 | |||
570 | BEGIN_NVC0(chan, NvSubCopy, 0x0000, 1); | ||
571 | OUT_RING (chan, 0x0000a0b5); | ||
572 | } | ||
573 | |||
574 | FIRE_RING (chan); | ||
575 | error: | ||
576 | if (ret) | ||
577 | nouveau_card_channel_fini(dev); | ||
578 | return ret; | ||
579 | } | 522 | } |
580 | 523 | ||
581 | static const struct vga_switcheroo_client_ops nouveau_switcheroo_ops = { | 524 | static const struct vga_switcheroo_client_ops nouveau_switcheroo_ops = { |