Bug 312231

Summary: KScreen doesn't support dock
Product: [Plasma] KScreen Reporter: Jessie A. Morris <jessie>
Component: commonAssignee: Daniel Vrátil <dvratil>
Status: RESOLVED FIXED    
Severity: wishlist CC: bhubbard, dvratil, matthias
Priority: VHI    
Version: unspecified   
Target Milestone: 1.0   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Jessie A. Morris 2012-12-26 19:01:01 UTC
I have two monitors (laptop and external) and plug my second external monitor in. kded then crashes (haven't gotten logs yet, since I'm at work).

I think this might have something to do with my laptop only supporting 2 monitors, not three. What I want to have happen is it enables the two external monitors and disables my laptop's monitor.

Reproducible: Always

Steps to Reproduce:
1. Have two monitors enabled and on
2. Plug in a third monitor
Actual Results:  
kded crashes

Expected Results:  
Third screen should be enabled and to the right of the other external screen and the laptop's screen should be disabled.
Comment 1 Matthias Blaicher 2012-12-30 19:04:24 UTC
I also see the same crash with my laptop which has a Sandy Bridge graphic card.  Note that only 2 CRTs are supported by this rather new card. With xrandr I get:

> xrandr: cannot find crtc for output HDMI2

I think you first have to disable all monitors and enable the once needed. This is really important for me, since I use two monitors with my docking station.
Comment 2 Matthias Blaicher 2012-12-30 19:38:43 UTC
I think this is the right backtrace:

Application: KDE Daemon (kdeinit4), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7faa9ab52780 (LWP 2911))]

Thread 2 (Thread 0x7faa7cbef700 (LWP 2929)):
#0  0x00007faa950fd388 in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#1  0x00007faa950fda3b in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007faa950fdc34 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007faa997e2b86 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007faa997b33ff in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007faa997b3688 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007faa996b48a0 in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007faa99793bbf in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007faa996b787c in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007faa99427e0f in start_thread () from /usr/lib/libpthread.so.0
#10 0x00007faa981b5efd in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7faa9ab52780 (LWP 2911)):
[KCrash Handler]
#5  0x00007faa7f0cd9d0 in KScreen::Mode::refreshRate() const () from /usr/lib/libkscreen.so.0
#6  0x00007faa7f2db5ae in ?? () from /usr/lib/kde4/kded_kscreen.so
#7  0x00007faa7f2d9ad2 in KScreenDaemon::saveCurrentConfig() () from /usr/lib/kde4/kded_kscreen.so
#8  0x00007faa997c906e in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#9  0x00007faa9894718c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#10 0x00007faa9894b60a in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#11 0x00007faa9a55cdf6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#12 0x00007faa997b46ae in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#13 0x00007faa997b8011 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#14 0x00007faa997e29d3 in ?? () from /usr/lib/libQtCore.so.4
#15 0x00007faa950fd845 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#16 0x00007faa950fdb78 in ?? () from /usr/lib/libglib-2.0.so.0
#17 0x00007faa950fdc34 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#18 0x00007faa997e2b66 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#19 0x00007faa989e769e in ?? () from /usr/lib/libQtGui.so.4
#20 0x00007faa997b33ff in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#21 0x00007faa997b3688 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#22 0x00007faa997b8328 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#23 0x00007faa856783e0 in kdemain () from /usr/lib/libkdeinit4_kded4.so
#24 0x0000000000408286 in _start ()
Comment 3 Daniel Vrátil 2012-12-30 19:57:08 UTC
Git commit 417c8196a329a56674670d04870b9d9873ce6aa4 by Dan Vrátil.
Committed on 30/12/2012 at 20:56.
Pushed by dvratil into branch 'master'.

Fix crash when saving configuration with a disabled output

REVIEW: 108031

M  +11   -8    kded/serializer.cpp

http://commits.kde.org/kscreen/417c8196a329a56674670d04870b9d9873ce6aa4
Comment 4 Matthias Blaicher 2012-12-30 21:19:33 UTC
Great! This fixed the crash. Docking with three monitors still does not work for me, though. I end up with LVDS1 enabled but the screen is dark. One HDMI is enabled, but the other one is not.

I guess configurations where "number of screens" > "number of crtcs"

Citing from [1]:

Most hardware only have 2 CRTCs, which means they only have 2 rendering pipeline and thus may only display on 2 outputs at the same time. This is why you may have to disable one output before being able to enable another one.

Some outputs may also be restricted to some CRTC. xrandr --verbose gives information on which CRTC are available/used for each output. 

[1] http://wiki.debian.org/XStrikeForce/HowToRandR12
Comment 5 Jekyll Wu 2012-12-31 03:50:21 UTC
*** Bug 312410 has been marked as a duplicate of this bug. ***
Comment 6 Brad Hubbard 2013-01-06 22:45:25 UTC
*** Bug 298951 has been marked as a duplicate of this bug. ***
Comment 7 Brad Hubbard 2013-01-06 23:01:19 UTC
*** Bug 312776 has been marked as a duplicate of this bug. ***
Comment 8 Alex Fiestas 2013-01-11 15:02:14 UTC
The CRTC mess is fixed, we have to add propper support to detect Docks though.
Comment 9 Daniel Vrátil 2015-03-05 18:34:35 UTC
Hi all,

I'm marking this as fixed, since there should be no crashes now, but we can't force your GPU to enable more monitors than it supports. We are however able to correctly handle cases when you dock, and KScreen will automatically turn off the laptop screen and turn on the two external monitors connected to your dock, all you need to do is to set this up in the KScreen KCM.