Don't rescale every output every time outputs change
ClosedPublic

Authored by davidedmundson on Apr 13 2019, 10:46 PM.

Details

Summary

Every time a display gets connected/disconnected, every output will be
reinitialized. We don't really need to reset the scaling to 1 every time
we don't know, especially since the setting has been set voluntarily.

Test Plan

When I disconnect the external display, my laptop doesn't fallback to scale=1.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apol created this revision.Apr 13 2019, 10:46 PM
Restricted Application added a project: KWin. · View Herald TranscriptApr 13 2019, 10:46 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
apol requested review of this revision.Apr 13 2019, 10:46 PM

concept makes sense ++
One question below.

plugins/platforms/drm/drm_backend.cpp
526–527

If we have the hasKey() check, then I don't understand why we also need to use a 0 as a special value for defining unset.

apol added inline comments.Apr 15 2019, 12:02 AM
plugins/platforms/drm/drm_backend.cpp
526–527

Because otherwise the window appears like uninitialized in practice, otherwise. This way we make sure that at least once the function is called.

::setScale does quite some calls under the hood.

davidedmundson added inline comments.Apr 15 2019, 8:34 AM
plugins/platforms/drm/drm_backend.cpp
526–527

:/ then it sounds like you've uncovered a bug!

From AbstractOutput::setScale:

m_waylandOutput->setScale(std::ceil(scale));

should work the same if not set

m_waylandOutputDevice->setScaleF(scale);

should work the same if not set

m_xdgOutput->setLogicalSize(pixelSize() / m_scale);

really really important to call once, but also called from setWaylandMode looks like it is being called correctly

emit modeChanged();

Is only emitted here and not in setWaylandMode?? Probably our bug.

apol added inline comments.Apr 15 2019, 2:16 PM
plugins/platforms/drm/drm_backend.cpp
526–527

Tried this, doesn't help.

davidedmundson commandeered this revision.Wed, Apr 24, 11:32 PM
davidedmundson added a reviewer: apol.
apol accepted this revision.Wed, Apr 24, 11:43 PM
This revision is now accepted and ready to land.Wed, Apr 24, 11:43 PM
This revision was automatically updated to reflect the committed changes.