Skip to contentSkip to conversation

kms_content_protection: modularizing the CP test steps

PATCH Superseded Ramalingam C 3 participants 7 messages Feb 7, 2019 – Feb 8, 2019

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 kms_content_protection: modularizing the CP test steps

Modularizing the CP test steps for the convenience of reusing it for other subtests.

---
 tests/kms_content_protection.c | 99 +++++++++++++++++++++++++-----------------
 1 file changed, 60 insertions(+), 39 deletions(-)
tests/kms_content_protection.c +60 -39
index 50ae82862949..f6b441d891e5 100644
@@ -33,6 +33,7 @@ IGT_TEST_DESCRIPTION("Test content protection (HDCP)");
 struct data {
 	int drm_fd;
 	igt_display_t display;
+	struct igt_fb red, green;
 } data;
 
 
@@ -116,16 +117,12 @@ commit_display_and_wait_for_flip(enum igt_commit_style s)
 	}
 }
 
-static void
-test_cp_enable_disable(const enum pipe pipe, igt_output_t *output,
-		       enum igt_commit_style s)
+static void modeset_with_fb(const enum pipe pipe, igt_output_t *output,
+			    enum igt_commit_style s)
 {
 	igt_display_t *display = &data.display;
 	drmModeModeInfo mode;
 	igt_plane_t *primary;
-	struct igt_fb red, green;
-	bool ret;
-	int retry = 3;
 
 	igt_assert(kmstest_get_connector_default_mode(
 			display->drm_fd, output->config.connector, &mode));
@@ -135,58 +132,75 @@ test_cp_enable_disable(const enum pipe pipe, igt_output_t *output,
 
 	igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay,
 			    DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
-			    1.f, 0.f, 0.f, &red);
+			    1.f, 0.f, 0.f, &data.red);
 	igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay,
 			    DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
-			    0.f, 1.f, 0.f, &green);
+			    0.f, 1.f, 0.f, &data.green);
 
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_display_commit2(display, s);
-
-	igt_plane_set_fb(primary, &red);
+	igt_plane_set_fb(primary, &data.red);
 
 	/* Wait for Flip completion before starting the HDCP authentication */
 	commit_display_and_wait_for_flip(s);
+}
 
-	do {
-		igt_output_set_prop_value(output,
-					  IGT_CONNECTOR_CONTENT_PROTECTION, 0);
-		igt_display_commit2(display, s);
+static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s)
+{
+	igt_display_t *display = &data.display;
+	igt_plane_t *primary;
+	bool ret;
+
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
-		/* Wait for HDCP to be disabled for fresh start. */
-		ret = wait_for_prop_value(output, 0, 1000);
-		igt_assert_f(ret, "Content Protection not cleared\n");
+	igt_output_set_prop_value(output,
+				  IGT_CONNECTOR_CONTENT_PROTECTION, 1);
+	igt_display_commit2(display, s);
 
-		igt_output_set_prop_value(output,
-					  IGT_CONNECTOR_CONTENT_PROTECTION, 1);
+	/* Wait for 18000mSec (3 authentication * 6Sec) */
+	ret = wait_for_prop_value(output, 2, 18000);
+	if (ret) {
+		igt_plane_set_fb(primary, &data.green);
 		igt_display_commit2(display, s);
+	}
 
-		/* Wait for 18000mSec (3 authentication * 6Sec) */
-		ret = wait_for_prop_value(output, 2, 18000);
-		if (ret) {
-			igt_plane_set_fb(primary, &green);
-			igt_display_commit2(display, s);
-		}
+	return ret;
+}
 
