[PATCH i-g-t v2 1/1] tests/kms_content_protection: Add force HDCP 1.4 subtest
Santhosh Reddy Guddati
santhosh.reddy.guddati at intel.com
Tue Jun 3 18:06:03 UTC 2025
If a Panel supports both HDCP1.4 and HDCP2.2 versions, the kernel will
always choose the HDCP2.2 protection path and if this fails, then
HDCP1.4 will be tried.
The subtest uses debugfs support to force hdcp1.4 on the connector and
verify content protection.
V2: Use hdcp14 debugfs for all the supported subtests (Suraj).
Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
---
tests/kms_content_protection.c | 97 ++++++++++++++++++++++++++++++++--
1 file changed, 92 insertions(+), 5 deletions(-)
diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 6fe1edbc4..3542b7c64 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -94,6 +94,7 @@ struct data {
struct igt_fb red, green;
unsigned int cp_tests;
struct udev_monitor *uevent_monitor;
+ bool is_force_hdcp14;
} data;
/* Test flags */
@@ -565,6 +566,51 @@ static bool output_hdcp_capable(igt_output_t *output, int content_type)
return true;
}
+static void set_i915_force_hdcp14(igt_output_t *output)
+{
+ int fd, ret;
+ char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
+
+ fd = igt_debugfs_connector_dir(data.drm_fd, output->name, O_RDONLY);
+ igt_require_f(fd >= 0, "Cannot open %s debugfs\n", output->name);
+
+ ret = igt_debugfs_simple_read(fd, "i915_force_hdcp14", buf, sizeof(buf));
+ if (ret <= 0) {
+ igt_info("i915_force_hdcp14 not supported\n");
+ close(fd);
+ return;
+ }
+
+ ret = igt_sysfs_write(fd, "i915_force_hdcp14", "1", 2);
+ igt_require_f(ret > 0, "i915_force_hdcp14 is not enabled\n");
+
+ ret = igt_debugfs_simple_read(fd, "i915_force_hdcp14", buf, sizeof(buf));
+ igt_assert_f(ret > 0 && strstr(buf, "yes"),
+ "i915_force_hdcp14 is not set to 'yes' on %s debugfs\n",
+ output->name);
+
+ close(fd);
+}
+
+static void reset_i915_force_hdcp14(igt_output_t *output)
+{
+ int fd, ret;
+ char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
+
+ fd = igt_debugfs_connector_dir(data.drm_fd, output->name, O_RDONLY);
+ igt_require_f(fd >= 0, "Cannot open %s debugfs\n", output->name);
+
+ ret = igt_sysfs_write(fd, "i915_force_hdcp14", "0", 2);
+ igt_require_f(ret > 0, "i915_force_hdcp14 is not disabled\n");
+
+ ret = igt_debugfs_simple_read(fd, "i915_force_hdcp14", buf, sizeof(buf));
+ igt_assert_f(ret > 0 && strstr(buf, "no"),
+ "i915_force_hdcp14 is not set to 'no' on %s debugfs\n",
+ "i915_force_hdcp14");
+
+ close(fd);
+}
+
static void
test_fini(igt_output_t *output, enum igt_commit_style commit_style)
{
@@ -607,8 +653,21 @@ test_content_protection(enum igt_commit_style commit_style, int content_type)
if (!output_hdcp_capable(output, content_type))
continue;
- igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), output->name)
+ // Run once with force-hdcp14 if requested
+ if (data.is_force_hdcp14) {
+ set_i915_force_hdcp14(output);
+
+ igt_dynamic_f("pipe-%s-%s-force-hdcp14", kmstest_pipe_name(pipe), output->name) {
+ test_content_protection_on_output(output, pipe, commit_style, content_type);
+ }
+
+ reset_i915_force_hdcp14(output);
+ data.is_force_hdcp14 = false;
+ }
+
+ igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), output->name) {
test_content_protection_on_output(output, pipe, commit_style, content_type);
+ }
test_fini(output, commit_style);
/*
@@ -671,6 +730,11 @@ test_mst_cp_enable_with_retry(igt_output_t *hdcp_mst_output[], int valid_outputs
int retry_orig = retries, count, i;
bool ret;
+ if (data.is_force_hdcp14) {
+ for (count = 0; count < valid_outputs; count++)
+ set_i915_force_hdcp14(hdcp_mst_output[count]);
+ }
+
do {
if (retry_orig != retries)
test_mst_cp_disable(hdcp_mst_output, COMMIT_ATOMIC, valid_outputs);
@@ -704,6 +768,11 @@ test_mst_cp_enable_with_retry(igt_output_t *hdcp_mst_output[], int valid_outputs
igt_display_commit2(display, COMMIT_ATOMIC);
} while (retries && !ret);
+ if (data.is_force_hdcp14) {
+ for (count = 0; count < valid_outputs; count++)
+ reset_i915_force_hdcp14(hdcp_mst_output[count]);
+ }
+
igt_assert_f(ret, "Content Protection not enabled on MST outputs\n");
}
@@ -830,43 +899,52 @@ static void create_fbs(void)
0.f, 1.f, 0.f, &data.green);
}
+
+
static const struct {
const char *desc;
const char *name;
unsigned int cp_tests;
bool content_type;
+ bool is_force_hdcp14;
} subtests[] = {
{ .desc = "Test content protection with atomic modesetting",
.name = "atomic",
.cp_tests = 0,
- .content_type = HDCP_CONTENT_TYPE_0
+ .content_type = HDCP_CONTENT_TYPE_0,
+ .is_force_hdcp14 = true,
},
{ .desc = "Test content protection with DPMS ON/OFF during atomic modesetting.",
.name = "atomic-dpms",
.cp_tests = CP_DPMS,
- .content_type = HDCP_CONTENT_TYPE_0
+ .content_type = HDCP_CONTENT_TYPE_0,
+ .is_force_hdcp14 = true,
},
{ .desc = "Test for the integrity of link with type 0 content.",
.name = "lic-type-0",
.cp_tests = CP_LIC,
.content_type = HDCP_CONTENT_TYPE_0,
+ .is_force_hdcp14 = true,
},
{ .desc = "Test for the integrity of link with type 1 content",
.name = "lic-type-1",
.cp_tests = CP_LIC,
.content_type = HDCP_CONTENT_TYPE_1,
+ .is_force_hdcp14 = false,
},
{ .desc = "Test content protection with content type 1 "
"that can be handled only through HDCP2.2.",
.name = "type1",
.cp_tests = 0,
.content_type = HDCP_CONTENT_TYPE_1,
+ .is_force_hdcp14 = false,
},
{ .desc = "Test the teardown and rebuild of the interface between "
"Intel and mei hdcp.",
.name = "mei-interface",
.cp_tests = CP_MEI_RELOAD,
.content_type = HDCP_CONTENT_TYPE_1,
+ .is_force_hdcp14 = false,
},
{ .desc = "Test the content type change when the content protection already enabled",
.name = "content-type-change",
@@ -878,6 +956,7 @@ static const struct {
.name = "uevent",
.cp_tests = CP_UEVENT,
.content_type = HDCP_CONTENT_TYPE_0,
+ .is_force_hdcp14 = true,
},
/*
* Testing the revocation check through SRM needs a HDCP sink with
@@ -892,6 +971,7 @@ static const struct {
.name = "srm",
.cp_tests = 0,
.content_type = HDCP_CONTENT_TYPE_0,
+ .is_force_hdcp14 = true,
},
};
@@ -900,26 +980,31 @@ static const struct {
const char *name;
unsigned int cp_tests;
bool content_type;
+ bool is_force_hdcp14;
} mst_subtests[] = {
{ .desc = "Test Content protection(Type 0) over DP MST.",
.name = "dp-mst-type-0",
.cp_tests = 0,
- .content_type = HDCP_CONTENT_TYPE_0
+ .content_type = HDCP_CONTENT_TYPE_0,
+ .is_force_hdcp14 = true,
},
{ .desc = "Test Content protection(Type 0) over DP MST with LIC.",
.name = "dp-mst-lic-type-0",
.cp_tests = CP_LIC,
- .content_type = HDCP_CONTENT_TYPE_0
+ .content_type = HDCP_CONTENT_TYPE_0,
+ .is_force_hdcp14 = true,
},
{ .desc = "Test Content protection(Type 1) over DP MST.",
.name = "dp-mst-type-1",
.cp_tests = 0,
.content_type = HDCP_CONTENT_TYPE_1,
+ .is_force_hdcp14 = false,
},
{ .desc = "Test Content protection(Type 1) over DP MST with LIC.",
.name = "dp-mst-lic-type-1",
.cp_tests = CP_LIC,
.content_type = HDCP_CONTENT_TYPE_1,
+ .is_force_hdcp14 = false,
},
};
@@ -947,6 +1032,7 @@ igt_main
igt_subtest_with_dynamic(subtests[i].name) {
data.cp_tests = subtests[i].cp_tests;
+ data.is_force_hdcp14 = subtests[i].is_force_hdcp14;
if (!strcmp(subtests[i].name, "srm")) {
bool ret;
@@ -970,6 +1056,7 @@ igt_main
igt_subtest(mst_subtests[i].name) {
data.cp_tests = mst_subtests[i].cp_tests;
+ data.is_force_hdcp14 = mst_subtests[i].is_force_hdcp14;
test_content_protection_mst(mst_subtests[i].content_type);
}
}
--
2.34.1
More information about the igt-dev
mailing list