poll: Always let the winsys add fds even if there is a zero timeout

Even if Cogl decides to set a zero timeout because there are events
queued, it still makes sense to give the winsys a chance to add file
descriptors to the list. The winsys might be relying on the list of
CoglPollFDs passed to poll_dispatch to decide whether to read from a
file descriptor and that should happen even if Cogl also woke up the
main loop because the event queue isn't empty.

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

(cherry picked from commit 6d2f3bc4913d0f1570c09e3714ac8fe2dbfc7a03)
This commit is contained in:
Neil Roberts 2013-02-03 10:03:39 +01:00
parent 446dd70b91
commit 8122368c6a

View File

@ -44,13 +44,6 @@ cogl_poll_get_info (CoglContext *context,
_COGL_RETURN_IF_FAIL (n_poll_fds != NULL); _COGL_RETURN_IF_FAIL (n_poll_fds != NULL);
_COGL_RETURN_IF_FAIL (timeout != NULL); _COGL_RETURN_IF_FAIL (timeout != NULL);
if (!COGL_TAILQ_EMPTY (&context->onscreen_events_queue))
{
*n_poll_fds = 0;
*timeout = 0;
return;
}
winsys = _cogl_context_get_winsys (context); winsys = _cogl_context_get_winsys (context);
if (winsys->poll_get_info) if (winsys->poll_get_info)
@ -59,13 +52,17 @@ cogl_poll_get_info (CoglContext *context,
poll_fds, poll_fds,
n_poll_fds, n_poll_fds,
timeout); timeout);
return; }
else
{
/* By default we'll assume Cogl doesn't need to block on anything */
*poll_fds = NULL;
*n_poll_fds = 0;
*timeout = -1; /* no timeout */
} }
/* By default we'll assume Cogl doesn't need to block on anything */ if (!COGL_TAILQ_EMPTY (&context->onscreen_events_queue))
*poll_fds = NULL; *timeout = 0;
*n_poll_fds = 0;
*timeout = -1; /* no timeout */
} }
void void