[mutter] clutter-stage: Add `gl-video-memory-purged` signal



commit 305fcd07134d7a2ea159aad260f04ed39a566b53
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Fri Jul 17 15:16:09 2020 +0800

    clutter-stage: Add `gl-video-memory-purged` signal
    
    For when you want parts of Clutter to connect to the signal, without
    referencing Meta classes.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1374

 clutter/clutter/clutter-stage.c | 17 +++++++++++++++++
 src/compositor/compositor.c     |  4 +++-
 2 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 454e6942e6..0e0d103add 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -172,6 +172,7 @@ enum
   AFTER_UPDATE,
   PAINT_VIEW,
   PRESENTED,
+  GL_VIDEO_MEMORY_PURGED,
 
   LAST_SIGNAL
 };
@@ -2011,6 +2012,22 @@ clutter_stage_class_init (ClutterStageClass *klass)
                   CLUTTER_TYPE_STAGE_VIEW,
                   G_TYPE_POINTER);
 
+ /**
+   * ClutterStage::gl-video-memory-purged: (skip)
+   * @stage: the stage that received the event
+   *
+   * Signals that the underlying GL driver has had its texture memory purged
+   * so anything presently held in texture memory is now invalidated, and
+   * likely corrupt. It needs redrawing.
+   */
+  stage_signals[GL_VIDEO_MEMORY_PURGED] =
+    g_signal_new (I_("gl-video-memory-purged"),
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE, 0);
+
   klass->activate = clutter_stage_real_activate;
   klass->deactivate = clutter_stage_real_deactivate;
   klass->delete_event = clutter_stage_real_delete_event;
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 79c93cf0ae..41a65be39d 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -1113,6 +1113,7 @@ meta_compositor_real_after_paint (MetaCompositor   *compositor,
 {
   MetaCompositorPrivate *priv =
     meta_compositor_get_instance_private (compositor);
+  ClutterActor *stage_actor = meta_backend_get_stage (priv->backend);
   CoglGraphicsResetStatus status;
   GList *l;
 
@@ -1124,7 +1125,8 @@ meta_compositor_real_after_paint (MetaCompositor   *compositor,
 
     case COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET:
       g_signal_emit_by_name (priv->display, "gl-video-memory-purged");
-      clutter_actor_queue_redraw (meta_backend_get_stage (priv->backend));
+      g_signal_emit_by_name (stage_actor, "gl-video-memory-purged");
+      clutter_actor_queue_redraw (stage_actor);
       break;
 
     default:


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