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

Proposed by Daniel van Vugt
Status: Rejected
Rejected by: Sebastien Bacher
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 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.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

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

Unmerged commits

2a7dc7c... by Daniel van Vugt

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

Subscribers

People subscribed via source and target branches