All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 5/6] tests/kms_pipe_crc_basic: Add tests for O_NONBLOCK CRC reads
Date: Fri, 18 Dec 2015 19:25:49 +0200	[thread overview]
Message-ID: <1450459550-16504-5-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1450459550-16504-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-12-18 17:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 17:25 [PATCH i-g-t 1/6] lib: Make 'extra_long_opts' const ville.syrjala
2015-12-18 17:25 ` [PATCH i-g-t 2/6] lib: Extract ssme common fb create+fill methods into helpers ville.syrjala
2015-12-21 10:42   ` Thomas Wood
2016-01-04 16:23     ` Ville Syrjälä
2015-12-18 17:25 ` [PATCH i-g-t 3/6] lib: Use igt_assert_eq() to check for crc component count ville.syrjala
2015-12-21 15:55   ` Daniel Vetter
2015-12-18 17:25 ` [PATCH i-g-t 4/6] lib: Add igt_pipe_crc_new_nonblock() ville.syrjala
2015-12-21 15:53   ` Daniel Vetter
2016-01-04 16:46     ` Ville Syrjälä
2015-12-18 17:25 ` ville.syrjala [this message]
2015-12-18 17:25 ` [PATCH i-g-t 6/6] tests/kms_chv_cursor_fail: Add a test to exercise CHV pipe C cursor fail ville.syrjala
2015-12-21 10:42   ` Thomas Wood
2016-01-04 15:59     ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450459550-16504-5-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.