Bug 486078 - Automatically enabling software rendering causes KWin to crash on all visual effects (alt+tab, maximise, snap window)
Summary: Automatically enabling software rendering causes KWin to crash on all visual ...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 6.0.4
Platform: NixOS Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-24 15:36 UTC by deftdawg
Modified: 2024-06-04 08:36 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description deftdawg 2024-04-24 15:36:01 UTC
SUMMARY

When KWin crashes due to a kernel driver issue, it automatically enables software rendering by adding the following to `~/.config/kdeglobals`:
```
[QtQuickRendererSettings]
SceneGraphBackend=software
```

While this may get KWin back up and running temporarily, the presence of this configuration causes *any* invocation of visual effects to crash KWin (a crash only Qt6 applications survive).

It also causes visual anomalies like the icons in launcher to get stacked. see https://discuss-cdn.kde.org/uploads/default/original/2X/a/aa9c4122664e8fa8ff613769b4f2b77d5343472b.png

A user will have no idea why their installation of KDE has become "corrupted" because there is no notification or warning that this change has happened / software rendering is active.   Switching back to KDE5 doesn't resolve the issue either because the setting causes the same behaviours under KDE5, only deleting that block and restarting KWin can resolve the issue.

STEPS TO REPRODUCE
1. add 
```
[QtQuickRendererSettings]
SceneGraphBackend=software
```
to `~/.config/kdeglobals`
2. Open a single application and "snap" it at a screen edge or open multiple applications and try to alt+tab between them
3. 

OBSERVED RESULT
KWin crashes

EXPECTED RESULT
KWin shouldn't crash or it should warn if software rendering was enabled.

SOFTWARE/OS VERSIONS
Operating System: NixOS 24.05
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.9.0-rc4 (64-bit)
Graphics Platform: Wayland
Processors: 32 × 13th Gen Intel® Core™ i9-13900K
Memory: 125.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6900 XT

SUGGESTION

Plasma should warn software rendering was enabled as part of fall back, perhaps when this block
```
[QtQuickRendererSettings]
SceneGraphBackend=software
```
is added another line should be added like so:

```
[QtQuickRendererSettings]
SceneGraphBackend=software
Warning=Software rendering was enabled at 2024-01-01 6:24 because of a crash
```

Then if the `Warning` is there, pop up a dialog or put in a notification to tell the user and ask them if they want to keep the setting in or turn it off again.
Comment 1 David Edmundson 2024-06-04 08:33:32 UTC
Git commit 8c149bb6b711c00e0fa3cf2f3d06a09dcc57a1e4 by David Edmundson.
Committed on 04/06/2024 at 08:33.
Pushed by davidedmundson into branch 'master'.

effects: Do not call RHI QQuickRenderControl methods when using software rendering

As per the docs:
Note: This function does not need to be, and must not be, called when
using the software adaptation of Qt Quick.

This sets up RHI on the render control, which in turn sets RHI on the
window, which shouldn't exist when using software rendering.
Related: bug 482663

M  +7    -3    src/effect/offscreenquickview.cpp

https://invent.kde.org/plasma/kwin/-/commit/8c149bb6b711c00e0fa3cf2f3d06a09dcc57a1e4
Comment 2 David Edmundson 2024-06-04 08:36:41 UTC
Git commit a22a8eb122bf2bb7c1e38450aa8d644f0a8ca30f by David Edmundson, on behalf of David Edmundson.
Committed on 04/06/2024 at 08:36.
Pushed by davidedmundson into branch 'Plasma/6.1'.

effects: Do not call RHI QQuickRenderControl methods when using software rendering

As per the docs:
Note: This function does not need to be, and must not be, called when
using the software adaptation of Qt Quick.

This sets up RHI on the render control, which in turn sets RHI on the
window, which shouldn't exist when using software rendering.
Related: bug 482663


(cherry picked from commit 8c149bb6b711c00e0fa3cf2f3d06a09dcc57a1e4)

a6826049 effects: Do not call RHI QQuickRenderControl methods when using software rendering

Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>

M  +7    -3    src/effect/offscreenquickview.cpp

https://invent.kde.org/plasma/kwin/-/commit/a22a8eb122bf2bb7c1e38450aa8d644f0a8ca30f