Bug 43163

Summary: [ILK eDP] Black Screen on Boot for Dell Latitude E6410 Intel HD Graphics (panel power sequencing fail?)
Product: Drivers Reporter: Vincent Frentzel (zcecc22)
Component: Video(DRI - Intel)Assignee: drivers_video-dri-intel (drivers_video-dri-intel)
Severity: normal CC: chris, daniel, florian
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.3.3 Tree: Mainline
Regression: Yes
Attachments: dmesg
Kernel Configuration
dmesg with drm.debug=0xe
dmesg with edp power seq fix patch
black screen after switching display back to laptop screen at 17:31:41
(hopefully) final patch
patch against 3.4-rc
dmesg 3.4rc6 + patch
patch against 3.4-rc, version 3
dmesg for v3 patch
new patch to test
reorder edp panel off v2
dmesg with proposed patch.

Description Vincent Frentzel 2012-04-25 17:29:29 UTC
On every boot under 3.3.3 the system starts to a black screen. I can login and startx at which point the screen works. 

When switching display via Xrandr the other monitor works without issue, however going back to the laptop display makes the black screen come back. Switching back and forth between display several times reactivates the laptop display.

The system was booting fine in 3.3.1 however xrandr had occasional issues. 
3.1.10 was perfect.
Comment 1 Vincent Frentzel 2012-04-25 17:31:27 UTC
Created attachment 73083 [details]
Comment 2 Vincent Frentzel 2012-04-25 17:32:35 UTC
Created attachment 73084 [details]
Kernel Configuration
Comment 3 Daniel Vetter 2012-04-25 19:31:36 UTC
Can you do a quick bisect between 3.3.1 and 3.3.3 to figure out which patch broke things for you please?
Comment 4 Daniel Vetter 2012-04-25 19:32:13 UTC
Also please boot with drm.debug=0xe attached to your kernel cmdline and attach the complete dmesg.
Comment 5 Vincent Frentzel 2012-04-25 20:27:58 UTC
Created attachment 73091 [details]
dmesg with drm.debug=0xe
Comment 6 Vincent Frentzel 2012-04-25 20:39:36 UTC
I am having issues recreating the problem. It seems that the black screen is
coming only when the computer is booted up (not restarted) and now even from a
cold start I cannot get it to appear.

Typically my computer is off overnight and I turn it on the next day, the
problem always appear in that case. I dont know how to interpret this, could it
be due to some RAM not being erased in between restart that allows the card to
work properly?

For information, I am starting the system with UEFI/GRUB 2.
Comment 7 Daniel Vetter 2012-04-25 20:48:05 UTC
So when you boot up and get a black screen, then immediately reboot, it works (for the rest of the day)?
Comment 8 Vincent Frentzel 2012-04-25 21:06:17 UTC
That s how it seems to be. Maybe the bug is hard to reproduce and I'm so far unlucky but in the last couple days I got it on every cold boots.

Actually when I get a black screen i log in and start X, the screen then is fine. If I get a black screen and issue Ctrl alt del (immediate reboot) the black screen is still there.

Starting X once seems to fix it for the whole day. 

What baffles me is that if I power down the computer now and boot up the black screen is not appearing.

Does that make any sense?
Comment 9 Daniel Vetter 2012-04-25 21:08:36 UTC
Bugs never make sense until it's tracked down and fixed ...

I guess we first need to figure out how to reliably reproduce this, otherwise we wont know when it's fixed. I've got an idea though, I'll dig up a patch for you to try.
Comment 10 Daniel Vetter 2012-04-25 21:09:28 UTC
Well, just a link to the patch:

Comment 11 Vincent Frentzel 2012-04-25 21:55:02 UTC
Created attachment 73092 [details]
dmesg with edp power seq fix patch

No black screen seen during this step.
Comment 12 Vincent Frentzel 2012-04-26 15:44:59 UTC
Created attachment 73100 [details]
black screen after switching display back to laptop screen at 17:31:41

I could nt reproduce the black screen on boot today. However it showed up at 17:31:41 when I switched from my external display back to the internal one. I had to switch back and forth several times with Xrandr (5+) before getting the internal display working again. The trick was to get back to tty with ctrl+alt+f1 with screen still black and then going back to X and switching screen again.

The screen is on at 17:34:38 in attached syslog.
Comment 13 Daniel Vetter 2012-04-26 16:35:43 UTC
Just to check: Is that with the patch or without it?
Comment 14 Vincent Frentzel 2012-04-26 16:38:52 UTC
Without it.
Comment 15 Vincent Frentzel 2012-04-28 13:33:09 UTC
I have been banging my head on how to reproduce the bug consistently and made some progress.

It seems that when I switch to external display only for some *time* then going back to the laptop display triggers the black screen. I emphasize time as going back immediately to the laptop display after external works without issue.

I believe that there is a connection between screen on/off, resolution changes that causes the black screen. Which would explain why I get it during boot and after switching display with XrandR.

I will test if the bug appears with the proposed patch. If you can find a way to reproduce the bug in a shorter timeframe (couple of hours currently)I can run the bisect.
Comment 16 Vincent Frentzel 2012-04-29 21:57:00 UTC
So far proposed patch seems to do the trick. No black screens observed in the last day. dmesg (see attached) reports some warning with stack traces tho, but did not observe anything on screen.
Comment 17 Daniel Vetter 2012-05-01 18:46:12 UTC
Can you please attach the dmesg with these stacktraces? And please keep on testing the patch until you're sure that it indeed fixes the problem.
Comment 18 Vincent Frentzel 2012-05-01 19:07:39 UTC
Already attached please see https://bugzilla.kernel.org/attachment.cgi?id=73092 starting at 2.425297 for drm init. I get them everytime I switch display with XRandR. I am not sure what those are as everything works fine.

[    2.661578] WARNING: at drivers/gpu/drm/i915/intel_dp.c:1152 ironlake_edp_panel_off+0xd6/0xe0()
[    2.661581] Hardware name: Latitude E6410
[    2.661583] Cannot turn power off while VDD is on
Comment 19 Daniel Vetter 2012-05-01 19:15:43 UTC
Ok, these are expected because the debug patch doesn't update all the checks in the code with the new edp panel sequencing.
Comment 20 Vincent Frentzel 2012-05-08 12:52:39 UTC
Everything clear on my end, I believe the patch proposed adresses the issue.
Comment 21 Daniel Vetter 2012-05-09 19:28:31 UTC
Reopen because the patch hasn't landed yet. And I need to clean it up so that it doesn't spew WARN noise into dmesg.

Please don't close this bug until a fix has landed in Linus' kernel tree (or is on track to get there), thanks.
Comment 22 Daniel Vetter 2012-05-10 10:46:33 UTC
Created attachment 73243 [details]
(hopefully) final patch

Ok, I've cleaned up the code and adjusted the WARN to be correct with the new logic. Please test quickly and check whether it still works and whether the WARN backtrace is indeed gone.

As soon as I have your tested-by, I can include the patch for 3.5, and when it's there it'll get backported.
Comment 23 Vincent Frentzel 2012-05-10 21:58:38 UTC
I get a patch does not apply error.

I tried applying it against v3.3.3 and MASTER

git apply --check ../0001-drm-i915-enable-vdd-when-switching-off-the-eDP-panel.patch

> error: patch failed: drivers/gpu/drm/i915/intel_dp.c:1154
> error: drivers/gpu/drm/i915/intel_dp.c: patch does not apply

Am I missing something here?
Comment 24 Daniel Vetter 2012-05-11 05:59:26 UTC
Created attachment 73250 [details]
patch against 3.4-rc
Comment 25 Vincent Frentzel 2012-05-11 18:06:46 UTC
Daniel, please, could you provide more information as to how to apply this patch correctly?

I am applying on 3.4-rc6 fresh tarball from kernel.org. No luck.

I am sure you used diff against something but I obviously dont have the same...

3.4-rc[1? 2? 3? 4?...]

patch -p1 --dry-run < 0001-drm-i915-enable-vdd-when-switching-off-the-eDP-panel.patch 
patching file drivers/gpu/drm/i915/intel_dp.c
Hunk #1 FAILED at 1154.
Hunk #2 succeeded at 1259 (offset -7 lines).
Hunk #3 succeeded at 1300 (offset -7 lines).
1 out of 3 hunks FAILED -- saving rejects to file drivers/gpu/drm/i915/intel_dp.c.rej
Comment 26 Vincent Frentzel 2012-05-11 18:10:17 UTC
Duh nevermind. Got the new attachment (did nt spot it). Apologies. Will come back after compilation.
Comment 27 Vincent Frentzel 2012-05-11 18:37:46 UTC
Created attachment 73251 [details]
dmesg 3.4rc6 + patch

Still some noise in dmesg.

[    1.379799] ------------[ cut here ]------------
[    1.379811] WARNING: at drivers/gpu/drm/i915/intel_dp.c:350 intel_dp_check_edp+0x5e/0xb0()
[    1.379814] Hardware name: Latitude E6410
[    1.379816] eDP powered off while attempting aux channel communication.
[    1.379819] Modules linked in:
[    1.379824] Pid: 1, comm: swapper/0 Not tainted 3.4.0-rc6-red34-p #1
[    1.379827] Call Trace:
[    1.379833]  [<ffffffff813108de>] ? intel_dp_check_edp+0x5e/0xb0
Comment 28 Daniel Vetter 2012-05-19 20:48:06 UTC
Can you please paste the entire backtrace?
Comment 29 Daniel Vetter 2012-05-19 20:49:30 UTC
Nevermind, I've noticed the attached dmesg ;-)
Comment 30 Daniel Vetter 2012-05-19 20:55:41 UTC
Created attachment 73335 [details]
patch against 3.4-rc, version 3

Ok, I've noticed something else that needs to be fixed, please test.
Comment 31 Vincent Frentzel 2012-05-20 14:48:59 UTC
Created attachment 73343 [details]
dmesg for v3 patch

dmesg now looks clean. I attached it for review.
Comment 32 Florian Mickler 2012-07-01 09:49:16 UTC
A patch referencing this bug report has been merged in Linux v3.5-rc1:

commit 6cb49835da0426f69a2931bc2a0a8156344b0e41
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Sun May 20 17:14:50 2012 +0200

    drm/i915: enable vdd when switching off the eDP panel
Comment 33 Daniel Vetter 2012-08-08 08:55:15 UTC
Created attachment 77111 [details]
new patch to test

Hi Vincent,

The patch that fixes your machine unfortunately breaks some MacBook Airs, so we need to find a different solution. Can you please test this patch (on top of the current fixes) to ensure that we don't break your system again?

Thanks, Daniel
Comment 34 Vincent Frentzel 2012-08-08 09:36:21 UTC
Hi Daniel, no issue. I am currently on the road and can proceed with the test on the 20th of august.

Comment 35 Daniel Vetter 2012-08-10 09:47:10 UTC
Created attachment 77281 [details]
reorder edp panel off v2

Please test this patch instead of the older one, that didn't work out for the macbook air regression. Again, I'm hopeful that this won't blow up on your machine ...
Comment 36 Vincent Frentzel 2012-08-18 14:26:42 UTC
Hi Daniel,

Could you let me know against which version to patch? 3.6rc2, 3.5.2, ... ?
Comment 37 Vincent Frentzel 2012-08-18 17:22:58 UTC
Created attachment 77911 [details]
dmesg with proposed patch.

Everything is working fine nothing out of the ordinary.

The dmesg has some debug messages for your review.

Comment 38 Daniel Vetter 2012-08-18 19:36:19 UTC
Yeah, the final patch fixed the dmesg noise. If 3.6-rc2 works out for you, everthing's still good (since the new patch landed in -rc2).
Comment 39 Florian Mickler 2012-08-20 21:56:10 UTC
A patch referencing this bug report has been merged in Linux v3.6-rc2:

commit 35a38556d900b9cb5dfa2529c93944b847f8a8a4
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Sun Aug 12 22:17:14 2012 +0200

    drm/i915: reorder edp disabling to fix ivb MacBook Air