Add support for main loop integration

This adds two new functions:

void
cogl_poll_get_info (CoglContext *context,
                    CoglPollFD **poll_fds,
                    int *n_poll_fds,
                    gint64 *timeout);

void
cogl_poll_dispatch (CoglContext *context,
                    const CoglPollFD *poll_fds,
                    int n_poll_fds);

The application is expected to call the first function whenever it is
about to block to go idle, and the second function whenever it comes
out of idle. This gives Cogl winsys's the ability poll file
descriptors for events. For example when handing swap complete
notifications, it can report that it needs to block on a file
descriptor.

The two functions are backed by winsys virtual functions. There are
currently no implementations. The default handler for get_info just
reports no file descriptors and an infinite timeout.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts
2011-12-16 17:49:28 +00:00
parent 55344ff2c4
commit 7497475295
8 changed files with 305 additions and 1 deletions

View File

@@ -151,6 +151,16 @@ typedef struct _CoglWinsysVtable
(*onscreen_remove_swap_buffers_callback) (CoglOnscreen *onscreen,
unsigned int id);
void
(*poll_get_info) (CoglContext *context,
CoglPollFD **poll_fds,
int *n_poll_fds,
gint64 *timeout);
void
(*poll_dispatch) (CoglContext *context,
const CoglPollFD *poll_fds,
int n_poll_fds);
#ifdef COGL_HAS_XLIB_SUPPORT
gboolean
(*texture_pixmap_x11_create) (CoglTexturePixmapX11 *tex_pixmap);