[gtk/gtk-3-24] gdkframeclockidle: Don't permanently skew frame time
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24] gdkframeclockidle: Don't permanently skew frame time
- Date: Thu, 11 Apr 2019 17:25:45 +0000 (UTC)
commit 3246d6a7385730ed780c57dff8694ffca8c26da5
Author: Chris Williams <chrisaw1990 gmail com>
Date: Tue Apr 9 16:26:25 2019 -0400
gdkframeclockidle: Don't permanently skew frame time
Since commit 3b2f9395, the frame time may be set into the future, so
only ensure monotonicity, and don't store the offset. This prevents the
frame time from becoming out of sync with g_get_monotonic_time().
Fixes #1612
gdk/gdkframeclockidle.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
---
diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c
index a0ca0ca1b9..2ad7da6ddd 100644
--- a/gdk/gdkframeclockidle.c
+++ b/gdk/gdkframeclockidle.c
@@ -37,9 +37,6 @@
struct _GdkFrameClockIdlePrivate
{
- GTimer *timer;
- /* timer_base is used to avoid ever going backward */
- gint64 timer_base;
gint64 frame_time;
gint64 min_next_frame_time;
gint64 sleep_serial;
@@ -160,22 +157,12 @@ compute_frame_time (GdkFrameClockIdle *idle)
{
GdkFrameClockIdlePrivate *priv = idle->priv;
gint64 computed_frame_time;
- gint64 elapsed;
- elapsed = g_get_monotonic_time () + priv->timer_base;
- if (elapsed < priv->frame_time)
- {
- /* clock went backward. adapt to that by forevermore increasing
- * timer_base. For now, assume we've gone forward in time 1ms.
- */
- /* hmm. just fix GTimer? */
+ computed_frame_time = g_get_monotonic_time ();
+
+ /* ensure monotonicity of frame time */
+ if (computed_frame_time <= priv->frame_time)
computed_frame_time = priv->frame_time + 1;
- priv->timer_base += (priv->frame_time - elapsed) + 1;
- }
- else
- {
- computed_frame_time = elapsed;
- }
return computed_frame_time;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]