Commit 9b945af8 authored by Ben Skeggs's avatar Ben Skeggs Committed by Ben Hutchings

drm/nouveau: fix suspend/resume when in headless mode

commit 9430738d upstream.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
[jrnieder@gmail.com: backport to 3.2: make fbcon suspend/resume
 handling conditional in a vague hope that this will approximate what
 the original does for 3.3+]
Signed-off-by: default avatarJonathan Nieder <jrnieder@gmail.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 19ceff5d
......@@ -178,8 +178,10 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0;
NV_INFO(dev, "Disabling fbcon acceleration...\n");
nouveau_fbcon_save_disable_accel(dev);
if (dev->mode_config.num_crtc) {
NV_INFO(dev, "Disabling fbcon acceleration...\n");
nouveau_fbcon_save_disable_accel(dev);
}
NV_INFO(dev, "Unpinning framebuffer(s)...\n");
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
......@@ -246,10 +248,12 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
pci_set_power_state(pdev, PCI_D3hot);
}
console_lock();
nouveau_fbcon_set_suspend(dev, 1);
console_unlock();
nouveau_fbcon_restore_accel(dev);
if (dev->mode_config.num_crtc) {
console_lock();
nouveau_fbcon_set_suspend(dev, 1);
console_unlock();
nouveau_fbcon_restore_accel(dev);
}
return 0;
out_abort:
......@@ -275,7 +279,8 @@ nouveau_pci_resume(struct pci_dev *pdev)
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0;
nouveau_fbcon_save_disable_accel(dev);
if (dev->mode_config.num_crtc)
nouveau_fbcon_save_disable_accel(dev);
NV_INFO(dev, "We're back, enabling device...\n");
pci_set_power_state(pdev, PCI_D0);
......@@ -376,15 +381,18 @@ nouveau_pci_resume(struct pci_dev *pdev)
nv_crtc->lut.depth = 0;
}
console_lock();
nouveau_fbcon_set_suspend(dev, 0);
console_unlock();
if (dev->mode_config.num_crtc) {
console_lock();
nouveau_fbcon_set_suspend(dev, 0);
console_unlock();
nouveau_fbcon_zfill_all(dev);
nouveau_fbcon_zfill_all(dev);
}
drm_helper_resume_force_mode(dev);
nouveau_fbcon_restore_accel(dev);
if (dev->mode_config.num_crtc)
nouveau_fbcon_restore_accel(dev);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment