Bug 287320 - Laptop + Docked Multi Monitors: Laptop Display Disables on Login, Even When Undocked
Summary: Laptop + Docked Multi Monitors: Laptop Display Disables on Login, Even When ...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: krandr
Classification: Miscellaneous
Component: general (show other bugs)
Version: 4.7
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: Gustavo Pichorim Boiko
URL:
Keywords:
: 287334 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-23 00:18 UTC by Brandon Kirsch
Modified: 2015-01-23 00:08 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brandon Kirsch 2011-11-23 00:18:53 UTC
Version:           unspecified (using KDE 4.7.2) 
OS:                Linux

KDE multi monitor madness using a Thinkpad T410S laptop and a dock that has two external monitors attached.  At work, I dock the laptop before booting it to try and prevent some of the problems I am about to describe.

I setup kcmdisplay to enable both external monitors that are hooked to the dock. Due to (hardware?) limitations, the internal laptop display ("LVDS") must be disabled to run two external monitors at the same time.  I setup my monitors (one "HDMI", one labeled "VGA") to work with the side-by-side setup and the correct resolution.  I then use "Save as Default" setting to make sure my multi-monitor desktop works properly after logging in. Without using "Save as Default", I have to re-configure my multi monitor setup every time I log in.

This configuration, combined with docking the laptop before boot, was the only way I could get consistently correct behavior with OpenSUSE 11.4. When I boot undocked, only the "LVDS" display was present and KDE would launch with single display and correct LVDS resolution.

Over the weekend, I reformatted and upgraded to SUSE 12.1 (KDE 4.7.2) and setup my multi monitor the same way as before.  Works fine in the dock, but now I can't log in at all when my laptop is not docked.  After boot, X comes up OK and I get my KDM login screen.  But as soon as I log in, the screen shuts off. I can't get the screen to power back on without pressing Ctrl Alt Backspace to kill X.  Then I get KDM back at the proper resolution, but as soon as I log into my user account, the laptop display shuts off and stays off until I kill X again. Ctrl Alt F1 does not bring the display back unless I kill X first.

So here's the problem:  KDE is restoring my multi-monitor config and then disabling the laptop display, even when those monitors aren't present because the laptop is undocked. It used to be "smart" enough to fall back to using the laptop LVDS when I would log in and those other monitors were not present.  At the moment, I can't log into KDE at all and I'm stuck that way until I return to work. Bummer.

Reproducible: Always

Steps to Reproduce:
Place laptop into dock that has two external monitors attached.

Use KDE to configure dual external displays, which forces the laptop display to disable.  Save these settings as default.

Reboot laptop while it is undocked and log into KDM.

Actual Results:  
Laptop display shuts off.  No other monitors are attached. KDE desktop remains unavailable.

Expected Results:  
Because there are no attached external monitors, KDE should use the laptop display instead of disabling it.

This problem did not exist in OpenSUSE 11.4.  An entirely different set of problems occurred with multi monitor in 11.4, but my laptop display always worked when it was the only monitor available.

Marking as "Crash" because I have no way to restore my display without killing X.
Comment 1 Thomas Lübking 2011-11-23 06:47:06 UTC
i'm not developing krandr, but it will be necessary to know whether the dock is attached.
you can figure this by running "udevadm monitor" before attaching or detaching - and post the output ;-)
Comment 2 Brandon Kirsch 2011-11-23 14:52:26 UTC
Hi Thomas, thanks for the quick response.

I ran `udevadm monitor` and it just sits there until I plug something in (USB mouse) then it dumps a bunch of output. 

But here's the situation with my laptop:  I am never docking (or undocking) while the laptop is powered on. Instead, I shut off the laptop, then remove it from the dock, and boot it back up.  Once I log in, THAT is what triggers my krandr problems.

No hardware is being attached or detached while the system is powered on.

Do you still wish for me to capture and attach `udevadm monitor` output?  

To me, it seems more like a "xrandr reports the monitors are not attached, yet KDE / krandr / ??? tries to use them anyways" type of problem.

Please let me know how to proceed.  Thanks again.
Comment 3 Thomas Lübking 2011-11-23 17:34:59 UTC
udev events are usually triggered at system start to initiate the system. i assume the crucial aspect here will be whether the attachment of the dock is transparent (bad - no way to know) about or not.

The randr settings are stored per account - what you need is some sort of profile support and those should ideally match some hardware condition.

Plain connects like HDMI or DVI (and even VGA) can be detected but if the change by the dock is a device event like "LDT4x-VO0 connect state" - that's unlikely considered ;-)

