diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-03-17 10:40:41 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-03-22 03:17:46 -0400 |
commit | 48aca13f0167ae78c28c6b48d82a157a6692eecb (patch) | |
tree | 54937c4fc0e8f19fcf2d8abfb35a82798f85ce96 /drivers/gpu/drm/nouveau/nouveau_state.c | |
parent | d5316e251230c4e54a157349a362229c3d4daa32 (diff) |
drm/nouveau: remove m2mf creation on userspace channels
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 | 91 |
1 files changed, 77 insertions, 14 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 9c144fb8bbba..6476cf604cc4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -552,6 +552,75 @@ static bool nouveau_switcheroo_can_switch(struct pci_dev *pdev) | |||
552 | return can_switch; | 552 | return can_switch; |
553 | } | 553 | } |
554 | 554 | ||
555 | static void | ||
556 | nouveau_card_channel_fini(struct drm_device *dev) | ||
557 | { | ||
558 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
559 | |||
560 | if (dev_priv->channel) | ||
561 | nouveau_channel_put_unlocked(&dev_priv->channel); | ||
562 | } | ||
563 | |||
564 | static int | ||
565 | nouveau_card_channel_init(struct drm_device *dev) | ||
566 | { | ||
567 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
568 | struct nouveau_channel *chan; | ||
569 | int ret, oclass; | ||
570 | |||
571 | ret = nouveau_channel_alloc(dev, &chan, NULL, NvDmaFB, NvDmaTT); | ||
572 | dev_priv->channel = chan; | ||
573 | if (ret) | ||
574 | return ret; | ||
575 | |||
576 | mutex_unlock(&dev_priv->channel->mutex); | ||
577 | |||
578 | if (dev_priv->card_type <= NV_50) { | ||
579 | if (dev_priv->card_type < NV_50) | ||
580 | oclass = 0x0039; | ||
581 | else | ||
582 | oclass = 0x5039; | ||
583 | |||
584 | ret = nouveau_gpuobj_gr_new(chan, NvM2MF, oclass); | ||
585 | if (ret) | ||
586 | goto error; | ||
587 | |||
588 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfe0, 0x1000, | ||
589 | &chan->m2mf_ntfy); | ||
590 | if (ret) | ||
591 | goto error; | ||
592 | |||
593 | ret = RING_SPACE(chan, 6); | ||
594 | if (ret) | ||
595 | goto error; | ||
596 | |||
597 | BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_NAME, 1); | ||
598 | OUT_RING (chan, NvM2MF); | ||
599 | BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 3); | ||
600 | OUT_RING (chan, NvNotify0); | ||
601 | OUT_RING (chan, chan->vram_handle); | ||
602 | OUT_RING (chan, chan->gart_handle); | ||
603 | } else | ||
604 | if (dev_priv->card_type <= NV_C0) { | ||
605 | ret = nouveau_gpuobj_gr_new(chan, 0x9039, 0x9039); | ||
606 | if (ret) | ||
607 | goto error; | ||
608 | |||
609 | ret = RING_SPACE(chan, 2); | ||
610 | if (ret) | ||
611 | goto error; | ||
612 | |||
613 | BEGIN_NVC0(chan, 2, NvSubM2MF, 0x0000, 1); | ||
614 | OUT_RING (chan, 0x00009039); | ||
615 | } | ||
616 | |||
617 | FIRE_RING (chan); | ||
618 | error: | ||
619 | if (ret) | ||
620 | nouveau_card_channel_fini(dev); | ||
621 | return ret; | ||
622 | } | ||
623 | |||
555 | int | 624 | int |
556 | nouveau_card_init(struct drm_device *dev) | 625 | nouveau_card_init(struct drm_device *dev) |
557 | { | 626 | { |
@@ -738,17 +807,14 @@ nouveau_card_init(struct drm_device *dev) | |||
738 | nouveau_backlight_init(dev); | 807 | nouveau_backlight_init(dev); |
739 | nouveau_pm_init(dev); | 808 | nouveau_pm_init(dev); |
740 | 809 | ||
741 | if (dev_priv->eng[NVOBJ_ENGINE_GR]) { | 810 | ret = nouveau_fence_init(dev); |
742 | ret = nouveau_fence_init(dev); | 811 | if (ret) |
743 | if (ret) | 812 | goto out_pm; |
744 | goto out_pm; | ||
745 | 813 | ||
746 | ret = nouveau_channel_alloc(dev, &dev_priv->channel, NULL, | 814 | if (!dev_priv->noaccel) { |
747 | NvDmaFB, NvDmaTT); | 815 | ret = nouveau_card_channel_init(dev); |
748 | if (ret) | 816 | if (ret) |
749 | goto out_fence; | 817 | goto out_fence; |
750 | |||
751 | mutex_unlock(&dev_priv->channel->mutex); | ||
752 | } | 818 | } |
753 | 819 | ||
754 | if (dev->mode_config.num_crtc) { | 820 | if (dev->mode_config.num_crtc) { |
@@ -762,7 +828,7 @@ nouveau_card_init(struct drm_device *dev) | |||
762 | return 0; | 828 | return 0; |
763 | 829 | ||
764 | out_chan: | 830 | out_chan: |
765 | nouveau_channel_put_unlocked(&dev_priv->channel); | 831 | nouveau_card_channel_fini(dev); |
766 | out_fence: | 832 | out_fence: |
767 | nouveau_fence_fini(dev); | 833 | nouveau_fence_fini(dev); |
768 | out_pm: | 834 | out_pm: |
@@ -820,11 +886,8 @@ static void nouveau_card_takedown(struct drm_device *dev) | |||
820 | nouveau_display_fini(dev); | 886 | nouveau_display_fini(dev); |
821 | } | 887 | } |
822 | 888 | ||
823 | if (dev_priv->channel) { | 889 | nouveau_card_channel_fini(dev); |
824 | nouveau_channel_put_unlocked(&dev_priv->channel); | 890 | nouveau_fence_fini(dev); |
825 | nouveau_fence_fini(dev); | ||
826 | } | ||
827 | |||
828 | nouveau_pm_fini(dev); | 891 | nouveau_pm_fini(dev); |
829 | nouveau_backlight_exit(dev); | 892 | nouveau_backlight_exit(dev); |
830 | nouveau_display_destroy(dev); | 893 | nouveau_display_destroy(dev); |