[mutter/wip/texture-purge-on-nvidia: 1/5] wip! force texture updates



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

    wip! force texture updates
    
    This unfinished 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.
    
    There's still no answer for client redraws, but I think maybe we
    can fudge it near term, by messing with the output scale factor
    or some other trick like that.
    
    Also, this needs to conditionalize the code so it only runs for
    nvidia. That's something i'm going to experiment with next.
    
    The code detects resume via timerfd instead of ARB_robustness, so
    we don't lose our context. that code needs to be conditionalized,
    so it doesn't try to build on platforms that don't have timerfd.
    
    This whole commit needs to be broken up into subcommits.

 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 0f6a00248..81b735899 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -670,9 +670,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]