-		if (!ret && --retry)
-			igt_debug("Retry (%d/2) ...\n", 3 - retry);
-	} while (retry && !ret);
+static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
+{
+	igt_display_t *display = &data.display;
+	igt_plane_t *primary;
+	bool ret;
+
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	/*
 	 * Even on HDCP enable failed scenario, IGT should exit leaving the
 	 * "content protection" at "UNDESIRED".
 	 */
 	igt_output_set_prop_value(output, IGT_CONNECTOR_CONTENT_PROTECTION, 0);
-	igt_plane_set_fb(primary, &red);
+	igt_plane_set_fb(primary, &data.red);
 	igt_display_commit2(display, s);
 
-	igt_assert_f(ret, "Content Protection not enabled\n");
-
 	/* Wait for HDCP to be disabled, before crtc off */
-	wait_for_prop_value(output, 0, 1000);
+	ret = wait_for_prop_value(output, 0, 1000);
+	igt_assert_f(ret, "Content Protection not cleared\n");
+}
+
+static void test_cp_enable_with_retry(igt_output_t *output,
+				      enum igt_commit_style s, int retry)
+{
+	bool ret;
 
-	igt_plane_set_fb(primary, NULL);
-	igt_output_set_pipe(output, PIPE_NONE);
+	do {
+		test_cp_disable(output, s);
+		ret = test_cp_enable(output, s);
+
+		if (!ret && --retry)
+			igt_debug("Retry (%d/2) ...\n", 3 - retry);
+	} while (retry && !ret);
+	igt_assert_f(ret, "Content Protection not enabled\n");
 }
 
 static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
@@ -200,11 +214,12 @@ static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
 	return true;
 }
 
-static void
-test_content_protection_on_output(igt_output_t *output,
-				  enum igt_commit_style s)
+
+static void test_content_protection_on_output(igt_output_t *output,
+					      enum igt_commit_style s)
 {
 	igt_display_t *display = &data.display;
+	igt_plane_t *primary;
 	enum pipe pipe;
 
 	for_each_pipe(display, pipe) {
@@ -220,7 +235,14 @@ test_content_protection_on_output(igt_output_t *output,
 		if (!igt_pipe_is_free(display, pipe))
 			continue;
 
-		test_cp_enable_disable(pipe, output, s);
+		modeset_with_fb(pipe, output, s);
+		test_cp_enable_with_retry(output, s, 3);
+		test_cp_disable(output, s);
+
+		primary = igt_output_get_plane_type(output,
+						    DRM_PLANE_TYPE_PRIMARY);
+		igt_plane_set_fb(primary, NULL);
+		igt_output_set_pipe(output, PIPE_NONE);
 
 		/*
 		 * Testing a output with a pipe is enough for HDCP
@@ -229,7 +251,6 @@ test_content_protection_on_output(igt_output_t *output,
 		 */
 		break;
 	}
-
 }
 
 static void __debugfs_read(int fd, const char *param, char *buf, int len)
Signature · 6 lines
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

PATCH 2/3 kms_content_protection: Test CP along with modeset

As we have two different patch for commitng the HDCP request
1. DDI_enable (during the modeset)
2. update_pipe (during fastset execution)

Currently our kms_content_protection covers only fastset path. So this test adds the coverage for the HDCP during the modeset by performing DPMS off-on and check for HDCP status.

But with respect to HDCP we allow few retries from userspace before reporting the failure. So only first attempt at kernel will be on modeset path, next retries will become fastset commiting of HDCP.

v2:
dpms test is added within existing implementation with a flag [Daniel]

---
 tests/kms_content_protection.c | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)
tests/kms_content_protection.c +24 -6
index f6b441d891e5..e2d5134421aa 100644
@@ -216,7 +216,8 @@ static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
 
 
 static void test_content_protection_on_output(igt_output_t *output,
-					      enum igt_commit_style s)
+					      enum igt_commit_style s,
+					      bool dpms_test)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
@@ -237,8 +238,20 @@ static void test_content_protection_on_output(igt_output_t *output,
 
 		modeset_with_fb(pipe, output, s);
 		test_cp_enable_with_retry(output, s, 3);
-		test_cp_disable(output, s);
 
+		if (dpms_test) {
+			igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 0);
+			igt_display_commit2(display, s);
+
+			igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 1);
+			igt_display_commit2(display, s);
+
+			ret = wait_for_prop_value(output, 2, 18000);
+			if (!ret)
+				test_cp_enable_with_retry(output, s, 2);
+		}
+
+		test_cp_disable(output, s);
 		primary = igt_output_get_plane_type(output,
 						    DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, NULL);
