gnome-shell/SOURCES/0003-st-texture-cache-purge...

67 lines
2.1 KiB
Diff
Raw Normal View History

2019-11-05 19:43:42 +00:00
From 2ebeda3385fb679df4bc13ba4b80bdeba5e2ad13 Mon Sep 17 00:00:00 2001
2019-05-07 12:23:00 +00:00
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 15 Jan 2019 12:54:32 -0500
Subject: [PATCH 3/4] 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 +++++-
2019-11-05 19:43:42 +00:00
src/st/st-texture-cache.c | 10 ++++++++++
2019-05-07 12:23:00 +00:00
src/st/st-texture-cache.h | 1 +
2019-11-05 19:43:42 +00:00
3 files changed, 16 insertions(+), 1 deletion(-)
2019-05-07 12:23:00 +00:00
diff --git a/js/ui/main.js b/js/ui/main.js
2019-11-05 19:43:42 +00:00
index 061303cf3..8d1755cf1 100644
2019-05-07 12:23:00 +00:00
--- a/js/ui/main.js
+++ b/js/ui/main.js
2019-11-05 19:43:42 +00:00
@@ -200,7 +200,11 @@ function _initializeUI() {
2019-05-07 12:23:00 +00:00
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
2019-11-05 19:43:42 +00:00
index cbe3afaba..40a11dd6d 100644
2019-05-07 12:23:00 +00:00
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
2019-11-05 19:43:42 +00:00
@@ -113,6 +113,16 @@ st_texture_cache_class_init (StTextureCacheClass *klass)
2019-05-07 12:23:00 +00:00
G_TYPE_NONE, 1, G_TYPE_FILE);
}
+/* Evicts all cached textures */
+void
+st_texture_cache_clear (StTextureCache *cache)
+{
2019-11-05 19:43:42 +00:00
+ g_return_if_fail (ST_IS_TEXTURE_CACHE (cache));
2019-05-07 12:23:00 +00:00
+
+ 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
2019-11-05 19:43:42 +00:00
index 11d1c4e64..9079d1fda 100644
2019-05-07 12:23:00 +00:00
--- a/src/st/st-texture-cache.h
+++ b/src/st/st-texture-cache.h
2019-11-05 19:43:42 +00:00
@@ -53,6 +53,7 @@ typedef enum {
2019-05-07 12:23:00 +00:00
} StTextureCachePolicy;
StTextureCache* st_texture_cache_get_default (void);
+void st_texture_cache_clear (StTextureCache *cache);
ClutterActor *
st_texture_cache_load_sliced_image (StTextureCache *cache,
--
2019-11-05 19:43:42 +00:00
2.21.0
2019-05-07 12:23:00 +00:00