[PATCH i-g-t 5/6] tests/kms_pipe_crc_basic: Add tests for O_NONBLOCK CRC reads

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

 



From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
 tests/kms_pipe_crc_basic.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index a3292c225203..eb8e15e7f413 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,
@@ -124,6 +125,7 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
 
 	for (c = 0; c < ARRAY_SIZE(colors); c++) {
 		char *crc_str;
+		int n_crcs;
 
 		igt_output_set_pipe(output, pipe);
 		igt_display_commit(display);
@@ -151,12 +153,29 @@ 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);
 
+		if (flags & TEST_NONBLOCK) {
+			int i;
+			for (i = 0; i < N_CRCS; i++)
+				igt_wait_for_vblank(data->drm_fd, pipe);
+		}
+
 		/* wait for N_CRCS vblanks and the corresponding N_CRCS CRCs */
-		igt_pipe_crc_get_crcs(pipe_crc, N_CRCS, &crcs);
+		if (flags & TEST_NONBLOCK) {
+			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);
 
@@ -171,11 +190,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);
@@ -246,6 +265,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();
 
-- 
2.4.10

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://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