]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/nouveau: shutdown display on suspend/hibernate
authorBen Skeggs <bskeggs@redhat.com>
Wed, 9 Nov 2011 05:18:47 +0000 (15:18 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 21 Dec 2011 09:01:35 +0000 (19:01 +1000)
Known to fix some serious issues with hibernate on a couple of systems.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/nouveau/nouveau_drv.c
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/nouveau/nouveau_state.c

index 803248d467fbe72b5772c51fb279f19e28a07bdb..6ac6931624f471b173f52ffa6208055befe4f173 100644 (file)
@@ -206,6 +206,31 @@ static struct drm_prop_enum_list dither_depth[] = {
        }                                                                      \
 } while(0)
 
+int
+nouveau_display_init(struct drm_device *dev)
+{
+       struct drm_nouveau_private *dev_priv = dev->dev_private;
+       struct nouveau_display_engine *disp = &dev_priv->engine.display;
+       int ret;
+
+       ret = disp->init(dev);
+       if (ret == 0) {
+               drm_kms_helper_poll_enable(dev);
+       }
+
+       return ret;
+}
+
+void
+nouveau_display_fini(struct drm_device *dev)
+{
+       struct drm_nouveau_private *dev_priv = dev->dev_private;
+       struct nouveau_display_engine *disp = &dev_priv->engine.display;
+
+       drm_kms_helper_poll_disable(dev);
+       disp->fini(dev);
+}
+
 int
 nouveau_display_create(struct drm_device *dev)
 {
@@ -258,13 +283,19 @@ nouveau_display_create(struct drm_device *dev)
                dev->mode_config.max_height = 8192;
        }
 
+       drm_kms_helper_poll_init(dev);
+       drm_kms_helper_poll_disable(dev);
+
        ret = disp->create(dev);
        if (ret)
                return ret;
 
-       ret = disp->init(dev);
-       if (ret)
-               disp->destroy(dev);
+       if (dev->mode_config.num_crtc) {
+               ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
+               if (ret)
+                       return ret;
+       }
+
        return ret;
 }
 
@@ -274,8 +305,11 @@ nouveau_display_destroy(struct drm_device *dev)
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nouveau_display_engine *disp = &dev_priv->engine.display;
 
-       disp->fini(dev);
+       drm_vblank_cleanup(dev);
+
        disp->destroy(dev);
+
+       drm_kms_helper_poll_fini(dev);
        drm_mode_config_cleanup(dev);
 }
 
index cb357ab3670c23bf1e5ce7a5b709257f1d534b92..e4485404892e88d8e908105706f0744fc49e94a6 100644 (file)
@@ -178,7 +178,8 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
                return 0;
 
-       drm_kms_helper_poll_disable(dev);
+       NV_INFO(dev, "Disabling display...\n");
+       nouveau_display_fini(dev);
 
        NV_INFO(dev, "Disabling fbcon...\n");
        nouveau_fbcon_set_suspend(dev, 1);
@@ -357,8 +358,7 @@ nouveau_pci_resume(struct pci_dev *pdev)
        nouveau_fbcon_set_suspend(dev, 0);
        nouveau_fbcon_zfill_all(dev);
 
-       engine->display.init(dev);
-       drm_kms_helper_poll_enable(dev);
+       nouveau_display_init(dev);
 
        /* Force CLUT to get re-loaded during modeset */
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
index a22ca47359434ba6c2dd9292433120a11dd25a53..c13918588034bbec6e1e05c5dc633a4b1406d200 100644 (file)
@@ -1449,6 +1449,8 @@ extern int nouveau_gem_ioctl_info(struct drm_device *, void *,
 /* nouveau_display.c */
 int nouveau_display_create(struct drm_device *dev);
 void nouveau_display_destroy(struct drm_device *dev);
+int nouveau_display_init(struct drm_device *dev);
+void nouveau_display_fini(struct drm_device *dev);
 int nouveau_vblank_enable(struct drm_device *dev, int crtc);
 void nouveau_vblank_disable(struct drm_device *dev, int crtc);
 int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
index 0c3368b36e6cd1f31f1e61b5fd98b02b7e6b20c1..013b33bac302ab271fd97853207ecbdcc4f671c9 100644 (file)
@@ -763,12 +763,11 @@ nouveau_card_init(struct drm_device *dev)
        }
 
        if (dev->mode_config.num_crtc) {
-               ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
+               ret = nouveau_display_init(dev);
                if (ret)
                        goto out_chan;
 
                nouveau_fbcon_init(dev);
-               drm_kms_helper_poll_init(dev);
        }
 
        return 0;
@@ -829,9 +828,8 @@ static void nouveau_card_takedown(struct drm_device *dev)
        int e;
 
        if (dev->mode_config.num_crtc) {
-               drm_kms_helper_poll_fini(dev);
                nouveau_fbcon_fini(dev);
-               drm_vblank_cleanup(dev);
+               nouveau_display_fini(dev);
        }
 
        if (dev_priv->channel) {