drm/nouveau/kms: restore fbcon after display has been resumed

Under some complicated circumstances (boot, suspend, resume, attach
second display, suspend, resume, suspend, detach second display,
resume, suspend, attach second display, resume), the fb_set_suspend()
call can somehow result in a modeset being attempted before we're
ready for it and things blow up in fun ways.

Running display init first fixes the issue.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2014-06-30 13:04:14 +10:00
parent 276e526cfb
commit 028791bb7d
3 changed files with 12 additions and 19 deletions

View File

@ -652,12 +652,12 @@ int nouveau_pmops_resume(struct device *dev)
ret = nouveau_do_resume(drm_dev); ret = nouveau_do_resume(drm_dev);
if (ret) if (ret)
return ret; return ret;
if (drm_dev->mode_config.num_crtc)
nouveau_fbcon_set_suspend(drm_dev, 0);
nouveau_fbcon_zfill_all(drm_dev); if (drm_dev->mode_config.num_crtc) {
if (drm_dev->mode_config.num_crtc)
nouveau_display_resume(drm_dev); nouveau_display_resume(drm_dev);
nouveau_fbcon_set_suspend(drm_dev, 0);
}
return 0; return 0;
} }
@ -683,11 +683,12 @@ static int nouveau_pmops_thaw(struct device *dev)
ret = nouveau_do_resume(drm_dev); ret = nouveau_do_resume(drm_dev);
if (ret) if (ret)
return ret; return ret;
if (drm_dev->mode_config.num_crtc)
nouveau_fbcon_set_suspend(drm_dev, 0); if (drm_dev->mode_config.num_crtc) {
nouveau_fbcon_zfill_all(drm_dev);
if (drm_dev->mode_config.num_crtc)
nouveau_display_resume(drm_dev); nouveau_display_resume(drm_dev);
nouveau_fbcon_set_suspend(drm_dev, 0);
}
return 0; return 0;
} }

View File

@ -531,17 +531,10 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state)
if (state == 1) if (state == 1)
nouveau_fbcon_save_disable_accel(dev); nouveau_fbcon_save_disable_accel(dev);
fb_set_suspend(drm->fbcon->helper.fbdev, state); fb_set_suspend(drm->fbcon->helper.fbdev, state);
if (state == 0) if (state == 0) {
nouveau_fbcon_restore_accel(dev); nouveau_fbcon_restore_accel(dev);
nouveau_fbcon_zfill(dev, drm->fbcon);
}
console_unlock(); console_unlock();
} }
} }
void
nouveau_fbcon_zfill_all(struct drm_device *dev)
{
struct nouveau_drm *drm = nouveau_drm(dev);
if (drm->fbcon) {
nouveau_fbcon_zfill(dev, drm->fbcon);
}
}

View File

@ -61,7 +61,6 @@ void nouveau_fbcon_gpu_lockup(struct fb_info *info);
int nouveau_fbcon_init(struct drm_device *dev); int nouveau_fbcon_init(struct drm_device *dev);
void nouveau_fbcon_fini(struct drm_device *dev); void nouveau_fbcon_fini(struct drm_device *dev);
void nouveau_fbcon_set_suspend(struct drm_device *dev, int state); void nouveau_fbcon_set_suspend(struct drm_device *dev, int state);
void nouveau_fbcon_zfill_all(struct drm_device *dev);
void nouveau_fbcon_save_disable_accel(struct drm_device *dev); void nouveau_fbcon_save_disable_accel(struct drm_device *dev);
void nouveau_fbcon_restore_accel(struct drm_device *dev); void nouveau_fbcon_restore_accel(struct drm_device *dev);