clutter/stage-cogl: Remove pending_swaps counter
As a protection against duplicate/early update times, it has already been replaced by commit35aa2781
and commit4faeb127
. 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
This commit is contained in:
parent
4d8190972d
commit
f57ce7254d
2 changed files with 8 additions and 48 deletions
|
@ -95,22 +95,7 @@ _clutter_stage_cogl_presented (ClutterStageCogl *stage_cogl,
|
||||||
CoglFrameEvent frame_event,
|
CoglFrameEvent frame_event,
|
||||||
ClutterFrameInfo *frame_info)
|
ClutterFrameInfo *frame_info)
|
||||||
{
|
{
|
||||||
|
if (frame_event == COGL_FRAME_EVENT_COMPLETE)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
gint64 presentation_time_cogl = frame_info->presentation_time;
|
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);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||||
|
|
||||||
if (stage_cogl->pending_swaps)
|
|
||||||
return -1; /* in the future, indefinite */
|
|
||||||
|
|
||||||
return stage_cogl->update_time;
|
return stage_cogl->update_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +436,7 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
||||||
cogl_framebuffer_pop_matrix (framebuffer);
|
cogl_framebuffer_pop_matrix (framebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
swap_framebuffer (ClutterStageWindow *stage_window,
|
swap_framebuffer (ClutterStageWindow *stage_window,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
cairo_rectangle_int_t *swap_region,
|
cairo_rectangle_int_t *swap_region,
|
||||||
|
@ -492,8 +474,6 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||||
|
|
||||||
cogl_onscreen_swap_region (onscreen,
|
cogl_onscreen_swap_region (onscreen,
|
||||||
damage, ndamage);
|
damage, ndamage);
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -502,8 +482,6 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||||
|
|
||||||
cogl_onscreen_swap_buffers_with_damage (onscreen,
|
cogl_onscreen_swap_buffers_with_damage (onscreen,
|
||||||
damage, ndamage);
|
damage, ndamage);
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -511,8 +489,6 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||||
CLUTTER_NOTE (BACKEND, "cogl_framebuffer_finish (framebuffer: %p)",
|
CLUTTER_NOTE (BACKEND, "cogl_framebuffer_finish (framebuffer: %p)",
|
||||||
framebuffer);
|
framebuffer);
|
||||||
cogl_framebuffer_finish (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);
|
_clutter_util_rectangle_int_extents (&tmp, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||||
ClutterStageView *view)
|
ClutterStageView *view)
|
||||||
{
|
{
|
||||||
|
@ -955,14 +931,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||||
transform_swap_region_to_onscreen (view, &swap_region);
|
transform_swap_region_to_onscreen (view, &swap_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
return swap_framebuffer (stage_window,
|
swap_framebuffer (stage_window,
|
||||||
view,
|
view,
|
||||||
&swap_region,
|
&swap_region,
|
||||||
swap_with_damage);
|
swap_with_damage);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -970,7 +942,6 @@ static void
|
||||||
clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||||
gboolean swap_event = FALSE;
|
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
COGL_TRACE_BEGIN (ClutterStageCoglRedraw, "Paint (Cogl Redraw)");
|
COGL_TRACE_BEGIN (ClutterStageCoglRedraw, "Paint (Cogl Redraw)");
|
||||||
|
@ -979,23 +950,13 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||||
{
|
{
|
||||||
ClutterStageView *view = l->data;
|
ClutterStageView *view = l->data;
|
||||||
|
|
||||||
swap_event =
|
clutter_stage_cogl_redraw_view (stage_window, view);
|
||||||
clutter_stage_cogl_redraw_view (stage_window, view) || swap_event;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_clutter_stage_emit_after_paint (stage_cogl->wrapper);
|
_clutter_stage_emit_after_paint (stage_cogl->wrapper);
|
||||||
|
|
||||||
_clutter_stage_window_finish_frame (stage_window);
|
_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... */
|
/* reset the redraw clipping for the next paint... */
|
||||||
stage_cogl->initialized_redraw_clip = FALSE;
|
stage_cogl->initialized_redraw_clip = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ struct _ClutterStageCogl
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
|
|
||||||
float refresh_rate;
|
float refresh_rate;
|
||||||
int pending_swaps;
|
|
||||||
|
|
||||||
gint64 last_presentation_time;
|
gint64 last_presentation_time;
|
||||||
gint64 update_time;
|
gint64 update_time;
|
||||||
|
|
Loading…
Reference in a new issue