summaryrefslogtreecommitdiff
path: root/tests/kms_content_protection.c
diff options
context:
space:
mode:
authorRamalingam C <ramalingam.c@intel.com>2019-07-03 15:24:41 +0530
committerRamalingam C <ramalingam.c@intel.com>2019-08-06 16:17:12 +0530
commit724884603c28b286e939045b0c9986fe9f4804d2 (patch)
treee72d7a4ff1b89c0cf79691967dcdb7fb4a3d3ec5 /tests/kms_content_protection.c
parentb407c7e09d04d68d073a5b0ab6c02111ffcdfc71 (diff)
kms_content_protection: Content type support
Adds a connector property called "CP_Content_Type" Content Type takes two values which classifies the content stream: Type 0: Stream that can be transmitted on HDCP1.4/HDCP2.2 Type 1: Stream that needs HDCP2.2 encryption only. So when Type 1 is set KMD is forced to enable HDCP2.2 only. For Type 0 request, Kernel chooses the highest capable HDCP version (v2.2) first. If that fails, then it fall back to the next available version(v1.4) before abondoning HDCP authentication attempts. Please note content_type is allowed to be updated when "Content Protection" is in UNDESIRED state. v2: s/cp_content_type/content_protection_type [danvet] v3: s/content_protection_type/HDCP Content Type [Pekka] v4: Rebased v5: Typos in the commit msg is fixed [Uma] Signed-off-by: Ramalingam C <ramalingam.c@intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Uma Shankar <uma.shankar@intel.com> Link: https://patchwork.freedesktop.org/patch/315467/?series=57756&rev=10
Diffstat (limited to 'tests/kms_content_protection.c')
-rw-r--r--tests/kms_content_protection.c74
1 files changed, 60 insertions, 14 deletions
diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index c86fe936f..32630f286 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -44,6 +44,13 @@ struct data {
#define CP_DESIRED 1
#define CP_ENABLED 2
+/*
+ * HDCP_CONTENT_TYPE_0 can be handled on both HDCP1.4 and HDCP2.2. Where as
+ * HDCP_CONTENT_TYPE_1 can be handled only through HDCP2.2.
+ */
+#define HDCP_CONTENT_TYPE_0 0
+#define HDCP_CONTENT_TYPE_1 1
+
#define LIC_PERIOD_MSEC (4 * 1000)
/* Kernel retry count=3, Max time per authentication allowed = 6Sec */
#define KERNEL_AUTH_TIME_ALLOWED_MSEC (3 * 6 * 1000)
@@ -159,7 +166,8 @@ static void modeset_with_fb(const enum pipe pipe, igt_output_t *output,
commit_display_and_wait_for_flip(s);
}
-static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s)
+static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
+ int content_type)
{
igt_display_t *display = &data.display;
igt_plane_t *primary;
@@ -169,6 +177,10 @@ static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s)
igt_output_set_prop_value(output,
IGT_CONNECTOR_CONTENT_PROTECTION, CP_DESIRED);
+ if (output->props[IGT_CONNECTOR_HDCP_CONTENT_TYPE])
+ igt_output_set_prop_value(output,
+ IGT_CONNECTOR_HDCP_CONTENT_TYPE,
+ content_type);
igt_display_commit2(display, s);
ret = wait_for_prop_value(output, CP_ENABLED,
@@ -205,13 +217,14 @@ 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)
+ enum igt_commit_style s, int retry,
+ int content_type)
{
bool ret;
do {
test_cp_disable(output, s);
- ret = test_cp_enable(output, s);
+ ret = test_cp_enable(output, s, content_type);
if (!ret && --retry)
igt_debug("Retry (%d/2) ...\n", 3 - retry);
@@ -244,7 +257,8 @@ static void test_cp_lic(igt_output_t *output)
}
static void test_content_protection_on_output(igt_output_t *output,
- enum igt_commit_style s)
+ enum igt_commit_style s,
+ int content_type)
{
igt_display_t *display = &data.display;
igt_plane_t *primary;
@@ -265,7 +279,7 @@ static void test_content_protection_on_output(igt_output_t *output,
continue;
modeset_with_fb(pipe, output, s);
- test_cp_enable_with_retry(output, s, 3);
+ test_cp_enable_with_retry(output, s, 3, content_type);
if (data.cp_tests & CP_LIC)
test_cp_lic(output);
@@ -282,7 +296,8 @@ static void test_content_protection_on_output(igt_output_t *output,
ret = wait_for_prop_value(output, CP_ENABLED,
KERNEL_AUTH_TIME_ALLOWED_MSEC);
if (!ret)
- test_cp_enable_with_retry(output, s, 2);
+ test_cp_enable_with_retry(output, s,
+ 2, content_type);
}
test_cp_disable(output, s);
@@ -309,7 +324,8 @@ static void __debugfs_read(int fd, const char *param, char *buf, int len)
#define debugfs_read(fd, p, arr) __debugfs_read(fd, p, arr, sizeof(arr))
-#define MAX_SINK_HDCP_CAP_BUF_LEN 500
+#define MAX_SINK_HDCP_CAP_BUF_LEN 5000
+
static bool sink_hdcp_capable(igt_output_t *output)
{
char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
@@ -327,9 +343,25 @@ static bool sink_hdcp_capable(igt_output_t *output)
return strstr(buf, "HDCP1.4");
}
+static bool sink_hdcp2_capable(igt_output_t *output)
+{
+ char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
+ int fd;
+
+ fd = igt_debugfs_connector_dir(data.drm_fd, output->name, O_RDONLY);
+ if (fd < 0)
+ return false;
+
+ debugfs_read(fd, "i915_hdcp_sink_capability", buf);
+ close(fd);
+
+ igt_debug("Sink capability: %s\n", buf);
+
+ return strstr(buf, "HDCP2.2");
+}
static void
-test_content_protection(enum igt_commit_style s)
+test_content_protection(enum igt_commit_style s, int content_type)
{
igt_display_t *display = &data.display;
igt_output_t *output;
@@ -339,14 +371,23 @@ test_content_protection(enum igt_commit_style s)
if (!output->props[IGT_CONNECTOR_CONTENT_PROTECTION])
continue;
+ if (!output->props[IGT_CONNECTOR_HDCP_CONTENT_TYPE] &&
+ content_type)
+ continue;
+
igt_info("CP Test execution on %s\n", output->name);
- if (!sink_hdcp_capable(output)) {
+
+ if (content_type && !sink_hdcp2_capable(output)) {
+ igt_info("\tSkip %s (Sink has no HDCP2.2 support)\n",
+ output->name);
+ continue;
+ } else if (!sink_hdcp_capable(output)) {
igt_info("\tSkip %s (Sink has no HDCP support)\n",
output->name);
continue;
}
- test_content_protection_on_output(output, s);
+ test_content_protection_on_output(output, s, content_type);
valid_tests++;
}
@@ -365,25 +406,30 @@ igt_main
igt_subtest("legacy") {
data.cp_tests = 0;
- test_content_protection(COMMIT_LEGACY);
+ test_content_protection(COMMIT_LEGACY, HDCP_CONTENT_TYPE_0);
}
igt_subtest("atomic") {
igt_require(data.display.is_atomic);
data.cp_tests = 0;
- test_content_protection(COMMIT_ATOMIC);
+ test_content_protection(COMMIT_ATOMIC, HDCP_CONTENT_TYPE_0);
}
igt_subtest("atomic-dpms") {
igt_require(data.display.is_atomic);
data.cp_tests = CP_DPMS;
- test_content_protection(COMMIT_ATOMIC);
+ test_content_protection(COMMIT_ATOMIC, HDCP_CONTENT_TYPE_0);
}
igt_subtest("LIC") {
igt_require(data.display.is_atomic);
data.cp_tests = CP_LIC;
- test_content_protection(COMMIT_ATOMIC);
+ test_content_protection(COMMIT_ATOMIC, HDCP_CONTENT_TYPE_0);
+ }
+
+ igt_subtest("type1") {
+ igt_require(data.display.is_atomic);
+ test_content_protection(COMMIT_ATOMIC, HDCP_CONTENT_TYPE_1);
}
igt_fixture