diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2012-11-09 07:26:14 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-11-20 01:19:56 -0500 |
commit | 506ff75c92a44d80da96bc18d9902d29e8236fc6 (patch) | |
tree | 20d8a4f2a4d9b024e5b2b9bb37cea8d79eefbf8d /drivers/gpu/drm/vmwgfx | |
parent | 29a16e9543f4122da13e9c0e18af117cc4964fb8 (diff) |
drm/vmwgfx: Refactor module load to not require fifo unless fbdev is loaded
This also fixes a bug where the fence manager was left without irq
enabled when waiting for fences, causing various errors at module
load time
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index a8b60b867277..56973cd41735 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -609,14 +609,18 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
609 | } | 609 | } |
610 | } | 610 | } |
611 | 611 | ||
612 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { | ||
613 | ret = drm_irq_install(dev); | ||
614 | if (ret != 0) { | ||
615 | DRM_ERROR("Failed installing irq: %d\n", ret); | ||
616 | goto out_no_irq; | ||
617 | } | ||
618 | } | ||
619 | |||
612 | dev_priv->fman = vmw_fence_manager_init(dev_priv); | 620 | dev_priv->fman = vmw_fence_manager_init(dev_priv); |
613 | if (unlikely(dev_priv->fman == NULL)) | 621 | if (unlikely(dev_priv->fman == NULL)) |
614 | goto out_no_fman; | 622 | goto out_no_fman; |
615 | 623 | ||
616 | /* Need to start the fifo to check if we can do screen objects */ | ||
617 | ret = vmw_3d_resource_inc(dev_priv, true); | ||
618 | if (unlikely(ret != 0)) | ||
619 | goto out_no_fifo; | ||
620 | vmw_kms_save_vga(dev_priv); | 624 | vmw_kms_save_vga(dev_priv); |
621 | 625 | ||
622 | /* Start kms and overlay systems, needs fifo. */ | 626 | /* Start kms and overlay systems, needs fifo. */ |
@@ -625,25 +629,11 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
625 | goto out_no_kms; | 629 | goto out_no_kms; |
626 | vmw_overlay_init(dev_priv); | 630 | vmw_overlay_init(dev_priv); |
627 | 631 | ||
628 | /* 3D Depends on Screen Objects being used. */ | ||
629 | DRM_INFO("Detected %sdevice 3D availability.\n", | ||
630 | vmw_fifo_have_3d(dev_priv) ? | ||
631 | "" : "no "); | ||
632 | |||
633 | /* We might be done with the fifo now */ | ||
634 | if (dev_priv->enable_fb) { | 632 | if (dev_priv->enable_fb) { |
633 | ret = vmw_3d_resource_inc(dev_priv, true); | ||
634 | if (unlikely(ret != 0)) | ||
635 | goto out_no_fifo; | ||
635 | vmw_fb_init(dev_priv); | 636 | vmw_fb_init(dev_priv); |
636 | } else { | ||
637 | vmw_kms_restore_vga(dev_priv); | ||
638 | vmw_3d_resource_dec(dev_priv, true); | ||
639 | } | ||
640 | |||
641 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { | ||
642 | ret = drm_irq_install(dev); | ||
643 | if (unlikely(ret != 0)) { | ||
644 | DRM_ERROR("Failed installing irq: %d\n", ret); | ||
645 | goto out_no_irq; | ||
646 | } | ||
647 | } | 637 | } |
648 | 638 | ||
649 | dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier; | 639 | dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier; |
@@ -651,20 +641,16 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
651 | 641 | ||
652 | return 0; | 642 | return 0; |
653 | 643 | ||
654 | out_no_irq: | 644 | out_no_fifo: |
655 | if (dev_priv->enable_fb) | ||
656 | vmw_fb_close(dev_priv); | ||
657 | vmw_overlay_close(dev_priv); | 645 | vmw_overlay_close(dev_priv); |
658 | vmw_kms_close(dev_priv); | 646 | vmw_kms_close(dev_priv); |
659 | out_no_kms: | 647 | out_no_kms: |
660 | /* We still have a 3D resource reference held */ | 648 | vmw_kms_restore_vga(dev_priv); |
661 | if (dev_priv->enable_fb) { | ||
662 | vmw_kms_restore_vga(dev_priv); | ||
663 | vmw_3d_resource_dec(dev_priv, false); | ||
664 | } | ||
665 | out_no_fifo: | ||
666 | vmw_fence_manager_takedown(dev_priv->fman); | 649 | vmw_fence_manager_takedown(dev_priv->fman); |
667 | out_no_fman: | 650 | out_no_fman: |
651 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) | ||
652 | drm_irq_uninstall(dev_priv->dev); | ||
653 | out_no_irq: | ||
668 | if (dev_priv->stealth) | 654 | if (dev_priv->stealth) |
669 | pci_release_region(dev->pdev, 2); | 655 | pci_release_region(dev->pdev, 2); |
670 | else | 656 | else |
@@ -699,8 +685,6 @@ static int vmw_driver_unload(struct drm_device *dev) | |||
699 | 685 | ||
700 | if (dev_priv->ctx.cmd_bounce) | 686 | if (dev_priv->ctx.cmd_bounce) |
701 | vfree(dev_priv->ctx.cmd_bounce); | 687 | vfree(dev_priv->ctx.cmd_bounce); |
702 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) | ||
703 | drm_irq_uninstall(dev_priv->dev); | ||
704 | if (dev_priv->enable_fb) { | 688 | if (dev_priv->enable_fb) { |
705 | vmw_fb_close(dev_priv); | 689 | vmw_fb_close(dev_priv); |
706 | vmw_kms_restore_vga(dev_priv); | 690 | vmw_kms_restore_vga(dev_priv); |
@@ -709,6 +693,8 @@ static int vmw_driver_unload(struct drm_device *dev) | |||
709 | vmw_kms_close(dev_priv); | 693 | vmw_kms_close(dev_priv); |
710 | vmw_overlay_close(dev_priv); | 694 | vmw_overlay_close(dev_priv); |
711 | vmw_fence_manager_takedown(dev_priv->fman); | 695 | vmw_fence_manager_takedown(dev_priv->fman); |
696 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) | ||
697 | drm_irq_uninstall(dev_priv->dev); | ||
712 | if (dev_priv->stealth) | 698 | if (dev_priv->stealth) |
713 | pci_release_region(dev->pdev, 2); | 699 | pci_release_region(dev->pdev, 2); |
714 | else | 700 | else |