[gnome-shell/wip/texture-purge-on-nvidia] Clear textures on resume



commit baedc73945ba68a84426c89f23e50b24ed068f55
Author: Ray Strode <rstrode redhat com>
Date:   Tue Jan 8 16:58:58 2019 -0500

    Clear textures on resume
    
    This is a few changes necessary to redo textures on resume on nvidia
    on wayland.

 js/ui/background.js       |  1 +
 js/ui/main.js             |  8 +++++++-
 src/shell-util.c          |  3 ---
 src/st/st-texture-cache.c | 12 ++++++++++++
 src/st/st-texture-cache.h |  1 +
 5 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/background.js b/js/ui/background.js
index b24f82536..4039c9b6d 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -265,6 +265,7 @@ var Background = new Lang.Class({
                 if (aboutToSuspend)
                     return;
                 this._refreshAnimation();
+                this.emit('changed');
             });
 
         this._settingsChangedSignalId = this._settings.connect('changed', () => {
diff --git a/js/ui/main.js b/js/ui/main.js
index d86cf9e81..19c0d4dc9 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -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.
diff --git a/src/shell-util.c b/src/shell-util.c
index 70b8c0611..c43bf4cc5 100644
--- a/src/shell-util.c
+++ b/src/shell-util.c
@@ -399,9 +399,6 @@ get_gl_vendor (void)
 gboolean
 shell_util_need_background_refresh (void)
 {
-  if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
-    return FALSE;
-
   if (g_strcmp0 (get_gl_vendor (), "NVIDIA Corporation") == 0)
     return TRUE;
 
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index 0c794a3ab..5a3dcd81f 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -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)
diff --git a/src/st/st-texture-cache.h b/src/st/st-texture-cache.h
index 26f9c30ac..b87adc4d5 100644
--- a/src/st/st-texture-cache.h
+++ b/src/st/st-texture-cache.h
@@ -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,


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