[gnome-shell/wip/rstrode/login-screen-extensions: 129/134] st-texture-cache: purge on resume




commit 77917cd0df6f9e579b274f2ef0e8421fd8b52b33
Author: Ray Strode <rstrode redhat com>
Date:   Tue Jan 15 12:54:32 2019 -0500

    st-texture-cache: purge on resume
    
    With the proprietary nvidia driver, textures get garbled on suspend,
    so the texture cache needs to evict all textures in that situation.

 js/ui/main.js             |  6 +++++-
 src/st/st-texture-cache.c | 10 ++++++++++
 src/st/st-texture-cache.h |  1 +
 3 files changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 18107d63ae..5fa5a80777 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -203,7 +203,11 @@ function _initializeUI() {
         return true;
     });
 
-    global.display.connect('gl-video-memory-purged', loadTheme);
+    global.display.connect('gl-video-memory-purged', () => {
+        let cache = St.TextureCache.get_default();
+        cache.clear();
+        loadTheme();
+    });
 
     // Provide the bus object for gnome-session to
     // initiate logouts.
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index 4d0d617c4b..6dc3512820 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -115,6 +115,16 @@ st_texture_cache_class_init (StTextureCacheClass *klass)
                   G_TYPE_NONE, 1, G_TYPE_FILE);
 }
 
+/* Evicts all cached textures */
+void
+st_texture_cache_clear (StTextureCache *cache)
+{
+  g_return_if_fail (ST_IS_TEXTURE_CACHE (cache));
+
+  g_hash_table_remove_all (cache->priv->keyed_cache);
+  g_signal_emit (cache, signals[ICON_THEME_CHANGED], 0);
+}
+
 /* Evicts all cached textures for named icons */
 static void
 st_texture_cache_evict_icons (StTextureCache *cache)
diff --git a/src/st/st-texture-cache.h b/src/st/st-texture-cache.h
index a99316da8f..84742be46e 100644
--- a/src/st/st-texture-cache.h
+++ b/src/st/st-texture-cache.h
@@ -53,6 +53,7 @@ typedef enum {
 } StTextureCachePolicy;
 
 StTextureCache* st_texture_cache_get_default (void);
+void st_texture_cache_clear (StTextureCache *cache);
 
 ClutterActor *
 st_texture_cache_load_sliced_image (StTextureCache *cache,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]