This adds a _cogl_poll_renderer_add_source() function that we can use
within cogl to hook into the mainloop without necessarily having a file
descriptor to poll. Since the intention is to use this to support
polling for fence completions this also updates the
CoglPollCheckCallback type to take a timeout pointer so sources can
optionally update the timeout that will be passed to poll.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 81c1ce0ffce4e75e08622e20848405987e00b3cc)
Instead of driving event dispatching through a per winsys poll_dispatch
vfunc its now possible to associate a check and dispatch function with
each file descriptor that is registered for polling. This means we can
remove the winsys get_dispatch_timeout and poll_dispatch vfuncs and it
also makes it easier for more orthogonal internal components to add file
descriptors for polling to the mainloop.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 627947622df36dd529b9dc60a3ae9e6083532b19)
This adds a _cogl_poll_renderer_add_idle api that can be used internally
for queuing an idle callback without needing to make any assumption
about the system mainloop that is being used. This is now used to avoid
having the _cogl_poll_renderer_dispatch() directly check for all kinds of
events to dispatch, and to avoid having the winsys dispatch vfuncs need
to directly know about CoglContext. This means we can now avoid having a
back reference from CoglRenderer to the CoglContext.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit a1e169f18f4257caec58760adccfe4ec09b9805d)
This updates the cogl_poll_ apis to allow dispatching events before we
have a CoglContext and to also enables pollfd state to be changed in a
more add-hoc way by different Cogl components by replacing the
winsys->get_poll_info with _cogl_poll_renderer_add/remove_fd functions
and a winsys->get_dispatch_timeout vfunc.
One of the intentions here is that applications should be able to run
their mainloop before creating a CoglContext to potentially get events
relating to CoglOutputs.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 667e58c9cb2662aef5f44e580a9eda42dc8d0176)