Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

Multiple monitors with different refresh rates #7

Open
rokups opened this issue May 8, 2019 · 8 comments
Open

Multiple monitors with different refresh rates #7

rokups opened this issue May 8, 2019 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@rokups
Copy link

rokups commented May 8, 2019

I am very excited about this project. Upstream kwin does bad job when it deals with multiple monitors of different refresh rates. They get locked down to lowest available refresh rate. Do you plan to solve this and allow each monitor run at it's own refresh rate? I found that Option "TearFree" "true" option somewhat remedies the situation but it is not perfect. There still is some stuttering, albeit almost inperceivable.

@tildearrow
Copy link
Owner

In a future it may be possible to do this, but the problem is that I feel this will require a major rewrite of the rendering/sync code to be able to handle multiple monitors. Furthermore, if I recall correctly most graphics cards only support synchronizing to a single monitor (which is why e.g. NVIDIA has an environment variable called __GL_SYNC_DISPLAY_DEVICE to set this monitor). It is likely I am wrong, however.

But I will be considering this for an upcoming version.

@rokups
Copy link
Author

rokups commented May 8, 2019

Sounds like this would get real ugly. What if i have 144hz and 60hz monitor, would it be any simpler to run one of them at 120hz and another on 60hz and have them in sync while 60hz monitor would skip every other frame?

@tildearrow
Copy link
Owner

It wouldn't be that simpler. Even if your other display runs at half the framerate there still are minor random timing differences that may cause lots of stuttering for the 60Hz display in some cases.

Right now I will be pretty busy but I am going to take a look at how I can solve this when it's night for me.

@Tony556
Copy link

Tony556 commented May 9, 2019

Found an additional bug with multiple refreshrate monitors!

Left - 144hz

Right - 75hz

Using MaxFPS=144 & RefreshRate=144 in ~/.config/kwinrc (as some apps such as Firefox were still locked to 75(?)hz without it.)

With kwin-lowlatency (AUR 5.15.5-1): https://streamable.com/tqelw

With normal kwin (kwin-5.15.4-1): https://streamable.com/2ynsa

Fullscreening Discord (from the AUR) seems to lock both monitors down to 75hz only when using kwin-lowlatency

@tildearrow
Copy link
Owner

So I just began testing KWin-lowlatency under a multi-monitor setup and just found another bug: if unredirection is on, and an application is full-screen in a monitor, the compositor severely slows down for the other monitors.

@tildearrow tildearrow self-assigned this May 11, 2019
@Tony556
Copy link

Tony556 commented May 11, 2019

Additional note, @tildearrow, is that Discord itself seems to always run at 60(?)fps. I'm not sure if that is part of the bug you and I are experiencing or not (and I doubt the Discord framelock outside of fullscreen is a bug with your implementation).

@tildearrow tildearrow added the help wanted Extra attention is needed label May 13, 2019
@tildearrow tildearrow removed their assignment Jul 5, 2019
tildearrow pushed a commit that referenced this issue Oct 8, 2019
Relevant output:

