Bug 441716

Summary: Kwin crashes in KWin::BlurEffect::uploadGeometry() on Present Windows with Radeon Vega 64 GPU
Product: [Plasma] kwin Reporter: Vadim Solomin <vadic0x2a>
Component: effects-present-windowsAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: nate
Priority: NOR Keywords: drkonqi
Version: 5.21.5   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In: 5.25
Sentry Crash Report:

Description Vadim Solomin 2021-08-29 19:16:05 UTC
Application: kwin_x11 (5.21.5)

Qt Version: 5.15.2
Frameworks Version: 5.83.0
Operating System: Linux 5.10.0-8-amd64 x86_64
Windowing System: X11
Drkonqi Version: 5.21.5
Distribution: Debian GNU/Linux bookworm/sid

-- Information about the crash:
- What I was doing when the application crashed:

Activated the Present Windows desktop effect. Also seeing other desktop effects-related crashes.

The crash can be reproduced every time.

-- Backtrace:
Application: KWin (kwin_x11), signal: Aborted

[KCrash Handler]
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x00007f9c908c4537 in __GI_abort () at abort.c:79
#6  0x00007f9c908c440f in __assert_fail_base (fmt=0x7f9c90a2d128 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7f9c8e2a0768 "0 && \"Couldn't find current GLX or EGL context.\\n\"", file=0x7f9c8e2a06c0 "../src/dispatch_common.c", line=858, function=<optimized out>) at assert.c:92
#7  0x00007f9c908d3662 in __GI___assert_fail (assertion=assertion@entry=0x7f9c8e2a0768 "0 && \"Couldn't find current GLX or EGL context.\\n\"", file=file@entry=0x7f9c8e2a06c0 "../src/dispatch_common.c", line=line@entry=858, function=function@entry=0x7f9c8e2a07a0 <__PRETTY_FUNCTION__.0> "epoxy_get_proc_address") at assert.c:101
#8  0x00007f9c8e27f6d7 in epoxy_get_proc_address (name=0x7f9c8e28e019 <entrypoint_strings+4537> "glClientWaitSync") at ../src/dispatch_common.c:858
#9  0x00007f9c8e2524fa in epoxy_glClientWaitSync_resolver () at src/gl_generated_dispatch.c:78852
#10 epoxy_glClientWaitSync_global_rewrite_ptr (sync=0x563a54cad270, flags=1, timeout=1000000000) at src/gl_generated_dispatch.c:49203
#11 0x00007f9c90749bf7 in KWin::GLVertexBufferPrivate::awaitFence(long) (this=this@entry=0x563a53641830, end=140721661753088) at ./libkwineffects/kwinglutils.cpp:1905
#12 0x00007f9c90749ea0 in KWin::GLVertexBufferPrivate::getIdleRange(unsigned long) (this=0x563a53641830, size=576) at ./libkwineffects/kwinglutils.cpp:1943
#13 0x00007f9c907c404a in KWin::BlurEffect::uploadGeometry(KWin::GLVertexBuffer*, QRegion const&, QRegion const&) (this=this@entry=0x563a53e391e0, vbo=vbo@entry=0x563a5340ae70, blurRegion=..., windowRegion=...) at ./effects/blur/blur.cpp:457
#14 0x00007f9c907c5bef in KWin::BlurEffect::doBlur(QRegion const&, QRect const&, float, QMatrix4x4 const&, bool, QRect) (this=this@entry=0x563a53e391e0, shape=..., screen=..., opacity=1, screenProjection=..., isDock=isDock@entry=false, windowRect=...) at ./effects/blur/blur.cpp:651
#15 0x00007f9c907c6713 in KWin::BlurEffect::drawWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) (this=0x563a53e391e0, w=<optimized out>, mask=10, region=..., data=...) at ./effects/blur/blur.cpp:588
#16 0x00007f9c922d10c1 in KWin::EffectsHandlerImpl::drawWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#17 0x00007f9c922d0f53 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#18 0x00007f9c922d0f53 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#19 0x00007f9c9234dcf8 in KWin::Scene::paintWindow(KWin::Scene::Window*, int, QRegion const&, KWin::WindowQuadList const&) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#20 0x00007f9c9234e927 in KWin::Scene::paintSimpleScreen(int, QRegion const&) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#21 0x00007f9c92348abe in KWin::Scene::finalPaintScreen(int, QRegion const&, KWin::ScreenPaintData&) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#22 0x00007f9c922d0d4a in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#23 0x00007f9c922d0d4a in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#24 0x00007f9c9234cedb in KWin::Scene::paintScreen(int*, QRegion const&, QRegion const&, QRegion*, QRegion*, KWin::RenderLoop*, QMatrix4x4 const&, QRect const&, double) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#25 0x00007f9c3c145797 in KWin::SceneOpenGL::paint(int, QRegion const&, QList<KWin::Toplevel*> const&, KWin::RenderLoop*) () at /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.scenes/KWinSceneOpenGL.so
#26 0x00007f9c922a4f80 in KWin::Compositor::handleFrameRequested(KWin::RenderLoop*) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#27 0x00007f9c90f545a6 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc50a94190, r=0x563a532e9160, this=0x563a534bb3f0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#28 doActivate<false>(QObject*, int, void**) (sender=0x7f9c84001e90, signal_index=5, argv=0x7ffc50a94190) at kernel/qobject.cpp:3886
#29 0x00007f9c92262d82 in KWin::RenderLoop::frameRequested(KWin::RenderLoop*) () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#30 0x00007f9c9233c613 in KWin::RenderLoopPrivate::dispatch() () at /usr/lib/x86_64-linux-gnu/libkwin.so.5
#31 0x00007f9c90f545a6 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc50a942c0, r=0x7f9c84001e90, this=0x563a530b3190) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#32 doActivate<false>(QObject*, int, void**) (sender=0x563a53117be8, signal_index=3, argv=argv@entry=0x7ffc50a942c0) at kernel/qobject.cpp:3886
#33 0x00007f9c90f4d900 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=m@entry=0x7f9c911b42a0 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffc50a942c0) at kernel/qobject.cpp:3946
#34 0x00007f9c90f584ba in QTimer::timeout(QTimer::QPrivateSignal) (this=<optimized out>, _t1=...) at .moc/moc_qtimer.cpp:205
#35 0x00007f9c90f49f2f in QObject::event(QEvent*) (this=0x563a53117be8, e=0x7ffc50a94430) at kernel/qobject.cpp:1336
#36 0x00007f9c91a9415f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#37 0x00007f9c90f1dfca in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x563a53117be8, event=0x7ffc50a94430) at kernel/qcoreapplication.cpp:1063
#38 0x00007f9c90f748e3 in QTimerInfoList::activateTimers() (this=this@entry=0x563a52f8ba38) at kernel/qtimerinfo_unix.cpp:643
#39 0x00007f9c90f7201c in QEventDispatcherUNIXPrivate::activateTimers() (this=this@entry=0x563a52f8b9b0) at kernel/qeventdispatcher_unix.cpp:249
#40 0x00007f9c90f72d77 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=<optimized out>, flags=...) at kernel/qeventdispatcher_unix.cpp:516
#41 0x00007f9c8a760b7e in QXcbUnixEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x563a53053360, flags=...) at qxcbeventdispatcher.cpp:60
#42 0x00007f9c90f1c98b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffc50a945d0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#43 0x00007f9c90f24c00 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#44 0x0000563a51392fa9 in main(int, char**) (argc=<optimized out>, argv=0x7ffc50a94858) at ./main_x11.cpp:491
[Inferior 1 (process 3106) detached]

