[Intel-gfx] [PATCH i-g-t 1/2] kms_psr_sink_crc: Introduce PSR BAT test.

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Dec 7 02:06:49 PST 2015


This simple test checks if PSR is enabled when it should.
Minimal and fastest check possible.

To make it faster for BAT we first check if it is enabled and return
Success. We just do the dpms_on in case psr is not enabled. So it was
probably because display went off maybe in idle. Even for this case
the test case is fast enough: ~ 1s.

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

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 8cd11a7..28ba5c2 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -227,6 +227,26 @@ static bool psr_possible(data_t *data)
 	return true;
 }
 
+static bool psr_enabled(data_t *data)
+{
+	int ret;
+	FILE *file;
+	char str[4];
+
+	file = igt_debugfs_fopen("i915_edp_psr_status", "r");
+	igt_require(file);
+
+	ret = fscanf(file, "Sink_Support: %s\n", str);
+	igt_assert_neq(ret, 0);
+	ret = fscanf(file, "Source_OK: %s\n", str);
+	igt_assert_neq(ret, 0);
+	ret = fscanf(file, "Enabled: %s\n", str);
+	igt_assert_neq(ret, 0);
+
+	fclose(file);
+	return strcmp(str, "yes") == 0;
+}
+
 static bool psr_active(data_t *data)
 {
 	int ret;
@@ -569,6 +589,22 @@ int main(int argc, char *argv[])
 		display_init(&data);
 	}
 
+	igt_subtest("psr_enabled_basic") {
+		if (psr_enabled(&data))
+			igt_success();
+		else {
+			/*
+			 * The only excuse to have PSR disabled at this point
+			 * is if dpms is off for some reason. So let's try to
+			 * force dpms on and check if that was the case.
+			 */
+			kmstest_set_connector_dpms(data.drm_fd,
+						   data.output->config.connector,
+						   DRM_MODE_DPMS_ON);
+			igt_assert(psr_enabled(&data));
+		}
+	}
+
 	for (op = PAGE_FLIP; op <= RENDER; op++) {
 		igt_subtest_f("primary_%s", op_str(op)) {
 			data.test_plane = PRIMARY;
-- 
2.4.3



More information about the Intel-gfx mailing list