==18647==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000048 (pc 0x7fbe27fb2db7 bp 0x7ffdcb6d4030 sp 0x7ffdcb6d4020 T0)
==18647==The signal is caused by a READ memory access.
==18647==Hint: address points to the zero page.
    #0 0x7fbe27fb2db6 in KWin::TabBox::TabBox::isDisplayed() const /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/tabbox/tabbox.h:231
    #1 0x7fbe286dbb85 in KWin::ShellClient::destroyClient() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/shell_client.cpp:421
    #2 0x7fbe2871f6a2 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::ShellClient::*)()>::call(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
    #3 0x7fbe2871d43f in void QtPrivate::FunctionPointer<void (KWin::ShellClient::*)()>::call<QtPrivate::List<>, void>(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
    #4 0x7fbe28719d65 in QtPrivate::QSlotObject<void (KWin::ShellClient::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/home/jenkins/install-prefix/lib64/libkwin.so.5+0x1677d65)
    #5 0x7fbe1d7cc357 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3357)
    #6 0x7fbe1fd86970 in KWayland::Server::Resource::unbound() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/build/src/server/KF5WaylandServer_autogen/EWIEGA46WW/moc_resource.cpp:142
    #7 0x7fbe1ff104b4 in KWayland::Server::Resource::Private::unbind(wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:68
    #8 0x7fbe194812ae  (/usr/lib64/libwayland-server.so.0+0x92ae)
    #9 0x7fbe1948132f in wl_resource_destroy (/usr/lib64/libwayland-server.so.0+0x932f)
    #10 0x7fbe1ff1053f in KWayland::Server::Resource::Private::resourceDestroyedCallback(wl_client*, wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:76
    #11 0x7fbe17d26d8c  (/usr/lib64/libffi.so.7+0x6d8c)
    #12 0x7fbe17d26179  (/usr/lib64/libffi.so.7+0x6179)
    #13 0x7fbe19484a5f  (/usr/lib64/libwayland-server.so.0+0xca5f)
    #14 0x7fbe194816d1  (/usr/lib64/libwayland-server.so.0+0x96d1)
    #15 0x7fbe19482c71 in wl_event_loop_dispatch (/usr/lib64/libwayland-server.so.0+0xac71)
    #16 0x7fbe1fde6e50 in KWayland::Server::Display::Private::dispatch() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:148
    #17 0x7fbe1fde82de in KWayland::Server::Display::dispatchEvents(int) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:220
    #18 0x7fbe2872b446 in KWin::WaylandServer::dispatch() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/wayland_server.cpp:616
    #19 0x457e08 in KWin::WaylandTestApplication::~WaylandTestApplication() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/kwin_wayland_test.cpp:91
    #20 0x43500b in main /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/debug_console_test.cpp:530
    #21 0x7fbe1d03bbca in __libc_start_main (/lib64/libc.so.6+0x26bca)
    #22 0x414ed9 in _start (/home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/bin/testDebugConsole+0x414ed9)
tildearrow pushed a commit that referenced this issue Oct 8, 2019
Summary:
When ShellClient tears down, it needs to access RuleBook in order to
discard temporary rules. The problem is that WaylandServer outlives
Workspace and therefore so does ShellClient.

We can't guard against the case when RuleBook::self() is nullptr as it
is vital to discard temporary rules.

This change adjusts termination sequence so all shell clients are
destroyed before Workspace(and thus RuleBook) is gone.

ASAN output:
    ==19922==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000142060 at pc 0x7fbc0fb878bb bp 0x7ffd7d464520 sp 0x7ffd7d464518
    READ of size 8 at 0x606000142060 thread T0
        #0 0x7fbc0fb878ba in QList<KWin::Rules*>::detach() /usr/include/qt5/QtCore/qlist.h:172
        #1 0x7fbc0fb8538d in QList<KWin::Rules*>::begin() /usr/include/qt5/QtCore/qlist.h:324
        #2 0x7fbc0fb808b6 in KWin::RuleBook::discardUsed(KWin::AbstractClient*, bool) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/rules.cpp:1144
        #3 0x7fbc0fe36e32 in KWin::ShellClient::destroyClient() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/shell_client.cpp:435
        #4 0x7fbc0fe7a726 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::ShellClient::*)()>::call(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
        #5 0x7fbc0fe784c3 in void QtPrivate::FunctionPointer<void (KWin::ShellClient::*)()>::call<QtPrivate::List<>, void>(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
        #6 0x7fbc0fe74de9 in QtPrivate::QSlotObject<void (KWin::ShellClient::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/home/jenkins/install-prefix/lib64/libkwin.so.5+0x1677de9)
        #7 0x7fbc04f27357 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3357)
        #8 0x7fbc074e1970 in KWayland::Server::Resource::unbound() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/build/src/server/KF5WaylandServer_autogen/EWIEGA46WW/moc_resource.cpp:142
        #9 0x7fbc0766b4b4 in KWayland::Server::Resource::Private::unbind(wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:68
        #10 0x7fbc00bdc2ae  (/usr/lib64/libwayland-server.so.0+0x92ae)
        #11 0x7fbc00bdc32f in wl_resource_destroy (/usr/lib64/libwayland-server.so.0+0x932f)
        #12 0x7fbc0766b53f in KWayland::Server::Resource::Private::resourceDestroyedCallback(wl_client*, wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:76
        #13 0x7fbbff481d8c  (/usr/lib64/libffi.so.7+0x6d8c)
        #14 0x7fbbff481179  (/usr/lib64/libffi.so.7+0x6179)
        #15 0x7fbc00bdfa5f  (/usr/lib64/libwayland-server.so.0+0xca5f)
        #16 0x7fbc00bdc6d1  (/usr/lib64/libwayland-server.so.0+0x96d1)
        #17 0x7fbc00bddc71 in wl_event_loop_dispatch (/usr/lib64/libwayland-server.so.0+0xac71)
        #18 0x7fbc07541e50 in KWayland::Server::Display::Private::dispatch() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:148
        #19 0x7fbc075432de in KWayland::Server::Display::dispatchEvents(int) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:220
        #20 0x7fbc0fe864ca in KWin::WaylandServer::dispatch() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/wayland_server.cpp:616
        #21 0x451ce0 in KWin::WaylandTestApplication::~WaylandTestApplication() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/kwin_wayland_test.cpp:91
        #22 0x42faa1 in main /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/globalshortcuts_test.cpp:381
        #23 0x7fbc04796bca in __libc_start_main (/lib64/libc.so.6+0x26bca)
        #24 0x413ea9 in _start (/home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/bin/testGlobalShortcuts+0x413ea9)

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22821
tildearrow pushed a commit that referenced this issue Oct 8, 2019
Currently internal window test fails because several internal clients
outlive tests where each one of them was created. Given that the scene
doesn't specify the context object when it creates screenScaleChanged
connection, we may call windowGeometryShapeChanged on a deleted scene
object.