Possible duplicates by query: bug 440777, bug 429344, bug 427384, bug 424911, bug 423222.

Reported using DrKonqi
Comment 1 Nate Graham 2021-08-30 16:36:09 UTC
Seems related to graphics drivers. What GPU hardware are you using?
Comment 2 Vadim Solomin 2021-08-30 20:11:50 UTC
It's Radeon Vega 64 with the amdgpu driver

$ glxinfo
[...]
OpenGL vendor string: AMD
OpenGL renderer string: Radeon RX Vega (VEGA10, DRM 3.40.0, 5.10.0-8-amd64, LLVM 12.0.1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 21.2.1
OpenGL core profile shading language version string: 4.60

(libdrm 2.4.107)

The crashes started after I upgraded from Debian Bullseye (released as stable a couple of weeks ago) to the new testing (Bookworm). Afterwards I've upgraded Mesa and KDE to the versions in unstable but that didn't fix the crashes.

If I switch the compositing backend to XRender, the problem goes away.

Notably I'm not getting any problems from translucency effects in qtcurve or from Steam/proton games (but the latter use DXVK / Vulkan, not OpenGL AFAIK).
Comment 3 Nate Graham 2021-08-30 20:52:15 UTC
If the crash goes away when using XRender, it's definitely a graphics bug. The next question is whether the Mesa drivers are at fault, or whether KWin is using them in a faulty way here. I'll let the KWin developers take over from here and answer that question.
Comment 4 Nate Graham 2022-05-05 15:11:35 UTC
This has been fixed with the rewrite in Plasma 5.25, done by Marco Martin with https://invent.kde.org/plasma/kwin/-/commit/376ee357dbc50fec3b6e71c40938171ddb2e726a!