[Cogl] [PATCH] poll: Always let the winsys add fds even if there is a zero timeout

Robert Bragg robert at sixbynine.org
Mon Feb 4 05:24:26 PST 2013


This looks good to land to me:

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

thanks,
- Robert

On Sun, Feb 3, 2013 at 9:03 AM, Neil Roberts <neil at linux.intel.com> wrote:
> 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.
> ---
>  cogl/cogl-poll.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/cogl/cogl-poll.c b/cogl/cogl-poll.c
> index c6d19fb..277b9a7 100644
> --- a/cogl/cogl-poll.c
> +++ b/cogl/cogl-poll.c
> @@ -44,13 +44,6 @@ cogl_poll_get_info (CoglContext *context,
>    _COGL_RETURN_IF_FAIL (n_poll_fds != 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);
>
>    if (winsys->poll_get_info)
> @@ -59,13 +52,17 @@ cogl_poll_get_info (CoglContext *context,
>                               poll_fds,
>                               n_poll_fds,
>                               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 */
> -  *poll_fds = NULL;
> -  *n_poll_fds = 0;
> -  *timeout = -1; /* no timeout */
> +  if (!COGL_TAILQ_EMPTY (&context->onscreen_events_queue))
> +    *timeout = 0;
>  }
>
>  void
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list