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

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