ASAN output:

    =================================================================
    ==23416==ERROR: AddressSanitizer: heap-use-after-free on address 0x60800005ffe0 at pc 0x7fdfb0451c26 bp 0x7fffc32fefb0 sp 0x7fffc32fefa8
    READ of size 8 at 0x60800005ffe0 thread T0
        #0 0x7fdfb0451c25 in QHash<KWin::Toplevel*, KWin::Scene::Window*>::findNode(KWin::Toplevel* const&, unsigned int*) const /usr/include/qt5/QtCore/qhash.h:933
        #1 0x7fdfb044c1eb in QHash<KWin::Toplevel*, KWin::Scene::Window*>::contains(KWin::Toplevel* const&) const /usr/include/qt5/QtCore/qhash.h:908
        #2 0x7fdfb04369c1 in KWin::Scene::windowGeometryShapeChanged(KWin::Toplevel*) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/scene.cpp:440
        #3 0x7fdfb045c017 in void std::__invoke_impl<void, void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&>(std::__invoke_memfun_deref, void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&) /usr/include/c++/9/bits/invoke.h:73
        #4 0x7fdfb045ba9c in std::__invoke_result<void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&>::type std::__invoke<void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&>(void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&) /usr/include/c++/9/bits/invoke.h:95
        #5 0x7fdfb045bc84 in void std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) /usr/include/c++/9/functional:400
        #6 0x7fdfb045b7c0 in void std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>::operator()<, void>() /usr/include/c++/9/functional:484
        #7 0x7fdfb045b3c2 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)> >::call(std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>&, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
        #8 0x7fdfb045abd4 in void QtPrivate::Functor<std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>, 0>::call<QtPrivate::List<>, void>(std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>&, void*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
        #9 0x7fdfb045a5b6 in QtPrivate::QFunctorSlotObject<std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt5/QtCore/qobjectdefs_impl.h:439
        #10 0x7fdfa5794137 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3137)
        #11 0x7fdfafeea2ca in KWin::Toplevel::screenScaleChanged() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/kwin_autogen/EWIEGA46WW/moc_toplevel.cpp:834
        #12 0x7fdfb0425712 in KWin::Toplevel::checkScreen() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/toplevel.cpp:538
        #13 0x7fdfafee3221 in KWin::Toplevel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/kwin_autogen/EWIEGA46WW/moc_toplevel.cpp:371
        #14 0x7fdfa5793fd7 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b2fd7)
        #15 0x7fdfafedefca in KWin::Screens::changed() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/kwin_autogen/EWIEGA46WW/moc_screens.cpp:276
        #16 0x7fdf9a199281 in operator() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/platforms/virtual/screens_virtual.cpp:45
        #17 0x7fdf9a199c7b in call /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
        #18 0x7fdf9a199b50 in call<QtPrivate::List<bool>, void> /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
        #19 0x7fdf9a199afc in impl /usr/include/qt5/QtCore/qobjectdefs_impl.h:439
        #20 0x7fdfa5794137 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3137)
        #21 0x7fdf9a17a37b in KWin::VirtualBackend::virtualOutputsSet(bool) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/plugins/platforms/virtual/KWinWaylandVirtualBackend_autogen/EWIEGA46WW/moc_virtual_backend.cpp:177
        #22 0x7fdf9a18c476 in KWin::VirtualBackend::setVirtualOutputs(int, QVector<QRect>, QVector<int>) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/platforms/virtual/virtual_backend.cpp:141
        #23 0x7fdf9a1794e2 in KWin::VirtualBackend::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/plugins/platforms/virtual/KWinWaylandVirtualBackend_autogen/EWIEGA46WW/moc_virtual_backend.cpp:94
        #24 0x7fdfa577794a in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib64/libQt5Core.so.5+0x29694a)
        #25 0x7fdfa57790d1 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (/usr/lib64/libQt5Core.so.5+0x2980d1)
        #26 0x45a3e0 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) /usr/include/qt5/QtCore/qobjectdefs.h:444
        #27 0x44bf37 in KWin::InternalWindowTest::testScale() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/internal_window.cpp:693
        #28 0x4562ec in KWin::InternalWindowTest::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/autotests/integration/testInternalWindow_autogen/include/internal_window.moc:169
        #29 0x7fdfa577794a in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib64/libQt5Core.so.5+0x29694a)
        #30 0x7fdfaf047962  (/usr/lib64/libQt5Test.so.5+0x19962)
        #31 0x7fdfaf048352  (/usr/lib64/libQt5Test.so.5+0x1a352)
        #32 0x7fdfaf048910  (/usr/lib64/libQt5Test.so.5+0x1a910)
        #33 0x7fdfaf048cda in QTest::qRun() (/usr/lib64/libQt5Test.so.5+0x1acda)
        #34 0x7fdfaf048edb in QTest::qExec(QObject*, int, char**) (/usr/lib64/libQt5Test.so.5+0x1aedb)
        #35 0x455d7b in main /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/internal_window.cpp:807
        #36 0x7fdfa5002bca in __libc_start_main (/lib64/libc.so.6+0x26bca)
        #37 0x415029 in _start (/home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/bin/testInternalWindow+0x415029)

    0x60800005ffe0 is located 64 bytes inside of 96-byte region [0x60800005ffa0,0x608000060000)
    freed by thread T0 here:
        #0 0x7fdfb2042595 in operator delete(void*, unsigned long) (/usr/lib64/libasan.so.5+0x10d595)
        #1 0x7fdf98774c4e in KWin::SceneQPainter::~SceneQPainter() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/scenes/qpainter/scene_qpainter.cpp:70
        #2 0x7fdfb03fef41 in KWin::Compositor::stop() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:451
        #3 0x7fdfb03fffe6 in KWin::Compositor::reinitialize() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:527
        #4 0x7fdfb03ffe2f in KWin::Compositor::configChanged() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:517
        #5 0x7fdfaffaf481 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::Compositor::*)()>::call(void (KWin::Compositor::*)(), KWin::Compositor*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
        #6 0x7fdfaffa4deb in void QtPrivate::FunctionPointer<void (KWin::Compositor::*)()>::call<QtPrivate::List<>, void>(void (KWin::Compositor::*)(), KWin::Compositor*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
        #7 0x7fdfaff9c765 in QtPrivate::QSlotObject<void (KWin::Compositor::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt5/QtCore/qobjectdefs_impl.h:414
        #8 0x7fdfa5794137 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3137)
        #9 0x7fdfafed441e in KWin::Options::configChanged() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/kwin_autogen/EWIEGA46WW/moc_options.cpp:1790
        #10 0x7fdfb02584c6 in KWin::Options::updateSettings() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/options.cpp:772
        #11 0x7fdfaff461db in KWin::Workspace::slotReconfigure() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/workspace.cpp:897
        #12 0x446f67 in KWin::InternalWindowTest::testModifierClickUnrestrictedMove() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/internal_window.cpp:620
        #13 0x45624d in KWin::InternalWindowTest::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/autotests/integration/testInternalWindow_autogen/include/internal_window.moc:166
        #14 0x7fdfa577794a in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib64/libQt5Core.so.5+0x29694a)
        #15 0x7fdfaf047962  (/usr/lib64/libQt5Test.so.5+0x19962)
        #16 0x7fdfaf048352  (/usr/lib64/libQt5Test.so.5+0x1a352)

    previously allocated by thread T0 here:
        #0 0x7fdfb204110f in operator new(unsigned long) (/usr/lib64/libasan.so.5+0x10c10f)
        #1 0x7fdf98774992 in KWin::SceneQPainter::createScene(QObject*) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/scenes/qpainter/scene_qpainter.cpp:58
        #2 0x7fdf9878db95 in KWin::QPainterFactory::create(QObject*) const /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/scenes/qpainter/scene_qpainter.cpp:870
        #3 0x7fdfb03f9488 in KWin::Compositor::setupStart() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:238
        #4 0x7fdfb0404ca4 in KWin::WaylandCompositor::start() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:862
        #5 0x7fdfaffaf481 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::Compositor::*)()>::call(void (KWin::Compositor::*)(), KWin::Compositor*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
        #6 0x7fdfaffa4deb in void QtPrivate::FunctionPointer<void (KWin::Compositor::*)()>::call<QtPrivate::List<>, void>(void (KWin::Compositor::*)(), KWin::Compositor*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
        #7 0x7fdfaff9c765 in QtPrivate::QSlotObject<void (KWin::Compositor::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt5/QtCore/qobjectdefs_impl.h:414
        #8 0x7fdfa57a0df1  (/usr/lib64/libQt5Core.so.5+0x2bfdf1)

    SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/qt5/QtCore/qhash.h:933 in QHash<KWin::Toplevel*, KWin::Scene::Window*>::findNode(KWin::Toplevel* const&, unsigned int*) const
    Shadow bytes around the buggy address:
      0x0c1080003fa0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
      0x0c1080003fb0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
      0x0c1080003fc0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
      0x0c1080003fd0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
      0x0c1080003fe0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
    =>0x0c1080003ff0: fa fa fa fa fd fd fd fd fd fd fd fd[fd]fd fd fd
      0x0c1080004000: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd
      0x0c1080004010: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 05 fa
      0x0c1080004020: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
      0x0c1080004030: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 04
      0x0c1080004040: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 01
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07
      Heap left redzone:       fa
      Freed heap region:       fd
      Stack left redzone:      f1
      Stack mid redzone:       f2
      Stack right redzone:     f3
      Stack after return:      f5
      Stack use after scope:   f8
      Global redzone:          f9
      Global init order:       f6
      Poisoned by user:        f7
      Container overflow:      fc
      Array cookie:            ac
      Intra object redzone:    bb
      ASan internal:           fe
      Left alloca redzone:     ca
      Right alloca redzone:    cb
      Shadow gap:              cc
    ==23416==ABORTING
    (EE) failed to read Wayland events: Connection reset by peer