@@ -282,7 +295,7 @@ static bool sink_hdcp_capable(igt_output_t *output)
 
 
 static void
-test_content_protection(enum igt_commit_style s)
+test_content_protection(enum igt_commit_style s, bool dpms_test)
 {
 	igt_display_t *display = &data.display;
 	igt_output_t *output;
@@ -299,7 +312,7 @@ test_content_protection(enum igt_commit_style s)
 			continue;
 		}
 
-		test_content_protection_on_output(output, s);
+		test_content_protection_on_output(output, s, dpms_test);
 		valid_tests++;
 	}
 
@@ -317,11 +330,16 @@ igt_main
 	}
 
 	igt_subtest("legacy")
-		test_content_protection(COMMIT_LEGACY);
+		test_content_protection(COMMIT_LEGACY, false);
 
 	igt_subtest("atomic") {
 		igt_require(data.display.is_atomic);
-		test_content_protection(COMMIT_ATOMIC);
+		test_content_protection(COMMIT_ATOMIC, false);
+	}
+
+	igt_subtest("atomic-dpms") {
+		igt_require(data.display.is_atomic);
+		test_content_protection(COMMIT_ATOMIC, true);
 	}
 
 	igt_fixture
Signature · 6 lines
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#2 lore raw

PATCH v3 2/3 kms_content_protection: Test CP along with modeset

As we have two different patch for commitng the HDCP request
1. DDI_enable (during the modeset)
2. update_pipe (during fastset execution)

Currently our kms_content_protection covers only fastset path. So this test adds the coverage for the HDCP during the modeset by performing DPMS off-on and check for HDCP status.

But with respect to HDCP we allow few retries from userspace before reporting the failure. So only first attempt at kernel will be on modeset path, next retries will become fastset commiting of HDCP.

v2:
dpms test is added within existing implementation with a flag [Daniel]
v3:
ret declared.

---
 tests/kms_content_protection.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)
tests/kms_content_protection.c +27 -6
index f6b441d891e5..7d82c733b378 100644
@@ -216,11 +216,13 @@ static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
 
 
 static void test_content_protection_on_output(igt_output_t *output,
-					      enum igt_commit_style s)
+					      enum igt_commit_style s,
+					      bool dpms_test)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
 	enum pipe pipe;
+	bool ret;
 
 	for_each_pipe(display, pipe) {
 		if (!igt_pipe_connector_valid(pipe, output))
@@ -237,8 +239,22 @@ static void test_content_protection_on_output(igt_output_t *output,
 
 		modeset_with_fb(pipe, output, s);
 		test_cp_enable_with_retry(output, s, 3);
-		test_cp_disable(output, s);
 
+		if (dpms_test) {
+			igt_pipe_set_prop_value(display, pipe,
+						IGT_CRTC_ACTIVE, 0);
+			igt_display_commit2(display, s);
+
+			igt_pipe_set_prop_value(display, pipe,
+						IGT_CRTC_ACTIVE, 1);
+			igt_display_commit2(display, s);
+
+			ret = wait_for_prop_value(output, 2, 18000);
+			if (!ret)
+				test_cp_enable_with_retry(output, s, 2);
+		}
+
+		test_cp_disable(output, s);
 		primary = igt_output_get_plane_type(output,
 						    DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, NULL);
@@ -282,7 +298,7 @@ static bool sink_hdcp_capable(igt_output_t *output)
 
 
 static void
-test_content_protection(enum igt_commit_style s)
+test_content_protection(enum igt_commit_style s, bool dpms_test)
 {
 	igt_display_t *display = &data.display;
 	igt_output_t *output;
@@ -299,7 +315,7 @@ test_content_protection(enum igt_commit_style s)
 			continue;
 		}
 
-		test_content_protection_on_output(output, s);
+		test_content_protection_on_output(output, s, dpms_test);
 		valid_tests++;
 	}
 
@@ -317,11 +333,16 @@ igt_main
 	}
 
 	igt_subtest("legacy")
