diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-10-30 22:11:15 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-30 22:11:15 -0400 |
commit | 9430738d80223a1cd791a2baa74fa170d3df1262 (patch) | |
tree | 83f51ac27c22e60e66338726e010489914512397 /drivers/gpu | |
parent | 5cad16acd25b16681a060d28d10eeacf98d07701 (diff) |
drm/nouveau: resurrect headless mode since rework
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 34 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.c | 34 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_irq.c | 16 |
4 files changed, 51 insertions, 35 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index d2f8ffeed742..0185837d9862 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -360,23 +360,26 @@ nouveau_display_create(struct drm_device *dev) | |||
360 | drm_kms_helper_poll_init(dev); | 360 | drm_kms_helper_poll_init(dev); |
361 | drm_kms_helper_poll_disable(dev); | 361 | drm_kms_helper_poll_disable(dev); |
362 | 362 | ||
363 | if (nv_device(drm->device)->card_type < NV_50) | 363 | if (nouveau_modeset == 1) { |
364 | ret = nv04_display_create(dev); | 364 | if (nv_device(drm->device)->card_type < NV_50) |
365 | else | 365 | ret = nv04_display_create(dev); |
366 | if (nv_device(drm->device)->card_type < NV_D0) | 366 | else |
367 | ret = nv50_display_create(dev); | 367 | if (nv_device(drm->device)->card_type < NV_D0) |
368 | else | 368 | ret = nv50_display_create(dev); |
369 | ret = nvd0_display_create(dev); | 369 | else |
370 | if (ret) | 370 | ret = nvd0_display_create(dev); |
371 | goto disp_create_err; | ||
372 | |||
373 | if (dev->mode_config.num_crtc) { | ||
374 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | ||
375 | if (ret) | 371 | if (ret) |
376 | goto vblank_err; | 372 | goto disp_create_err; |
373 | |||
374 | if (dev->mode_config.num_crtc) { | ||
375 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | ||
376 | if (ret) | ||
377 | goto vblank_err; | ||
378 | } | ||
379 | |||
380 | nouveau_backlight_init(dev); | ||
377 | } | 381 | } |
378 | 382 | ||
379 | nouveau_backlight_init(dev); | ||
380 | return 0; | 383 | return 0; |
381 | 384 | ||
382 | vblank_err: | 385 | vblank_err: |
@@ -395,7 +398,8 @@ nouveau_display_destroy(struct drm_device *dev) | |||
395 | nouveau_backlight_exit(dev); | 398 | nouveau_backlight_exit(dev); |
396 | drm_vblank_cleanup(dev); | 399 | drm_vblank_cleanup(dev); |
397 | 400 | ||
398 | disp->dtor(dev); | 401 | if (disp->dtor) |
402 | disp->dtor(dev); | ||
399 | 403 | ||
400 | drm_kms_helper_poll_fini(dev); | 404 | drm_kms_helper_poll_fini(dev); |
401 | drm_mode_config_cleanup(dev); | 405 | drm_mode_config_cleanup(dev); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index ccae8c26ae2b..9cc83f18f9dc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -63,8 +63,9 @@ MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration"); | |||
63 | static int nouveau_noaccel = 0; | 63 | static int nouveau_noaccel = 0; |
64 | module_param_named(noaccel, nouveau_noaccel, int, 0400); | 64 | module_param_named(noaccel, nouveau_noaccel, int, 0400); |
65 | 65 | ||
66 | MODULE_PARM_DESC(modeset, "enable driver"); | 66 | MODULE_PARM_DESC(modeset, "enable driver (default: auto, " |
67 | static int nouveau_modeset = -1; | 67 | "0 = disabled, 1 = enabled, 2 = headless)"); |
68 | int nouveau_modeset = -1; | ||
68 | module_param_named(modeset, nouveau_modeset, int, 0400); | 69 | module_param_named(modeset, nouveau_modeset, int, 0400); |
69 | 70 | ||
70 | static struct drm_driver driver; | 71 | static struct drm_driver driver; |
@@ -363,7 +364,8 @@ nouveau_drm_unload(struct drm_device *dev) | |||
363 | 364 | ||
364 | nouveau_pm_fini(dev); | 365 | nouveau_pm_fini(dev); |
365 | 366 | ||
366 | nouveau_display_fini(dev); | 367 | if (dev->mode_config.num_crtc) |
368 | nouveau_display_fini(dev); | ||
367 | nouveau_display_destroy(dev); | 369 | nouveau_display_destroy(dev); |
368 | 370 | ||
369 | nouveau_irq_fini(dev); | 371 | nouveau_irq_fini(dev); |
@@ -403,13 +405,15 @@ nouveau_drm_suspend(struct pci_dev *pdev, pm_message_t pm_state) | |||
403 | pm_state.event == PM_EVENT_PRETHAW) | 405 | pm_state.event == PM_EVENT_PRETHAW) |
404 | return 0; | 406 | return 0; |
405 | 407 | ||
406 | NV_INFO(drm, "suspending fbcon...\n"); | 408 | if (dev->mode_config.num_crtc) { |
407 | nouveau_fbcon_set_suspend(dev, 1); | 409 | NV_INFO(drm, "suspending fbcon...\n"); |
410 | nouveau_fbcon_set_suspend(dev, 1); | ||
408 | 411 | ||
409 | NV_INFO(drm, "suspending display...\n"); | 412 | NV_INFO(drm, "suspending display...\n"); |
410 | ret = nouveau_display_suspend(dev); | 413 | ret = nouveau_display_suspend(dev); |
411 | if (ret) | 414 | if (ret) |
412 | return ret; | 415 | return ret; |
416 | } | ||
413 | 417 | ||
414 | NV_INFO(drm, "evicting buffers...\n"); | 418 | NV_INFO(drm, "evicting buffers...\n"); |
415 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); | 419 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); |
@@ -445,8 +449,10 @@ fail_client: | |||
445 | nouveau_client_init(&cli->base); | 449 | nouveau_client_init(&cli->base); |
446 | } | 450 | } |
447 | 451 | ||
448 | NV_INFO(drm, "resuming display...\n"); | 452 | if (dev->mode_config.num_crtc) { |
449 | nouveau_display_resume(dev); | 453 | NV_INFO(drm, "resuming display...\n"); |
454 | nouveau_display_resume(dev); | ||
455 | } | ||
450 | return ret; | 456 | return ret; |
451 | } | 457 | } |
452 | 458 | ||
@@ -486,8 +492,10 @@ nouveau_drm_resume(struct pci_dev *pdev) | |||
486 | nouveau_irq_postinstall(dev); | 492 | nouveau_irq_postinstall(dev); |
487 | nouveau_pm_resume(dev); | 493 | nouveau_pm_resume(dev); |
488 | 494 | ||
489 | NV_INFO(drm, "resuming display...\n"); | 495 | if (dev->mode_config.num_crtc) { |
490 | nouveau_display_resume(dev); | 496 | NV_INFO(drm, "resuming display...\n"); |
497 | nouveau_display_resume(dev); | ||
498 | } | ||
491 | return 0; | 499 | return 0; |
492 | } | 500 | } |
493 | 501 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h index 819471217546..a10169927086 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.h +++ b/drivers/gpu/drm/nouveau/nouveau_drm.h | |||
@@ -141,4 +141,6 @@ int nouveau_drm_resume(struct pci_dev *); | |||
141 | nv_info((cli), fmt, ##args); \ | 141 | nv_info((cli), fmt, ##args); \ |
142 | } while (0) | 142 | } while (0) |
143 | 143 | ||
144 | extern int nouveau_modeset; | ||
145 | |||
144 | #endif | 146 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 9ca8afdb5549..1d8cb506a28a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
@@ -61,13 +61,15 @@ nouveau_irq_handler(DRM_IRQ_ARGS) | |||
61 | 61 | ||
62 | nv_subdev(pmc)->intr(nv_subdev(pmc)); | 62 | nv_subdev(pmc)->intr(nv_subdev(pmc)); |
63 | 63 | ||
64 | if (device->card_type >= NV_D0) { | 64 | if (dev->mode_config.num_crtc) { |
65 | if (nv_rd32(device, 0x000100) & 0x04000000) | 65 | if (device->card_type >= NV_D0) { |
66 | nvd0_display_intr(dev); | 66 | if (nv_rd32(device, 0x000100) & 0x04000000) |
67 | } else | 67 | nvd0_display_intr(dev); |
68 | if (device->card_type >= NV_50) { | 68 | } else |
69 | if (nv_rd32(device, 0x000100) & 0x04000000) | 69 | if (device->card_type >= NV_50) { |
70 | nv50_display_intr(dev); | 70 | if (nv_rd32(device, 0x000100) & 0x04000000) |
71 | nv50_display_intr(dev); | ||
72 | } | ||
71 | } | 73 | } |
72 | 74 | ||
73 | return IRQ_HANDLED; | 75 | return IRQ_HANDLED; |