diff mbox

[igt,5/8] tests/kms_fbc_crc: extract check_crc()

Message ID 1431024996-2267-6-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni May 7, 2015, 6:56 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

To remove some duplicated code. When we finally fix that FIXME, the
code will get a little bigger too.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 tests/kms_fbc_crc.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index 0f09a60..d36cf02 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -207,11 +207,21 @@  static bool wait_for_fbc_enabled(data_t *data)
 	return igt_wait(fbc_enabled(data), 3000, 30);
 }
 
-static void test_crc(data_t *data, enum test_mode mode)
+static void check_crc(data_t *data, enum test_mode mode)
 {
-	uint32_t crtc_id = data->output->config.crtc->crtc_id;
 	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
 	igt_crc_t crc;
+
+	igt_pipe_crc_collect_crc(pipe_crc, &crc);
+	if (mode == TEST_PAGE_FLIP)
+		igt_assert_crc_equal(&crc, &data->ref_crc[1]);
+	else
+		;/* FIXME: missing reference CRCs */
+}
+
+static void test_crc(data_t *data, enum test_mode mode)
+{
+	uint32_t crtc_id = data->output->config.crtc->crtc_id;
 	uint32_t handle = data->fb[0].gem_handle;
 
 	igt_assert(fbc_enabled(data));
@@ -266,11 +276,7 @@  static void test_crc(data_t *data, enum test_mode mode)
 	igt_wait_for_vblank(data->drm_fd, data->pipe);
 	igt_wait_for_vblank(data->drm_fd, data->pipe);
 
-	igt_pipe_crc_collect_crc(pipe_crc, &crc);
-	if (mode == TEST_PAGE_FLIP)
-		igt_assert_crc_equal(&crc, &data->ref_crc[1]);
-	else
-		;/* FIXME: missing reference CRCs */
+	check_crc(data, mode);
 
 	/*
 	 * Allow time for FBC to kick in again if it
@@ -278,11 +284,7 @@  static void test_crc(data_t *data, enum test_mode mode)
 	 */
 	igt_assert(wait_for_fbc_enabled(data));
 
-	igt_pipe_crc_collect_crc(pipe_crc, &crc);
-	if (mode == TEST_PAGE_FLIP)
-		igt_assert_crc_equal(&crc, &data->ref_crc[1]);
-	else
-		;/* FIXME: missing reference CRCs */
+	check_crc(data, mode);
 }
 
 static bool prepare_crtc(data_t *data)