Blame SOURCES/0004-background-refresh-background-on-gl-video-memory-pur.patch

671c89
From 055bc14c70af66fe1893dcd4c42c65662ae1f9d0 Mon Sep 17 00:00:00 2001
671c89
From: Ray Strode <rstrode@redhat.com>
671c89
Date: Mon, 21 Jan 2019 15:07:15 -0500
671c89
Subject: [PATCH 4/4] background: refresh background on gl-video-memory-purged
671c89
 signal
671c89
671c89
Right now we refresh the background when resuming and when NVIDIA.
671c89
But mutter has a signal to tell us specifically when to refresh,
671c89
and the signal is only emitted for NVIDIA, so use that instead.
671c89
---
671c89
 js/ui/background.js |  9 +++++++--
671c89
 js/ui/layout.js     | 12 ------------
671c89
 src/shell-util.c    | 27 ---------------------------
671c89
 src/shell-util.h    |  2 --
671c89
 4 files changed, 7 insertions(+), 43 deletions(-)
671c89
671c89
diff --git a/js/ui/background.js b/js/ui/background.js
671c89
index 75b76a57e..466cc4de7 100644
671c89
--- a/js/ui/background.js
671c89
+++ b/js/ui/background.js
671c89
@@ -527,10 +527,15 @@ var BackgroundSource = class BackgroundSource {
671c89
         let monitorManager = Meta.MonitorManager.get();
671c89
         this._monitorsChangedId =
671c89
             monitorManager.connect('monitors-changed',
671c89
-                                   this._onMonitorsChanged.bind(this));
671c89
+                                   this._refresh.bind(this));
671c89
+
671c89
+        global.display.connect('gl-video-memory-purged', () => {
671c89
+            Meta.Background.refresh_all();
671c89
+            this._refresh();
671c89
+        });
671c89
     }
671c89
 
671c89
-    _onMonitorsChanged() {
671c89
+    _refresh() {
671c89
         for (let monitorIndex in this._backgrounds) {
671c89
             let background = this._backgrounds[monitorIndex];
671c89
 
671c89
diff --git a/js/ui/layout.js b/js/ui/layout.js
671c89
index 30e750dc5..2b3bb7442 100644
671c89
--- a/js/ui/layout.js
671c89
+++ b/js/ui/layout.js
671c89
@@ -282,18 +282,6 @@ var LayoutManager = GObject.registerClass({
671c89
         monitorManager.connect('monitors-changed',
671c89
                                this._monitorsChanged.bind(this));
671c89
         this._monitorsChanged();
671c89
-
671c89
-        // NVIDIA drivers don't preserve FBO contents across
671c89
-        // suspend/resume, see
671c89
-        // https://bugzilla.gnome.org/show_bug.cgi?id=739178
671c89
-        if (Shell.util_need_background_refresh()) {
671c89
-            LoginManager.getLoginManager().connect('prepare-for-sleep',
671c89
-                (lm, suspending) => {
671c89
-                    if (suspending)
671c89
-                        return;
671c89
-                    Meta.Background.refresh_all();
671c89
-                });
671c89
-        }
671c89
     }
671c89
 
671c89
     // This is called by Main after everything else is constructed
671c89
diff --git a/src/shell-util.c b/src/shell-util.c
671c89
index c6e5abed6..9c25643c6 100644
671c89
--- a/src/shell-util.c
671c89
+++ b/src/shell-util.c
671c89
@@ -374,33 +374,6 @@ shell_util_create_pixbuf_from_data (const guchar      *data,
671c89
                                    (GdkPixbufDestroyNotify) g_free, NULL);
671c89
 }
671c89
 
671c89
-typedef const gchar *(*ShellGLGetString) (GLenum);
671c89
-
671c89
-static const gchar *
671c89
-get_gl_vendor (void)
671c89
-{
671c89
-  static const gchar *vendor = NULL;
671c89
-
671c89
-  if (!vendor)
671c89
-    {
671c89
-      ShellGLGetString gl_get_string;
671c89
-      gl_get_string = (ShellGLGetString) cogl_get_proc_address ("glGetString");
671c89
-      if (gl_get_string)
671c89
-        vendor = gl_get_string (GL_VENDOR);
671c89
-    }
671c89
-
671c89
-  return vendor;
671c89
-}
671c89
-
671c89
-gboolean
671c89
-shell_util_need_background_refresh (void)
671c89
-{
671c89
-  if (g_strcmp0 (get_gl_vendor (), "NVIDIA Corporation") == 0)
671c89
-    return TRUE;
671c89
-
671c89
-  return FALSE;
671c89
-}
671c89
-
671c89
 static gboolean
671c89
 canvas_draw_cb (ClutterContent *content,
671c89
                 cairo_t        *cr,
671c89
diff --git a/src/shell-util.h b/src/shell-util.h
671c89
index 6904f43bc..049c3fe18 100644
671c89
--- a/src/shell-util.h
671c89
+++ b/src/shell-util.h
671c89
@@ -44,8 +44,6 @@ GdkPixbuf *shell_util_create_pixbuf_from_data (const guchar      *data,
671c89
                                                int                height,
671c89
                                                int                rowstride);
671c89
 
671c89
-gboolean shell_util_need_background_refresh (void);
671c89
-
671c89
 ClutterContent * shell_util_get_content_for_window_actor (MetaWindowActor *window_actor,
671c89
                                                           MetaRectangle   *window_rect);
671c89
 
671c89
-- 
671c89
2.21.0
671c89