Bug 440322 - Connecting an external monitor but using laptop screen causes screen settings being to be reloaded in a loop
Summary: Connecting an external monitor but using laptop screen causes screen settings...
Status: RESOLVED WORKSFORME
Alias: None
Product: KScreen
Classification: Plasma
Component: common (show other bugs)
Version: 5.22.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-27 10:32 UTC by Matej Mrenica
Modified: 2022-12-08 05:15 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matej Mrenica 2021-07-27 10:32:55 UTC
What I did:
1. I connected an external monitor using HDMI
2. From the "screen selector" started with a keyboard shortcut, I selected "Switch to laptop screen"
(3.) My laptop screen is set to 125% scale and my external monitor is set to 100%

OBSERVED RESULT
My laptop screen started switching between 125% and 100% scale every few seconds in a loop.
KScreen KCM shows a message every time the scaling is changed saying something like: 
"New output added. Settings were reloaded" and "Output removed. Settings were reloaded"


SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Tested on Wayland
Comment 1 Nate Graham 2021-07-28 14:02:25 UTC
Yikes!
Comment 2 Matej Mrenica 2021-09-21 14:34:01 UTC
"Screen settings being reloaded in a loop" is actually kwin crashing and reloading in a loop. See the linked logs:

https://pastebin.com/qwrH9G5X
https://pastebin.com/r1wmJzbp
https://pastebin.com/BphSNtUQ
Comment 3 Matej Mrenica 2021-10-02 16:24:54 UTC
New log: https://pastebin.com/WWxRPUez

#0  0x00007f8eb31c4d22 in raise () at /usr/lib/libc.so.6
#1  0x00007f8eb31ae90e in abort () at /usr/lib/libc.so.6
#2  0x00007f8eb3ae2abe in  () at /usr/lib/libQt5Core.so.5
#3  0x00007f8eb3ae1dd0 in qt_assert_x(char const*, char const*, char const*, int) () at /usr/lib/libQt5Core.so.5
#4  0x00007f8eade58d72 in KWin::EglGbmBackend::removeOutput(KWin::DrmAbstractOutput*) (this=0x5591dc154230, drmOutput=
    0x5591dcb18d60) at /tmp/kwin/src/plugins/platforms/drm/egl_gbm_backend.cpp:213
#5  0x00007f8eade4e681 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<KWin::DrmAbstractOutput*>, void, void (KWin::AbstractEglDrmBackend::*)(KWin::DrmAbstractOutput*)>::call(void (KWin::AbstractEglDrmBackend::*)(KWin::DrmAbstractOutput*), KWin::AbstractEglDrmBackend*, void**) (f=
    &virtual table offset 224, o=0x5591dc154230, arg=0x7fffc8ab8000) at /usr/include/qt/QtCore/qobjectdefs_impl.h:152
#6  0x00007f8eade4e525 in QtPrivate::FunctionPointer<void (KWin::AbstractEglDrmBackend::*)(KWin::DrmAbstractOutput*)>::call<QtPrivate::List<KWin::DrmAbstractOutput*>, void>(void (KWin::AbstractEglDrmBackend::*)(KWin::DrmAbstractOutput*), KWin::AbstractEglDrmBackend*, void**) (f=&virtual table offset 224, o=0x5591dc154230, arg=0x7fffc8ab8000)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:185
#7  0x00007f8eade4e44b in QtPrivate::QSlotObject<void (KWin::AbstractEglDrmBackend::*)(KWin::DrmAbstractOutput*), QtPrivate::List<KWin::DrmAbstractOutput*>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
    (which=1, this_=0x5591dbf551d0, r=0x5591dc154230, a=0x7fffc8ab8000, ret=0x0)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:418
#8  0x00007f8eb3d4e39b in  () at /usr/lib/libQt5Core.so.5
#9  0x00007f8eade18030 in KWin::DrmGpu::outputDisabled(KWin::DrmAbstractOutput*)
    (this=0x5591dbfb0260, _t1=0x5591dcb18d60)
    at /tmp/kwin/build/src/plugins/platforms/drm/KWinWaylandDrmBackend_autogen/EWIEGA46WW/moc_drm_gpu.cpp:189
#10 0x00007f8eade42803 in KWin::DrmGpu::removeOutput(KWin::DrmOutput*) (this=0x5591dbfb0260, output=0x5591dcb18d60)
    at /tmp/kwin/src/plugins/platforms/drm/drm_gpu.cpp:489
#11 0x00007f8eade40b82 in KWin::DrmGpu::updateOutputs() (this=0x5591dbfb0260)
    at /tmp/kwin/src/plugins/platforms/drm/drm_gpu.cpp:198
#12 0x00007f8eade1b2b2 in KWin::DrmBackend::updateOutputs() (this=0x5591dbf8ebe0)
    at /tmp/kwin/src/plugins/platforms/drm/drm_backend.cpp:350
#13 0x00007f8eade1a86f in KWin::DrmBackend::handleUdevEvent() (this=0x5591dbf8ebe0)
    at /tmp/kwin/src/plugins/platforms/drm/drm_backend.cpp:270
#14 0x00007f8eade2632a in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::DrmBackend::*)()>::call(void (KWin::DrmBackend::*)(), KWin::DrmBackend*, void**)
    (f=(void (KWin::DrmBackend::*)(KWin::DrmBackend * const)) 0x7f8eade1a18e <KWin::DrmBackend::handleUdevEvent()>, o=0x5591dbf8ebe0, arg=0x7fffc8ab84d0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:152
#15 0x00007f8eade25523 in QtPrivate::FunctionPointer<void (KWin::DrmBackend::*)()>::call<QtPrivate::List<>, void>(void (KWin::DrmBackend::*)(), KWin::DrmBackend*, void**)
    (f=(void (KWin::DrmBackend::*)(KWin::DrmBackend * const)) 0x7f8eade1a18e <KWin::DrmBackend::handleUdevEvent()>, o=0x5591dbf8ebe0, arg=0x7fffc8ab84d0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:185
#16 0x00007f8eade244e9 in QtPrivate::QSlotObject<void (KWin::DrmBackend::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
    (which=1, this_=0x5591dbfb2b00, r=0x5591dbf8ebe0, a=0x7fffc8ab84d0, ret=0x0)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:418
#17 0x00007f8eb3d4e39b in  () at /usr/lib/libQt5Core.so.5
#18 0x00007f8eb3d518fe in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#19 0x00007f8eb3d5210d in QSocketNotifier::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#20 0x00007f8eb4b90772 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#21 0x00007f8eb3d15aa8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#22 0x00007f8eb3d6d654 in QEventDispatcherUNIXPrivate::activateSocketNotifiers() () at /usr/lib/libQt5Core.so.5
#23 0x00007f8eb3d6dad5 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/libQt5Core.so.5
#24 0x00005591db04d4ae in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
#25 0x00007f8eb3d1442c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#26 0x00007f8eb3d1cd24 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#27 0x00005591dafbfb60 in main(int, char**) (argc=15, argv=0x7fffc8ab8c38) at /tmp/kwin/src/main_wayland.cpp:745
Comment 4 Bug Janitor Service 2021-10-04 07:06:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1488
Comment 5 Zamundaaa 2021-10-04 09:39:01 UTC
Git commit 6a68caef7be72a3ae004c71bb844a0716966ca98 by Xaver Hugl.
Committed on 04/10/2021 at 09:38.
Pushed by zamundaaa into branch 'master'.

Only emit outputDisabled if the output is enabled

M  +6    -2    src/plugins/platforms/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/commit/6a68caef7be72a3ae004c71bb844a0716966ca98
Comment 6 Zamundaaa 2021-10-04 09:39:28 UTC
Git commit 9a5794a63aec4fe28d3290f011ba103eef8892bc by Xaver Hugl.
Committed on 04/10/2021 at 09:39.
Pushed by zamundaaa into branch 'Plasma/5.23'.

Only emit outputDisabled if the output is enabled


(cherry picked from commit 6a68caef7be72a3ae004c71bb844a0716966ca98)

M  +6    -2    src/plugins/platforms/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/commit/9a5794a63aec4fe28d3290f011ba103eef8892bc
Comment 7 Zamundaaa 2021-10-04 10:57:28 UTC
Did you test it? I didn't close the report on purpose; the commit fixes the crash but likely doesn't fix the original problem
Comment 8 Matej Mrenica 2021-10-04 15:39:43 UTC
You're right, I only tested whether it crashes which it doesn't, but it still loops. I also changed both of my screens to the same scale 100% which doesn't fix the issue, but it's less visible that way.
Comment 9 Zamundaaa 2021-10-04 19:56:03 UTC
Can you set the environment variable
QT_LOGGING_RULES="kwin_wayland_drm.debug=true"
for KWin and check your ~/.local/share/sddm/wayland-session.log for messages with "new output" & "udev change"? Specifically, are there a lot of them?
Comment 10 Matej Mrenica 2021-10-05 09:37:20 UTC
I just found out I have the same issue in Xorg session. I just never noticed it, since it doesn't support different scaling settings.
Log looks like this:

kwin_wayland_drm: Received change event for monitored drm device "/dev/dri/card1"
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701b6c250, name="eDP-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Could not find a fitting mode with size=1920x1080 and refresh rate 59933 for output eDP-1
kwin_wayland_drm: Received change event for monitored drm device "/dev/dri/card1"
kwin_wayland_drm: Connector 85 has properties "CRTC_ID"=0, "non-desktop"=0, "DPMS"=3, "EDID"=106, "overscan" not found, "vrr_capable"=0, "underscan"="off", "underscan vborder"=0, "underscan hborder"=0, "Broadcast RGB" not found
kwin_wayland_drm: New output on GPU "/dev/dri/card1": "PLE2407HDS/110019100071"
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701b6c250, name="eDP-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Could not find a fitting mode with size=1920x1080 and refresh rate 59933 for output eDP-1
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555702841040, name="HDMI-A-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Got invalid timestamp (sec: 0, usec: 0) on output HDMI-A-1
kwin_wayland_drm: Received change event for monitored drm device "/dev/dri/card1"
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701b6c250, name="eDP-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Could not find a fitting mode with size=1920x1080 and refresh rate 59933 for output eDP-1
kwin_wayland_drm: Received change event for monitored drm device "/dev/dri/card1"
kwin_wayland_drm: Connector 85 has properties "CRTC_ID"=0, "non-desktop"=0, "DPMS"=3, "EDID"=106, "overscan" not found, "vrr_capable"=0, "underscan"="off", "underscan vborder"=0, "underscan hborder"=0, "Broadcast RGB" not found
kwin_wayland_drm: New output on GPU "/dev/dri/card1": "PLE2407HDS/110019100071"
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701b6c250, name="eDP-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Could not find a fitting mode with size=1920x1080 and refresh rate 59933 for output eDP-1
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701feaac0, name="HDMI-A-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Got invalid timestamp (sec: 0, usec: 0) on output HDMI-A-1
kwin_wayland_drm: Received change event for monitored drm device "/dev/dri/card1"
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701b6c250, name="eDP-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Could not find a fitting mode with size=1920x1080 and refresh rate 59933 for output eDP-1
kwin_wayland_drm: Received change event for monitored drm device "/dev/dri/card1"
kwin_wayland_drm: Connector 85 has properties "CRTC_ID"=0, "non-desktop"=0, "DPMS"=3, "EDID"=105, "overscan" not found, "vrr_capable"=0, "underscan"="off", "underscan vborder"=0, "underscan hborder"=0, "Broadcast RGB" not found
kwin_wayland_drm: New output on GPU "/dev/dri/card1": "PLE2407HDS/110019100071"
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701b6c250, name="eDP-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Could not find a fitting mode with size=1920x1080 and refresh rate 59933 for output eDP-1
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701e73b20, name="HDMI-A-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Got invalid timestamp (sec: 0, usec: 0) on output HDMI-A-1
kwin_wayland_drm: Received change event for monitored drm device "/dev/dri/card1"
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701b6c250, name="eDP-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Could not find a fitting mode with size=1920x1080 and refresh rate 59933 for output eDP-1
kwin_wayland_drm: Received change event for monitored drm device "/dev/dri/card1"
kwin_wayland_drm: Connector 85 has properties "CRTC_ID"=0, "non-desktop"=0, "DPMS"=3, "EDID"=104, "overscan" not found, "vrr_capable"=0, "underscan"="off", "underscan vborder"=0, "underscan hborder"=0, "Broadcast RGB" not found
kwin_wayland_drm: New output on GPU "/dev/dri/card1": "PLE2407HDS/110019100071"
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555701b6c250, name="eDP-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Could not find a fitting mode with size=1920x1080 and refresh rate 59933 for output eDP-1
kwin_wayland_drm: Reading output configuration for  KWin::DrmOutput(0x555702846170, name="HDMI-A-1", geometry=QRect(0,0 1920x1080), scale=1)
kwin_wayland_drm: Got invalid timestamp (sec: 0, usec: 0) on output HDMI-A-1
kwin_wayland_drm: Got invalid timestamp (sec: 0, usec: 0) on output HDMI-A-1

Full log here: https://pastebin.com/FwrSu3Rk
Comment 11 Nate Graham 2022-11-08 22:31:31 UTC
Thank you for the bug report. Unfortunately we were not able to get to it yet. Can we ask you to please check if this is still an issue with Plasma 5.25 or 5.26?

If it is, please add a comment with the output of `kscreen-doctor -o` and change the status to CONFIRMED. If not, or if you can't because you no longer use this setup, you can change the status to RESOLVED WORKSFORME. Thanks a lot!
Comment 12 Bug Janitor Service 2022-11-23 05:16:01 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 13 Bug Janitor Service 2022-12-08 05:15:32 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!