From ca55def5eb15d54e2b283c7c26120a0fd4b4587e Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Wed, 6 Mar 2024 13:04:25 -0500 Subject: [PATCH] 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. --- .../homescreens/folio/foliosettings.cpp | 2 +- .../folio/package/contents/ui/main.qml | 31 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/containments/homescreens/folio/foliosettings.cpp b/containments/homescreens/folio/foliosettings.cpp index e94408f9..57d6ca31 100644 --- a/containments/homescreens/folio/foliosettings.cpp +++ b/containments/homescreens/folio/foliosettings.cpp @@ -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(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(); diff --git a/containments/homescreens/folio/package/contents/ui/main.qml b/containments/homescreens/folio/package/contents/ui/main.qml index b9e68b7b..8efaacd7 100644 --- a/containments/homescreens/folio/package/contents/ui/main.qml +++ b/containments/homescreens/folio/package/contents/ui/main.qml @@ -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,