Merge branch 'linux-3.17' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes

A few regression fixes, the runpm ones dating back to 3.15. Also a fairly severe TMDS regression that effected a lot of GF8/9/GT2xx users.

* 'linux-3.17' of git://anongit.freedesktop.org/git/nouveau/linux-2.6:
drm/nouveau: make sure display hardware is reinitialised on runtime resume
drm/nouveau: punt fbcon resume out to a workqueue
drm/nouveau: fix regression on original nv50 board
drm/nv50/disp: fix dpms regression on certain boards

Changed files
+52 -61
drivers
+2 -1
drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
··· 1763 1763 const int or = ffs(outp->or) - 1; 1764 1764 const u32 loff = (or * 0x800) + (link * 0x80); 1765 1765 const u16 mask = (outp->sorconf.link << 6) | outp->or; 1766 + struct dcb_output match; 1766 1767 u8 ver, hdr; 1767 1768 1768 - if (dcb_outp_match(bios, DCB_OUTPUT_DP, mask, &ver, &hdr, outp)) 1769 + if (dcb_outp_match(bios, DCB_OUTPUT_DP, mask, &ver, &hdr, &match)) 1769 1770 nv_mask(priv, 0x61c10c + loff, 0x00000001, 0x00000000); 1770 1771 } 1771 1772
+6 -1
drivers/gpu/drm/nouveau/nouveau_chan.c
··· 285 285 struct nouveau_software_chan *swch; 286 286 struct nv_dma_v0 args = {}; 287 287 int ret, i; 288 + bool save; 288 289 289 290 nvif_object_map(chan->object); 290 291 ··· 387 386 } 388 387 389 388 /* initialise synchronisation */ 390 - return nouveau_fence(chan->drm)->context_new(chan); 389 + save = cli->base.super; 390 + cli->base.super = true; /* hack until fencenv50 fixed */ 391 + ret = nouveau_fence(chan->drm)->context_new(chan); 392 + cli->base.super = save; 393 + return ret; 391 394 } 392 395 393 396 int
+11 -12
drivers/gpu/drm/nouveau/nouveau_display.c
··· 550 550 } 551 551 552 552 int 553 - nouveau_display_suspend(struct drm_device *dev) 553 + nouveau_display_suspend(struct drm_device *dev, bool runtime) 554 554 { 555 - struct nouveau_drm *drm = nouveau_drm(dev); 556 555 struct drm_crtc *crtc; 557 556 558 557 nouveau_display_fini(dev); 559 558 560 - NV_INFO(drm, "unpinning framebuffer(s)...\n"); 561 559 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 562 560 struct nouveau_framebuffer *nouveau_fb; 563 561 ··· 577 579 } 578 580 579 581 void 580 - nouveau_display_repin(struct drm_device *dev) 582 + nouveau_display_resume(struct drm_device *dev, bool runtime) 581 583 { 582 584 struct nouveau_drm *drm = nouveau_drm(dev); 583 585 struct drm_crtc *crtc; 584 - int ret; 586 + int ret, head; 585 587 588 + /* re-pin fb/cursors */ 586 589 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 587 590 struct nouveau_framebuffer *nouveau_fb; 588 591 ··· 605 606 if (ret) 606 607 NV_ERROR(drm, "Could not pin/map cursor.\n"); 607 608 } 608 - } 609 - 610 - void 611 - nouveau_display_resume(struct drm_device *dev) 612 - { 613 - struct drm_crtc *crtc; 614 - int head; 615 609 616 610 nouveau_display_init(dev); 617 611 ··· 618 626 /* Make sure that drm and hw vblank irqs get resumed if needed. */ 619 627 for (head = 0; head < dev->mode_config.num_crtc; head++) 620 628 drm_vblank_on(dev, head); 629 + 630 + /* This should ensure we don't hit a locking problem when someone 631 + * wakes us up via a connector. We should never go into suspend 632 + * while the display is on anyways. 633 + */ 634 + if (runtime) 635 + return; 621 636 622 637 drm_helper_resume_force_mode(dev); 623 638
+2 -3
drivers/gpu/drm/nouveau/nouveau_display.h
··· 63 63 void nouveau_display_destroy(struct drm_device *dev); 64 64 int nouveau_display_init(struct drm_device *dev); 65 65 void nouveau_display_fini(struct drm_device *dev); 66 - int nouveau_display_suspend(struct drm_device *dev); 67 - void nouveau_display_repin(struct drm_device *dev); 68 - void nouveau_display_resume(struct drm_device *dev); 66 + int nouveau_display_suspend(struct drm_device *dev, bool runtime); 67 + void nouveau_display_resume(struct drm_device *dev, bool runtime); 69 68 int nouveau_display_vblank_enable(struct drm_device *, int); 70 69 void nouveau_display_vblank_disable(struct drm_device *, int); 71 70 int nouveau_display_scanoutpos(struct drm_device *, int, unsigned int,
+13 -38
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 547 547 struct nouveau_cli *cli; 548 548 int ret; 549 549 550 - if (dev->mode_config.num_crtc && !runtime) { 550 + if (dev->mode_config.num_crtc) { 551 + NV_INFO(drm, "suspending console...\n"); 552 + nouveau_fbcon_set_suspend(dev, 1); 551 553 NV_INFO(drm, "suspending display...\n"); 552 - ret = nouveau_display_suspend(dev); 554 + ret = nouveau_display_suspend(dev, runtime); 553 555 if (ret) 554 556 return ret; 555 557 } ··· 605 603 fail_display: 606 604 if (dev->mode_config.num_crtc) { 607 605 NV_INFO(drm, "resuming display...\n"); 608 - nouveau_display_resume(dev); 606 + nouveau_display_resume(dev, runtime); 609 607 } 610 608 return ret; 611 609 } ··· 620 618 drm_dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF) 621 619 return 0; 622 620 623 - if (drm_dev->mode_config.num_crtc) 624 - nouveau_fbcon_set_suspend(drm_dev, 1); 625 - 626 621 ret = nouveau_do_suspend(drm_dev, false); 627 622 if (ret) 628 623 return ret; ··· 632 633 } 633 634 634 635 static int 635 - nouveau_do_resume(struct drm_device *dev) 636 + nouveau_do_resume(struct drm_device *dev, bool runtime) 636 637 { 637 638 struct nouveau_drm *drm = nouveau_drm(dev); 638 639 struct nouveau_cli *cli; ··· 657 658 658 659 if (dev->mode_config.num_crtc) { 659 660 NV_INFO(drm, "resuming display...\n"); 660 - nouveau_display_repin(dev); 661 + nouveau_display_resume(dev, runtime); 662 + NV_INFO(drm, "resuming console...\n"); 663 + nouveau_fbcon_set_suspend(dev, 0); 661 664 } 662 665 663 666 return 0; ··· 682 681 return ret; 683 682 pci_set_master(pdev); 684 683 685 - ret = nouveau_do_resume(drm_dev); 686 - if (ret) 687 - return ret; 688 - 689 - if (drm_dev->mode_config.num_crtc) { 690 - nouveau_display_resume(drm_dev); 691 - nouveau_fbcon_set_suspend(drm_dev, 0); 692 - } 693 - 694 - return 0; 684 + return nouveau_do_resume(drm_dev, false); 695 685 } 696 686 697 687 static int nouveau_pmops_freeze(struct device *dev) 698 688 { 699 689 struct pci_dev *pdev = to_pci_dev(dev); 700 690 struct drm_device *drm_dev = pci_get_drvdata(pdev); 701 - int ret; 702 - 703 - if (drm_dev->mode_config.num_crtc) 704 - nouveau_fbcon_set_suspend(drm_dev, 1); 705 - 706 - ret = nouveau_do_suspend(drm_dev, false); 707 - return ret; 691 + return nouveau_do_suspend(drm_dev, false); 708 692 } 709 693 710 694 static int nouveau_pmops_thaw(struct device *dev) 711 695 { 712 696 struct pci_dev *pdev = to_pci_dev(dev); 713 697 struct drm_device *drm_dev = pci_get_drvdata(pdev); 714 - int ret; 715 - 716 - ret = nouveau_do_resume(drm_dev); 717 - if (ret) 718 - return ret; 719 - 720 - if (drm_dev->mode_config.num_crtc) { 721 - nouveau_display_resume(drm_dev); 722 - nouveau_fbcon_set_suspend(drm_dev, 0); 723 - } 724 - 725 - return 0; 698 + return nouveau_do_resume(drm_dev, false); 726 699 } 727 700 728 701 ··· 952 977 return ret; 953 978 pci_set_master(pdev); 954 979 955 - ret = nouveau_do_resume(drm_dev); 980 + ret = nouveau_do_resume(drm_dev, true); 956 981 drm_kms_helper_poll_enable(drm_dev); 957 982 /* do magic */ 958 983 nvif_mask(device, 0x88488, (1 << 25), (1 << 25));
+17 -6
drivers/gpu/drm/nouveau/nouveau_fbcon.c
··· 486 486 .fb_probe = nouveau_fbcon_create, 487 487 }; 488 488 489 + static void 490 + nouveau_fbcon_set_suspend_work(struct work_struct *work) 491 + { 492 + struct nouveau_fbdev *fbcon = container_of(work, typeof(*fbcon), work); 493 + console_lock(); 494 + nouveau_fbcon_accel_restore(fbcon->dev); 495 + nouveau_fbcon_zfill(fbcon->dev, fbcon); 496 + fb_set_suspend(fbcon->helper.fbdev, FBINFO_STATE_RUNNING); 497 + console_unlock(); 498 + } 489 499 490 500 int 491 501 nouveau_fbcon_init(struct drm_device *dev) ··· 513 503 if (!fbcon) 514 504 return -ENOMEM; 515 505 506 + INIT_WORK(&fbcon->work, nouveau_fbcon_set_suspend_work); 516 507 fbcon->dev = dev; 517 508 drm->fbcon = fbcon; 518 509 ··· 562 551 { 563 552 struct nouveau_drm *drm = nouveau_drm(dev); 564 553 if (drm->fbcon) { 565 - console_lock(); 566 - if (state == 0) { 567 - nouveau_fbcon_accel_restore(dev); 568 - nouveau_fbcon_zfill(dev, drm->fbcon); 554 + if (state == FBINFO_STATE_RUNNING) { 555 + schedule_work(&drm->fbcon->work); 556 + return; 569 557 } 558 + flush_work(&drm->fbcon->work); 559 + console_lock(); 570 560 fb_set_suspend(drm->fbcon->helper.fbdev, state); 571 - if (state == 1) 572 - nouveau_fbcon_accel_save_disable(dev); 561 + nouveau_fbcon_accel_save_disable(dev); 573 562 console_unlock(); 574 563 } 575 564 }
+1
drivers/gpu/drm/nouveau/nouveau_fbcon.h
··· 36 36 struct nouveau_framebuffer nouveau_fb; 37 37 struct list_head fbdev_list; 38 38 struct drm_device *dev; 39 + struct work_struct work; 39 40 unsigned int saved_flags; 40 41 struct nvif_object surf2d; 41 42 struct nvif_object clip;