[Intel-gfx] [PATCH i-g-t 10/15] tests/kms_psr_sink_crc: Use PSR wakeup 2 + timeout for waiting psr active.

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Jan 12 10:22:02 PST 2015


This wakeup time is now set from VBT and sometimes it can be bigger than
10 seconds we used here.
So let's use at least 2 seconds plus VBT. We grab this info from debugfs.

Also since this timeout can be bigger, in manual mode we warn tester we
are waiting.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
 tests/kms_psr_sink_crc.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 553a1f8..285600f 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -84,6 +84,7 @@ typedef struct {
 	struct igt_fb fb_green, fb_white;
 	igt_plane_t *primary, *sprite, *cursor;
 	int mod_size;
+	int psr_wakeup_time;
 } data_t;
 
 static void create_cursor_fb(data_t *data)
@@ -195,8 +196,19 @@ static bool psr_enabled(data_t *data)
 	ret = fscanf(file, "Enabled: %s\n", str);
 	igt_assert(ret != 0);
 
+	/* This function will return if psr is enabled, however we can reuse
+	 * it to read and set wakeup_time */
+	ret = strcmp(str, "yes") == 0;
+
+	fscanf(file, "Active: %s\n", str);
+	fscanf(file, "Busy frontbuffer bits: %s\n", str);
+	fscanf(file, "Re-enable work scheduled: %s\n", str);
+	fscanf(file, "HW Enabled & Active bit: %s\n", str);
+	fscanf(file, "Link standby: %s\n", str);
+	fscanf(file, "Wakeup time: %d\n", &data->psr_wakeup_time);
+
 	fclose(file);
-	return strcmp(str, "yes") == 0;
+	return ret;
 }
 
 static bool psr_active(data_t *data)
@@ -230,8 +242,14 @@ static bool psr_active(data_t *data)
 	return strcmp(str, "yes") == 0;
 }
 
-static bool wait_psr_entry(data_t *data, int timeout)
+static bool wait_psr_entry(data_t *data)
 {
+	int timeout = 2 + data->psr_wakeup_time;
+
+	if (igt_interactive_debug)
+		igt_info("Waiting up to %d seconds for PSR to get active...\n",
+			 timeout);
+
 	while (timeout--) {
 		if (psr_active(data))
 			return true;
@@ -336,7 +354,7 @@ static void test_crc(data_t *data)
 	assert_or_manual(is_green(ref_crc), "screen GREEN");
 
 	/* Confirm screen stays Green after PSR got active */
-	igt_assert(wait_psr_entry(data, 10));
+	igt_assert(wait_psr_entry(data));
 	get_sink_crc(data, ref_crc);
 	assert_or_manual(is_green(ref_crc), "screen GREEN");
 
@@ -350,7 +368,7 @@ static void test_crc(data_t *data)
 	igt_display_commit(&data->display);
 
 	/* Confirm it is not Green anymore */
-	igt_assert(wait_psr_entry(data, 10));
+	igt_assert(wait_psr_entry(data));
 	get_sink_crc(data, ref_crc);
 	if (data->test_plane == PRIMARY)
 		assert_or_manual(!is_green(ref_crc), "screen WHITE");
-- 
2.1.0



More information about the Intel-gfx mailing list