[Cogl] [PATCH 2/6] poll: Always run the prepare callbacks for all sources

Neil Roberts neil at linux.intel.com
Fri Jun 28 10:03:07 PDT 2013


Eventually the Wayland winsys will want to do useful work in its
prepare callback before the main loop goes idle. Previously
cogl_poll_renderer_get_info would stop calling any further prepare
functions if it found one with a zero timeout. That would mean the
Wayland prepare function might not get called before going idle in
some cases. This patch changes it so that it continues to call all of
the prepare functions regardless of the timeout.
---
 cogl/cogl-poll.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/cogl/cogl-poll.c b/cogl/cogl-poll.c
index c50d648..10d1560 100644
--- a/cogl/cogl-poll.c
+++ b/cogl/cogl-poll.c
@@ -58,10 +58,7 @@ cogl_poll_renderer_get_info (CoglRenderer *renderer,
   *timeout = -1;
 
   if (!_cogl_list_empty (&renderer->idle_closures))
-    {
-      *timeout = 0;
-      return renderer->poll_fds_age;
-    }
+    *timeout = 0;
 
   for (l = renderer->poll_sources; l; l = l->next)
     {
@@ -69,13 +66,8 @@ cogl_poll_renderer_get_info (CoglRenderer *renderer,
       if (source->prepare)
         {
           int64_t source_timeout = source->prepare (source->user_data);
-          if (source_timeout == 0)
-            {
-              *timeout = 0;
-              return renderer->poll_fds_age;
-            }
-          else if (source_timeout > 0 &&
-                   (*timeout == -1 || *timeout > source_timeout))
+          if (source_timeout >= 0 &&
+              (*timeout == -1 || *timeout > source_timeout))
             *timeout = source_timeout;
         }
     }
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list