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

116 lines
3.8 KiB
Diff
Raw Normal View History

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