[igt-dev] [PATCH i-g-t v2 4/5] kms_content_protection: test content type change

Ramalingam C ramalingam.c at intel.com
Fri Mar 8 16:30:48 UTC 2019


Testing the content type change when the content protection already
enabled.

Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
 tests/kms_content_protection.c | 61 ++++++++++++++++++++++------------
 1 file changed, 40 insertions(+), 21 deletions(-)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 3d2a01db277b..a1e73fcbdceb 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -274,7 +274,7 @@ static void modeset_with_fb(const enum pipe pipe, igt_output_t *output,
 }
 
 static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
-			   int content_type)
+			   int content_type, bool test_type_change)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
@@ -282,8 +282,11 @@ static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
 
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
-	igt_output_set_prop_value(output,
-				  IGT_CONNECTOR_CONTENT_PROTECTION, CP_DESIRED);
+	if (!test_type_change)
+		igt_output_set_prop_value(output,
+					  IGT_CONNECTOR_CONTENT_PROTECTION,
+					  CP_DESIRED);
+
 	if (output->props[IGT_CONNECTOR_CP_CONTENT_TYPE])
 		igt_output_set_prop_value(output, IGT_CONNECTOR_CP_CONTENT_TYPE,
 					  content_type);
@@ -325,13 +328,16 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
 static void test_cp_enable_with_retry(igt_output_t *output,
 				      enum igt_commit_style s, int retry,
 				      int content_type, bool expect_failure,
-				      bool test_srm)
+				      bool test_srm, bool test_type_change)
 {
+	int retry_orig = retry;
 	bool ret;
 
 	do {
-		test_cp_disable(output, s);
-		ret = test_cp_enable(output, s, content_type);
+		if (!test_type_change || retry_orig != retry)
+			test_cp_disable(output, s);
+
+		ret = test_cp_enable(output, s, content_type, test_type_change);
 
 		if (!ret && --retry)
 			igt_debug("Retry (%d/2) ...\n", 3 - retry);
@@ -384,7 +390,8 @@ static bool write_srm_into_sysfs(const char *srm, int len)
 static void
 test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 				  bool dpms_test, int content_type,
-				  bool mei_reload_test, bool test_srm)
+				  bool mei_reload_test, bool test_srm,
+				  bool test_type_change)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
@@ -408,7 +415,11 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 		srm_modified = false;
 		modeset_with_fb(pipe, output, s);
 		test_cp_enable_with_retry(output, s, 3, content_type, false,
-					  false);
+					  false, false);
+		if (test_type_change && content_type == CP_TYPE_1)
+			test_cp_enable_with_retry(output, s, 3, CP_TYPE_0,
+						  false, false,
+						  test_type_change);
 
 		if (mei_reload_test) {
 			igt_assert_f(!igt_kmod_unload("mei_hdcp", 0),
@@ -416,14 +427,16 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 
 			/* Expected to fail */
 			test_cp_enable_with_retry(output, s, 3,
-						  content_type, false, true);
+						  content_type, false, true,
+						  false);
 
 			igt_assert_f(!igt_kmod_load("mei_hdcp", NULL),
 				     "mei_hdcp load failed");
 
 			/* Expected to pass */
 			test_cp_enable_with_retry(output, s, 3,
-						  content_type, false, false);
+						  content_type, false, false,
+						  false);
 		}
 
 		test_cp_lic(output);
@@ -440,7 +453,7 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 		if (test_srm && srm_modified) {
 			test_cp_disable(output, s);
 			test_cp_enable_with_retry(output, s, 3, content_type,
-						  false, test_srm);
+						  false, test_srm, false);
 
 			/* Removing the sink's Receiver ID from SRM Blob */
 			for (i = 0; i < 5; i++)
@@ -452,7 +465,7 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 			igt_assert_f(srm_modified, "SRM update failed");
 
 			test_cp_enable_with_retry(output, s, 1, content_type,
-						  false, false);
+						  false, false, false);
 		}
 
 		if (dpms_test) {
@@ -469,7 +482,7 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 			if (!ret)
 				test_cp_enable_with_retry(output, s, 2,
 							  content_type, false,
-							  false);
+							  false, false);
 		}
 
 		test_cp_disable(output, s);
@@ -535,7 +548,7 @@ static bool sink_hdcp2_capable(igt_output_t *output)
 static void
 test_content_protection(enum igt_commit_style s, bool dpms_test,
 			int content_type, bool mei_reload_test,
-			bool test_srm)
+			bool test_srm, bool test_type_change)
 {
 	igt_display_t *display = &data.display;
 	igt_output_t *output;
@@ -567,7 +580,8 @@ test_content_protection(enum igt_commit_style s, bool dpms_test,
 
 		test_content_protection_on_output(output, s, dpms_test,
 						  content_type,
-						  mei_reload_test, test_srm);
+						  mei_reload_test, test_srm,
+						  test_type_change);
 		valid_tests++;
 	}
 
@@ -586,30 +600,30 @@ igt_main
 
 	igt_subtest("legacy")
 		test_content_protection(COMMIT_LEGACY, false, CP_TYPE_0,
-					false, false);
+					false, false, false);
 
 	igt_subtest("atomic") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false, CP_TYPE_0,
-					false, false);
+					false, false, false);
 	}
 
 	igt_subtest("atomic-dpms") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, true, CP_TYPE_0,
-					false, false);
+					false, false, false);
 	}
 
 	igt_subtest("Type1") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false, CP_TYPE_1,
-					false, false);
+					false, false, false);
 	}
 
 	igt_subtest("type1_mei_interface") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false, CP_TYPE_1,
-					true, false);
+					true, false, false);
 	}
 
 	/*
@@ -635,9 +649,14 @@ igt_main
 	igt_subtest("srm") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false, CP_TYPE_1,
-					false, true);
+					false, true, false);
 	}
 
+	igt_subtest("content_type_change") {
+		igt_require(data.display.is_atomic);
+		test_content_protection(COMMIT_ATOMIC, false, CP_TYPE_1,
+					false, false, true);
+	}
 
 	igt_fixture
 		igt_display_fini(&data.display);
-- 
2.19.1



More information about the igt-dev mailing list