[mutter/wip/texture-purge-on-nvidia: 68/71] backends/native: force texture updates



commit 2899da6922b278c9101ff265071e85e0cc0de342
Author: Ray Strode <rstrode redhat com>
Date:   Tue Jan 8 16:51:28 2019 -0500

    backends/native: force texture updates
    
    This commit makes sure all the various texture caches
    get flushed on resume, so they don't leave corruption on the
    screen with nvidia proprietary driver.

 src/backends/native/meta-backend-native.c |  5 +++++
 src/compositor/compositor.c               | 15 ++++++++++++---
 src/core/screen-private.h                 |  2 --
 src/meta/screen.h                         |  3 +++
 4 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index 042d96ec6..4916c53ac 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -645,9 +645,14 @@ void meta_backend_native_resume (MetaBackendNative *native)
     meta_backend_get_monitor_manager (backend);
   MetaMonitorManagerKms *monitor_manager_kms =
     META_MONITOR_MANAGER_KMS (monitor_manager);
+  MetaDisplay *display = meta_get_display ();
   ClutterActor *stage;
   MetaIdleMonitor *idle_monitor;
 
+  clutter_clear_glyph_cache ();
+  meta_screen_update_cursor (display->screen);
+  g_signal_emit_by_name (display, "gl-video-memory-purged");
+
   meta_monitor_manager_kms_resume (monitor_manager_kms);
 
   clutter_evdev_reclaim_devices ();
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 8c924d256..1dedd2fd8 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -54,6 +54,8 @@
 
 #include <clutter/x11/clutter-x11.h>
 
+#include <sys/timerfd.h>
+
 #include "core.h"
 #include <meta/screen.h>
 #include <meta/errors.h>
@@ -89,7 +91,6 @@ on_presented (ClutterStage     *stage,
               CoglFrameEvent    event,
               ClutterFrameInfo *frame_info,
               MetaCompositor   *compositor);
-
 static gboolean
 is_modal (MetaDisplay *display)
 {
@@ -1175,6 +1176,14 @@ meta_pre_paint_func (gpointer data)
   return TRUE;
 }
 
+static void
+purge_textures (MetaCompositor *compositor)
+{
+  clutter_clear_glyph_cache ();
+  g_signal_emit_by_name (compositor->display, "gl-video-memory-purged");
+  clutter_actor_queue_redraw (CLUTTER_ACTOR (compositor->stage));
+}
+
 static gboolean
 meta_post_paint_func (gpointer data)
 {
@@ -1190,14 +1199,14 @@ meta_post_paint_func (gpointer data)
     }
 
   status = cogl_get_graphics_reset_status (compositor->context);
+
   switch (status)
     {
     case COGL_GRAPHICS_RESET_STATUS_NO_ERROR:
       break;
 
     case COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET:
-      g_signal_emit_by_name (compositor->display, "gl-video-memory-purged");
-      clutter_actor_queue_redraw (CLUTTER_ACTOR (compositor->stage));
+      purge_textures (compositor);
       break;
 
     default:
diff --git a/src/core/screen-private.h b/src/core/screen-private.h
index ff796f01a..37f2a01a1 100644
--- a/src/core/screen-private.h
+++ b/src/core/screen-private.h
@@ -122,8 +122,6 @@ void          meta_screen_foreach_window      (MetaScreen                 *scree
                                                MetaScreenWindowFunc        func,
                                                gpointer                    data);
 
-void          meta_screen_update_cursor       (MetaScreen                 *screen);
-
 void          meta_screen_update_tile_preview          (MetaScreen    *screen,
                                                         gboolean       delay);
 void          meta_screen_hide_tile_preview            (MetaScreen    *screen);
diff --git a/src/meta/screen.h b/src/meta/screen.h
index 13c92516e..36c397418 100644
--- a/src/meta/screen.h
+++ b/src/meta/screen.h
@@ -125,4 +125,7 @@ void meta_screen_override_workspace_layout (MetaScreen      *screen,
 void          meta_screen_set_cursor          (MetaScreen                 *screen,
                                                MetaCursor                  cursor);
 
+void          meta_screen_update_cursor       (MetaScreen                 *screen);
+
+
 #endif


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