https://bugs.kde.org/show_bug.cgi?id=528642

            Bug ID: 528642
           Summary: kwin_wayland 6.8.2 crashes when DisplayLink (evdi)
                    virtual outputs are connected
    Classification: I don't know
           Product: kde
      Version First unspecified
       Reported In:
          Platform: NixOS
                OS: Linux
            Status: REPORTED
          Keywords: drkonqi
          Severity: crash
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Application:  (6.8.2)

ApplicationNotResponding [ANR]: false
Qt Version: 6.12.0
Frameworks Version: 6.31.0
Operating System: Linux 7.3.3 x86_64
Windowing System: Wayland
Distribution: NixOS 26.11 (Zokor)
DrKonqi: 6.8.2 [CoredumpBackend]

-- Information about the crash:
DESCRIPTION
Using NixOS on the nixos-unstable branch since updating kwin from 6.7.5 to
6.8.2, kwin_wayland and plasmashell crashed after login when I connected my
USB-A Toshiba dynadock which I am using with displaylink and the evdi 1.15.1
(1.15.0 with kwin 6.7.5) kernel module. The linux kernel was 7.2.6 with kwin
6.7.5 and 7.3.3 with kwin 6.8.2. 

When booting with SDDM (services.displayManager.sddm) with the dock attached, a
black screen with a blinking cursor would appear. I switched to Plasma Login
Manager (services.displayManager.plasma-login-manager) - with this the splash
screen showed up and login was possible, but plasma still crashed after
hotplugging the dock. I think kwin_wayland was restarted, but plasmashell did
not, because yakuake still worked and I could open GUI programs via CLI. 

STEPS TO REPRODUCE
1. Run KDE Plasma 6.8.2 on Wayland with evdi and DisplayLinkManager enabled.
2. Boot with a USB DisplayLink dock attached, or hotplug it during an active
Wayland session.

OBSERVED RESULT
kwin_wayland immediately crashes with SIGSEGV.

EXPECTED RESULT
No crash and a working multi-monitor setup.



ADDITIONAL INFORMATION
I used a conversational LLM to help debugging this issue (but everything I
write here in this bug report is formulated by me). It helped interpret the
journalctl and coredumpctl info, suggested to inspect kdePackages.kwin.src and
identified the issue to be in src/compositor.cpp around line 480. It then wrote
a nixpkgs overlay with a patch which I tested and it solves the issue for me. I
don't know if this info is valued here, but for completeness below is the
overlay with the patch:

nixpkgs.overlays = [
  (final: prev: {
    kdePackages = prev.kdePackages.overrideScope (kfinal: kprev: {
      kwin = kprev.kwin.overrideAttrs (oldAttrs: {
        patches = (oldAttrs.patches or [ ]) ++ [
          (final.writeText "fix-kwin-evdi-null-renderdevice.patch" ''
            --- a/src/compositor.cpp
            +++ b/src/compositor.cpp
            @@ -477,7 +477,10 @@
                 if (!attrs) {
                     return false;
                 }
            +    if (!layer->scanoutDevice()) {
            +        return false;
            +    }
                 const auto compatibleDevice =
GpuManager::self()->compatibleRenderDevice(layer->scanoutDevice());
            -    if (attrs->device != layer->scanoutDevice()->deviceId() &&
attrs->device != compatibleDevice->deviceId()) {
            +    if (attrs->device != layer->scanoutDevice()->deviceId() &&
(!compatibleDevice || attrs->device != compatibleDevice->deviceId())) {
                     // Disallow direct scanout between GPUs, as
          '')
        ];
      });
    });
  })
];

The crash can be reproduced every time.

-- Backtrace (Reduced):
#4  0x00007179954265c0 in KWin::RenderDevice::deviceId() const () from
/nix/store/gxdbcjaamm4vksrl6ka6gx354baffr7p-kwin-6.8.2/lib/libkwin.so.6
#5  0x00007179953c0f17 in KWin::Compositor::setupLayers(KWin::SceneView*,
KWin::LogicalOutput*, KWin::BackendOutput*, QList<KWin::OutputLayer*> const&,
std::unordered_map<KWin::OutputLayer*, KWin::Item*,
std::hash<KWin::OutputLayer*>, std::equal_to<KWin::OutputLayer*>,
std::allocator<std::pair<KWin::OutputLayer* const, KWin::Item*> > > const&,
std::shared_ptr<KWin::OutputFrame> const&,
std::unordered_set<KWin::OutputLayer*, std::hash<KWin::OutputLayer*>,
std::equal_to<KWin::OutputLayer*>, std::allocator<KWin::OutputLayer*> >&) ()
from /nix/store/gxdbcjaamm4vksrl6ka6gx354baffr7p-kwin-6.8.2/lib/libkwin.so.6
#6  0x00007179953c2ced in KWin::Compositor::composite(KWin::RenderLoop*) ()
from /nix/store/gxdbcjaamm4vksrl6ka6gx354baffr7p-kwin-6.8.2/lib/libkwin.so.6
#7  0x0000717991c4b537 in void doActivate<false>(QObject*, int, void**) () from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6
#8  0x00007179954499c6 in KWin::RenderLoop::frameRequested(KWin::RenderLoop*)
() from /nix/store/gxdbcjaamm4vksrl6ka6gx354baffr7p-kwin-6.8.2/lib/libkwin.so.6
#9  0x0000717991c4b537 in void doActivate<false>(QObject*, int, void**) () from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6
#10 0x00007179958f9e27 in KWin::PreciseTimer::timerFdReadable() () from
/nix/store/gxdbcjaamm4vksrl6ka6gx354baffr7p-kwin-6.8.2/lib/libkwin.so.6
#11 0x0000717991c4b537 in void doActivate<false>(QObject*, int, void**) () from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6
#12 0x0000717991c5a813 in QSocketNotifier::activated(QSocketDescriptor,
QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) () from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6
#13 0x0000717991c5b03f in QSocketNotifier::event(QEvent*) () from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6
#14 0x00007179931ac17e in QApplicationPrivate::notify_helper(QObject*, QEvent*)
() from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Widgets.so.6
#15 0x0000717991bcfd98 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
() from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6
#16 0x0000717991de03b5 in
QEventDispatcherUNIXPrivate::activateSocketNotifiers() () from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6
#17 0x0000717991de0eb4 in
QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6
[...]
#19 0x0000717991bded6b in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6
#20 0x0000717991bd9c02 in QCoreApplication::exec() () from
/nix/store/12sd69v2zqs0x4xys6af45hcck74mjhl-qtbase-6.12.0/lib/libQt6Core.so.6


Reported using DrKonqi

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to