[mutter] clutter/stage-cogl: Remove pending_swaps counter



commit f57ce7254d4abd462044318bb088fccd8557ccc8
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Wed Aug 7 10:24:35 2019 +0800

    clutter/stage-cogl: Remove pending_swaps counter
    
    As a protection against duplicate/early update times, it has already
    been replaced by commit 35aa2781 and commit 4faeb127.
    
    Removing it also prevents a common cause of frame skips:
    
      clutter_stage_cogl_schedule_update()
      clutter_stage_cogl_get_update_time() == -1
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1411
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/719

 clutter/clutter/cogl/clutter-stage-cogl.c | 55 +++++--------------------------
 clutter/clutter/cogl/clutter-stage-cogl.h |  1 -
 2 files changed, 8 insertions(+), 48 deletions(-)
---
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index 8f97a5fa6..4dd7a900e 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -95,22 +95,7 @@ _clutter_stage_cogl_presented (ClutterStageCogl *stage_cogl,
                                CoglFrameEvent    frame_event,
                                ClutterFrameInfo *frame_info)
 {
-
-  if (frame_event == COGL_FRAME_EVENT_SYNC)
-    {
-      /* Early versions of the swap_event implementation in Mesa
-       * deliver BufferSwapComplete event when not selected for,
-       * so if we get a swap event we aren't expecting, just ignore it.
-       *
-       * https://bugs.freedesktop.org/show_bug.cgi?id=27962
-       *
-       * FIXME: This issue can be hidden inside Cogl so we shouldn't
-       * need to care about this bug here.
-       */
-      if (stage_cogl->pending_swaps > 0)
-        stage_cogl->pending_swaps--;
-    }
-  else if (frame_event == COGL_FRAME_EVENT_COMPLETE)
+  if (frame_event == COGL_FRAME_EVENT_COMPLETE)
     {
       gint64 presentation_time_cogl = frame_info->presentation_time;
 
@@ -243,9 +228,6 @@ clutter_stage_cogl_get_update_time (ClutterStageWindow *stage_window)
 {
   ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
 
-  if (stage_cogl->pending_swaps)
-    return -1; /* in the future, indefinite */
-
   return stage_cogl->update_time;
 }
 
@@ -454,7 +436,7 @@ paint_damage_region (ClutterStageWindow    *stage_window,
   cogl_framebuffer_pop_matrix (framebuffer);
 }
 
-static gboolean
+static void
 swap_framebuffer (ClutterStageWindow    *stage_window,
                   ClutterStageView      *view,
                   cairo_rectangle_int_t *swap_region,
@@ -492,8 +474,6 @@ swap_framebuffer (ClutterStageWindow    *stage_window,
 
           cogl_onscreen_swap_region (onscreen,
                                      damage, ndamage);
-
-          return FALSE;
         }
       else
         {
@@ -502,8 +482,6 @@ swap_framebuffer (ClutterStageWindow    *stage_window,
 
           cogl_onscreen_swap_buffers_with_damage (onscreen,
                                                   damage, ndamage);
-
-          return TRUE;
         }
     }
   else
@@ -511,8 +489,6 @@ swap_framebuffer (ClutterStageWindow    *stage_window,
       CLUTTER_NOTE (BACKEND, "cogl_framebuffer_finish (framebuffer: %p)",
                     framebuffer);
       cogl_framebuffer_finish (framebuffer);
-
-      return FALSE;
     }
 }
 
@@ -636,7 +612,7 @@ scale_and_clamp_rect (const ClutterRect     *rect,
   _clutter_util_rectangle_int_extents (&tmp, dest);
 }
 
-static gboolean
+static void
 clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
                                 ClutterStageView   *view)
 {
@@ -955,14 +931,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
           transform_swap_region_to_onscreen (view, &swap_region);
         }
 
-      return swap_framebuffer (stage_window,
-                               view,
-                               &swap_region,
-                               swap_with_damage);
-    }
-  else
-    {
-      return FALSE;
+      swap_framebuffer (stage_window,
+                        view,
+                        &swap_region,
+                        swap_with_damage);
     }
 }
 
@@ -970,7 +942,6 @@ static void
 clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
 {
   ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
-  gboolean swap_event = FALSE;
   GList *l;
 
   COGL_TRACE_BEGIN (ClutterStageCoglRedraw, "Paint (Cogl Redraw)");
@@ -979,23 +950,13 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
     {
       ClutterStageView *view = l->data;
 
-      swap_event =
-        clutter_stage_cogl_redraw_view (stage_window, view) || swap_event;
+      clutter_stage_cogl_redraw_view (stage_window, view);
     }
 
   _clutter_stage_emit_after_paint (stage_cogl->wrapper);
 
   _clutter_stage_window_finish_frame (stage_window);
 
-  if (swap_event)
-    {
-      /* If we have swap buffer events then cogl_onscreen_swap_buffers
-       * will return immediately and we need to track that there is a
-       * swap in progress... */
-      if (clutter_feature_available (CLUTTER_FEATURE_SWAP_EVENTS))
-        stage_cogl->pending_swaps++;
-    }
-
   /* reset the redraw clipping for the next paint... */
   stage_cogl->initialized_redraw_clip = FALSE;
 
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.h b/clutter/clutter/cogl/clutter-stage-cogl.h
index a69c424eb..53d0267de 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.h
+++ b/clutter/clutter/cogl/clutter-stage-cogl.h
@@ -49,7 +49,6 @@ struct _ClutterStageCogl
   ClutterBackend *backend;
 
   float refresh_rate;
-  int pending_swaps;
 
   gint64 last_presentation_time;
   gint64 update_time;


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