[mutter] wayland/compositor: Process frame callbacks on 'after-update'



commit 8cff3b84f7263480cbe2c9757c61b566d2941246
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Jun 3 11:38:32 2020 +0200

    wayland/compositor: Process frame callbacks on 'after-update'
    
    Instead of going via MetaCompositor to know about when we updated
    (confusingly named post-paint), use the new stage signal directly.
    
    Note that this doesn't change the time frame callbacks are dispatched;
    it's still not tied to actual painting even though it seemed so before
    given the function names.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285

 src/compositor/compositor.c |  5 -----
 src/wayland/meta-wayland.c  | 12 ++++++++----
 2 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 9afb1a5eae..65c1c30348 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -1142,11 +1142,6 @@ meta_compositor_real_post_paint (MetaCompositor *compositor)
     meta_compositor_get_instance_private (compositor);
   CoglGraphicsResetStatus status;
 
-#ifdef HAVE_WAYLAND
-  if (meta_is_wayland_compositor ())
-    meta_wayland_compositor_paint_finished (meta_wayland_compositor_get_default ());
-#endif
-
   status = cogl_get_graphics_reset_status (priv->context);
   switch (status)
     {
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index e4b09cbfc7..30d3979ba1 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -194,8 +194,9 @@ meta_wayland_compositor_update (MetaWaylandCompositor *compositor,
     meta_wayland_seat_update (compositor->seat, event);
 }
 
-void
-meta_wayland_compositor_paint_finished (MetaWaylandCompositor *compositor)
+static void
+on_after_update (ClutterStage          *stage,
+                 MetaWaylandCompositor *compositor)
 {
   GList *l;
   int64_t now_us;
@@ -397,9 +398,9 @@ meta_wayland_compositor_new (MetaBackend *backend)
 }
 
 void
-meta_wayland_compositor_setup (MetaWaylandCompositor *wayland_compositor)
+meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
 {
-  MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
+  ClutterActor *stage = meta_backend_get_stage (compositor->backend);
   GSource *wayland_event_source;
 
   wayland_event_source = wayland_event_source_new (compositor->wayland_display);
@@ -413,6 +414,9 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *wayland_compositor)
   g_source_set_priority (wayland_event_source, GDK_PRIORITY_EVENTS + 1);
   g_source_attach (wayland_event_source, NULL);
 
+  g_signal_connect (stage, "after-update",
+                    G_CALLBACK (on_after_update), compositor);
+
   if (!wl_global_create (compositor->wayland_display,
                         &wl_compositor_interface,
                         META_WL_COMPOSITOR_VERSION,


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