Bug 422372 - kwin_wayland asserts when overlapping screens
Summary: kwin_wayland asserts when overlapping screens
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 424425 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-06-02 13:38 UTC by Nicolas Fella
Modified: 2020-11-13 03:49 UTC (History)
4 users (show)

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


Attachments
faulty configuration (99.94 KB, image/png)
2020-06-02 13:48 UTC, Nicolas Fella
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Fella 2020-06-02 13:38:29 UTC
SUMMARY

I have two screens. One 3840x2160 with 2x scaling, one 1920x1080 with 1x scaling

When I position them disjoint in the KScreen KCM and hit apply things are fine.

When I position them to overlap and apply kwin_wayland asserts (see backtrace).

When I set the scale of the 4K monitor to 1x and overlap them things are fine.

All KDE stuff built from master.
Qt built from 5.15 branch

#0  0x00007f7d31a93355 in raise () at /usr/lib/libc.so.6
#1  0x00007f7d31a7c853 in abort () at /usr/lib/libc.so.6
#2  0x00007f7d32150c51 in qt_message_fatal (message=<synthetic pointer>..., context=...) at global/qlogging.cpp:1914
#3  QMessageLogger::fatal(char const*, ...) const (this=this@entry=0x7ffc1a65aa98, msg=msg@entry=0x7f7d3244aee8 "ASSERT: \"%s\" in file %s, line %d") at global/qlogging.cpp:893
#4  0x00007f7d3215004a in qt_assert(char const*, char const*, int) (assertion=<optimized out>, file=<optimized out>, line=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qlogging.h:90
#5  0x00007f7d35777dd4 in KWin::SwipeGesture::setStartGeometry(QRect const&) (this=0x5559e07944a0, geometry=...) at /home/nico/kde/src/kwin/gestures.cpp:54
#6  0x00007f7d3582c78e in KWin::Edge::setGeometry(QRect const&) (this=0x5559e0794500, geometry=...) at /home/nico/kde/src/kwin/screenedge.cpp:529
#7  0x00007f7d3582f40c in KWin::ScreenEdges::createEdge(KWin::ElectricBorder, int, int, int, int, bool) (this=0x5559dfdd0ce0, border=KWin::ElectricTop, x=53, y=740, width=-52, height=1, createAction=true)
    at /home/nico/kde/src/kwin/screenedge.cpp:1120
#8  0x00007f7d3582f33a in KWin::ScreenEdges::createHorizontalEdge(KWin::ElectricBorder, QRect const&, QRect const&) (this=0x5559dfdd0ce0, border=KWin::ElectricTop, screen=..., fullArea=...) at /home/nico/kde/src/kwin/screenedge.cpp:1109
#9  0x00007f7d3582ec80 in KWin::ScreenEdges::recreateEdges() (this=0x5559dfdd0ce0) at /home/nico/kde/src/kwin/screenedge.cpp:1026
#10 0x00007f7d358da89e in KWin::Workspace::desktopResized() (this=0x5559df475920) at /home/nico/kde/src/kwin/workspace.cpp:1941
#11 0x00007f7d356a1882 in KWin::Workspace::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x5559df475920, _c=QMetaObject::InvokeMetaMethod, _id=66, _a=0x7ffc1a65b010) at kwin_autogen/EWIEGA46WW/moc_workspace.cpp:427
#12 0x00007f7d323a0be0 in doActivate<false>(QObject*, int, void**) (sender=0x5559df621610, signal_index=4, argv=0x7ffc1a65b010) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:395
#13 0x00007f7d35690fcd in KWin::Screens::changed() (this=0x5559df621610) at kwin_autogen/EWIEGA46WW/moc_screens.cpp:277
#14 0x00007f7d356d52bf in KWin::AbstractWaylandOutput::applyChanges(KWaylandServer::OutputChangeSet const*) (this=0x5559df61c5b0, changeSet=0x5559e075fa10) at /home/nico/kde/src/kwin/abstract_wayland_output.cpp:205
#15 0x00007f7d357ebe56 in KWin::Platform::requestOutputsChange(KWaylandServer::OutputConfigurationInterface*) (this=0x5559df4d80a0, config=0x5559e06c5500) at /home/nico/kde/src/kwin/platform.cpp:150
#16 0x00007f7d358ba6a9 in operator()(KWaylandServer::OutputConfigurationInterface*) const (__closure=0x5559df4e99e0, config=0x5559e06c5500) at /home/nico/kde/src/kwin/wayland_server.cpp:463
#17 0x00007f7d358c0a1f in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<KWaylandServer::OutputConfigurationInterface*>, void, KWin::WaylandServer::init(const QByteArray&, KWin::WaylandServer::InitializationFlags)::<lambda(KWaylandServer::OutputConfigurationInterface*)> >::call(struct {...} &, void **) (f=..., arg=0x7ffc1a65b380) at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:146
#18 0x00007f7d358c0445 in QtPrivate::Functor<KWin::WaylandServer::init(const QByteArray&, KWin::WaylandServer::InitializationFlags)::<lambda(KWaylandServer::OutputConfigurationInterface*)>, 1>::call<QtPrivate::List<KWaylandServer::OutputConfigurationInterface*>, void>(struct {...} &, void *, void **) (f=..., arg=0x7ffc1a65b380) at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:256
#19 0x00007f7d358bf402 in QtPrivate::QFunctorSlotObject<KWin::WaylandServer::init(const QByteArray&, KWin::WaylandServer::InitializationFlags)::<lambda(KWaylandServer::OutputConfigurationInterface*)>, 1, QtPrivate::List<KWaylandServer::OutputConfigurationInterface*>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x5559df4e99d0, r=0x5559df4bb520, a=0x7ffc1a65b380, ret=0x0) at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:443
#20 0x00007f7d323a0ba6 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc1a65b380, r=0x5559df4bb520, this=0x5559df4e99d0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#21 doActivate<false>(QObject*, int, void**) (sender=0x5559df4e9860, signal_index=4, argv=0x7ffc1a65b380) at kernel/qobject.cpp:3886
#22 0x00007f7d3376477e in KWaylandServer::OutputManagementInterface::configurationChangeRequested(KWaylandServer::OutputConfigurationInterface*) (this=0x5559df4e9860, _t1=0x5559e06c5500)
    at src/server/KWaylandServer_autogen/EWIEGA46WW/moc_outputmanagement_interface.cpp:136
