Created attachment 126917 [details] Log with QT_LOGGING_RULES="kwin_*.debug=true" and LIBGL_DEBUG=verbose SUMMARY When plugging in an external display via USB-C/Thunderbolt hub (display connected via DisplayPort to it) to my Dell XPS 9370, KWin does not activate the display. When starting KWin with the display already connected, it works fine. Hot plugging works fine in other compositors like Sway. Udev events are triggered reliably and KWin sees them. It tried stepping through without being very familiar with the code or libdrm. The issue seems to be, that in DrmBackend::updateOutputs() the con->isConnected() check fails, because libdrm always returns a device with connection == DRM_MODE_DISCONNECTED. I don't know yet how this differs from e.g. Sway. STEPS TO REPRODUCE 1. Connect external display via USB-C/Thunderbolt hub to XPS 9370 2. startplasma-wayland --xwayland --drm 3. Everything works fine 4. Disconnect external display 5. KWin correctly updates display configuration to a single dispaly 6. Reconnect external display OBSERVED RESULT Nothing happens. EXPECTED RESULT KWin updates display configuration back to two displays. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 5.18.3 KDE Frameworks Version: 5.68.0 Qt Version: 5.14.1 Kernel Version: 5.5.9-arch1-2 OS Type: 64-bit Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz Memory: 15,3 GiB of RAM OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2) OpenGL version string: 4.6 (Core Profile) Mesa 19.3.4 OpenGL shading language version string: 4.60 Driver: Intel GPU class: Unknown OpenGL version: 4.6 GLSL version: 4.60 Mesa version: 19.3.4 Linux kernel version: 5.5.9
From the log to me only these errors stood out: kwin_wayland_drm: Atomic test commit failed. Aborting present. kwin_wayland_drm: Atomic test commit failed. Aborting present.
Hello, Thanks for your report, unfortunately I can't reproduce it. Can you confirm bug is still reproductible with plasma 5.18.4 ? Thanks
If I use my dock (Dell WD15) I also can reproduce this somehow. Using the environment variables mentioned above I get the following output upon reconnecting it. Note there's 2 displays connected there, could maybe explain why it's receiving 4 events? kwin/plugins/platforms/drm/drm_backend.cpp:373) - Received hot plug event for monitored drm device kwin/plugins/platforms/drm/drm_backend.cpp:520) - Reading output configuration for [ "5eb6e7d202" ] [ "5eb6e7d202" ] kwin/plugins/platforms/drm/drm_backend.cpp:373) - Received hot plug event for monitored drm device kwin/plugins/platforms/drm/drm_backend.cpp:520) - Reading output configuration for [ "5eb6e7d202" ] [ "5eb6e7d202" ] kwin/plugins/platforms/drm/drm_backend.cpp:373) - Received hot plug event for monitored drm device kwin/plugins/platforms/drm/drm_backend.cpp:520) - Reading output configuration for [ "5eb6e7d202" ] [ "5eb6e7d202" ] kwin/plugins/platforms/drm/drm_backend.cpp:373) - Received hot plug event for monitored drm device kwin/plugins/platforms/drm/drm_backend.cpp:520) - Reading output configuration for [ "5eb6e7d202" ] [ "5eb6e7d202" ] If instead I log out and log back in, then it works perfectly. Bear in mind that if I use my usbc adaptors it works, so it's going to be hard to reproduce. The code works, there's probably something wonky in our display listing code. Also note it's being detected too.
I'm pretty sure I see what's wrong. DRM has a connector (think physical port) and Outputs. Attached to the port. In openDRM we set our connectors In updateOutputs we see which outputs should be attached to which connectors When hotplugging a true docking station our connectors changes. We call updateOutputs, but m_connectors is the same as before. We surely need to update it.
https://phabricator.kde.org/D28642
I gave the patch a try and it works in the sense that kscreen-doctor now shows the external display in a connected+enabled state after plugging in. Unfortunately it doesn't actually show anything on the screen. If I disable the display via kscreen-doctor output.1.disable, I get a crash in libepoxy: #0 0x00007f415cb84ce5 in raise () at /usr/lib/libc.so.6 #1 0x00007f415cb6e92c in abort () at /usr/lib/libc.so.6 #2 0x00007f415cb6e727 in _nl_load_domain.cold () at /usr/lib/libc.so.6 #3 0x00007f415cb7d426 in () at /usr/lib/libc.so.6 #4 0x00007f415c0390d8 in epoxy_get_proc_address (name=0x7f415c0494d9 <entrypoint_strings+9849> "glDeleteProgram") at ../src/dispatch_common.c:863 #5 epoxy_get_proc_address (name=0x7f415c0494d9 <entrypoint_strings+9849> "glDeleteProgram") at ../src/dispatch_common.c:839 #6 0x00007f415c00f72a in epoxy_glDeleteProgram_resolver () at src/gl_generated_dispatch.c:81668 #7 epoxy_glDeleteProgram_global_rewrite_ptr (program=30) at src/gl_generated_dispatch.c:49458 #8 0x00007f4154574979 in () at /usr/lib/qt/plugins/org.kde.kwin.scenes/KWinSceneOpenGL.so #9 0x00007f41545777a4 in () at /usr/lib/qt/plugins/org.kde.kwin.scenes/KWinSceneOpenGL.so #10 0x00007f415d1fccde in () at /usr/lib/libQt5Core.so.5 #11 0x00007f415d1fccde in () at /usr/lib/libQt5Core.so.5 #12 0x00007f415e35ad8b in KWin::DrmBackend::enableOutput(KWin::DrmOutput*, bool) () at /usr/lib/qt/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so #13 0x00007f415e368b2a in KWin::DrmOutput::atomicDisable() () at /usr/lib/qt/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so #14 0x00007f415e163bdc in KWin::Platform::requestOutputsChange(KWayland::Server::OutputConfigurationInterface*) () at /usr/lib/libkwin.so.5 #15 0x00007f415d1fccde in () at /usr/lib/libQt5Core.so.5 #16 0x00007f415dd36b80 in KWayland::Server::OutputManagementInterface::configurationChangeRequested(KWayland::Server::OutputConfigurationInterface*) () at /usr/lib/libKF5WaylandServer.so.5 #17 0x00007f41593ff69a in ffi_call_unix64 () at /usr/lib/libffi.so.6 #18 0x00007f41593fefb6 in ffi_call () at /usr/lib/libffi.so.6 #19 0x00007f415a97cf62 in () at /usr/lib/libwayland-server.so.0 #20 0x00007f415a9792dc in () at /usr/lib/libwayland-server.so.0 #21 0x00007f415a97afaa in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0 #22 0x00007f415dd4aa90 in KWayland::Server::Display::Private::dispatch() () at /usr/lib/libKF5WaylandServer.so.5 #23 0x00007f415d1fccde in () at /usr/lib/libQt5Core.so.5 #24 0x00007f415d200532 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) () at /usr/lib/libQt5Core.so.5 #25 0x00007f415d200882 in QSocketNotifier::event(QEvent*) () at /usr/lib/libQt5Core.so.5 #26 0x00007f415d5b6352 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5 #27 0x00007f415d5bf829 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5 #28 0x00007f415d1c74f2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5 #29 0x00007f415d21cb04 in QEventDispatcherUNIXPrivate::activateSocketNotifiers() () at /usr/lib/libQt5Core.so.5 #30 0x00007f415d21cf75 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #31 0x00007f415651b10e in () at /usr/lib/qt/plugins/platforms/KWinQpaPlugin.so #32 0x00007f415d1c605c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #33 0x00007f415d1ce066 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5 #34 0x000055d9754f0f1e in () #35 0x00007f415cb70023 in __libc_start_main () at /usr/lib/libc.so.6 #36 0x000055d9754f138e in _start ()
I'll be landing the fix now. If you still get a crash, which I can't reproduce myself, please reopen a new bug with the backtrace including debug symbols and we'll look into it. Thanks for following up!
Git commit 85b322ad9c8f6f0ec9937802d995b754ef5a4a56 by Aleix Pol. Committed on 08/04/2020 at 22:45. Pushed by apol into branch 'master'. drm: Fix hotplugging docking stations Summary: It turns out DRM connectors are not static and may change over time. This patch refreshes them right before looking for new outputs. FIXED-IN: 5.19.0 Test Plan: Seems to work better, it's still not ideal but I think there's an unrelated bug sending updates to clients. Reviewers: #kwin, davidedmundson, meven Reviewed By: #kwin, davidedmundson, meven Subscribers: dalbers, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D28642 M +48 -30 plugins/platforms/drm/drm_backend.cpp M +1 -1 plugins/platforms/drm/drm_backend.h https://commits.kde.org/kwin/85b322ad9c8f6f0ec9937802d995b754ef5a4a56
Awesome, I can confirm this is working now. Doesn't crash anymore either. Thanks for fixing!
*** Bug 411361 has been marked as a duplicate of this bug. ***