[mutter/wip/texture-purge-on-nvidia: 3/4] wip! force texture updates



commit 41f8c9e56412757c6d8875d7fce6a0c1e2f7b88f
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/compositor/compositor-private.h         |  2 ++
 src/compositor/compositor.c                 | 19 ++++++++++++++++---
 src/compositor/meta-surface-actor-wayland.c |  2 ++
 3 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index 40c0344cc..4e1656f77 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -41,6 +41,8 @@ struct _MetaCompositor
 
   MetaPluginManager *plugin_mgr;
 
+  MetaSuspendMonitor *suspend_monitor;
+
   gboolean frame_has_updated_xsurfaces;
   gboolean have_x11_sync_object;
 };
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 8c924d256..f77c71896 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)
 {
@@ -503,6 +504,8 @@ meta_compositor_manage (MetaCompositor *compositor)
                     G_CALLBACK (on_presented),
                     compositor);
 
+  compositor->suspend_monitor = meta_suspend_monitor_new ();
+
   /* We use connect_after() here to accomodate code in GNOME Shell that,
    * when benchmarking drawing performance, connects to ::after-paint
    * and calls glFinish(). The timing information from that will be
@@ -580,6 +583,8 @@ meta_compositor_unmanage (MetaCompositor *compositor)
        * window manager won't be able to redirect subwindows */
       XCompositeUnredirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
     }
+
+  g_clear_object (&compositor->suspend_monitor);
 }
 
 /**
@@ -1175,6 +1180,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 +1203,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/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c
index 7505b7d79..7b00b68a2 100644
--- a/src/compositor/meta-surface-actor-wayland.c
+++ b/src/compositor/meta-surface-actor-wayland.c
@@ -228,6 +228,8 @@ meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass)
 static void
 meta_surface_actor_wayland_init (MetaSurfaceActorWayland *self)
 {
+  MetaSurfaceActorWaylandPrivate *priv =
+    meta_surface_actor_wayland_get_instance_private (self);
 }
 
 MetaSurfaceActor *


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