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

Proposed by Marco Trevisan (Treviño)
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 Bícha Approve
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)

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

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

Subscribers

People subscribed via source and target branches