From 163a0b061d3672bc5e0338b16fa11eaa53f63c77 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sun, 1 Mar 2020 09:53:42 -0800 Subject: atomic: allow user input to trigger exit Similar to what legacy kms backend does. --- drm-atomic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 #include +#include #include #include #include @@ -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 -- cgit v1.2.1