Bug 440464

Summary: Screen rotation broken on wayland; KWin crashes in KWin::LanczosFilter::~LanczosFilter()
Product: [Plasma] kwin Reporter: log4ewa
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: crash CC: log4ewa, nate
Priority: NOR    
Version: 5.22.4   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description log4ewa 2021-07-31 21:49:37 UTC
SUMMARY
I am unable to rotate the screen under a wayland session. The screen will always stay in non-rotated mode, regardless of which rotation I select. Sometimes, the desktop will crash and restart upon applying the setting.

STEPS TO REPRODUCE
1. Open display settings and under manual orientation pick 90° clockwise, counter clockwise or upside down.
2. Click Apply.

OBSERVED RESULT
The screen either doesn't rotate, or desktop crashes, blinking to text mode before reloading.

EXPECTED RESULT
The screen is rotated to selected setting.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 5.22 (User Edition)
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
- The system is running on nvidia proprietary driver, version 470.
- I have two displays connected and the behavior is the same on first and second one, as well as when disabling one.
- I have found reports of similar issues on KDE forums in regards to Plasma 4.21 (https://forum.kde.org/viewtopic.php?f=111&t=170833). Note that a similar bug was supposedly fixed in 1.19, so this could be a regression (https://bugs.kde.org/show_bug.cgi?id=389665).
Comment 1 Nate Graham 2021-08-02 20:21:30 UTC
Sounds like KWin itself is crashing. Any chance you could get a backtrace of the crash? See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports, particularly the section about coredumpctl.
Comment 2 log4ewa 2021-08-04 00:13:43 UTC
(In reply to Nate Graham from comment #1)
> Sounds like KWin itself is crashing. Any chance you could get a backtrace of
> the crash?

Managed to get one. This took a few unsuccessful rotation attempts, turning second monitor on and off and moving screens around, but it happened eventually.

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f60fa9a792e in __GI_abort () at abort.c:100
#2  0x00007f60fa9a7729 in __assert_fail_base (fmt=0x7f60fab3d588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7f60faf2b768 "0 && \"Couldn't find current GLX or EGL context.\\n\"", file=0x7f60faf2b6c0 "../src/dispatch_common.c", line=863, function=<optimized out>) at assert.c:92
#3  0x00007f60fa9b8f36 in __GI___assert_fail (assertion=assertion@entry=0x7f60faf2b768 "0 && \"Couldn't find current GLX or EGL context.\\n\"", file=file@entry=0x7f60faf2b6c0 "../src/dispatch_common.c", line=line@entry=863, 
    function=function@entry=0x7f60faf2b7a0 <__PRETTY_FUNCTION__.38427> "epoxy_get_proc_address") at assert.c:101
#4  0x00007f60faf09a9f in epoxy_get_proc_address (name=0x7f60faf1a4d9 <entrypoint_strings+9849> "glDeleteProgram") at ../src/dispatch_common.c:863
#5  epoxy_get_proc_address (name=0x7f60faf1a4d9 <entrypoint_strings+9849> "glDeleteProgram") at ../src/dispatch_common.c:839
#6  0x00007f60faedf6da in epoxy_glDeleteProgram_resolver () at src/gl_generated_dispatch.c:81668
#7  epoxy_glDeleteProgram_global_rewrite_ptr (program=37) at src/gl_generated_dispatch.c:49458
#8  0x00007f60f402349a in QScopedPointerDeleter<KWin::GLShader>::cleanup (pointer=0x5606cf626e80) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qscopedpointer.h:52
#9  QScopedPointer<KWin::GLShader, QScopedPointerDeleter<KWin::GLShader> >::~QScopedPointer (this=0x5606cf0f0bd8, __in_chrg=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qscopedpointer.h:107
#10 KWin::LanczosFilter::~LanczosFilter (this=0x5606cf0f0bb0, __in_chrg=<optimized out>) at ./src/plugins/scenes/opengl/lanczosfilter.cpp:47
#11 0x00007f60f40234ed in KWin::LanczosFilter::~LanczosFilter (this=0x5606cf0f0bb0, __in_chrg=<optimized out>) at ./src/plugins/scenes/opengl/lanczosfilter.cpp:47
#12 0x00007f60f4025ef1 in KWin::SceneOpenGL2::<lambda()>::operator() (__closure=0x5606cf75fd50) at ./src/plugins/scenes/opengl/scene_opengl.cpp:1093
#13 QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, KWin::SceneOpenGL2::performPaintWindow(KWin::EffectWindowImpl*, int, const QRegion&, KWin::WindowPaintData&)::<lambda()> >::call (arg=<optimized out>, f=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:146
#14 QtPrivate::Functor<KWin::SceneOpenGL2::performPaintWindow(KWin::EffectWindowImpl*, int, const QRegion&, KWin::WindowPaintData&)::<lambda()>, 0>::call<QtPrivate::List<>, void> (arg=<optimized out>, f=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:256
#15 QtPrivate::QFunctorSlotObject<KWin::SceneOpenGL2::performPaintWindow(KWin::EffectWindowImpl*, int, const QRegion&, KWin::WindowPaintData&)::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=0x5606cf75fd40, 
    r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:443
#16 0x00007f60fb26377e in QtPrivate::QSlotObjectBase::call (a=0x7ffe2fb14ac0, r=0x5606ce0224f0, this=0x5606cf75fd40) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#17 doActivate<false> (sender=0x5606cdf53f50, signal_index=4, argv=0x7ffe2fb14ac0) at kernel/qobject.cpp:3886
#18 0x00007f60fb25cb47 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7f60fceb8f00 <KWin::Screens::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3946
#19 0x00007f60fcbf0347 in KWin::Screens::changed (this=<optimized out>) at ./obj-x86_64-linux-gnu/src/kwin_autogen/EWIEGA46WW/moc_screens.cpp:272
#20 0x00007f60fcc2d6df in KWin::AbstractWaylandOutput::applyChanges (this=0x5606cdef89d0, changeSet=0x5606cf37e2b0) at ./src/screens.h:227
#21 0x00007f60fcce4763 in KWin::Platform::requestOutputsChange (this=0x5606cdee1620, config=0x5606cf796460) at ./src/platform.cpp:133
#22 0x00007f60fb26377e in QtPrivate::QSlotObjectBase::call (a=0x7ffe2fb14d80, r=0x5606cdecd6a0, this=0x5606cdedddc0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#23 doActivate<false> (sender=0x5606cdeddc90, signal_index=3, argv=0x7ffe2fb14d80) at kernel/qobject.cpp:3886
#24 0x00007f60fbc479a3 in KWaylandServer::OutputManagementInterface::configurationChangeRequested(KWaylandServer::OutputConfigurationInterface*) () from /lib/x86_64-linux-gnu/libKWaylandServer.so.5
#25 0x00007f60f7fc1ff5 in ffi_call_unix64 () at ../src/x86/unix64.S:101
#26 0x00007f60f7fc140a in ffi_call_int (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>) at ../src/x86/ffi64.c:669
#27 0x00007f60f93d4628 in wl_closure_invoke (closure=closure@entry=0x5606cf779850, flags=flags@entry=2, target=<optimized out>, target@entry=0x5606ce2b1ba0, opcode=opcode@entry=5, data=<optimized out>, data@entry=0x5606ceee65d0) at ../src/connection.c:1018
#28 0x00007f60f93d09e2 in wl_client_connection_data (fd=<optimized out>, mask=<optimized out>, data=0x5606ceee65d0) at ../src/wayland-server.c:432
#29 0x00007f60f93d265a in wl_event_loop_dispatch (loop=0x5606cdeac010, timeout=<optimized out>) at ../src/event-loop.c:1027
#30 0x00007f60fbc5a64c in KWaylandServer::Display::dispatchEvents() () from /lib/x86_64-linux-gnu/libKWaylandServer.so.5
#31 0x00007f60fb26377e in QtPrivate::QSlotObjectBase::call (a=0x7ffe2fb15490, r=0x5606cdec9bd0, this=0x5606ce377050) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#32 doActivate<false> (sender=0x5606cdeccf90, signal_index=3, argv=0x7ffe2fb15490) at kernel/qobject.cpp:3886
#33 0x00007f60fb25cb47 in QMetaObject::activate (sender=sender@entry=0x5606cdeccf90, m=m@entry=0x7f60fb4c8b40 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffe2fb15490) at kernel/qobject.cpp:3946
#34 0x00007f60fb267803 in QSocketNotifier::activated (this=this@entry=0x5606cdeccf90, _t1=..., _t2=<optimized out>, _t3=...) at .moc/moc_qsocketnotifier.cpp:178
#35 0x00007f60fb267fa3 in QSocketNotifier::event (this=0x5606cdeccf90, e=0x7ffe2fb15760) at kernel/qsocketnotifier.cpp:302
#36 0x00007f60fbee3dc3 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#37 0x00007f60fbeecbb8 in QApplication::notify(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#38 0x00007f60fb22c75a in QCoreApplication::notifyInternal2 (receiver=0x5606cdeccf90, event=0x7ffe2fb15760) at ../../include/QtCore/5.15.3/QtCore/private/../../../../../src/corelib/thread/qthread_p.h:325
#39 0x00007f60fb2841db in QEventDispatcherUNIXPrivate::activateSocketNotifiers (this=0x5606cdea38e0) at kernel/qeventdispatcher_unix.cpp:304
#40 0x00007f60fb28463b in QEventDispatcherUNIX::processEvents (this=<optimized out>, flags=...) at kernel/qeventdispatcher_unix.cpp:511
#41 0x00005606ccec2f91 in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
#42 0x00007f60fb22b25b in QEventLoop::exec (this=this@entry=0x7ffe2fb158f0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:141
#43 0x00007f60fb233414 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#44 0x00005606cce50054 in main (argc=<optimized out>, argv=<optimized out>) at ./src/main_wayland.cpp:727

Aside from this, I managed to confirm that screen rotation in wayland works fine on a fresh install of KDE Neon on an AMD laptop, so this could be nvidia-specific.
Comment 3 Vlad Zahorodnii 2022-06-24 08:10:14 UTC
The relevant code where kwin used to crash has been dropped.