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

Proposed by Daniel van Vugt
Status: Rejected
Rejected by: Robert Ancell
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
Marco Trevisan (Treviño) Approve
Ubuntu Desktop 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.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

This LGTM

review: Approve
Revision history for this message
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.

Revision history for this message
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> ]

Revision history for this message
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.

Revision history for this message
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?

Revision history for this message
Daniel van Vugt (vanvugt) :
review: Disapprove

Unmerged commits

b0d514e... by Daniel van Vugt

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

Subscribers

People subscribed via source and target branches