Bug 26952

Summary: SNB/ILK: Resume from S3 in external-only monitor mode (VGA) broken
Product: Drivers Reporter: Stefan Dirsch (sndirsch)
Component: Video(DRI - Intel)Assignee: drivers_video-dri-intel (drivers_video-dri-intel)
Status: CLOSED CODE_FIX    
Severity: normal CC: chris, eric, florian, gordon.jin, mat, tiwai, yi.sun
Priority: P1    
Hardware: All   
OS: Linux   
URL: https://bugzilla.novell.com/show_bug.cgi?id=658764
Kernel Version: 2.6.37 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: Fix patch for 2.6.37
Reset hotplug detection upon resume

Description Stefan Dirsch 2011-01-17 16:11:20 UTC
After suspending (S3) in external-only monitor mode (VGA), resuming doesn't work properly. Both monitors show the Linux console (apparently a fake) with the mouse cursor on the external monitor. After switching to real Linux console and back to X you're back in external-only monitor mode. "powersave -u" (SUSE:SLE-11-SP1) is used for suspend (S3).

Mesa 7.10
libdrm 2.4.23 + git 0184bb1c
xf86-video-intel 2.14.0
Comment 1 Stefan Dirsch 2011-01-18 15:04:20 UTC
Same issue with Ironlake.
Comment 2 Sun Yi 2011-01-20 07:31:21 UTC
The issue is gone on SNB with the latest kernel(drm-intel-fixes)4efe070896e1f7373c98a13713e659d1f5dee52a. But it still exists on the ILK.
Comment 3 Takashi Iwai 2011-01-20 15:07:39 UTC
It's a regression from 2.6.36, at least for IronLake.  2.6.36 works fine with S3.
Comment 4 Takashi Iwai 2011-01-20 17:02:05 UTC
Ditto for SandyBridge.  2.6.36 works fine.
Comment 5 Takashi Iwai 2011-01-20 17:05:53 UTC
Unfortunately, I can't confirm drm-intel-fixes because S3 itself got broken with that branch (ditto for 2.6.38-rc1).
Comment 6 Takashi Iwai 2011-01-20 18:04:46 UTC
I tried to port all fixes to 2.6.37 so that S3 works.

The commit in comment 2 doesn't fix the problem.  Still a black screen after S3 on the VGA, or a broken output.
Comment 7 Takashi Iwai 2011-01-21 16:22:29 UTC
I bisected 2.6.37.  The bad commit is

  commit e7dbb2f2f8ac843ab5e4d6a8e9a71d16089d324b
  Author: Keith Packard <keithp@keithp.com>
  Date:   Tue Nov 16 16:03:53 2010 +0800

    drm/i915: Take advantage of auto-polling CRT hotplug detection on PCH hardwa
    
Reverting this commit fixes the problem.  The external monitor is restored properly with S3 resume again.

However, as a side-effect, reverting this commit causes a flickering of screen at each time the mode-setting is changed or turned on/off.
Comment 8 Takashi Iwai 2011-01-24 09:44:34 UTC
A better fix is to re-trigger the CRT detection after resume.

Below is a simple patch to add that fix.  It requires a fix for S4-resume regression in bug 27272 beforehand:
    https://bugzilla.kernel.org/attachment.cgi?id=44982
Comment 9 Takashi Iwai 2011-01-24 09:45:30 UTC
Created attachment 44992 [details]
Fix patch for 2.6.37
Comment 10 Chris Wilson 2011-01-24 14:47:32 UTC
Created attachment 45002 [details]
Reset hotplug detection upon resume

Takashi, we were thinking along the same lines. I think this a slightly more elegant approach.
Comment 11 Chris Wilson 2011-01-24 14:54:32 UTC
However, connector->restore() is not called from anyway. Neither is crtc->restore(). Bah.
Comment 12 Takashi Iwai 2011-01-24 16:56:23 UTC
Heh, I falled into the same trap, so I tried to write a minimal fix in i915 without DRM core changes instead.  The above was the result of such :)

However, it's cleaner to have a proper callback for resume-preparation indeed.
Comment 14 Florian Mickler 2011-02-19 23:49:28 UTC
merged in .38-rc4