The select fds have to be reinitialized before each call to select.
Signed-off-by: Ilia Mirkin <[email protected]>
---
drm-legacy.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drm-legacy.c b/drm-legacy.c
index a0b419a..fd98a38 100644
--- a/drm-legacy.c
+++ b/drm-legacy.c
@@ -53,10 +53,6 @@ static int legacy_run(const struct gbm *gbm, const struct
egl *egl)
uint32_t i = 0;
int ret;
- FD_ZERO(&fds);
- FD_SET(0, &fds);
- FD_SET(drm.fd, &fds);
-
eglSwapBuffers(egl->display, egl->surface);
bo = gbm_surface_lock_front_buffer(gbm->surface);
fb = drm_fb_get_from_bo(bo);
@@ -100,6 +96,10 @@ static int legacy_run(const struct gbm *gbm, const struct
egl *egl)
}
while (waiting_for_flip) {
+ FD_ZERO(&fds);
+ FD_SET(0, &fds);
+ FD_SET(drm.fd, &fds);
+
ret = select(drm.fd + 1, &fds, NULL, NULL, NULL);
if (ret < 0) {
printf("select err: %s\n", strerror(errno));
@@ -109,7 +109,7 @@ static int legacy_run(const struct gbm *gbm, const struct
egl *egl)
return -1;
} else if (FD_ISSET(0, &fds)) {
printf("user interrupted!\n");
- break;
+ return 0;
}
drmHandleEvent(drm.fd, &evctx);
}
--
2.13.6
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev