diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2013-11-03 20:15:38 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2013-11-08 00:39:56 -0500 |
commit | 46ea16884c19cb63254cfc6150a76055afbe63e7 (patch) | |
tree | 3447e27454bfa73e07c131571484f1aa21e7e52d | |
parent | 6d8d163132d7df6ca701efcde7832046ecb2f040 (diff) |
drm/nouveau/fbcon: bracket entrypoints with a per-device enabled check
We don't necessarily have fbcon on all devices these days.
Fixes suspend on (at least) Quadro NVS 450.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fbcon.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index c80b519b513a..7903e0ed3c75 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -503,34 +503,45 @@ nouveau_fbcon_fini(struct drm_device *dev) | |||
503 | drm->fbcon = NULL; | 503 | drm->fbcon = NULL; |
504 | } | 504 | } |
505 | 505 | ||
506 | void nouveau_fbcon_save_disable_accel(struct drm_device *dev) | 506 | void |
507 | nouveau_fbcon_save_disable_accel(struct drm_device *dev) | ||
507 | { | 508 | { |
508 | struct nouveau_drm *drm = nouveau_drm(dev); | 509 | struct nouveau_drm *drm = nouveau_drm(dev); |
509 | 510 | if (drm->fbcon) { | |
510 | drm->fbcon->saved_flags = drm->fbcon->helper.fbdev->flags; | 511 | drm->fbcon->saved_flags = drm->fbcon->helper.fbdev->flags; |
511 | drm->fbcon->helper.fbdev->flags |= FBINFO_HWACCEL_DISABLED; | 512 | drm->fbcon->helper.fbdev->flags |= FBINFO_HWACCEL_DISABLED; |
513 | } | ||
512 | } | 514 | } |
513 | 515 | ||
514 | void nouveau_fbcon_restore_accel(struct drm_device *dev) | 516 | void |
517 | nouveau_fbcon_restore_accel(struct drm_device *dev) | ||
515 | { | 518 | { |
516 | struct nouveau_drm *drm = nouveau_drm(dev); | 519 | struct nouveau_drm *drm = nouveau_drm(dev); |
517 | drm->fbcon->helper.fbdev->flags = drm->fbcon->saved_flags; | 520 | if (drm->fbcon) { |
521 | drm->fbcon->helper.fbdev->flags = drm->fbcon->saved_flags; | ||
522 | } | ||
518 | } | 523 | } |
519 | 524 | ||
520 | void nouveau_fbcon_set_suspend(struct drm_device *dev, int state) | 525 | void |
526 | nouveau_fbcon_set_suspend(struct drm_device *dev, int state) | ||
521 | { | 527 | { |
522 | struct nouveau_drm *drm = nouveau_drm(dev); | 528 | struct nouveau_drm *drm = nouveau_drm(dev); |
523 | console_lock(); | 529 | if (drm->fbcon) { |
524 | if (state == 0) | 530 | console_lock(); |
525 | nouveau_fbcon_save_disable_accel(dev); | 531 | if (state == 0) |
526 | fb_set_suspend(drm->fbcon->helper.fbdev, state); | 532 | nouveau_fbcon_save_disable_accel(dev); |
527 | if (state == 1) | 533 | fb_set_suspend(drm->fbcon->helper.fbdev, state); |
528 | nouveau_fbcon_restore_accel(dev); | 534 | if (state == 1) |
529 | console_unlock(); | 535 | nouveau_fbcon_restore_accel(dev); |
536 | console_unlock(); | ||
537 | } | ||
530 | } | 538 | } |
531 | 539 | ||
532 | void nouveau_fbcon_zfill_all(struct drm_device *dev) | 540 | void |
541 | nouveau_fbcon_zfill_all(struct drm_device *dev) | ||
533 | { | 542 | { |
534 | struct nouveau_drm *drm = nouveau_drm(dev); | 543 | struct nouveau_drm *drm = nouveau_drm(dev); |
535 | nouveau_fbcon_zfill(dev, drm->fbcon); | 544 | if (drm->fbcon) { |
545 | nouveau_fbcon_zfill(dev, drm->fbcon); | ||
546 | } | ||
536 | } | 547 | } |