summaryrefslogtreecommitdiff
path: root/lib/igt_debugfs.c
diff options
context:
space:
mode:
authorMahesh Kumar <mahesh1.kumar@intel.com>2018-08-13 19:23:18 +0530
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-08-14 11:12:48 +0200
commitb0263e5d0563a81a42cf66e7d3b84662d3222862 (patch)
tree9f8040eea3a367bba12f085b11fb45213efbbaf9 /lib/igt_debugfs.c
parentc88e219c6e890d89b7836c5e248ffedf334d55a2 (diff)
lib/igt_debugfs: explicitly wait for first crc in igt_pipe_crc_start
Now crc framework does not wait for first CRC during open, User need to wait for crc if he wants so. This patch make changes in igt_pipe_crc_start to make sure we wait until first crc available after open to keep the tests behaviour same. Without this if driver is skipping few initial crcs there will be mismatch in expected and actual number of crcs returned by crc framework. Changes Since V1: - poll instead of read_one_crc (Maarten) Changes Since V2: - poll without timeout, we already have igt_timeout (Maarten) Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'lib/igt_debugfs.c')
-rw-r--r--lib/igt_debugfs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index f3196f43..4de6b247 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -35,6 +35,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <i915_drm.h>
+#include <poll.h>
#include "drmtest.h"
#include "igt_aux.h"
@@ -748,6 +749,7 @@ static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc)
{
const char *src = pipe_crc_source_name(pipe_crc->source);
+ struct pollfd pfd;
char buf[32];
/* Stop first just to make sure we don't have lingering state left. */
@@ -757,11 +759,16 @@ void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc)
sprintf(buf, "crtc-%d/crc/data", pipe_crc->pipe);
- igt_set_timeout(10, "Opening crc fd, which waits for first CRC.");
+ igt_set_timeout(10, "Opening crc fd, and poll for first CRC.");
pipe_crc->crc_fd = openat(pipe_crc->dir, buf, pipe_crc->flags);
+ igt_assert(pipe_crc->crc_fd != -1);
+
+ pfd.fd = pipe_crc->crc_fd;
+ pfd.events = POLLIN;
+ poll(&pfd, 1, -1);
+
igt_reset_timeout();
- igt_assert(pipe_crc->crc_fd != -1);
errno = 0;
}