[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Losing video output when hibernating with HDMI plugged


I've got a Dell Latitude E6220 (with "Intel Corporation 2nd Generation
Core Processor Family Integrated Graphics Controller (rev 09)"
according to lspci) running Debian stretch, with the Xfce4 desktop.
After a fresh boot, when I plug an external monitor into its HDMI
port, the internal display flickers for a moment then both screens
show a mirrored image. Originally Xfce4 would automatically start
`xfce4-display-settings -m` in that situation, and I could click to
disable the internal screen etc. Problem is when I hibernate before
unplugging the external monitor, after resume the laptop will neither
show any video to the external screen nor the internal one. (I
disabled the automatic start of `xfce4-display-settings -m` via
xfce4's settings in the Display settings tool (which is
xfce4-display-settings without any options) but that doesn't change

When I log into the laptop from another computer via SSH, there's one
way I can revive the *internal* LCD with this script:

xrandr --output LVDS-1 --crtc 0 --brightness 1 --auto
sleep 2
xrandr --output LVDS-1 --crtc 1 --brightness 1 --auto

(I think only the second xrandr call is relevant here.)

Problem is, at that point I've got the internal display up but nothing
works to re-enable the HDMI screen. I've tried both
xfce4-display-settings with -m and without, as well as hours spent on
various combinations of xrandr commands to no avail. Currently the
only way I found to use the HDMI screen again is to reboot.

It appears that --crtc only takes the values 0 and 1 (seems to make
sense, `xrandr --listproviders` shows the following).

$ xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x49 cap: 0xf, Source Output, Sink Output, Source
Offload, Sink Offload crtcs: 2 outputs: 8 associated providers: 0

I've got a suspicion that upon a fresh boot, the system allocates crtc
0 to LVDS-1 and crtc 1 to HDMI-1. Then when hibernating with cable
attached, after bringing it up crtc 1 sees it's unused and becomes
free, but crtc 0 is still configured to be off, and a normal "xrandr
--output LVDS-1 --auto" call fails because of some kind of bug. Then
when I issue "xrandr --output LVDS-1 --crtc 1 --brightness 1 --auto",
it will allocate crtc 1 to the LVDS-1 as well and use it, hence I've
got video again, but now I can't use HDMI anymore since both crtcs are
in use. Anyone more knowledgeable please tell me if that can't be.

So, I've come up with the following script in an attempt to shut down
everything, then reconfigure from scratch:

xrandr --output HDMI-1 --off --output LVDS-1 --off
for i in 0 1; do
    xrandr --output HDMI-1 --crtc $i --off
    xrandr --output LVDS-1 --crtc $i --off
sleep 1
xrandr --output LVDS-1 --auto || xrandr --output LVDS-1 --crtc 0
--auto || xrandr --output LVDS-1 --crtc 1 --auto

But, after running this, video seems to be f*ed up worse than ever,
not even my first recovery script above works after that.

I've captured "xrandr --verbose" output at various stages.
fuckedup_unplugged is when resuming after hibernation with HDMI
plugged then unplugging it. completelyfucked is after fresh boot,
hibernation with HDMI attached then running the second script above.

$ diff -u fuckedup_unplugged completelyfucked

@@ -1,13 +1,10 @@
-Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
-LVDS-1 connected primary 1366x768+0+0 (0x4a) normal (normal left
inverted right x axis y axis) 277mm x 156mm
+Screen 0: minimum 320 x 200, current 320 x 200, maximum 8192 x 8192
+LVDS-1 connected primary (normal left inverted right x axis y axis)

-       Gamma:      1.0:1.0:1.0
-       Brightness: 1.0
-       CRTC:       0
-       CRTCs:      1 0
+       CRTCs:      0 1

So it appears there's no CRTC assigned to it. Fine, I think, but why
does it not work when using the --crtc option? There's another option
in the xrandr man page (which sadly doesn't really explain enough
about that option to even specify proper usage):

$ xrandr --setprovideroutputsource 1 LVDS-1
Could not find provider with index 1
$ xrandr --setprovideroutputsource 0 LVDS-1
Could not find provider with name LVDS-1
$ xrandr --setprovideroutputsource LVDS-1 0
Could not find provider with name LVDS-1

Now I'm out of ideas. Do you have any clue?


Reply to: