[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    D13853: Fix setting primary connector if primary output changed
From:       Robert Hoffmann <noreply () phabricator ! kde ! org>
Date:       2018-07-04 14:15:57
Message-ID: 6d27600a5069b4083133ac6c768bb73d () localhost ! localdomain
[Download RAW message or body]

[Attachment #2 (text/plain)]

hoffmannrobert marked an inline comment as done.
hoffmannrobert added inline comments.

INLINE COMMENTS

> davidedmundson wrote in screenpool.cpp:108
> Either this is a valid case to be in, and this assert doesn't make sense.
> 
> Or we should never be in this case, and the patch doesn't make sense.
> 
> I don't fully understand the background of how we end up in this situation to say \
> which it is.

This is a valid case, and the assert doesn't make sense, it needs to be removed.

In the case described in the test plan, the old primary display ist HDMI-3, the new \
primary is HDMI-2. If HDMI-2 is plugged in and "extend to right" is selected in the \
OSD, the QGuiApplication::screenAdded signal starts ShellCorona::addOutput().

This checks, if the new screen is redundant (ShellCorona::isOutputRedundant). At this \
time, both have the same geometry (two equal screens, QRect(0,0 1920x1080)), so yes, \
the new screen is considered redundant and not added to the screen pool.

There is already some remedy against this wrong assumption:
On the signal QGuiApplication::primaryScreenChanged ShellCorona::primaryOutputChanged \
is called. Here, with m_reconsiderOutputsTimer.start() \
ShellCorona::reconsiderOutputs() is run at a later time, which will correct this.

But that's too late for the primary change: before reconsiderOutputs()  is run, \
ScreenPool::setPrimaryConnector( newPrimary->name() ) is called. Here, \
m_idForConnector does not contain this new primary, it only knows "HDMI-3", which is \
still mapped to 0.

If the Q_ASSERT is disabled, m_idForConnector.value(primary (The new primary HDMI-2!) \
) returns 0, so both HDMI-2 and HDMI-3 are mapped to 0 in m_idForConnector, and \
m_connectorForId[0] is set to "HDMI-2", so the mapping to HDMI-3 is lost.

The other case, booting with HDMI-2 and hotplugging HDMI-3 works, because in \
ShellCorona::isOutputRedundant, geometries are different: HDMI-2 has: QRect(0,0 \
1920x1080) and HDMI-3: QRect(1920,0 1920x1080), so one doesn't contain the other.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D13853

To: hoffmannrobert, #plasma, mart, davidedmundson
Cc: davidedmundson, ngraham, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, \
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


[Attachment #3 (text/html)]

<table><tr><td style="">hoffmannrobert marked an inline comment as done.<br \
/>hoffmannrobert added inline comments. </td><a style="text-decoration: none; \
padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; \
border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to \
bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" \
href="https://phabricator.kde.org/D13853">View Revision</a></tr></table><br \
/><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div \
style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; \
background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 \
1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; \
overflow: hidden;"><a style="float: right; text-decoration: none;" \
href="https://phabricator.kde.org/D13853#inline-73049">View Inline</a><span \
style="color: #4b4d51; font-weight: bold;">davidedmundson</span> wrote in <span \
style="color: #4b4d51; font-weight: bold;">screenpool.cpp:108</span></div> <div \
style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: \
8px;">Either this is a valid case to be in, and this assert doesn&#039;t make \
sense.</p>

<p style="padding: 0; margin: 8px;">Or we should never be in this case, and the patch \
doesn&#039;t make sense.</p>

<p style="padding: 0; margin: 8px;">I don&#039;t fully understand the background of \
how we end up in this situation to say which it is.</p></div></div> <div \
style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">This is a \
valid case, and the assert doesn&#039;t make sense, it needs to be removed.</p>

<p style="padding: 0; margin: 8px;">In the case described in the test plan, the old \
primary display ist HDMI-3, the new primary is HDMI-2. If HDMI-2 is plugged in and \
&quot;extend to right&quot; is selected in the OSD, the QGuiApplication::screenAdded \
signal starts ShellCorona::addOutput().</p>

<p style="padding: 0; margin: 8px;">This checks, if the new screen is redundant \
(ShellCorona::isOutputRedundant). At this time, both have the same geometry (two \
equal screens, QRect(0,0 1920x1080)), so yes, the new screen is considered redundant \
and not added to the screen pool.</p>

<p style="padding: 0; margin: 8px;">There is already some remedy against this wrong \
assumption:<br /> On the signal QGuiApplication::primaryScreenChanged \
ShellCorona::primaryOutputChanged is called. Here, with \
m_reconsiderOutputsTimer.start() ShellCorona::reconsiderOutputs() is run at a later \
time, which will correct this.</p>

<p style="padding: 0; margin: 8px;">But that&#039;s too late for the primary change: \
before reconsiderOutputs()  is run, ScreenPool::setPrimaryConnector( \
newPrimary-&gt;name() ) is called. Here, m_idForConnector does not contain this new \
primary, it only knows &quot;HDMI-3&quot;, which is still mapped to 0.</p>

<p style="padding: 0; margin: 8px;">If the Q_ASSERT is disabled, \
m_idForConnector.value(primary (The new primary HDMI-2!) ) returns 0, so both HDMI-2 \
and HDMI-3 are mapped to 0 in m_idForConnector, and m_connectorForId[0] is set to \
&quot;HDMI-2&quot;, so the mapping to HDMI-3 is lost.</p>

<p style="padding: 0; margin: 8px;">The other case, booting with HDMI-2 and \
hotplugging HDMI-3 works, because in ShellCorona::isOutputRedundant, geometries are \
different: HDMI-2 has: QRect(0,0 1920x1080) and HDMI-3: QRect(1920,0 1920x1080), so \
one doesn&#039;t contain the other.</p></div></div></div></div></div><br \
/><div><strong>REPOSITORY</strong><div><div>R120 Plasma \
Workspace</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a \
href="https://phabricator.kde.org/D13853">https://phabricator.kde.org/D13853</a></div></div><br \
/><div><strong>To: </strong>hoffmannrobert, Plasma, mart, davidedmundson<br \
/><strong>Cc: </strong>davidedmundson, ngraham, plasma-devel, ragreen, Pitel, \
ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br \
/></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic