fmuellner pushed to gnome-shell-extension-background-logo (f21). "Fix high CPU usage due to feedback loop"
notifications at fedoraproject.org
notifications at fedoraproject.org
Thu Apr 16 16:38:42 UTC 2015
>From 8148d512b1bd44a60548e36f786747bd5340746d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner at gnome.org>
Date: Thu, 16 Apr 2015 18:28:27 +0200
Subject: Fix high CPU usage due to feedback loop
diff --git a/0001-Fix-high-CPU-usage-by-avoiding-feedback-loop.patch b/0001-Fix-high-CPU-usage-by-avoiding-feedback-loop.patch
new file mode 100644
index 0000000..849e227
--- /dev/null
+++ b/0001-Fix-high-CPU-usage-by-avoiding-feedback-loop.patch
@@ -0,0 +1,45 @@
+From 70b0033ac3033e371d09e089493964afc57f3771 Mon Sep 17 00:00:00 2001
+From: Christian Krause <chkr at plauener.de>
+Date: Sun, 5 Apr 2015 18:19:02 +0200
+Subject: [PATCH] Fix high CPU usage by avoiding feedback loop
+
+Depending on the size of the logo image and the
+configured size it is possible, that any
+_icon.set_size() call triggers a new
+"allocation-changed" event which in order calls
+_updateScale() and _icon.set_size() again (with
+slightly different numbers).
+
+This happens if the manually set size and the
+subsequently allocated size differ a little bit
+(e.g. due to rounding).
+
+Avoid this kind of "feedback loop" by limiting the
+update to cases where the current size differs
+significantly from the new size.
+---
+ extension.js | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/extension.js b/extension.js
+index c51191d..b790116 100644
+--- a/extension.js
++++ b/extension.js
+@@ -131,6 +131,14 @@ const BackgroundLogo = new Lang.Class({
+ let size = this._settings.get_double('logo-size');
+ let width = this.actor.width * size / 100;
+ let height = this._icon.height * width / this._icon.width;
++ if (Math.abs(this._icon.height - height) < 1.0 &&
++ Math.abs(this._icon.width - width) < 1.0) {
++ // size of icon would not significantly change, so don't
++ // update the size to avoid recursion in case the
++ // manually set size differs just minimal from the eventually
++ // allocated size
++ return;
++ }
+ this._icon.set_size(width, height);
+ },
+
+--
+2.3.5
+
diff --git a/gnome-shell-extension-background-logo.spec b/gnome-shell-extension-background-logo.spec
index 5455021..e6abf13 100644
--- a/gnome-shell-extension-background-logo.spec
+++ b/gnome-shell-extension-background-logo.spec
@@ -2,12 +2,13 @@
Name: gnome-shell-extension-background-logo
Version: 3.14.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Background logo extension for GNOME Shell
License: GPLv2+
URL: https://git.fedorahosted.org/git/background-logo-extension.git
Source0: https://fedorahosted.org/releases/b/a/background-logo-extension/background-logo-extension-%{version}.tar.xz
+Patch0: 0001-Fix-high-CPU-usage-by-avoiding-feedback-loop.patch
BuildArch: noarch
BuildRequires: glib2-devel
@@ -19,6 +20,7 @@ Overlay a tasteful logo on the background to enhance the user experience.
%prep
%setup -q -n background-logo-extension-%{version}
+%patch0 -p1 -b .avoid-feedback-loop
%build
%configure
@@ -41,5 +43,8 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/gnome-shell/extensions/
%changelog
+* Thu Apr 16 2015 Florian Müllner <fmuellner at redhat.com> - 3.14.0-2
+- Fix high CPU usage due to feedback loop
+
* Fri Nov 07 2014 Kalev Lember <kalevlember at gmail.com> - 3.14.0-1
- Initial Fedora packaging
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/gnome-shell-extension-background-logo.git/commit/?h=f21&id=8148d512b1bd44a60548e36f786747bd5340746d
More information about the scm-commits
mailing list