From: Thomas Hellstrom <thellstrom@vmware.com>
To: airlied@redhat.com
Cc: Thomas Hellstrom <thellstrom@vmware.com>,
dri-devel@lists.freedesktop.org
Subject: [PATCH 03/15] vmwgfx: Fix ACPI S3 & S4 functionality.
Date: Mon, 27 Sep 2010 15:20:20 +0200 [thread overview]
Message-ID: <1285593632-10585-4-git-send-email-thellstrom@vmware.com> (raw)
In-Reply-To: <1285593632-10585-3-git-send-email-thellstrom@vmware.com>
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>
---
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 38 +++++++++++++++++++++++++++++++++-
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 +
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 40bdb54..a3ab1e7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -753,15 +753,40 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
* Buffer contents is moved to swappable memory.
*/
ttm_bo_swapout_all(&dev_priv->bdev);
+
+ /**
+ * Release 3d reference held by fbdev and potentially
+ * stop fifo.
+ */
+ dev_priv->suspended = true;
+ if (dev_priv->enable_fb)
+ vmw_3d_resource_dec(dev_priv);
+
break;
case PM_POST_HIBERNATION:
case PM_POST_SUSPEND:
+ case PM_POST_RESTORE:
+ if (!dev_priv->suspended) {
+ printk(KERN_WARNING
+ "[%s] Driver is not suspended at resume"
+ " point.\n", VMWGFX_DRIVER_NAME);
+
+ break;
+ }
+
+ /**
+ * Reclaim 3d reference held by fbdev and potentially
+ * start fifo.
+ */
+ if (dev_priv->enable_fb)
+ vmw_3d_resource_inc(dev_priv);
+
+ dev_priv->suspended = false;
ttm_suspend_unlock(&vmaster->lock);
+
break;
case PM_RESTORE_PREPARE:
break;
- case PM_POST_RESTORE:
- break;
default:
break;
}
@@ -774,6 +799,15 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
int vmw_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
+ struct drm_device *dev = pci_get_drvdata(pdev);
+ struct vmw_private *dev_priv = vmw_priv(dev);
+
+ if (dev_priv->num_3d_resources != 0) {
+ DRM_INFO("Can't suspend or hibernate "
+ "while 3D resources are active.\n");
+ return -EBUSY;
+ }
+
pci_save_state(pdev);
pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 9142454..b0b10a4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -286,6 +286,7 @@ struct vmw_private {
struct vmw_master *active_master;
struct vmw_master fbdev_master;
struct notifier_block pm_nb;
+ bool suspended;
struct mutex release_mutex;
uint32_t num_3d_resources;
--
1.6.2.5
next prev parent reply other threads:[~2010-09-27 13:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-27 13:20 [PATCH 0/15] vmwgfx updates Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 01/15] vmwgfx: Add an option to choose whether to enable fbdev at load time Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 02/15] vmwgfx: Really support other depths than 32 Thomas Hellstrom
2010-09-27 13:20 ` Thomas Hellstrom [this message]
2010-09-27 13:20 ` [PATCH 04/15] vmwgfx: Add new-style PM hooks to improve hibernation behavior Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 05/15] drm: vmwgfx: Add a struct drm_file parameter to the dirty framebuffer callback Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 06/15] vmwgfx: Take the ttm lock around the dirty ioctl Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 07/15] vmwgfx: Prune modes based on available VRAM size Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 08/15] vmwgfx: Don't flush fb if we're in the suspended state Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 09/15] vmwgfx: Add a parameter to get the max fb size Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 10/15] vmwgfx: Enable use of the vblank system Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 11/15] vmwgfx: Add modinfo version Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 12/15] vmwgfx: Remove initialisation of dev::devname Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 13/15] vmwgfx: Add a get_vblank_counter function Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 14/15] vmwgfx: Save at least one screen layout Thomas Hellstrom
2010-09-27 13:20 ` [PATCH 15/15] vmwgfx: Bump minor and driver date Thomas Hellstrom
2010-09-28 7:23 ` [PATCH 13/15] vmwgfx: Add a get_vblank_counter function Michel Dänzer
2010-09-28 8:06 ` Thomas Hellstrom
2010-09-27 22:41 ` [PATCH 03/15] vmwgfx: Fix ACPI S3 & S4 functionality Dave Airlie
2010-09-28 6:44 ` Thomas Hellstrom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1285593632-10585-4-git-send-email-thellstrom@vmware.com \
--to=thellstrom@vmware.com \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.