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

Proposed by Daniel van Vugt on 2019-09-19
Status: Rejected
Rejected by: Sebastien Bacher on 2019-10-23
Proposed branch: ~vanvugt/ubuntu/+source/mutter:fix-1809407
Merge into: ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/disco
Diff against target: 145 lines (+123/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/background-Reload-when-GPU-memory-is-invalidated.patch (+114/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Ubuntu Desktop 2019-09-19 Pending
Review via email: mp+372984@code.launchpad.net

Commit message

Add background-Reload-when-GPU-memory-is-invalidated.patch

to fix corrupt background wallpaper when resuming from suspend on the
Nvidia driver. (LP: #1809407)

To post a comment you must log in.
Daniel van Vugt (vanvugt) wrote :

Disco is not a priority, replaced by eoan. So closing.

Unmerged commits

2a7dc7c... by Daniel van Vugt on 2019-09-19

Add background-Reload-when-GPU-memory-is-invalidated.patch

to fix corrupt background wallpaper when resuming from suspend on the
Nvidia driver. (LP: #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 83c1e34..7bc4e0c 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+mutter (3.32.2+git20190711-2ubuntu1~19.04.2) UNRELEASED; urgency=medium
7+
8+ * Add background-Reload-when-GPU-memory-is-invalidated.patch to fix
9+ corrupt background wallpaper when resuming from suspend on the
10+ Nvidia driver. (LP: #1809407)
11+
12+ -- Daniel van Vugt <daniel.van.vugt@canonical.com> Thu, 19 Sep 2019 17:55:02 +0800
13+
14 mutter (3.32.2+git20190711-2ubuntu1~19.04.1) disco; urgency=medium
15
16 * No-change backport from disco to eoan.
17diff --git a/debian/patches/background-Reload-when-GPU-memory-is-invalidated.patch b/debian/patches/background-Reload-when-GPU-memory-is-invalidated.patch
18new file mode 100644
19index 0000000..19ecec7
20--- /dev/null
21+++ b/debian/patches/background-Reload-when-GPU-memory-is-invalidated.patch
22@@ -0,0 +1,114 @@
23+From 5a486f5b6bf5f838db5dc2bfc5819a0cba5d2d19 Mon Sep 17 00:00:00 2001
24+From: Daniel van Vugt <daniel.van.vugt@canonical.com>
25+Date: Thu, 23 May 2019 18:15:28 +0800
26+Subject: [PATCH] background: Reload when GPU memory is invalidated
27+
28+Fixes corrupt background wallpaper when resuming from suspend on the
29+Nvidia driver.
30+
31+Bug: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1084
32+Bug-Ubuntu: http://launchpad.net/bugs/1809407
33+Origin: https://gitlab.gnome.org/GNOME/mutter/commit/5a486f5b6
34+Forwarded: yes
35+
36+diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
37+index c033395fe..387ce5dd3 100644
38+--- a/src/compositor/meta-background.c
39++++ b/src/compositor/meta-background.c
40+@@ -252,12 +252,11 @@ static void
41+ set_file (MetaBackground *self,
42+ GFile **filep,
43+ MetaBackgroundImage **imagep,
44+- GFile *file)
45++ GFile *file,
46++ gboolean force_reload)
47+ {
48+- if (!file_equal0 (*filep, file))
49++ if (force_reload || !file_equal0 (*filep, file))
50+ {
51+- g_clear_object (filep);
52+-
53+ if (*imagep)
54+ {
55+ g_signal_handlers_disconnect_by_func (*imagep,
56+@@ -267,11 +266,12 @@ set_file (MetaBackground *self,
57+ *imagep = NULL;
58+ }
59+
60++ g_set_object (filep, file);
61++
62+ if (file)
63+ {
64+ MetaBackgroundImageCache *cache = meta_background_image_cache_get_default ();
65+
66+- *filep = g_object_ref (file);
67+ *imagep = meta_background_image_cache_load (cache, file);
68+ g_signal_connect (*imagep, "loaded",
69+ G_CALLBACK (on_background_loaded), self);
70+@@ -279,6 +279,32 @@ set_file (MetaBackground *self,
71+ }
72+ }
73+
74++static void
75++on_gl_video_memory_purged (MetaBackground *self)
76++{
77++ MetaBackgroundImageCache *cache = meta_background_image_cache_get_default ();
78++
79++ /* The GPU memory that just got invalidated is the texture inside
80++ * self->background_image1,2 and/or its mipmaps. However, to save memory the
81++ * original pixbuf isn't kept in RAM so we can't do a simple re-upload. The
82++ * only copy of the image was the one in texture memory that got invalidated.
83++ * So we need to do a full reload from disk.
84++ */
85++ if (self->file1)
86++ {
87++ meta_background_image_cache_purge (cache, self->file1);
88++ set_file (self, &self->file1, &self->background_image1, self->file1, TRUE);
89++ }
90++
91++ if (self->file2)
92++ {
93++ meta_background_image_cache_purge (cache, self->file2);
94++ set_file (self, &self->file2, &self->background_image2, self->file2, TRUE);
95++ }
96++
97++ mark_changed (self);
98++}
99++
100+ static void
101+ meta_background_dispose (GObject *object)
102+ {
103+@@ -287,8 +313,8 @@ meta_background_dispose (GObject *object)
104+ free_color_texture (self);
105+ free_wallpaper_texture (self);
106+
107+- set_file (self, &self->file1, &self->background_image1, NULL);
108+- set_file (self, &self->file2, &self->background_image2, NULL);
109++ set_file (self, &self->file1, &self->background_image1, NULL, FALSE);
110++ set_file (self, &self->file2, &self->background_image2, NULL, FALSE);
111+
112+ set_display (self, NULL);
113+
114+@@ -312,7 +338,7 @@ meta_background_constructed (GObject *object)
115+ G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
116+
117+ g_signal_connect_object (self->display, "gl-video-memory-purged",
118+- G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
119++ G_CALLBACK (on_gl_video_memory_purged), object, G_CONNECT_SWAPPED);
120+
121+ g_signal_connect_object (monitor_manager, "monitors-changed",
122+ G_CALLBACK (on_monitors_changed), self,
123+@@ -937,8 +963,8 @@ meta_background_set_blend (MetaBackground *self,
124+ g_return_if_fail (META_IS_BACKGROUND (self));
125+ g_return_if_fail (blend_factor >= 0.0 && blend_factor <= 1.0);
126+
127+- set_file (self, &self->file1, &self->background_image1, file1);
128+- set_file (self, &self->file2, &self->background_image2, file2);
129++ set_file (self, &self->file1, &self->background_image1, file1, FALSE);
130++ set_file (self, &self->file2, &self->background_image2, file2, FALSE);
131+
132+ self->blend_factor = blend_factor;
133+ self->style = style;
134+--
135+2.20.1
136+
137diff --git a/debian/patches/series b/debian/patches/series
138index d4f2ccb..4a545bc 100644
139--- a/debian/patches/series
140+++ b/debian/patches/series
141@@ -6,3 +6,4 @@ meson-add-back-default_driver-option.patch
142 debian/synaptics-support.patch
143 x11-Add-support-for-fractional-scaling-using-Randr.patch
144 debian/Revert-meson-Bump-meson-requirement-to-0.50.0.patch
145+background-Reload-when-GPU-memory-is-invalidated.patch

Subscribers

People subscribed via source and target branches