-		test_content_protection(COMMIT_LEGACY);
+		test_content_protection(COMMIT_LEGACY, false);
 
 	igt_subtest("atomic") {
 		igt_require(data.display.is_atomic);
-		test_content_protection(COMMIT_ATOMIC);
+		test_content_protection(COMMIT_ATOMIC, false);
+	}
+
+	igt_subtest("atomic-dpms") {
+		igt_require(data.display.is_atomic);
+		test_content_protection(COMMIT_ATOMIC, true);
 	}
 
 	igt_fixture
Signature · 6 lines
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v3 2/3
#3 lore raw

Re: [igt-dev] [PATCH i-g-t v3 2/3] kms_content_protection: Test CP along with modeset

Quoted 12 lines · Ramalingam C

As we have two different patch for commitng the HDCP request
1. DDI_enable (during the modeset)
2. update_pipe (during fastset execution)

Currently our kms_content_protection covers only fastset path. So this test adds the coverage for the HDCP during the modeset by performing DPMS off-on and check for HDCP status.

But with respect to HDCP we allow few retries from userspace before reporting the failure. So only first attempt at kernel will be on modeset path, next retries will become fastset commiting of HDCP.

Quoted 6 lines

v2:
dpms test is added within existing implementation with a flag [Daniel]
v3:
ret declared.

Quoted 87 lines
---
 tests/kms_content_protection.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)
tests/kms_content_protection.c +27 -6
index f6b441d891e5..7d82c733b378 100644
@@ -216,11 +216,13 @@ static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
 
 
 static void test_content_protection_on_output(igt_output_t *output,
-					      enum igt_commit_style s)
+					      enum igt_commit_style s,
+					      bool dpms_test)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
 	enum pipe pipe;
+	bool ret;
 
 	for_each_pipe(display, pipe) {
 		if (!igt_pipe_connector_valid(pipe, output))
@@ -237,8 +239,22 @@ static void test_content_protection_on_output(igt_output_t *output,
 
 		modeset_with_fb(pipe, output, s);
 		test_cp_enable_with_retry(output, s, 3);
-		test_cp_disable(output, s);
 
+		if (dpms_test) {
+			igt_pipe_set_prop_value(display, pipe,
+						IGT_CRTC_ACTIVE, 0);
+			igt_display_commit2(display, s);
+
+			igt_pipe_set_prop_value(display, pipe,
+						IGT_CRTC_ACTIVE, 1);
+			igt_display_commit2(display, s);
+
+			ret = wait_for_prop_value(output, 2, 18000);
+			if (!ret)
+				test_cp_enable_with_retry(output, s, 2);
+		}
+
+		test_cp_disable(output, s);
 		primary = igt_output_get_plane_type(output,
 						    DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, NULL);
@@ -282,7 +298,7 @@ static bool sink_hdcp_capable(igt_output_t *output)
 
 
 static void
-test_content_protection(enum igt_commit_style s)
+test_content_protection(enum igt_commit_style s, bool dpms_test)
 {
 	igt_display_t *display = &data.display;
 	igt_output_t *output;
@@ -299,7 +315,7 @@ test_content_protection(enum igt_commit_style s)
 			continue;
 		}
 
-		test_content_protection_on_output(output, s);
+		test_content_protection_on_output(output, s, dpms_test);
 		valid_tests++;
 	}
 
@@ -317,11 +333,16 @@ igt_main
 	}
 
 	igt_subtest("legacy")
-		test_content_protection(COMMIT_LEGACY);
+		test_content_protection(COMMIT_LEGACY, false);
 
 	igt_subtest("atomic") {
 		igt_require(data.display.is_atomic);
-		test_content_protection(COMMIT_ATOMIC);
+		test_content_protection(COMMIT_ATOMIC, false);
+	}
+
+	igt_subtest("atomic-dpms") {
+		igt_require(data.display.is_atomic);
+		test_content_protection(COMMIT_ATOMIC, true);
 	}
 
 	igt_fixture
Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#4 lore raw

