Known to fix some serious issues with hibernate on a couple of systems.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
} 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)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
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;
}
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);
}
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);
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) {
/* 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,
}
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;
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) {