tildearrow pushed a commit that referenced this issue Oct 8, 2019
Summary:
m_currentTemp can be equal to targetTemp when resetSlowUpdateTimer is
called. resetSlowUpdateTimer doesn't handle that case, which results
in an FP exception being raised:

    ==20103==ERROR: AddressSanitizer: FPE on unknown address 0x7f40857d5ca6 (pc 0x7f40857d5ca6 bp 0x7ffccd95c330 sp 0x7ffccd95c220 T0)
        #0 0x7f40857d5ca5 in KWin::ColorCorrect::Manager::resetSlowUpdateTimer() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:417
        #1 0x7f40857d521d in KWin::ColorCorrect::Manager::resetSlowUpdateStartTimer() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:388
        #2 0x7f40857d42d5 in KWin::ColorCorrect::Manager::resetQuickAdjustTimer() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:324
        #3 0x7f40857d3ac1 in KWin::ColorCorrect::Manager::resetAllTimers() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:286
        #4 0x7f40857d0311 in KWin::ColorCorrect::Manager::hardReset() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:152
        #5 0x7f40857d038d in KWin::ColorCorrect::Manager::reparseConfigAndReset() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:159
        #6 0x420e75 in ColorCorrectNightColorTest::testConfigRead() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/colorcorrect_nightcolor_test.cpp:126
        #7 0x4326b4 in ColorCorrectNightColorTest::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/autotests/integration/testColorCorrectNightColor_waylandonly_autogen/include/colorcorrect_nightcolor_test.moc:98
        #8 0x7f407a80a94a in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib64/libQt5Core.so.5+0x29694a)
        #9 0x7f40840a8962  (/usr/lib64/libQt5Test.so.5+0x19962)
        #10 0x7f40840a9352  (/usr/lib64/libQt5Test.so.5+0x1a352)
        #11 0x7f40840a9910  (/usr/lib64/libQt5Test.so.5+0x1a910)
        #12 0x7f40840a9cda in QTest::qRun() (/usr/lib64/libQt5Test.so.5+0x1acda)
        #13 0x7f40840a9edb in QTest::qExec(QObject*, int, char**) (/usr/lib64/libQt5Test.so.5+0x1aedb)
        #14 0x432428 in main /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/colorcorrect_nightcolor_test.cpp:338
        #15 0x7f407a095bca in __libc_start_main (/lib64/libc.so.6+0x26bca)
        #16 0x413ea9 in _start (/home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/bin/testColorCorrectNightColor_waylandonly+0x413ea9)

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23914
tildearrow pushed a commit that referenced this issue May 5, 2020
Summary:
BUG: 420077