#23 0x00007f7d337afddf in KWaylandServer::OutputConfigurationInterface::Private::emitConfigurationChangeRequested() const (this=0x5559e041b530) at /home/nico/kde/src/kwayland-server/src/server/outputconfiguration_interface.cpp:243
#24 0x00007f7d337afa91 in KWaylandServer::OutputConfigurationInterface::Private::applyCallback(wl_client*, wl_resource*) (client=0x5559e06b2ad0, resource=0x5559e0624980)
    at /home/nico/kde/src/kwayland-server/src/server/outputconfiguration_interface.cpp:201
#25 0x00007f7d2e76aa8d in  () at /usr/lib/libffi.so.7
#26 0x00007f7d2e76a01b in  () at /usr/lib/libffi.so.7
#27 0x00007f7d31008f62 in  () at /usr/lib/libwayland-server.so.0
#28 0x00007f7d310052dc in  () at /usr/lib/libwayland-server.so.0
#29 0x00007f7d31006faa in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
#30 0x00007f7d33787865 in KWaylandServer::Display::Private::dispatch() (this=0x5559df4dacf0) at /home/nico/kde/src/kwayland-server/src/server/display.cpp:132
#31 0x00007f7d33787495 in operator()() const (__closure=0x5559df4daf90) at /home/nico/kde/src/kwayland-server/src/server/display.cpp:100
#32 0x00007f7d3378fe6a in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, KWaylandServer::Display::Private::installSocketNotifier()::<lambda()> >::call(struct {...} &, void **) (f=..., arg=0x7ffc1a65bbc0)
    at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:146
#33 0x00007f7d3378f74d in QtPrivate::Functor<KWaylandServer::Display::Private::installSocketNotifier()::<lambda()>, 0>::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x7ffc1a65bbc0)
    at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:256
#34 0x00007f7d3378ddd4 in QtPrivate::QFunctorSlotObject<KWaylandServer::Display::Private::installSocketNotifier()::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *)
    (which=1, this_=0x5559df4daf80, r=0x5559df4c9870, a=0x7ffc1a65bbc0, ret=0x0) at /home/nico/kde/usr/include/QtCore/qobjectdefs_impl.h:443
#35 0x00007f7d323a0ba6 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc1a65bbc0, r=0x5559df4c9870, this=0x5559df4daf80) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#36 doActivate<false>(QObject*, int, void**) (sender=0x5559df4daf00, signal_index=3, argv=argv@entry=0x7ffc1a65bbc0) at kernel/qobject.cpp:3886
#37 0x00007f7d32399f00 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)
    (sender=sender@entry=0x5559df4daf00, m=m@entry=0x7f7d32637a80 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffc1a65bbc0) at kernel/qobject.cpp:3946
#38 0x00007f7d323a3fdf in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) (this=this@entry=0x5559df4daf00, _t1=..., _t2=<optimized out>, _t3=...) at .moc/moc_qsocketnotifier.cpp:178
#39 0x00007f7d323a47db in QSocketNotifier::event(QEvent*) (this=0x5559df4daf00, e=0x7ffc1a65bcd0) at kernel/qsocketnotifier.cpp:302
#40 0x00007f7d32e2d0ef in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x5559df4daf00, e=0x7ffc1a65bcd0) at kernel/qapplication.cpp:3671
Comment 1 Nicolas Fella 2020-06-02 13:41:23 UTC
scaling *both* to 2x works fine
Comment 2 Nicolas Fella 2020-06-02 13:48:05 UTC
Created attachment 128999 [details]
faulty configuration
Comment 3 Nicolas Fella 2020-06-02 13:48:38 UTC
The way the screens overlap seems to be important, so here's a screenshot
Comment 4 Nicolas Fella 2020-06-03 21:29:12 UTC
I think what happens is this:

The first (lower) screen is processed fine.
When the second screen (upper) screen is processed the geometry of the first is subtracted. This results in two region parts. An upper one, above the second screen, and a very narrow one (1 x something pixels) to the left or right of the first screen, because by pure chance the x position of the screen was 1 instead of 0. (I can give you a mediocre drawing if that helps). Both these rects are then checked for being a top screen, which is true for both, although the narrow one arguably shouldn't be considered top. Then further down in the calculation something seems to go wrong because of the very narrow rect
Comment 5 Nicolas Fella 2020-07-19 15:22:30 UTC
*** Bug 424425 has been marked as a duplicate of this bug. ***
Comment 6 Roman Gilg 2020-08-17 21:39:58 UTC
Hey, we also hit this bug in KWinFT:
https://gitlab.com/kwinft/kwinft/-/issues/67#note_397290004

I have a MR for it here:
https://gitlab.com/kwinft/kwinft/-/merge_requests/36

Should apply cleanly to KWin too.
Comment 7 Bug Janitor Service 2020-08-18 17:54:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/193
Comment 8 Nate Graham 2020-11-13 03:49:31 UTC
Shoulda been fixed with https://invent.kde.org/plasma/kwin/-/merge_requests/193. For some reason this didn't get closed.