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

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