PATCH 3/3 kms_content_protection: Confirm that LIC is passed

In reply to Ramalingam C

Once the HDCP is enabled, kernel will run the link integrity check(LIC) atleast once in 2Secs based on the HDCP versions.

So to confirm the link integrity check is passed, we oberve that HDCP state remains ENABLED for next 4Secs.

v2:
Rebased.

---
 tests/kms_content_protection.c | 9 +++++++++
 1 file changed, 9 insertions(+)
tests/kms_content_protection.c +9 -0
index e2d5134421aa..234ba08fae0d 100644
@@ -214,6 +214,14 @@ static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
 	return true;
 }
 
+static void test_cp_lic(igt_output_t *output)
+{
+	bool ret;
+
+	/* Wait for 4Secs (min 2 cycles of Link Integrity Check) */
+	ret = wait_for_prop_value(output, 1, 4 * 1000);
+	igt_assert_f(!ret, "Content Protection LIC Failed\n");
+}
 
 static void test_content_protection_on_output(igt_output_t *output,
 					      enum igt_commit_style s,
@@ -238,6 +246,7 @@ static void test_content_protection_on_output(igt_output_t *output,
 
 		modeset_with_fb(pipe, output, s);
 		test_cp_enable_with_retry(output, s, 3);
+		test_cp_lic(output);
 
 		if (dpms_test) {
 			igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 0);
Signature · 6 lines
2.7.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 3/3
#5 lore raw

Re: [igt-dev] [PATCH i-g-t 3/3] kms_content_protection: Confirm that LIC is passed

Quoted 10 lines · Ramalingam C

Once the HDCP is enabled, kernel will run the link integrity check(LIC) atleast once in 2Secs based on the HDCP versions.

So to confirm the link integrity check is passed, we oberve that HDCP state remains ENABLED for next 4Secs.

v2:
Rebased.

Somehow my reply in the previous discussion didn't make it out to the list.

Quoted 10 lines
---
 tests/kms_content_protection.c | 9 +++++++++
 1 file changed, 9 insertions(+)
tests/kms_content_protection.c +0 -0
index e2d5134421aa..234ba08fae0d 100644
@@ -214,6 +214,14 @@ static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
 	return true;

tests/kms_content_protection.c static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe) · line 224

Quoted 10 lines
tests/kms_content_protection.c +8 -0
 }
 
+static void test_cp_lic(igt_output_t *output)
+{
+	bool ret;
+
+	/* Wait for 4Secs (min 2 cycles of Link Integrity Check) */
+	ret = wait_for_prop_value(output, 1, 4 * 1000);
+	igt_assert_f(!ret, "Content Protection LIC Failed\n");
+}

With your explanation, makes sense now.

It would be nice though to follow up with a patch to replace all the magic numbers with some local #defines, e.g.

#define LOCAL_CONTENT_PROTECTION_DESIRED 1

Similar for others. That way we don't depend upon the header and stuff, and the code becomes a lot less confusing.
-Daniel

Quoted 14 lines
tests/kms_content_protection.c +1 -0
 static void test_content_protection_on_output(igt_output_t *output,
 					      enum igt_commit_style s,
@@ -238,6 +246,7 @@ static void test_content_protection_on_output(igt_output_t *output,
 
 		modeset_with_fb(pipe, output, s);
 		test_cp_enable_with_retry(output, s, 3);
+		test_cp_lic(output);
 
 		if (dpms_test) {
 			igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 0);
Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#6 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/3] kms_content_protection: modularizing the CP test steps (rev2)

In reply to Ramalingam C
== Series Details ==

== Series Details ==

Series: series starting with [i-g-t,1/3] kms_content_protection: modularizing the CP test steps (rev2)
URL : https://patchwork.freedesktop.org/series/56361/
State : failure

== Summary ==

Applying: kms_content_protection: modularizing the CP test steps
Applying: kms_content_protection: Test CP along with modeset
Applying: kms_content_protection: Confirm that LIC is passed Patch failed at 0003 kms_content_protection: Confirm that LIC is passed When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev