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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
---
 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

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux