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.
This commit is contained in:
Ray Strode 2019-01-15 12:54:32 -05:00
parent 68c631223c
commit 0507fef4cd
3 changed files with 20 additions and 1 deletions

View File

@ -207,7 +207,13 @@ 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.

View File

@ -105,6 +105,18 @@ 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)
{
GHashTableIter iter;
gpointer key;
gpointer value;
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)

View File

@ -52,6 +52,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,