Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
696c3d65
Commit
696c3d65
authored
Feb 24, 2022
by
Xaver Hugl
Browse files
output changes: handle to-be-enabled outputs first
This prevents situations where we have no enabled outputs
parent
dbe2a7ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/backends/drm/drm_backend.cpp
View file @
696c3d65
...
...
@@ -640,7 +640,8 @@ DrmGpu *DrmBackend::findGpuByFd(int fd) const
bool
DrmBackend
::
applyOutputChanges
(
const
WaylandOutputConfig
&
config
)
{
QVector
<
DrmOutput
*>
changed
;
QVector
<
DrmOutput
*>
toBeEnabled
;
QVector
<
DrmOutput
*>
toBeDisabled
;
for
(
const
auto
&
gpu
:
qAsConst
(
m_gpus
))
{
const
auto
&
outputs
=
gpu
->
outputs
();
for
(
const
auto
&
o
:
outputs
)
{
...
...
@@ -650,10 +651,17 @@ bool DrmBackend::applyOutputChanges(const WaylandOutputConfig &config)
continue
;
}
output
->
queueChanges
(
config
);
changed
<<
output
;
if
(
config
.
constChangeSet
(
output
)
->
enabled
)
{
toBeEnabled
<<
output
;
}
else
{
toBeDisabled
<<
output
;
}
}
if
(
!
gpu
->
testPendingConfiguration
())
{
for
(
const
auto
&
output
:
qAsConst
(
changed
))
{
for
(
const
auto
&
output
:
qAsConst
(
toBeEnabled
))
{
output
->
revertQueuedChanges
();
}
for
(
const
auto
&
output
:
qAsConst
(
toBeDisabled
))
{
output
->
revertQueuedChanges
();
}
return
false
;
...
...
@@ -661,7 +669,10 @@ bool DrmBackend::applyOutputChanges(const WaylandOutputConfig &config)
}
// first, apply changes to drm outputs.
// This may remove the placeholder output and thus change m_outputs!
for
(
const
auto
&
output
:
qAsConst
(
changed
))
{
for
(
const
auto
&
output
:
qAsConst
(
toBeEnabled
))
{
output
->
applyQueuedChanges
(
config
);
}
for
(
const
auto
&
output
:
qAsConst
(
toBeDisabled
))
{
output
->
applyQueuedChanges
(
config
);
}
// only then apply changes to the virtual outputs
...
...
@@ -669,7 +680,7 @@ bool DrmBackend::applyOutputChanges(const WaylandOutputConfig &config)
if
(
!
qobject_cast
<
DrmOutput
*>
(
output
))
{
output
->
applyChanges
(
config
);
}
}
;
}
if
(
Compositor
::
compositing
())
{
Compositor
::
self
()
->
scene
()
->
addRepaintFull
();
}
...
...
src/platform.cpp
View file @
696c3d65
...
...
@@ -151,8 +151,20 @@ void Platform::requestOutputsChange(KWaylandServer::OutputConfigurationV2Interfa
bool
Platform
::
applyOutputChanges
(
const
WaylandOutputConfig
&
config
)
{
const
auto
outputs
=
enabledOutputs
();
for
(
const
auto
&
output
:
outputs
)
{
const
auto
availableOutputs
=
outputs
();
QVector
<
AbstractOutput
*>
toBeEnabledOutputs
;
QVector
<
AbstractOutput
*>
toBeDisabledOutputs
;
for
(
const
auto
&
output
:
availableOutputs
)
{
if
(
config
.
constChangeSet
(
qobject_cast
<
AbstractWaylandOutput
*>
(
output
))
->
enabled
)
{
toBeEnabledOutputs
<<
output
;
}
else
{
toBeDisabledOutputs
<<
output
;
}
}
for
(
const
auto
&
output
:
toBeEnabledOutputs
)
{
static_cast
<
AbstractWaylandOutput
*>
(
output
)
->
applyChanges
(
config
);
}
for
(
const
auto
&
output
:
toBeDisabledOutputs
)
{
static_cast
<
AbstractWaylandOutput
*>
(
output
)
->
applyChanges
(
config
);
}
return
true
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment