summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2020-03-01 09:53:42 -0800
committerRob Clark <robdclark@chromium.org>2020-03-07 09:22:17 -0800
commit163a0b061d3672bc5e0338b16fa11eaa53f63c77 (patch)
tree29c6d2ea286c17b705d0bf4bde1c094da4ce4289
parent27d4de2bb9bfd9c425848c78d729ba27f9408041 (diff)
atomic: allow user input to trigger exit
Similar to what legacy kms backend does.
-rw-r--r--drm-atomic.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drm-atomic.c b/drm-atomic.c
index d748772..0f04268 100644
--- a/drm-atomic.c
+++ b/drm-atomic.c
@@ -23,6 +23,7 @@
#include <assert.h>
#include <errno.h>
+#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -257,6 +258,17 @@ static int atomic_run(const struct gbm *gbm, const struct egl *egl)
egl->eglDestroySyncKHR(egl->display, kms_fence);
}
+ /* Check for user input: */
+ struct pollfd fdset[] = { {
+ .fd = STDIN_FILENO,
+ .events = POLLIN,
+ } };
+ ret = poll(fdset, ARRAY_SIZE(fdset), 0);
+ if (ret > 0) {
+ printf("user interrupted!\n");
+ return 0;
+ }
+
/*
* Here you could also update drm plane layers if you want
* hw composition