ecore: Reduce rendering latency in g_main_loop
authormike_m <mike_m@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 27 Jul 2011 03:13:47 +0000 (03:13 +0000)
committermike_m <mike_m@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 27 Jul 2011 03:13:47 +0000 (03:13 +0000)
After a lot of hair pulling, and other debugging, it appears
that to make animation smooth on an embedded device, the
following things should happen in (quick) sequence:

1. update the loop time
2. call timers (which animates and updates the scene graph)
3. call idle enterers (which renders to the display)
4. call fd buf handlers (which flushes xlib stuff)

Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@61784 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore/ecore_main.c

index 41422a5..53d7a8a 100644 (file)
@@ -492,12 +492,16 @@ _ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time)
 
    if (!ecore_idling && !_ecore_glib_idle_enterer_called)
      {
+        _ecore_time_loop_time = ecore_time_get();
         while (_ecore_timer_call(_ecore_time_loop_time));
         _ecore_timer_cleanup();
 
         _ecore_idle_enterer_call();
         _ecore_throttle();
         _ecore_glib_idle_enterer_called = FALSE;
+
+        if (fd_handlers_with_buffer)
+          _ecore_main_fd_handlers_buf_call();
      }
 
    while (_ecore_signal_count_get()) _ecore_signal_call();
@@ -607,7 +611,6 @@ _ecore_main_gsource_check(GSource *source __UNUSED__)
      ret = TRUE;
 
    /* check timers after updating loop time */
-   _ecore_time_loop_time = ecore_time_get();
    if (!ret && _ecore_timers_exists())
      ret = (0.0 == _ecore_timer_next_get());
 
@@ -675,6 +678,9 @@ _ecore_main_gsource_dispatch(GSource *source __UNUSED__, GSourceFunc callback __
         _ecore_idle_enterer_call();
         _ecore_throttle();
         _ecore_glib_idle_enterer_called = TRUE;
+
+        if (fd_handlers_with_buffer)
+          _ecore_main_fd_handlers_buf_call();
      }
 
    in_main_loop--;