[PATCH 01/12] tests/kms_atomic_transition: use select + read instead of blocking read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>

If the event never arrives we can timeout with select and end the test.

Signed-off-by: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
---
 tests/kms_atomic_transition.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 1977993..e693c88 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -296,6 +296,14 @@ static void commit_display(igt_display_t *display, unsigned event_mask, bool non
 		struct drm_event *e = (void *)buf;
 		struct drm_event_vblank *vblank = (void *)buf;
 		uint32_t crtc_id, pipe = I915_MAX_PIPES;
+		struct timeval timeout = { .tv_sec = 3, .tv_usec = 0 };
+		fd_set fds;
+
+		FD_ZERO(&fds);
+		FD_SET(0, &fds);
+		FD_SET(display->drm_fd, &fds);
+		ret = select(display->drm_fd + 1, &fds, NULL, NULL, &timeout);
+		igt_assert(ret > 0);
 
 		ret = read(display->drm_fd, buf, sizeof(buf));
 		if (ret < 0 && (errno == EINTR || errno == EAGAIN))
-- 
2.5.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux