Blame SOURCES/0001-st-texture-cache-purge-on-resume.patch

0999a2
From 483f0340bb64767bd8d6d95788058270dfdb5def Mon Sep 17 00:00:00 2001
0999a2
From: Ray Strode <rstrode@redhat.com>
0999a2
Date: Tue, 15 Jan 2019 12:54:32 -0500
0999a2
Subject: [PATCH] st-texture-cache: purge on resume
0999a2
0999a2
With the proprietary nvidia driver, textures get garbled on suspend,
0999a2
so the texture cache needs to evict all textures in that situation.
0999a2
---
0999a2
 js/ui/main.js             |  6 +++++-
0999a2
 src/st/st-texture-cache.c | 10 ++++++++++
0999a2
 src/st/st-texture-cache.h |  1 +
0999a2
 3 files changed, 16 insertions(+), 1 deletion(-)
0999a2
0999a2
diff --git a/js/ui/main.js b/js/ui/main.js
0999a2
index 979fcefa5..dbf3a32d3 100644
0999a2
--- a/js/ui/main.js
0999a2
+++ b/js/ui/main.js
0999a2
@@ -249,7 +249,11 @@ function _initializeUI() {
0999a2
         return true;
0999a2
     });
0999a2
 
0999a2
-    global.display.connect('gl-video-memory-purged', loadTheme);
0999a2
+    global.display.connect('gl-video-memory-purged', () => {
0999a2
+        let cache = St.TextureCache.get_default();
0999a2
+        cache.clear();
0999a2
+        loadTheme();
0999a2
+    });
0999a2
 
0999a2
     // Provide the bus object for gnome-session to
0999a2
     // initiate logouts.
0999a2
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
0999a2
index b7b547a78..583c3f7d2 100644
0999a2
--- a/src/st/st-texture-cache.c
0999a2
+++ b/src/st/st-texture-cache.c
0999a2
@@ -130,6 +130,16 @@ st_texture_cache_class_init (StTextureCacheClass *klass)
0999a2
                   G_TYPE_NONE, 1, G_TYPE_FILE);
0999a2
 }
0999a2
 
0999a2
+/* Evicts all cached textures */
0999a2
+void
0999a2
+st_texture_cache_clear (StTextureCache *cache)
0999a2
+{
0999a2
+  g_return_if_fail (ST_IS_TEXTURE_CACHE (cache));
0999a2
+
0999a2
+  g_hash_table_remove_all (cache->priv->keyed_cache);
0999a2
+  g_signal_emit (cache, signals[ICON_THEME_CHANGED], 0);
0999a2
+}
0999a2
+
0999a2
 /* Evicts all cached textures for named icons */
0999a2
 static void
0999a2
 st_texture_cache_evict_icons (StTextureCache *cache)
0999a2
diff --git a/src/st/st-texture-cache.h b/src/st/st-texture-cache.h
0999a2
index 55d84952d..948915c30 100644
0999a2
--- a/src/st/st-texture-cache.h
0999a2
+++ b/src/st/st-texture-cache.h
0999a2
@@ -53,6 +53,7 @@ typedef enum {
0999a2
 } StTextureCachePolicy;
0999a2
 
0999a2
 StTextureCache* st_texture_cache_get_default (void);
0999a2
+void st_texture_cache_clear (StTextureCache *cache);
0999a2
 
0999a2
 ClutterActor *
0999a2
 st_texture_cache_load_sliced_image (StTextureCache *cache,
0999a2
-- 
0999a2
2.31.1
0999a2