Merge lp:~3v1n0/gnome-shell/bionic-patches-add-gpu-cached-texture into lp:~ubuntu-desktop/gnome-shell/ubuntu

Proposed by Marco Trevisan (Treviño) on 2018-04-18
Status: Merged
Merged at revision: 147
Proposed branch: lp:~3v1n0/gnome-shell/bionic-patches-add-gpu-cached-texture
Merge into: lp:~ubuntu-desktop/gnome-shell/ubuntu
Diff against target: 162 lines (+142/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/js-ui-Choose-some-actors-to-cache-on-the-GPU.patch (+133/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~3v1n0/gnome-shell/bionic-patches-add-gpu-cached-texture
Reviewer Review Type Date Requested Status
Jeremy Bicha 2018-04-18 Approve on 2018-04-23
Review via email: mp+343565@code.launchpad.net

This proposal supersedes a proposal from 2018-04-18.

Commit message

debian/patches/js-ui-Choose-some-actors-to-cache-on-the-GPU.patch: include duflu change

To post a comment you must log in.
147. By Marco Trevisan (Treviño) on 2018-04-19

debian/patches/js-ui-Choose-some-actors-to-cache-on-the-GPU.patch: include duflu change

Jeremy Bicha (jbicha) wrote :

Ok. I uploaded this to the bionic queue. If you need this in before release or as a 0-day SRU, someone should talk to the Ubuntu Release Team.

review: Approve
Daniel van Vugt (vanvugt) wrote :

Thanks. Although that's not the current version of the upstream patch, it is functionally identical.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2018-04-18 11:40:07 +0000
+++ debian/changelog 2018-04-19 02:46:33 +0000
@@ -1,3 +1,11 @@
1gnome-shell (3.28.1-0ubuntu2) UNRELEASED; urgency=medium
2
3 * js-ui-Choose-some-actors-to-cache-on-the-GPU.patch:
4 - Improve rendering of shell elements moving rendering to GPU
5 (LP: #1744001)
6
7 -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 18 Apr 2018 21:29:28 -0500
8
1gnome-shell (3.28.1-0ubuntu1) bionic; urgency=medium9gnome-shell (3.28.1-0ubuntu1) bionic; urgency=medium
210
3 [ Jeremy Bicha ]11 [ Jeremy Bicha ]
412
=== added file 'debian/patches/js-ui-Choose-some-actors-to-cache-on-the-GPU.patch'
--- debian/patches/js-ui-Choose-some-actors-to-cache-on-the-GPU.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/js-ui-Choose-some-actors-to-cache-on-the-GPU.patch 2018-04-19 02:46:33 +0000
@@ -0,0 +1,133 @@
1From: Daniel van Vugt <daniel.van.vugt@canonical.com>
2Date: Fri, 6 Apr 2018 05:26:58 -0500
3Subject: js/ui: Choose some actors to cache on the GPU
4
5Adds a wrapper function to flag actors that are good candidates for
6caching in texture memory (what Clutter calls "offscreen redirect"),
7thereby mostly eliminating their repaint overhead.
8
9This isn't exactly groundbreaking, it's how you're meant to use
10OpenGL in the first place. But the difficulty is in the design of
11Clutter which has some peculiarities making universal caching
12inefficient at the moment:
13
14 * Repainting an offscreen actor is measurably slower than repainting
15 the same actor if it was uncached. But only by less than 100%,
16 so if an actor can avoid changing every frame then caching is usually
17 more efficient over that timeframe.
18
19 * The cached painting from a container typically includes its children,
20 so you can't cache containers whose children are usually animating at
21 full frame rate. That results in a performance loss.
22 This could be remedied in future by Clutter explicitly separating a
23 container's background painting from its child painting and always
24 caching the background (as StWidget tries to in some cases already).
25
26So this commit selects just a few areas where caching has been verified
27to be beneficial, and many use cases now see their CPU usage halved:
28
29One small window active...... 10% -> 7% (-30%)
30...under a panel menu........ 23% -> 9% (-61%)
31One maximized window active.. 12% -> 9% (-25%)
32...under a panel menu........ 23% -> 11% (-52%)
33...under a shell dialog...... 22% -> 12% (-45%)
34...in activities overview.... 32% -> 17% (-47%)
35(on an i7-7700)
36
37Also a couple of bugs are fixed by this:
38
39https://bugzilla.gnome.org/show_bug.cgi?id=792634
40https://bugzilla.gnome.org/show_bug.cgi?id=792633
41
42Bug-GNOME: https://bugzilla.gnome.org/show_bug.cgi?id=792634
43Bug-GNOME: https://bugzilla.gnome.org/show_bug.cgi?id=792633
44Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1744001
45Forwarded: yes, https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/73
46---
47 js/ui/boxpointer.js | 1 +
48 js/ui/dash.js | 1 +
49 js/ui/dialog.js | 2 ++
50 js/ui/main.js | 16 ++++++++++++++++
51 js/ui/panel.js | 1 +
52 5 files changed, 21 insertions(+)
53
54diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
55index 47f718a..602646a 100644
56--- a/js/ui/boxpointer.js
57+++ b/js/ui/boxpointer.js
58@@ -44,6 +44,7 @@ var BoxPointer = new Lang.Class({
59 y_fill: true });
60 this._container = new Shell.GenericContainer();
61 this.actor.set_child(this._container);
62+ Main.hintActorSeldomChanges(this.actor);
63 this._container.connect('get-preferred-width', this._getPreferredWidth.bind(this));
64 this._container.connect('get-preferred-height', this._getPreferredHeight.bind(this));
65 this._container.connect('allocate', this._allocate.bind(this));
66diff --git a/js/ui/dash.js b/js/ui/dash.js
67index 5ee2476..14864f1 100644
68--- a/js/ui/dash.js
69+++ b/js/ui/dash.js
70@@ -402,6 +402,7 @@ var Dash = new Lang.Class({
71 clip_to_allocation: true });
72 this._box._delegate = this;
73 this._container.add_actor(this._box);
74+ Main.hintActorSeldomChanges(this._container);
75
76 this._showAppsIcon = new ShowAppsIcon();
77 this._showAppsIcon.childScale = 1;
78diff --git a/js/ui/dialog.js b/js/ui/dialog.js
79index cfa192d..89db963 100644
80--- a/js/ui/dialog.js
81+++ b/js/ui/dialog.js
82@@ -6,6 +6,7 @@ const GObject = imports.gi.GObject;
83 const Pango = imports.gi.Pango;
84 const St = imports.gi.St;
85 const Lang = imports.lang;
86+const Main = imports.ui.main;
87
88 var Dialog = new Lang.Class({
89 Name: 'Dialog',
90@@ -40,6 +41,7 @@ var Dialog = new Lang.Class({
91 // mode accordingly so wrapped labels are handled correctly during
92 // size requests.
93 this._dialog.request_mode = Clutter.RequestMode.HEIGHT_FOR_WIDTH;
94+ Main.hintActorSeldomChanges(this._dialog);
95
96 this.contentLayout = new St.BoxLayout({ vertical: true,
97 style_class: "modal-dialog-content-box" });
98diff --git a/js/ui/main.js b/js/ui/main.js
99index d86cf9e..5277cf7 100644
100--- a/js/ui/main.js
101+++ b/js/ui/main.js
102@@ -716,3 +716,19 @@ function showRestartMessage(message) {
103 let restartMessage = new RestartMessage(message);
104 restartMessage.open();
105 }
106+
107+/**
108+ * hintActorSeldomChanges:
109+ * @actor: A clutter actor
110+ *
111+ * Flag an actor as known to not need repainting very often. Such actors can
112+ * have their painting cached in GPU memory so that future repaints triggered
113+ * by other actors don't incur a repaint of @actor. This can provide dramatic
114+ * performance benefits if used wisely.
115+ *
116+ * This hint needs to be provided manually because clutter presently lacks
117+ * a good enough heuristic to toggle the optimization automatically.
118+ */
119+function hintActorSeldomChanges(actor) {
120+ actor.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
121+}
122diff --git a/js/ui/panel.js b/js/ui/panel.js
123index 2f59324..2237ead 100644
124--- a/js/ui/panel.js
125+++ b/js/ui/panel.js
126@@ -772,6 +772,7 @@ var Panel = new Lang.Class({
127 this.actor = new Shell.GenericContainer({ name: 'panel',
128 reactive: true });
129 this.actor._delegate = this;
130+ Main.hintActorSeldomChanges(this.actor);
131
132 this._sessionStyle = null;
133
0134
=== modified file 'debian/patches/series'
--- debian/patches/series 2018-04-18 11:33:34 +0000
+++ debian/patches/series 2018-04-19 02:46:33 +0000
@@ -26,3 +26,4 @@
26workspace-fix-repositioned-windows-in-activities.patch26workspace-fix-repositioned-windows-in-activities.patch
27st-texture-cache-Cancel-sliced-image-loading-on-target-ac.patch27st-texture-cache-Cancel-sliced-image-loading-on-target-ac.patch
28st-texture-cache-Don-t-add-NULL-textures-to-cache.patch28st-texture-cache-Don-t-add-NULL-textures-to-cache.patch
29js-ui-Choose-some-actors-to-cache-on-the-GPU.patch

Subscribers

People subscribed via source and target branches