diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2012-11-14 12:49:06 -0500 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2013-02-14 17:19:50 -0500 |
commit | 15ee04c66f0e0d34106eb12e815b5f8f2a2b3c5f (patch) | |
tree | 0259ffa7774d2491ad83948fc6ba072e38b010bb /gdk/gdkframeclockidle.c | |
parent | d761df7e0c73341a191b45ac5c30c44eaf31e305 (diff) | |
download | gtk+-15ee04c66f0e0d34106eb12e815b5f8f2a2b3c5f.tar.gz |
Add GdkFrameHistory and GdkFrameTimings, handle _NET_WM_FRAME_TIMINGS
In order to be able to track statistics about how well we are drawing,
and in order to be able to do sophisticated things with frame timing
like predicting per-frame latencies and synchronizing audio with video,
we need to be able to track exactly when previous frames were drawn
to the screen.
Information about each frame is stored in a new GdkFrameTimings object.
A new GdkFrameHistory object is added which keeps a queue of recent
GdkFrameTimings (this is added to avoid further complicating the
implementation of GdkFrameClock.)
https://bugzilla.gnome.org/show_bug.cgi?id=685460
Diffstat (limited to 'gdk/gdkframeclockidle.c')
-rw-r--r-- | gdk/gdkframeclockidle.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c index c8a90368ac..00d284c039 100644 --- a/gdk/gdkframeclockidle.c +++ b/gdk/gdkframeclockidle.c @@ -33,6 +33,7 @@ struct _GdkFrameClockIdlePrivate { + GdkFrameHistory *history; GTimer *timer; /* timer_base is used to avoid ever going backward */ guint64 timer_base; @@ -77,6 +78,7 @@ gdk_frame_clock_idle_init (GdkFrameClockIdle *frame_clock_idle) GdkFrameClockIdlePrivate); priv = frame_clock_idle->priv; + priv->history = gdk_frame_history_new (); priv->timer = g_timer_new (); priv->freeze_count = 0; } @@ -229,7 +231,14 @@ gdk_frame_clock_paint_idle (void *data) case GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT: if (priv->freeze_count == 0) { + GdkFrameTimings *timings; + gint64 frame_counter; + priv->frame_time = compute_frame_time (clock_idle); + gdk_frame_history_begin_frame (priv->history); + frame_counter = gdk_frame_history_get_frame_counter (priv->history); + timings = gdk_frame_history_get_timings (priv->history, frame_counter); + gdk_frame_timings_set_frame_time (timings, priv->frame_time); priv->phase = GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT; @@ -370,6 +379,15 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock) } } +static GdkFrameHistory * +gdk_frame_clock_idle_get_history (GdkFrameClock *clock) +{ + GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock); + GdkFrameClockIdlePrivate *priv = clock_idle->priv; + + return priv->history; +} + static void gdk_frame_clock_idle_interface_init (GdkFrameClockInterface *iface) { @@ -378,6 +396,7 @@ gdk_frame_clock_idle_interface_init (GdkFrameClockInterface *iface) iface->get_requested = gdk_frame_clock_idle_get_requested; iface->freeze = gdk_frame_clock_idle_freeze; iface->thaw = gdk_frame_clock_idle_thaw; + iface->get_history = gdk_frame_clock_idle_get_history; } GdkFrameClock * |