From: Neil Roberts Date: Fri, 5 Feb 2010 21:56:31 +0000 (+0000) Subject: clutter-master-clock: Don't wait for a frame if time goes backwards X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24338a7511cd09298695f0a0b51ea6a97fa6786a;p=profile%2Fivi%2Fclutter.git clutter-master-clock: Don't wait for a frame if time goes backwards If we aren't syncing to vblank or if the last dispatch didn't cause a redraw then the master clock will try to wait at least a small amount of time before dispatching again. However if time goes backwards then it would not do a dispatch until time catches up again. To fix this it know just runs a dispatch immediately if time goes backwards. This is related to Moblin bug #3839. There was a similar fix for this in 9dc012c07, however that only fixed the case where timelines wouldn't update. If there are no animations running then the master clock won't even try updating timelines until time catches up. http://bugzilla.o-hand.com/show_bug.cgi?id=1974 --- diff --git a/clutter/clutter-master-clock.c b/clutter/clutter-master-clock.c index 9e54b9e..ee66396 100644 --- a/clutter/clutter-master-clock.c +++ b/clutter/clutter-master-clock.c @@ -179,6 +179,17 @@ master_clock_next_frame_delay (ClutterMasterClock *master_clock) g_source_get_current_time (master_clock->source, &now); next = master_clock->prev_tick; + + /* If time has gone backwards then there's no way of knowing how + long we should wait so let's just dispatch immediately */ + if (now.tv_sec < next.tv_sec || + (now.tv_sec == next.tv_sec && now.tv_usec <= next.tv_usec)) + { + CLUTTER_NOTE (SCHEDULER, "Time has gone backwards"); + + return 0; + } + g_time_val_add (&next, 1000000L / (gulong) clutter_get_default_frame_rate ()); if (next.tv_sec < now.tv_sec ||