[cogl] poll: Add _cogl_poll_renderer_modify_fd
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] poll: Add _cogl_poll_renderer_modify_fd
- Date: Mon, 1 Jul 2013 12:45:28 +0000 (UTC)
commit 8bc0df53ee508687b87e547c1cbac5e8d7d5fc80
Author: Neil Roberts <neil linux intel com>
Date: Fri Jun 28 12:15:26 2013 +0100
poll: Add _cogl_poll_renderer_modify_fd
_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.
Reviewed-by: Robert Bragg <robert linux intel com>
cogl/cogl-poll-private.h | 5 +++++
cogl/cogl-poll.c | 19 +++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
---
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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]