Merge ~vanvugt/ubuntu/+source/mutter:fix-1809407-eoan into ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/master

Proposed by Daniel van Vugt on 2019-06-07
Status: Rejected
Rejected by: Robert Ancell on 2019-07-22
Proposed branch: ~vanvugt/ubuntu/+source/mutter:fix-1809407-eoan
Merge into: ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/master
Diff against target: 264 lines (+242/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/fix-lp1809407-3.32.patch (+234/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Daniel van Vugt (community) Disapprove on 2019-07-17
Marco Trevisan (Treviño) (community) Approve on 2019-06-21
Ubuntu Desktop 2019-06-07 Pending
Review via email: mp+368536@code.launchpad.net

Commit message

Fix wallpaper corruption on resume from suspend on Nvidia

https://bugs.launchpad.net/bugs/1809407

To post a comment you must log in.
Marco Trevisan (Treviño) (3v1n0) wrote :

This LGTM

review: Approve
Daniel van Vugt (vanvugt) wrote :

There are now stylistic changes being made upstream. Nothing of substance though so I probably wouldn't bother reflecting them here. This merge proposal exists to avoid being blocked waiting for upstream. If we are now waiting for upstream then I would more likely close this and just wait for the upstream fix to land via mutter 3.33/3.34 into eoan.

Iain Lane (laney) wrote :

I'll be uploading 3.33.4 once it's released next week. Ideally I'll just
have to do one upload, so this fix can be incorporated into that same
release. Double ideally it'll be in the upstream part of that upload, if
Marco stops nit-picking and presses merge at some point soon. :-)

Close this MP if it gets merged upstream. If it doesn't, I'll look to
merge it when the time comes.

On Fri, Jul 05, 2019 at 03:31:03AM -0000, Daniel van Vugt wrote:
> There are now stylistic changes being made upstream. Nothing of substance though so I probably wouldn't bother reflecting them here. This merge proposal exists to avoid being blocked waiting for upstream. If we are now waiting for upstream then I would more likely close this and just wait for the upstream fix to land via mutter 3.33/3.34 into eoan.
> --
> https://code.launchpad.net/~vanvugt/ubuntu/+source/mutter/+git/mutter/+merge/368536
> Your team Ubuntu Desktop is requested to review the proposed merge of ~vanvugt/ubuntu/+source/mutter:fix-1809407-eoan into ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/master.
>
> --
> ubuntu-desktop mailing list
> <email address hidden>
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

Daniel van Vugt (vanvugt) wrote :

Forget this MP. A simpler version has now landed in mutter master, so we'll get the fix from there.

Daniel van Vugt (vanvugt) wrote :

I would like to reject this instead of deleting it, so we retain history. But Launchpad gives me no Reject option. Can someone else?

Daniel van Vugt (vanvugt) :
review: Disapprove

Unmerged commits

b0d514e... by Daniel van Vugt on 2019-06-07

Fix wallpaper corruption on resume from suspend on Nvidia

https://bugs.launchpad.net/bugs/1809407

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 531a23e..fb2b934 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+mutter (3.32.2+git20190626-1ubuntu2) UNRELEASED; urgency=medium
7+
8+ * Add fix-lp1809407-3.32.patch to fix background wallpaper corruption on
9+ Nvidia when resuming from suspend (LP: #1809407)
10+
11+ -- Daniel van Vugt <daniel.van.vugt@canonical.com> Wed, 03 Jul 2019 17:41:52 +0800
12+
13 mutter (3.32.2+git20190626-1ubuntu1) eoan; urgency=medium
14
15 * Merge with debian (LP: #1834493). Remaining changes:
16diff --git a/debian/patches/fix-lp1809407-3.32.patch b/debian/patches/fix-lp1809407-3.32.patch
17new file mode 100644
18index 0000000..685edc7
19--- /dev/null
20+++ b/debian/patches/fix-lp1809407-3.32.patch
21@@ -0,0 +1,234 @@
22+Description: Refresh desktop wallpaper upon resume from suspend
23+ The Nvidia driver loses/corrupts its texture memory upon resuming from
24+ suspend. This is a *feature* that is officially documented in OpenGL
25+ extension "NV_robustness_video_memory_purge". To accomodate this we need
26+ to refresh textures kept long-term in GPU memory, most noticeably the
27+ desktop wallpaper and clutter canvases like the rounded panel corners
28+ (if enabled).
29+Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
30+Origin: https://gitlab.gnome.org/GNOME/mutter/merge_requests/600
31+Bug: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1084
32+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1809407
33+Forwarded: yes
34+Last-Update: 2019-06-07
35+
36+Index: mutter/clutter/clutter/clutter-canvas.c
37+===================================================================
38+--- mutter.orig/clutter/clutter/clutter-canvas.c
39++++ mutter/clutter/clutter/clutter-canvas.c
40+@@ -76,6 +76,8 @@ struct _ClutterCanvasPrivate
41+ gboolean dirty;
42+
43+ CoglBitmap *buffer;
44++
45++ ClutterStage *stage;
46+ };
47+
48+ enum
49+@@ -130,6 +132,14 @@ clutter_cairo_context_draw_marshaller (G
50+ }
51+
52+ static void
53++clutter_canvas_dispose (GObject *gobject)
54++{
55++ ClutterCanvasPrivate *priv = CLUTTER_CANVAS (gobject)->priv;
56++
57++ g_clear_object (&priv->stage);
58++}
59++
60++static void
61+ clutter_canvas_finalize (GObject *gobject)
62+ {
63+ ClutterCanvasPrivate *priv = CLUTTER_CANVAS (gobject)->priv;
64+@@ -312,6 +322,7 @@ clutter_canvas_class_init (ClutterCanvas
65+
66+ gobject_class->set_property = clutter_canvas_set_property;
67+ gobject_class->get_property = clutter_canvas_get_property;
68++ gobject_class->dispose = clutter_canvas_dispose;
69+ gobject_class->finalize = clutter_canvas_finalize;
70+
71+ g_object_class_install_properties (gobject_class, LAST_PROP, obj_props);
72+@@ -328,6 +339,12 @@ clutter_canvas_init (ClutterCanvas *self
73+ }
74+
75+ static void
76++clutter_canvas_video_memory_purged (ClutterCanvas *self)
77++{
78++ clutter_content_invalidate (CLUTTER_CONTENT (self));
79++}
80++
81++static void
82+ clutter_canvas_paint_content (ClutterContent *content,
83+ ClutterActor *actor,
84+ ClutterPaintNode *root)
85+@@ -335,6 +352,7 @@ clutter_canvas_paint_content (ClutterCon
86+ ClutterCanvas *self = CLUTTER_CANVAS (content);
87+ ClutterCanvasPrivate *priv = self->priv;
88+ ClutterPaintNode *node;
89++ ClutterActor *stage;
90+
91+ if (priv->buffer == NULL)
92+ return;
93+@@ -356,6 +374,17 @@ clutter_canvas_paint_content (ClutterCon
94+ clutter_paint_node_unref (node);
95+
96+ priv->dirty = FALSE;
97++
98++ stage = clutter_actor_get_stage (actor);
99++ if (stage != (ClutterActor *) priv->stage)
100++ {
101++ g_set_object (&priv->stage, CLUTTER_STAGE (stage));
102++
103++ g_signal_connect_object (stage, "gl-video-memory-purged",
104++ G_CALLBACK (clutter_canvas_video_memory_purged),
105++ self,
106++ G_CONNECT_SWAPPED);
107++ }
108+ }
109+
110+ static void
111+Index: mutter/clutter/clutter/clutter-stage.c
112+===================================================================
113+--- mutter.orig/clutter/clutter/clutter-stage.c
114++++ mutter/clutter/clutter/clutter-stage.c
115+@@ -192,6 +192,7 @@ enum
116+ DELETE_EVENT,
117+ AFTER_PAINT,
118+ PRESENTED,
119++ GL_VIDEO_MEMORY_PURGED,
120+
121+ LAST_SIGNAL
122+ };
123+@@ -2268,6 +2269,22 @@ clutter_stage_class_init (ClutterStageCl
124+ G_TYPE_NONE, 2,
125+ G_TYPE_INT, G_TYPE_POINTER);
126+
127++ /**
128++ * ClutterStage::gl-video-memory-purged: (skip)
129++ * @stage: the stage that received the event
130++ *
131++ * Signals that the underlying GL driver has had its texture memory purged
132++ * so anything presently held in texture memory is now invalidated, and
133++ * likely corrupt. It needs redrawing.
134++ */
135++ stage_signals[GL_VIDEO_MEMORY_PURGED] =
136++ g_signal_new (I_("gl-video-memory-purged"),
137++ G_TYPE_FROM_CLASS (gobject_class),
138++ G_SIGNAL_RUN_LAST,
139++ 0,
140++ NULL, NULL, NULL,
141++ G_TYPE_NONE, 0);
142++
143+ klass->fullscreen = clutter_stage_real_fullscreen;
144+ klass->activate = clutter_stage_real_activate;
145+ klass->deactivate = clutter_stage_real_deactivate;
146+Index: mutter/src/compositor/compositor.c
147+===================================================================
148+--- mutter.orig/src/compositor/compositor.c
149++++ mutter/src/compositor/compositor.c
150+@@ -1323,6 +1323,7 @@ meta_post_paint_func (gpointer data)
151+
152+ case COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET:
153+ g_signal_emit_by_name (compositor->display, "gl-video-memory-purged");
154++ g_signal_emit_by_name (compositor->stage , "gl-video-memory-purged");
155+ clutter_actor_queue_redraw (CLUTTER_ACTOR (compositor->stage));
156+ break;
157+
158+Index: mutter/src/compositor/meta-background.c
159+===================================================================
160+--- mutter.orig/src/compositor/meta-background.c
161++++ mutter/src/compositor/meta-background.c
162+@@ -252,12 +252,11 @@ static void
163+ set_file (MetaBackground *self,
164+ GFile **filep,
165+ MetaBackgroundImage **imagep,
166+- GFile *file)
167++ GFile *file,
168++ gboolean force_reload)
169+ {
170+- if (!file_equal0 (*filep, file))
171++ if (force_reload || !file_equal0 (*filep, file))
172+ {
173+- g_clear_object (filep);
174+-
175+ if (*imagep)
176+ {
177+ g_signal_handlers_disconnect_by_func (*imagep,
178+@@ -267,11 +266,12 @@ set_file (MetaBackground *self,
179+ *imagep = NULL;
180+ }
181+
182++ g_set_object (filep, file);
183++
184+ if (file)
185+ {
186+ MetaBackgroundImageCache *cache = meta_background_image_cache_get_default ();
187+
188+- *filep = g_object_ref (file);
189+ *imagep = meta_background_image_cache_load (cache, file);
190+ g_signal_connect (*imagep, "loaded",
191+ G_CALLBACK (on_background_loaded), self);
192+@@ -280,6 +280,32 @@ set_file (MetaBackground *self,
193+ }
194+
195+ static void
196++on_gl_video_memory_purged (MetaBackground *self)
197++{
198++ MetaBackgroundImageCache *cache = meta_background_image_cache_get_default ();
199++
200++ /* The GPU memory that just got invalidated is the texture inside
201++ * self->background_image1,2 and/or its mipmaps. However, to save memory the
202++ * original pixbuf isn't kept in RAM so we can't do a simple re-upload. The
203++ * only copy of the image was the one in texture memory that got invalidated.
204++ * So we need to do a full reload from disk.
205++ */
206++ if (self->file1)
207++ {
208++ meta_background_image_cache_purge (cache, self->file1);
209++ set_file (self, &self->file1, &self->background_image1, self->file1, TRUE);
210++ }
211++
212++ if (self->file2)
213++ {
214++ meta_background_image_cache_purge (cache, self->file2);
215++ set_file (self, &self->file2, &self->background_image2, self->file2, TRUE);
216++ }
217++
218++ mark_changed (self);
219++}
220++
221++static void
222+ meta_background_dispose (GObject *object)
223+ {
224+ MetaBackground *self = META_BACKGROUND (object);
225+@@ -287,8 +313,8 @@ meta_background_dispose (GObject *object
226+ free_color_texture (self);
227+ free_wallpaper_texture (self);
228+
229+- set_file (self, &self->file1, &self->background_image1, NULL);
230+- set_file (self, &self->file2, &self->background_image2, NULL);
231++ set_file (self, &self->file1, &self->background_image1, NULL, FALSE);
232++ set_file (self, &self->file2, &self->background_image2, NULL, FALSE);
233+
234+ set_display (self, NULL);
235+
236+@@ -312,7 +338,7 @@ meta_background_constructed (GObject *ob
237+ G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
238+
239+ g_signal_connect_object (self->display, "gl-video-memory-purged",
240+- G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
241++ G_CALLBACK (on_gl_video_memory_purged), object, G_CONNECT_SWAPPED);
242+
243+ g_signal_connect_object (monitor_manager, "monitors-changed",
244+ G_CALLBACK (on_monitors_changed), self,
245+@@ -937,8 +963,8 @@ meta_background_set_blend (MetaBackgroun
246+ g_return_if_fail (META_IS_BACKGROUND (self));
247+ g_return_if_fail (blend_factor >= 0.0 && blend_factor <= 1.0);
248+
249+- set_file (self, &self->file1, &self->background_image1, file1);
250+- set_file (self, &self->file2, &self->background_image2, file2);
251++ set_file (self, &self->file1, &self->background_image1, file1, FALSE);
252++ set_file (self, &self->file2, &self->background_image2, file2, FALSE);
253+
254+ self->blend_factor = blend_factor;
255+ self->style = style;
256diff --git a/debian/patches/series b/debian/patches/series
257index 5e2b370..cd3cd05 100644
258--- a/debian/patches/series
259+++ b/debian/patches/series
260@@ -3,3 +3,4 @@ theme-load-icons-as-Gtk-does-with-fallback-and-RTL-suppor.patch
261 meson-add-back-default_driver-option.patch
262 debian/synaptics-support.patch
263 x11-Add-support-for-fractional-scaling-using-Randr.patch
264+fix-lp1809407-3.32.patch

Subscribers

People subscribed via source and target branches