summaryrefslogtreecommitdiff
path: root/tests/kms_pipe_crc_basic.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2015-12-18 16:10:34 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2016-01-08 15:01:59 +0200
commita7a2c76a806e7aa93c7e8c998465a8cb63dbaa37 (patch)
treeea276dfc1e44a136aa9a2995406b78d1fbefb15c /tests/kms_pipe_crc_basic.c
parent909074503012a11fc631118cd3180b4a1c27646e (diff)
tests/kms_pipe_crc_basic: Add tests for O_NONBLOCK CRC reads
v2: Rebased due to __attribute__((warn_unused_result)) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'tests/kms_pipe_crc_basic.c')
-rw-r--r--tests/kms_pipe_crc_basic.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 6b99e57c..11d6ff90 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -110,6 +110,7 @@ static void test_bad_command(data_t *data, const char *cmd)
#define N_CRCS 3
#define TEST_SEQUENCE (1<<0)
+#define TEST_NONBLOCK (1<<1)
static int
test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
@@ -152,13 +153,28 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
igt_display_commit(display);
- pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ if (flags & TEST_NONBLOCK)
+ pipe_crc = igt_pipe_crc_new_nonblock(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ else
+ pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
igt_pipe_crc_start(pipe_crc);
/* wait for N_CRCS vblanks and the corresponding N_CRCS CRCs */
- n_crcs = igt_pipe_crc_get_crcs(pipe_crc, N_CRCS, &crcs);
- igt_assert_eq(n_crcs, N_CRCS);
+ if (flags & TEST_NONBLOCK) {
+ int i;
+
+ for (i = 0; i < N_CRCS; i++)
+ igt_wait_for_vblank(data->drm_fd, pipe);
+
+ n_crcs = igt_pipe_crc_get_crcs(pipe_crc, N_CRCS * 3, &crcs);
+ /* allow a one frame difference */
+ igt_assert_lte(n_crcs, N_CRCS + 1);
+ igt_assert_lte(N_CRCS, n_crcs + 1);
+ } else {
+ n_crcs = igt_pipe_crc_get_crcs(pipe_crc, N_CRCS, &crcs);
+ igt_assert_eq(n_crcs, N_CRCS);
+ }
igt_pipe_crc_stop(pipe_crc);
@@ -173,11 +189,11 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
free(crc_str);
/* and ensure that they'are all equal, we haven't changed the fb */
- for (j = 0; j < (N_CRCS - 1); j++)
+ for (j = 0; j < (n_crcs - 1); j++)
igt_assert_crc_equal(&crcs[j], &crcs[j + 1]);
if (flags & TEST_SEQUENCE)
- for (j = 0; j < (N_CRCS - 1); j++)
+ for (j = 0; j < (n_crcs - 1); j++)
igt_assert(crcs[j].frame + 1 == crcs[j + 1].frame);
free(crcs);
@@ -248,6 +264,12 @@ igt_main
igt_subtest_f("read-crc-pipe-%c-frame-sequence", 'A'+i)
test_read_crc(&data, i, TEST_SEQUENCE);
+ igt_subtest_f("nonblocking-crc-pipe-%c", 'A'+i)
+ test_read_crc(&data, i, TEST_NONBLOCK);
+
+ igt_subtest_f("nonblocking-crc-pipe-%c-frame-sequence", 'A'+i)
+ test_read_crc(&data, i, TEST_SEQUENCE | TEST_NONBLOCK);
+
igt_subtest_f("suspend-read-crc-pipe-%c", 'A'+i) {
igt_system_suspend_autoresume();