monitoring de/attaching the dock should yell the relevant udev information.
Comment 4 Ronny Standtke 2012-06-14 16:43:50 UTC
I can confirm this issue, I just run into almost exactly the same situation, just with *one* external monitor.
When docked at work, I always want to use the (huge) external monitor and want to have the notebook display to be switched off. Therefore I saved this configuration as default.
Now, whenever I boot this notebook undocked (somewhere traveling), the display goes completely black after logging in to KDE... very bad... KDE should fall back to sane defaults when no external monitor is present.
Comment 5 Brandon Kirsch 2012-06-14 17:08:52 UTC
To fix this problem, I created the following bash script that does what I believe KDE4 display manager should be doing out of the box.  It checks to make sure monitors are attached.  If they aren't, it calls xrandr --auto to enable whatever monitors *are* attached.

The end result is this:

1)  Boot up machine out of dock.  See login prompt.
2)  Enter user credentials and click "Login". This is where the KDE display manager decides to activate my "Saved as Default" settings -- even though none of the monitors it references are currently attached.  My primary and only display shuts off.
3)  Wait about 15 seconds for KDE to finish logging in.  Then my bash script (which is setup in the Autostart folder) executes and re-enables the only attached display.
4)  Work!



You will need to modify the "requiredmonitors" variable in the following bash script to suite your needs:

#!/bin/bash
# xrandr multi monitor fix for KDE4.  If search for required monitors failrs, run `xrandr --auto`

# required monitor names separated by vertical pipes |
requiredmonitors='VGA1|HDMI1'

if xrandr | pcregrep "^(${requiredmonitors}) disconnected"
then
        echo "Multi-Monitor Check Failed: A required monitor is not present. Executing xrandr --auto"
        xrandr --auto
else
        echo "Multi-Monitor Check: All required monitors are connected."
Comment 6 Myriam Schweingruber 2012-06-20 07:07:02 UTC
*** Bug 287334 has been marked as a duplicate of this bug. ***
Comment 7 Myriam Schweingruber 2012-06-20 07:07:39 UTC
Setting status to confirmed.
Comment 8 Marc Schoechlin 2012-09-22 18:05:54 UTC
Unbelievable that this is broken for years and at the other side kde add tons of new fancy features.

KDE stores the xrandr setup in $HOME/.kde/share/config/startupconfig - and restores the saved settings without checking the referenced outputs.

Ubuntu unity has a almost perfect handling of xrandr with multiple monitor-setups.

Probably just implement the following things:
- save xrandr configuration in a profile which contains detailed information about connected monitors
  (resolutions, active outputs...)
- only reactivate a stored xrandr configuration if exactly the same setup appears again
- otherwise clone output on all connected monitors

What do you think?

Where can i find the sourcecode which causes this problem?
Can you describe a simple procedure how to compile and test this part of kde?
Comment 9 xxtobi 2012-09-25 20:56:30 UTC
Same story as for Ronny (laptop + one external monitor) happening for me, on KDE 4.8.5 - it is really annoying, please VOTE for it if affected by this bug.

I think I found the suspect in ~/.kde/share/config/krandrrc. Saving a monitor config as default in the settings sets ApplyOnStartup=true in this file, which does exactly that - without checking for connected monitors...
@Marc: If you are willing and capable of fixing this, I'd suggest du check on IRC for some hints from the developers.
Comment 10 Orion Poplawski 2012-11-26 16:51:12 UTC
Same problem here.  krandr really needs hardware profile support.
Comment 11 Thomas Lübking 2012-11-26 19:22:33 UTC
kde-workspace/kcontrol/randr/randroutput.cpp
QStringList RandROutput::startupCommands() const
{
}

since the entire stuff ends up bein (multiple...) bash calls to xrandr, wrapping it into sth. like "if xrandr -q | grep %1 | grep \" connected\" > /dev/null; then" ... "fi" would prevent alterations to not connected screens - for the "--off" call you'd have to check whether the other outputs are connected, but that would have to be done by parsing the commands from rndrscreen level
you can also write a short bash snippet into ~/.kde/share/config/krandrrc instead or append a sanity check (ie, check the resolution and if it's void append an xrandr --auto for all devices found by xrandr -q)
Comment 12 Christoph Feck 2015-01-23 00:08:36 UTC
Thank you for your bug report or feature request.

Unfortunately, we did not have a maintainer for the "krandr" components, which are used to manage displays and monitors in the KDE Workspaces.

The "krandr" components has been superseded by "KScreen" in newer releases of the KDE Workspaces. It is compatible with all versions since 4.11, and is also used with Plasma 5. Please check with your distribution how to update to KScreen.

If this issue or feature request is still applicable to KScreen version 1.0.5 or newer, please add a comment. We will then reassign this ticket to KScreen developers.

If you are already using KScreen to manage displays or monitors, and found a different bug or need a specific feature, please create a new ticket for "KScreen" product in this bugzilla using this link: https://bugs.kde.org/enter_bug.cgi?product=KScreen

(This is an automatic message from the KDE Bug Triaging Team)