summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-03-26 13:13:57 -0700
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-03-26 13:14:38 -0700
commite6b3f906cef26e1efb8625f5dd4e460b4c79a771 (patch)
tree8bfd25bc8ec134539e6468a859a9b76f33b95cd9 /tests
parent245d6957794648d7fd83279c680fed6e4c262147 (diff)
modetest: add optional select codepath
For misc. testing.
Diffstat (limited to 'tests')
-rw-r--r--tests/modetest/modetest.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index c12699cb..0a60c896 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -618,6 +618,7 @@ set_mode(struct connector *c, int count, int page_flip)
evctx.page_flip_handler = page_flip_handler;
while (1) {
+#if 0
struct pollfd pfd[2];
pfd[0].fd = 0;
@@ -632,6 +633,24 @@ set_mode(struct connector *c, int count, int page_flip)
if (pfd[0].revents)
break;
+#else
+ struct timeval timeout = { .tv_sec = 3, .tv_usec = 0 };
+ fd_set fds;
+ int ret;
+
+ FD_ZERO(&fds);
+ FD_SET(0, &fds);
+ FD_SET(fd, &fds);
+ ret = select(fd + 1, &fds, NULL, NULL, &timeout);
+
+ if (ret <= 0) {
+ fprintf(stderr, "select timed out or error (ret %d)\n",
+ ret);
+ continue;
+ } else if (FD_ISSET(0, &fds)) {
+ break;
+ }
+#endif
drmHandleEvent(fd, &evctx);
}