poll: Always run the prepare callbacks for all sources

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.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 02f7fa538c9d2b383fa0f601177140b571ecf315)
This commit is contained in:
Neil Roberts 2013-06-28 12:11:20 +01:00
parent 813e8f3a98
commit 41b97b885a

View File

@ -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;
}
}