Summary: | Crash in ContrastEffect::uploadRegion | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Marc Schiffbauer <mschiff> |
Component: | effects-various | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | 2012gdwu+k2, 293153, 988alex, aleksandar.vassilev, ascaris, avemilia, bartovic.milan, const, dakota.sullivan, DanielHalens, dimanne, djaler1+kde, elxreno, ffiarpg+kdebugs, jasonsociety, jesaenh, jesterflint007, jodr666, jonathanirvine29, jpalecek, k21gcy20j, kde, KVAnton.WEB, laurent, matt.fagnani, michaelsbarrett, mikon55592, nate, null, piercing-huber, schneider.andi, software, sub, superape96, szotsaki, t.kijas, wesley.graba, zawertun |
Priority: | VHI | Keywords: | drkonqi |
Version: | 5.8.3 | Flags: | vlad.zahorodnii:
Intel-
vlad.zahorodnii: NVIDIA+ |
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/plasma/kwin/commit/ddd60a0c1b6a6bbf7a1ba7e34cdc63582048b862 | Version Fixed In: | 5.27 |
Sentry Crash Report: | |||
Attachments: |
New crash information added by DrKonqi
New crash information added by DrKonqi New crash information added by DrKonqi A crude patch which reinitializes the VBO New crash information added by DrKonqi New crash information added by DrKonqi |
Description
Marc Schiffbauer
2016-11-10 20:45:27 UTC
which mesa version are you using? Hi Martin, great to see my report has your attention ;-) My mesa version is 13.0.0. Please tell me when you need further information TIA -Marc > My mesa version is 13.0.0. Please tell me when you need further information
That's what I feared :-( Mesa 13 has a change that when a graphics reset happens some methods will return a nullptr. And I think you run into that problem here. To fix will be difficult as it can be many calls affected, so it will be a little bit like whack-a-mole.
Important question: are you able to trigger the problem at will? If yes that could end up super helpful as I could provide patches which should address it.
*** Bug 373248 has been marked as a duplicate of this bug. *** Created attachment 113741 [details]
New crash information added by DrKonqi
kwin_x11 (5.13.2) using Qt 5.11.0
- What I was doing when the application crashed:
Switching back from tty1 to tty7
I am running KDE Neon on a Lenovo ThinkPad T470 laptop with NVIDIA GeForce 940MX hybrid graphics, with two external displays connected through a dock.
This issue just started happening after upgrading xorg to the HWE version so that I could stop screen tearing.
When I was running xorg 1.18 I didn't have any issues regardless of if the NVIDIA GPU was enabled or not.
I'm also running the latest nvidia-390 display drivers.
-- Backtrace (Reduced):
#6 KWin::ContrastEffect::uploadRegion (this=this@entry=0x19c8550, map=@0x7ffdc02346a8: 0x7f2be05c56f0, region=...) at /workspace/build/effects/backgroundcontrast/contrast.cpp:281
#7 0x00007f2c02c009a4 in KWin::ContrastEffect::uploadGeometry (this=this@entry=0x19c8550, vbo=vbo@entry=0x191a200, region=...) at /workspace/build/effects/backgroundcontrast/contrast.cpp:299
#8 0x00007f2c02c01ea4 in KWin::ContrastEffect::doContrast (this=this@entry=0x19c8550, w=w@entry=0x226a940, shape=..., screen=..., opacity=1, screenProjection=...) at /workspace/build/effects/backgroundcontrast/contrast.cpp:442
#9 0x00007f2c02c02929 in KWin::ContrastEffect::drawWindow (this=this@entry=0x19c8550, w=w@entry=0x226a940, mask=mask@entry=2, region=..., data=...) at /workspace/build/effects/backgroundcontrast/contrast.cpp:419
#10 0x00007f2c05e9a16e in KWin::EffectsHandlerImpl::drawWindow (this=0x19c2e90, w=w@entry=0x226a940, mask=mask@entry=2, region=..., data=...) at /workspace/build/effects.cpp:456
*** Bug 396227 has been marked as a duplicate of this bug. *** From the comment above: Other report was on resume from suspend, which means it's probably fallout from that nvidia graphics reset and us not resetting the vertex. I'll look into it. I just want to add that I am seeing this crash as well, after resume w/ NVidia 390.77 driver, and it seems vbo.d->persistent is true, but vbo.d->map is not pointing to accessible memory (although set). Created attachment 115311 [details]
New crash information added by DrKonqi
kwin_x11 (5.14.80) using Qt 5.11.2
- What I was doing when the application crashed:
Resuming out os suspend mode. Using NVIDIA's 390.86 on opensuse tumbleweed.
-- Backtrace (Reduced):
#6 0x00007f4ab29efb11 in KWin::ContrastEffect::uploadRegion (this=this@entry=0x5575e168cde0, map=@0x7fffa3865868: 0x7f4a991f4f50, region=...) at /usr/include/qt5/QtCore/qrect.h:269
#7 0x00007f4ab29efbd4 in KWin::ContrastEffect::uploadGeometry (this=this@entry=0x5575e168cde0, vbo=vbo@entry=0x5575e15a3dd0, region=...) at /usr/src/debug/kwin5-5.14.80git.20180928T202124~72ad5dc89-6.1.x86_64/effects/backgroundcontrast/contrast.cpp:299
#8 0x00007f4ab29f1135 in KWin::ContrastEffect::doContrast (this=this@entry=0x5575e168cde0, w=w@entry=0x5575e1b736d0, shape=..., screen=..., opacity=1, screenProjection=...) at /usr/src/debug/kwin5-5.14.80git.20180928T202124~72ad5dc89-6.1.x86_64/effects/backgroundcontrast/contrast.cpp:442
#9 0x00007f4ab29f1b13 in KWin::ContrastEffect::drawWindow (this=this@entry=0x5575e168cde0, w=w@entry=0x5575e1b736d0, mask=mask@entry=2, region=..., data=...) at /usr/src/debug/kwin5-5.14.80git.20180928T202124~72ad5dc89-6.1.x86_64/effects/backgroundcontrast/contrast.cpp:419
#10 0x00007f4ab3f09f13 in KWin::EffectsHandlerImpl::drawWindow (this=this@entry=0x5575e1728b10, w=w@entry=0x5575e1b736d0, mask=mask@entry=2, region=..., data=...) at /usr/src/debug/kwin5-5.14.80git.20180928T202124~72ad5dc89-6.1.x86_64/effects.cpp:456
*** Bug 399800 has been marked as a duplicate of this bug. *** *** Bug 399876 has been marked as a duplicate of this bug. *** *** Bug 402976 has been marked as a duplicate of this bug. *** Created attachment 117511 [details]
New crash information added by DrKonqi
kwin_x11 (5.14.5) using Qt 5.11.2
- What I was doing when the application crashed:
Just open my laptop after suspen.
This happens to me only when second monitor connected to my laptop
-- Backtrace (Reduced):
#6 KWin::ContrastEffect::uploadRegion (this=this@entry=0x564330207890, map=@0x7ffdb34cd698: 0x7f2954425790, region=...) at ./effects/backgroundcontrast/contrast.cpp:281
#7 0x00007f2975638404 in KWin::ContrastEffect::uploadGeometry (this=this@entry=0x564330207890, vbo=vbo@entry=0x5643303b5230, region=...) at ./effects/backgroundcontrast/contrast.cpp:299
#8 0x00007f2975639965 in KWin::ContrastEffect::doContrast (this=this@entry=0x564330207890, w=w@entry=0x564330563d50, shape=..., screen=..., opacity=0, screenProjection=...) at ./effects/backgroundcontrast/contrast.cpp:442
#9 0x00007f297563a35b in KWin::ContrastEffect::drawWindow (this=this@entry=0x564330207890, w=w@entry=0x564330563d50, mask=mask@entry=2, region=..., data=...) at ./effects/backgroundcontrast/contrast.cpp:419
#10 0x00007f29788ab11e in KWin::EffectsHandlerImpl::drawWindow (this=this@entry=0x5643303fd890, w=w@entry=0x564330563d50, mask=mask@entry=2, region=..., data=...) at ./effects.cpp:456
*** Bug 403863 has been marked as a duplicate of this bug. *** *** Bug 396264 has been marked as a duplicate of this bug. *** *** Bug 405248 has been marked as a duplicate of this bug. *** *** Bug 409733 has been marked as a duplicate of this bug. *** *** Bug 409900 has been marked as a duplicate of this bug. *** *** Bug 411409 has been marked as a duplicate of this bug. *** *** Bug 411625 has been marked as a duplicate of this bug. *** *** Bug 411824 has been marked as a duplicate of this bug. *** *** Bug 412911 has been marked as a duplicate of this bug. *** *** Bug 412883 has been marked as a duplicate of this bug. *** *** Bug 414199 has been marked as a duplicate of this bug. *** *** Bug 414461 has been marked as a duplicate of this bug. *** *** Bug 415775 has been marked as a duplicate of this bug. *** Git commit 212d87a32ef15b9baf6102060639c06fa580e965 by David Edmundson. Committed on 10/01/2020 at 14:24. Pushed by davidedmundson into branch 'master'. [scenes/opengl] Remove outdated hack to reset vertex buffers Summary: Scene opengl has a callback for when we have a GL error. One of the handlers for an error calls scheduleVboReInit the history shows it was a forerunner to the GLX_NV_robustness_video_memory_purge but resetting only one tiny part based on debug output. When we get here we schedule a reset of the vertex buffer, via a timer. When the timer is caled we have no idea what GL context was last current, if it's not the currect context then the main scene GLVertexBuffer will be deleted but not correctly re-initialised. We have two very common crashes with a corrupted GLVertexBuffer::streamingBuffer() which would match up perfectly. Given that we now have a proper mechanism to reset the entire scene, we don't need this timer based hack and resolve that problem. Related: bug 399499 Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D26556 M +0 -31 plugins/scenes/opengl/scene_opengl.cpp https://commits.kde.org/kwin/212d87a32ef15b9baf6102060639c06fa580e965 Note, I could not reproduce this crash and this fix is based on a strong theory. If we get a duplicate with Plasma 5.18beta or newer, please reopen. *** Bug 416472 has been marked as a duplicate of this bug. *** *** Bug 417109 has been marked as a duplicate of this bug. *** *** Bug 416498 has been marked as a duplicate of this bug. *** The crash still happens in KDE Plasma 5.18 beta. Good news everyone! I've been experiencing similar crashes, and after finding an easy way to reproduce, I've been able to dissect it further. My crash is this: #4 0xb7eeebb8 in <signal handler called> () #5 0xb5878691 in KWin::WindowQuadList::makeInterleavedArrays(unsigned int, KWin::GLVertex2D*, QMatrix4x4 const&) const (this=0xbfe81d84, type=7, vertices=0xa94b9b60, textureMatrix=...) at ./libkwineffects/kwineffects.cpp:1171 #6 0xad9b362d in KWin::SceneOpenGL2Window::performPaint(int, QRegion, KWin::WindowPaintData) (this=0xbfe81fc4, mask=-1075306552, region=..., data=...) at ./plugins/scenes/opengl/scene_opengl.cpp:1431 also caused by vbo mapping pointing to inaccessible memory. I reproduced it by putting kwin under stress with this (don't laugh): ( for((;;)); do qdbus org.kde.kopete /kopete/MainWindow_1 org.qtproject.Qt.QWidget.minimumHeight 100; qdbus org.kde.kopete /kopete/MainWindow_1 org.qtproject.Qt.QWidget.maximumHeight 100; qdbus org.kde.kopete /kopete/MainWindow_1 org.qtproject.Qt.QWidget.maximumHeight 16000000; for i in $(seq 1 10); do qdbus org.kde.kopete /kopete/MainWindow_1 org.qtproject.Qt.QWidget.minimumHeight $((i*100)); done; done ) & and then provoke the crash by cycling the computer through suspend-to-ram: for i in $(seq 1 60); do rtcwake -m mem -s 30; sleep 20; done In my experience, kwin crashes within the first 10 iterations if vulnerable to this particular bug. With this, I found that: 1) KWIN_PERSISTENT_VBO=0 avoids the crash 2) reinitializing GLVertexBuffer::streamingBuffer while handling graphics reset also avoids the crash. I hope with this a way to fix this bug can be found. Created attachment 126458 [details]
A crude patch which reinitializes the VBO
That's very interesting! Thank you so much. In theory the VBO should be reset inside resetCompositing, but the fact that it comes after a queued event could be problematic. Maybe another paint() is scheduled whilst we're in that silly usleep which means we end up painting before we've actually performed the reset? Could you test https://phabricator.kde.org/P548 as an alternate fix (In reply to David Edmundson from comment #36) > Could you test https://phabricator.kde.org/P548 as an alternate fix Yes. Still crashes, unfortunately. *** Bug 417779 has been marked as a duplicate of this bug. *** Please have a look at https://phabricator.kde.org/D27924. *** Bug 417120 has been marked as a duplicate of this bug. *** *** Bug 418978 has been marked as a duplicate of this bug. *** *** Bug 418068 has been marked as a duplicate of this bug. *** *** Bug 420372 has been marked as a duplicate of this bug. *** Created attachment 129418 [details]
New crash information added by DrKonqi
kwin_x11 (5.18.5) using Qt 5.14.2
- What I was doing when the application crashed:
resume from suspend
this is the first time this happened, been runing Fedora32 for just over a week
Last night I finished installing v4l2loopback to use my DSLR as a webcam before suspending for the night
Using NVDIA drivers - I noticed this in other bug reports, not sure if it's relevant
-- Backtrace (Reduced):
#4 0x00007f3d65638b81 in KWin::ContrastEffect::uploadRegion(QVector2D*&, QRegion const&) () from /lib64/libkwin4_effect_builtins.so.1
#5 0x00007f3d65638c49 in KWin::ContrastEffect::uploadGeometry(KWin::GLVertexBuffer*, QRegion const&) () from /lib64/libkwin4_effect_builtins.so.1
#6 0x00007f3d6563a8fa in KWin::ContrastEffect::doContrast(KWin::EffectWindow*, QRegion const&, QRect const&, float, QMatrix4x4 const&) () from /lib64/libkwin4_effect_builtins.so.1
#7 0x00007f3d6563b1c1 in KWin::ContrastEffect::drawWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) () from /lib64/libkwin4_effect_builtins.so.1
#8 0x00007f3d66d6fbbf in KWin::EffectsHandlerImpl::drawWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) () from /lib64/libkwin.so.5
Created attachment 133825 [details]
New crash information added by DrKonqi
kwin_x11 (5.20.3) using Qt 5.15.2
- What I was doing when the application crashed:
Switched back from tty1 to tty7.
1. Coming back from suspend-to-ram
2. init 3 && killall kwin_x11 (needed to do both because KWin was still running)
3. init 5 and started Plasma session normally
4. Switched back to TTY1 (Ctrl+Alt+F1) and then back to TTY7
5. KWin crashed
- NVIDIA driver 455.38
- Qt 5.15.2
- KWin 5.20.3
-- Backtrace (Reduced):
#4 0x00007f6432729e3e in KWin::ContrastEffect::uploadRegion(QVector2D*&, QRegion const&) (this=<optimized out>, region=..., map=<synthetic pointer>: <optimized out>) at /usr/src/debug/kwin5-5.20.3-1.2.x86_64/effects/backgroundcontrast/contrast.cpp:301
#5 KWin::ContrastEffect::uploadGeometry(KWin::GLVertexBuffer*, QRegion const&) (this=0x560beaab7c80, region=..., vbo=0x560beab3d240) at /usr/src/debug/kwin5-5.20.3-1.2.x86_64/effects/backgroundcontrast/contrast.cpp:328
#6 KWin::ContrastEffect::doContrast(KWin::EffectWindow*, QRegion const&, QRect const&, float, QMatrix4x4 const&) (screenProjection=..., opacity=1, screen=..., shape=..., w=0x560bead9d740, this=0x560beaab7c80) at /usr/src/debug/kwin5-5.20.3-1.2.x86_64/effects/backgroundcontrast/contrast.cpp:471
#7 KWin::ContrastEffect::drawWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) (this=0x560beaab7c80, w=<optimized out>, mask=2, region=..., data=...) at /usr/src/debug/kwin5-5.20.3-1.2.x86_64/effects/backgroundcontrast/contrast.cpp:447
#8 0x00007f6434280211 in KWin::EffectsHandlerImpl::drawWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) (this=0x560beab27060, w=<optimized out>, mask=<optimized out>, region=..., data=...) at /usr/src/debug/kwin5-5.20.3-1.2.x86_64/effects.cpp:463
*** Bug 423295 has been marked as a duplicate of this bug. *** *** Bug 430699 has been marked as a duplicate of this bug. *** Tons of dupes, raising priority. *** Bug 431783 has been marked as a duplicate of this bug. *** *** Bug 419177 has been marked as a duplicate of this bug. *** *** Bug 462017 has been marked as a duplicate of this bug. *** *** Bug 429365 has been marked as a duplicate of this bug. *** *** Bug 435763 has been marked as a duplicate of this bug. *** *** Bug 463039 has been marked as a duplicate of this bug. *** Raising priority due to number of duplicates. A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3415 Git commit ddd60a0c1b6a6bbf7a1ba7e34cdc63582048b862 by Vlad Zahorodnii, on behalf of Aleix Pol. Committed on 11/01/2023 at 14:37. Pushed by vladz into branch 'master'. backgroundcontrast: Guard against calling a nullptr There are cases where GLVertexBuffer::map will return null (as seen in kwinglutils.cpp:1816) which does happen (as seen in the backtrace of bug 462017) Make sure we don't call the null map in that case. M +10 -3 src/effects/backgroundcontrast/contrast.cpp M +1 -1 src/effects/backgroundcontrast/contrast.h M +10 -4 src/effects/blur/blur.cpp M +1 -1 src/effects/blur/blur.h https://invent.kde.org/plasma/kwin/commit/ddd60a0c1b6a6bbf7a1ba7e34cdc63582048b862 (In reply to Vlad Zahorodnii from comment #57) > Git commit ddd60a0c1b6a6bbf7a1ba7e34cdc63582048b862 by Vlad Zahorodnii, on > behalf of Aleix Pol. > Committed on 11/01/2023 at 14:37. > Pushed by vladz into branch 'master'. > > backgroundcontrast: Guard against calling a nullptr > > There are cases where GLVertexBuffer::map will return null (as seen in > kwinglutils.cpp:1816) which does happen (as seen in the backtrace of bug > 462017) > Make sure we don't call the null map in that case. > https://invent.kde.org/plasma/kwin/commit/ddd60a0c1b6a6bbf7a1ba7e34cdc63582048b862 Are you sure this fixes the problem? In many of the backtraces, you can see that the map pointer isn't actually zero, although some of the backtraces seem different and I suspect they might indicate a different problem. Did you try to reproduce it and confirm it is fixed, by the procedure in my other comment? I used to have this problem, but since then I've changed my computer. I still have the graphics card in question around so maybe I could try to see what it does, but I can't promise anything. Without a clear idea of what's wrong and how to fix it, I don't think this can move forward. It seems like some peculiarity of NVidia drivers, but then again, other gl apps don't crash on Nvidia, or do they? |