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

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