Skip to contentSkip to conversation

kms_psr_sink_crc: Introduce PSR BAT test.

PATCH In review Rodrigo Vivi 3 participants 6 messages Dec 7, 2015 – Dec 10, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kms_psr_sink_crc: Introduce PSR BAT test.

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.

---
 tests/kms_psr_sink_crc.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
tests/kms_psr_sink_crc.c +36 -0
index 8cd11a7..28ba5c2 100644
@@ -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;
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 kms_psr_sink_crc: Add basic check for PSR active.

It takes from 2 to 5 seconds to run.

---
 tests/kms_psr_sink_crc.c | 5 +++++
 1 file changed, 5 insertions(+)
tests/kms_psr_sink_crc.c +5 -0
index 28ba5c2..4baf131 100644
@@ -605,6 +605,11 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	igt_subtest("psr_active_basic") {
+		setup_test_plane(&data);
+		igt_assert(wait_psr_entry(&data));
+	}
+
 	for (op = PAGE_FLIP; op <= RENDER; op++) {
 		igt_subtest_f("primary_%s", op_str(op)) {
 			data.test_plane = PRIMARY;
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH i-g-t 2/2] kms_psr_sink_crc: Add basic check for PSR active.

Quoted 13 lines · Rodrigo Vivi

It takes from 2 to 5 seconds to run.

---
 tests/kms_psr_sink_crc.c | 5 +++++
 1 file changed, 5 insertions(+)
tests/kms_psr_sink_crc.c +0 -0
index 28ba5c2..4baf131 100644

tests/kms_psr_sink_crc.c int main(int argc, char *argv[]) · line 611

Quoted 7 lines
tests/kms_psr_sink_crc.c +4 -0
@@ -605,6 +605,11 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	igt_subtest("psr_active_basic") {
+		setup_test_plane(&data);
+		igt_assert(wait_psr_entry(&data));
+	}

I think I'm dense, but why do we need 2 BAT tests for psr? This one here seems totally fine.
-Daniel

Quoted 7 lines
tests/kms_psr_sink_crc.c +1 -0
+
 	for (op = PAGE_FLIP; op <= RENDER; op++) {
 		igt_subtest_f("primary_%s", op_str(op)) {
 			data.test_plane = PRIMARY;
Signature · 1 line
2.4.3
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH i-g-t 2/2] kms_psr_sink_crc: Add basic check for PSR active.

Quoted 17 lines · Daniel Vetter
Quoted 16 lines · Rodrigo Vivi

It takes from 2 to 5 seconds to run.

---
 tests/kms_psr_sink_crc.c | 5 +++++
 1 file changed, 5 insertions(+)
tests/kms_psr_sink_crc.c +0 -0
index 28ba5c2..4baf131 100644
@@ -605,6 +605,11 @@ int main(int argc, char *argv[])
              }
      }
 
Quoted 7 lines

tests/kms_psr_sink_crc.c int main(int argc, char *argv[]) · line 611

Quoted 4 lines
tests/kms_psr_sink_crc.c +4 -0
+     igt_subtest("psr_active_basic") {
+             setup_test_plane(&data);
+             igt_assert(wait_psr_entry(&data));
+     }

I think I'm dense, but why do we need 2 BAT tests for psr? This one here seems totally fine.

No your are not. I just sent 2 solutions because I didn't know which one you would prefer and I forgot if 2 to 5 secs was acceptable as BAT.
So, ignore the other test. I will resubmit only this one... And I believe that I forgot the other patch that reduces to 5 the maximum wait time for psr entry on this test case..

Quoted 18 lines

-Daniel

Quoted 7 lines
tests/kms_psr_sink_crc.c +1 -1
+
      for (op = PAGE_FLIP; op <= RENDER; op++) {
              igt_subtest_f("primary_%s", op_str(op)) {
                      data.test_plane = PRIMARY;
--

2.4.3

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH i-g-t 2/2] kms_psr_sink_crc: Add basic check for PSR active.

Quoted 26 lines · Rodrigo Vivi
Quoted 17 lines · Daniel Vetter
Quoted 16 lines · Rodrigo Vivi

It takes from 2 to 5 seconds to run.

---
 tests/kms_psr_sink_crc.c | 5 +++++
 1 file changed, 5 insertions(+)
tests/kms_psr_sink_crc.c +0 -0
index 28ba5c2..4baf131 100644
@@ -605,6 +605,11 @@ int main(int argc, char *argv[])
              }
      }
 
Quoted 7 lines

tests/kms_psr_sink_crc.c int main(int argc, char *argv[]) · line 611

Quoted 4 lines
tests/kms_psr_sink_crc.c +4 -0
+     igt_subtest("psr_active_basic") {
+             setup_test_plane(&data);
+             igt_assert(wait_psr_entry(&data));
+     }

I think I'm dense, but why do we need 2 BAT tests for psr? This one here seems totally fine.

Quoted 6 lines

No your are not. I just sent 2 solutions because I didn't know which one you would prefer and I forgot if 2 to 5 secs was acceptable as BAT.
So, ignore the other test. I will resubmit only this one... And I believe that I forgot the other patch that reduces to 5 the maximum wait time for psr entry on this test case..

I think for such a major feature like PSR a few seconds in BAT is totally ok.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
In reply to Rodrigo Vivi
Quoted 7 lines · Rodrigo Vivi

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.

Please don't do that. If you need a mode enabled, enable it. We have some other not-so-awesome testcase which try to inherit modeset state from fbcon and then sometimes fall over.

If that causes too much delay due to unecessary modesets, then we need to extract a bit of logic into libraries to make sure everyone uses the same setup for basic tests, and that we don't force a modeset by accident in-between (either the test or fbcon).
-Daniel

Quoted 64 lines
---
 tests/kms_psr_sink_crc.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
tests/kms_psr_sink_crc.c +36 -0
index 8cd11a7..28ba5c2 100644
@@ -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;
Signature · 1 line
2.4.3
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx