diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2010-10-05 06:43:00 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-10-05 21:29:33 -0400 |
commit | 094e0fa8b96c9fab5df9597e728d82f3d87ee471 (patch) | |
tree | 2cd6825c18acba42fea36b8b3e604266dcdbd5f2 /drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |
parent | d3216a0c3133d8e88ec45c7ecd9f38b421f90c03 (diff) |
drm/vmwgfx: Fix ACPI S3 & S4 functionality.
Don't suspend or hibernate when there are 3D resources active since we
can't restore the device's 3D state. Instead fail with an error message.
In other cases, make sure we re-enable the fifo and unlock ttm on resume.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_drv.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 5c845b6ec49..91eeade9212 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -751,15 +751,40 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, | |||
751 | * Buffer contents is moved to swappable memory. | 751 | * Buffer contents is moved to swappable memory. |
752 | */ | 752 | */ |
753 | ttm_bo_swapout_all(&dev_priv->bdev); | 753 | ttm_bo_swapout_all(&dev_priv->bdev); |
754 | |||
755 | /** | ||
756 | * Release 3d reference held by fbdev and potentially | ||
757 | * stop fifo. | ||
758 | */ | ||
759 | dev_priv->suspended = true; | ||
760 | if (dev_priv->enable_fb) | ||
761 | vmw_3d_resource_dec(dev_priv); | ||
762 | |||
754 | break; | 763 | break; |
755 | case PM_POST_HIBERNATION: | 764 | case PM_POST_HIBERNATION: |
756 | case PM_POST_SUSPEND: | 765 | case PM_POST_SUSPEND: |
766 | case PM_POST_RESTORE: | ||
767 | if (!dev_priv->suspended) { | ||
768 | printk(KERN_WARNING | ||
769 | "[%s] Driver is not suspended at resume" | ||
770 | " point.\n", VMWGFX_DRIVER_NAME); | ||
771 | |||
772 | break; | ||
773 | } | ||
774 | |||
775 | /** | ||
776 | * Reclaim 3d reference held by fbdev and potentially | ||
777 | * start fifo. | ||
778 | */ | ||
779 | if (dev_priv->enable_fb) | ||
780 | vmw_3d_resource_inc(dev_priv); | ||
781 | |||
782 | dev_priv->suspended = false; | ||
757 | ttm_suspend_unlock(&vmaster->lock); | 783 | ttm_suspend_unlock(&vmaster->lock); |
784 | |||
758 | break; | 785 | break; |
759 | case PM_RESTORE_PREPARE: | 786 | case PM_RESTORE_PREPARE: |
760 | break; | 787 | break; |
761 | case PM_POST_RESTORE: | ||
762 | break; | ||
763 | default: | 788 | default: |
764 | break; | 789 | break; |
765 | } | 790 | } |
@@ -772,6 +797,15 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, | |||
772 | 797 | ||
773 | int vmw_pci_suspend(struct pci_dev *pdev, pm_message_t state) | 798 | int vmw_pci_suspend(struct pci_dev *pdev, pm_message_t state) |
774 | { | 799 | { |
800 | struct drm_device *dev = pci_get_drvdata(pdev); | ||
801 | struct vmw_private *dev_priv = vmw_priv(dev); | ||
802 | |||
803 | if (dev_priv->num_3d_resources != 0) { | ||
804 | DRM_INFO("Can't suspend or hibernate " | ||
805 | "while 3D resources are active.\n"); | ||
806 | return -EBUSY; | ||
807 | } | ||
808 | |||
775 | pci_save_state(pdev); | 809 | pci_save_state(pdev); |
776 | pci_disable_device(pdev); | 810 | pci_disable_device(pdev); |
777 | pci_set_power_state(pdev, PCI_D3hot); | 811 | pci_set_power_state(pdev, PCI_D3hot); |