Sample stack traces :

From bug:

  #2  QImage::copy (this=this@entry=0x558117775e20, r=...) at image/qimage.cpp:1172
  #3  0x00007f22d0a24cdf in QImage::detach (this=this@entry=0x558117775e20) at image/qimage.cpp:1091
  #4  0x00007f22d0a25ae0 in QImage::fill (this=0x558117775e20, color=...) at image/qimage.cpp:1806
  #5  0x00007f22d0a25f5f in QImage::fill (this=this@entry=0x558117775e20, color=color@entry=Qt::transparent) at image/qimage.cpp:1780
  #6  0x00007f22bf3bdffd in KWin::DrmOutput::updateCursor (this=0x5581176fb780) at ./plugins/platforms/drm/drm_output.cpp:175
  #7  0x00007f22bf3b0e55 in KWin::DrmBackend::updateCursor (this=0x558117669b60) at ./plugins/platforms/drm/drm_backend.cpp:701

Locally reproduced:

  #0  0x00007f360611e159 in KWayland::Server::OutputDeviceInterface::transform() const (this=<optimized out>)
      at /home/meven/kde/src/kwayland/src/server/outputdevice_interface.cpp:590
  #1  0x00007f3607438059 in KWin::AbstractWaylandOutput::transform() const (this=this@entry=0x5645bed10f90) at /home/meven/kde/src/kwin/abstract_wayland_output.cpp:317
  #2  0x00007f35ecd8acd3 in KWin::DrmOutput::matrixDisplay(QSize const&) const (this=0x5645bed10f90, s=...)
      at /home/meven/kde/src/kwin/plugins/platforms/drm/drm_output.cpp:155
  #3  0x00007f35ecd8efa9 in KWin::DrmOutput::updateCursor() (this=<optimized out>) at /home/meven/kde/src/kwin/plugins/platforms/drm/drm_output.cpp:179
  #4  0x00007f35ecd81db5 in KWin::DrmBackend::updateCursor() (this=0x5645bec743a0) at /home/meven/kde/src/kwin/plugins/platforms/drm/drm_backend.cpp:701
  #5  0x00007f36049e7fe7 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
  #6  0x00007f36075ee43f in KWin::Cursors::currentCursorChanged(KWin::Cursor*) (this=<optimized out>, _t1=<optimized out>)
      at /home/meven/kde/build/kwin/kwin_autogen/EWIEGA46WW/moc_cursor.cpp:385

Test Plan: Could not reproduce

Reviewers: #kwin, zzag, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: ngraham, apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28889
@svenmauch
Copy link

So I just began testing KWin-lowlatency under a multi-monitor setup and just found another bug: if unredirection is on, and an application is full-screen in a monitor, the compositor severely slows down for the other monitors.

I just noticed the same issue with my setup and came across this issue. I am using three monitors, all run on 60 Hz. If one of them has a full screen app running, the others seem to lock to 15 fps.

Is there a more specific issue I can refer to in case more info is needed?

@Kodehawa
Copy link

Additional note, @tildearrow, is that Discord itself seems to always run at 60(?)fps. I'm not sure if that is part of the bug you and I are experiencing or not (and I doubt the Discord framelock outside of fullscreen is a bug with your implementation).

This is actually an issue on Chromium. Chromium is locked to 60fps on multi-monitor setups, somehow, and Discord uses Electron, which uses Chromium.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants