[Cogl] [PATCH 3/6] poll: Add _cogl_poll_renderer_modify_fd
Neil Roberts
neil at linux.intel.com
Fri Jun 28 10:03:08 PDT 2013
_cogl_poll_rendererer_modify_fd can be used internally to modify the
event mask on an FD to be polled. This will be used in the Wayland
backend to start blocking on write whenever flushing the display fills
the socket's buffer. Modifying the FD's events causes the poll age to
increase.
---
cogl/cogl-poll-private.h | 5 +++++
cogl/cogl-poll.c | 19 +++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/cogl/cogl-poll-private.h b/cogl/cogl-poll-private.h
index 3dfaa2b..2a24128 100644
--- a/cogl/cogl-poll-private.h
+++ b/cogl/cogl-poll-private.h
@@ -43,6 +43,11 @@ _cogl_poll_renderer_add_fd (CoglRenderer *renderer,
CoglPollDispatchCallback dispatch,
void *user_data);
+void
+_cogl_poll_renderer_modify_fd (CoglRenderer *renderer,
+ int fd,
+ CoglPollFDEvent events);
+
typedef struct _CoglPollSource CoglPollSource;
CoglPollSource *
diff --git a/cogl/cogl-poll.c b/cogl/cogl-poll.c
index 10d1560..cb62327 100644
--- a/cogl/cogl-poll.c
+++ b/cogl/cogl-poll.c
@@ -152,6 +152,25 @@ _cogl_poll_renderer_remove_fd (CoglRenderer *renderer, int fd)
}
void
+_cogl_poll_renderer_modify_fd (CoglRenderer *renderer,
+ int fd,
+ CoglPollFDEvent events)
+{
+ int fd_index = find_pollfd (renderer, fd);
+
+ if (fd_index == -1)
+ g_warn_if_reached ();
+ else
+ {
+ CoglPollFD *pollfd =
+ &g_array_index (renderer->poll_sources, CoglPollFD, fd_index);
+
+ pollfd->events = events;
+ renderer->poll_fds_age++;
+ }
+}
+
+void
_cogl_poll_renderer_add_fd (CoglRenderer *renderer,
int fd,
CoglPollFDEvent events,
--
1.7.11.3.g3c3efa5
More information about the Cogl
mailing list