Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH i-g-t 7/9] tests/kms_psr_sink_crc: Add manual mode.
Date: Tue,  9 Dec 2014 21:01:55 -0500	[thread overview]
Message-ID: <1418176917-16598-7-git-send-email-rodrigo.vivi@intel.com> (raw)
In-Reply-To: <1418176917-16598-1-git-send-email-rodrigo.vivi@intel.com>

Sink CRC is the most reliable way to test PSR. However in some platforms
apparently auto generated packages force panel to keep calculating CRC invalidating
our current sink crc check over debugfs.

So, this manual test help us to find possible gaps on this platforms where we cannot
trust on sink crc checks.

v2: Accept Daniel's suggestions:
    * Avoid strcpy
    * don't override assert definition
    * Make --interactive-debug for every testcases instead using local --manual

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 tests/kms_psr_sink_crc.c | 48 ++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 42 insertions(+), 6 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 155c25f..e7a2ef4 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -244,6 +244,9 @@ static void get_sink_crc(data_t *data, char *crc) {
 	int ret;
 	FILE *file;
 
+	if (igt_interactive_debug)
+		return;
+
 	file = igt_debugfs_fopen("i915_sink_crc_eDP1", "r");
 	igt_require(file);
 
@@ -271,6 +274,9 @@ static bool is_green(char *crc)
 	unsigned int rh, gh, bh, mask;
 	int ret;
 
+	if (igt_interactive_debug)
+		return false;
+
 	sscanf(color_mask, "%4x", &mask);
 
 	memcpy(rs, &crc[0], 4);
@@ -293,6 +299,16 @@ static bool is_green(char *crc)
 		(bh & mask) == 0);
 }
 
+static void assert_or_manual(bool condition, const char *expected)
+{
+	if (igt_interactive_debug)
+		igt_info("Is %s?\n", expected);
+	else
+		igt_debug("%s\n", expected);
+	igt_debug_wait_for_keypress("manual");
+	igt_assert(igt_interactive_debug || condition);
+}
+
 static void test_crc(data_t *data)
 {
 	uint32_t handle = data->fb_white.gem_handle;
@@ -300,18 +316,19 @@ static void test_crc(data_t *data)
 	void *ptr;
 	char ref_crc[12];
 	char crc[12];
+	const char *expected = "";
 
 	igt_plane_set_fb(data->primary, &data->fb_green);
 	igt_display_commit(&data->display);
 
 	/* Confirm that screen became Green */
 	get_sink_crc(data, ref_crc);
-	igt_assert(is_green(ref_crc));
+	assert_or_manual(is_green(ref_crc), "screen GREEN");
 
 	/* Confirm screen stays Green after PSR got active */
 	igt_assert(wait_psr_entry(data, 10));
 	get_sink_crc(data, ref_crc);
-	igt_assert(is_green(ref_crc));
+	assert_or_manual(is_green(ref_crc), "screen GREEN");
 
 	/* Setting a secondary fb/plane */
 	switch (data->test_plane) {
@@ -325,7 +342,10 @@ static void test_crc(data_t *data)
 	/* Confirm it is not Green anymore */
 	igt_assert(wait_psr_entry(data, 10));
 	get_sink_crc(data, ref_crc);
-	igt_assert(!is_green(ref_crc));
+	if (data->test_plane == PRIMARY)
+		assert_or_manual(!is_green(ref_crc), "screen WHITE");
+	else
+		assert_or_manual(!is_green(ref_crc), "GREEN background with WHITE box");
 
 	switch (data->op) {
 	case PAGE_FLIP:
@@ -333,7 +353,8 @@ static void test_crc(data_t *data)
 		igt_assert(drmModePageFlip(data->drm_fd, data->crtc_id,
 					   data->fb_green.fb_id, 0, NULL) == 0);
 		get_sink_crc(data, crc);
-		igt_assert(is_green(crc));
+		assert_or_manual(is_green(crc), "screen GREEN");
+		expected = "still GREEN";
 		break;
 	case MMAP_GTT:
 		ptr = gem_mmap__gtt(data->drm_fd, handle, data->mod_size,
@@ -342,6 +363,7 @@ static void test_crc(data_t *data)
 			       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 		memset(ptr, 0xcc, data->mod_size);
 		munmap(ptr, data->mod_size);
+		expected = "BLACK or TRANSPARENT mark on top of plane in test";
 		break;
 	case MMAP_GTT_WAITING:
 		ptr = gem_mmap__gtt(data->drm_fd, handle, data->mod_size,
@@ -352,7 +374,11 @@ static void test_crc(data_t *data)
 		/* Printing white on white so the screen shouldn't change */
 		memset(ptr, 0xff, data->mod_size);
 		get_sink_crc(data, crc);
-		igt_assert(strcmp(ref_crc, crc) == 0);
+		if (data->test_plane == PRIMARY)
+			assert_or_manual(strcmp(ref_crc, crc) == 0, "screen WHITE");
+		else
+			assert_or_manual(strcmp(ref_crc, crc) == 0,
+			       "GREEN background with WHITE box");
 
 		igt_info("Waiting 10s...\n");
 		sleep(10);
@@ -360,6 +386,7 @@ static void test_crc(data_t *data)
 		/* Now lets print black to change the screen */
 		memset(ptr, 0, data->mod_size);
 		munmap(ptr, data->mod_size);
+		expected = "BLACK or TRANSPARENT mark on top of plane in test";
 		break;
 	case MMAP_CPU:
 		ptr = gem_mmap__cpu(data->drm_fd, handle, 0, data->mod_size, PROT_WRITE);
@@ -368,26 +395,31 @@ static void test_crc(data_t *data)
 		memset(ptr, 0, data->mod_size);
 		munmap(ptr, data->mod_size);
 		gem_sw_finish(data->drm_fd, handle);
+		expected = "BLACK or TRANSPARENT mark on top of plane in test";
 		break;
 	case BLT:
 		fill_blt(data, handle, 0);
+		expected = "BLACK or TRANSPARENT mark on top of plane in test";
 		break;
 	case RENDER:
 		fill_render(data, handle, 0);
+		expected = "BLACK or TRANSPARENT mark on top of plane in test";
 		break;
 	case PLANE_MOVE:
 		/* Only in use when testing Sprite and Cursor */
 		igt_plane_set_position(test_plane, 500, 500);
 		igt_display_commit(&data->display);
+		expected = "White box moved to 500x500";
 		break;
 	case PLANE_ONOFF:
 		/* Only in use when testing Sprite and Cursor */
 		igt_plane_set_fb(test_plane, NULL);
 		igt_display_commit(&data->display);
+		expected = "screen GREEN";
 		break;
 	}
 	get_sink_crc(data, crc);
-	igt_assert(strcmp(ref_crc, crc) != 0);
+	assert_or_manual(strcmp(ref_crc, crc) != 0, expected);
 }
 
 static void test_cleanup(data_t *data) {
@@ -507,6 +539,10 @@ int main(int argc, char *argv[])
 		kmstest_set_vt_graphics_mode();
 		data.devid = intel_get_drm_devid(data.drm_fd);
 
+		if ((IS_VALLEYVIEW(data.devid) || IS_CHERRYVIEW(data.devid)) &&
+		    !igt_interactive_debug)
+			igt_skip("Sink CRC is unreliable on this platform when PSR is enabled. Test available only on manual interactive debug mode. Run again with --interactive-debug=manual\n");
+
 		igt_skip_on(!psr_enabled(&data));
 
 		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
-- 
1.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2014-12-10  2:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10  2:01 [PATCH i-g-t 1/9] tests/kms_psr_sink_crc: Make blt visible to human eyes Rodrigo Vivi
2014-12-10  2:01 ` [PATCH i-g-t 2/9] tests/kms_psr_sink_crc: Make render " Rodrigo Vivi
2014-12-10  2:01 ` [PATCH i-g-t 3/9] tests/kms_psr_sink_crc: Make mmaps " Rodrigo Vivi
2014-12-10  2:01 ` [PATCH i-g-t 4/9] tests/kms_psr_sink_crc: Make plane_move " Rodrigo Vivi
2014-12-10  2:01 ` [PATCH i-g-t 5/9] lib/igt_aux: Don't remove echo from terminal Rodrigo Vivi
2014-12-10  2:01 ` [PATCH i-g-t 6/9] lib: s/IGT_DEBUG_INTERACTIVE/--interactive-debug=var Rodrigo Vivi
2014-12-10 10:17   ` Daniel Vetter
2014-12-10  2:01 ` Rodrigo Vivi [this message]
2014-12-10  2:01 ` [PATCH i-g-t 8/9] lib/igt_aux: Extend igt_debug_wait_for_keypres Rodrigo Vivi
2014-12-10 10:20   ` Daniel Vetter
2014-12-10  2:01 ` [PATCH i-g-t 9/9] tests/kms_psr_sink_crc: Use pressed key to pass/fail Rodrigo Vivi

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=1418176917-16598-7-git-send-email-rodrigo.vivi@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox