homescreens/folio: Improve performance of wallpaper blur, and enable by default

Fixes https://invent.kde.org/plasma/plasma-mobile/-/issues/306

I added a ShaderEffectSource in between so that the blur only samples the wallpaper when necessary

I also switched to FastBlur which seems to be much, much faster than MultiEffect on the PinePhone.

From testing, this made the performance about on-par with no blur at all.
This commit is contained in:
Devin Lin 2024-03-06 13:04:25 -05:00
parent ec5a112da2
commit ca55def5eb
2 changed files with 19 additions and 14 deletions

View file

@ -170,7 +170,7 @@ void FolioSettings::load()
m_delegateIconSize = m_applet->config().readEntry("delegateIconSize", 48);
m_showFavouritesBarBackground = m_applet->config().readEntry("showFavoritesBarBackground", true);
m_pageTransitionEffect = static_cast<PageTransitionEffect>(m_applet->config().readEntry("pageTransitionEffect", (int)SlideTransition));
m_showWallpaperBlur = m_applet->config().readEntry("showWallpaperBlur", false);
m_showWallpaperBlur = m_applet->config().readEntry("showWallpaperBlur", true);
Q_EMIT homeScreenRowsChanged();
Q_EMIT homeScreenColumnsChanged();

View file

@ -5,6 +5,7 @@ import QtQuick
import QtQuick.Window
import QtQuick.Layouts
import QtQuick.Effects
import Qt5Compat.GraphicalEffects
import org.kde.kirigami 2.20 as Kirigami
@ -35,23 +36,27 @@ ContainmentItem {
anchors.fill: parent
sourceComponent: Item {
// HACK: wallpaper (to enforce same dimensions that blur uses)
MultiEffect {
blurEnabled: true
blur: 0.0
blurMax: 0.0
autoPaddingEnabled: false
source: Plasmoid.wallpaperGraphicsObject
id: wallpaper
anchors.fill: parent
// only take samples from wallpaper when we need the blur for performance
ShaderEffectSource {
id: controlledWallpaperSource
anchors.fill: parent
sourceItem: Plasmoid.wallpaperGraphicsObject
live: blur.visible
hideSource: false
visible: false
}
// wallpaper blur
MultiEffect {
blurEnabled: true
blur: 1.0
blurMax: 50
autoPaddingEnabled: false
source: Plasmoid.wallpaperGraphicsObject
// we attempted to use MultiEffect in the past, but it had very poor performance on the PinePhone
FastBlur {
id: blur
radius: 50
cached: true
source: controlledWallpaperSource
anchors.fill: parent
visible: opacity > 0
opacity: Math.min(1,