Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 0/4] Add HDCP support for unigraf
@ 2026-07-31 18:21 Louis Chauvet
  2026-07-31 18:21 ` [PATCH i-g-t 1/4] tests/kms_content_protection: Avoid using internal pointers Louis Chauvet
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Louis Chauvet @ 2026-07-31 18:21 UTC (permalink / raw)
  To: igt-dev; +Cc: markyacoub, thomas.petazzoni, Louis Chauvet, fomys

UCD-500 is able to emulate HDCP 2.2, so add the infrastructure to:
- test HDCP using UCD-500
- automatically enable HDCP for existing tests and avoid creating many more
tests.

Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
Louis Chauvet (3):
      tests/kms_content_protection: Avoid using internal pointers
      tests/kms_content_protection: Enable HDCP for unigraf if available
      tests/kms_content_protection: Add test to ensure HDCP is properly detected  by the DUT

fomys (1):
      lib/unigraf: Add HDCP management

 lib/vendor/unigraf/unigraf.c   | 23 ++++++++++++++++-
 lib/vendor/unigraf/unigraf.h   |  4 +++
 tests/kms_content_protection.c | 56 +++++++++++++++++++++++++++++++-----------
 3 files changed, 68 insertions(+), 15 deletions(-)
---
base-commit: be1d1af352dbd4ca4557202a8ed0d6d60f95e0bf
change-id: 20260731-b4-unigraf-hdcp-60321591eb9a

Best regards,
--  
fomys <fomys@google.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH i-g-t 1/4] tests/kms_content_protection: Avoid using internal pointers
  2026-07-31 18:21 [PATCH i-g-t 0/4] Add HDCP support for unigraf Louis Chauvet
@ 2026-07-31 18:21 ` Louis Chauvet
  2026-07-31 18:21 ` [PATCH i-g-t 2/4] lib/unigraf: Add HDCP management Louis Chauvet
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Louis Chauvet @ 2026-07-31 18:21 UTC (permalink / raw)
  To: igt-dev; +Cc: markyacoub, thomas.petazzoni, Louis Chauvet

output->name is an internal pointer. Replace usage of this pointer by the
existing igt_output_name helper.

Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
 tests/kms_content_protection.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index d931ce7682be..133060af3c0a 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -558,7 +558,7 @@ static bool sink_hdcp_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);
+	fd = igt_debugfs_connector_dir(data.drm_fd, igt_output_name(output), O_RDONLY);
 	if (fd < 0)
 		return false;
 
@@ -586,7 +586,7 @@ 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);
+	fd = igt_debugfs_connector_dir(data.drm_fd, igt_output_name(output), O_RDONLY);
 	if (fd < 0)
 		return false;
 
@@ -634,11 +634,11 @@ static bool output_hdcp_capable(igt_output_t *output, int content_type)
 
 		if (content_type && !sink_hdcp2_capable(output)) {
 			igt_info("\tSkip %s (Sink has no HDCP2.2 support)\n",
-				 output->name);
+				 igt_output_name(output));
 			return false;
 		} else if (!sink_hdcp_capable(output)) {
 			igt_info("\tSkip %s (Sink has no HDCP support)\n",
-				 output->name);
+				 igt_output_name(output));
 			return false;
 		}
 
@@ -650,8 +650,8 @@ 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);
+	fd = igt_debugfs_connector_dir(data.drm_fd, igt_output_name(output), O_RDONLY);
+	igt_require_f(fd >= 0, "Cannot open %s debugfs\n", igt_output_name(output));
 
 	ret = igt_debugfs_simple_read(fd, "i915_force_hdcp14", buf, sizeof(buf));
 	if (ret <= 0) {
@@ -666,7 +666,7 @@ static void set_i915_force_hdcp14(igt_output_t *output)
 	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);
+			 igt_output_name(output));
 
 	close(fd);
 }
@@ -676,8 +676,8 @@ 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);
+	fd = igt_debugfs_connector_dir(data.drm_fd, igt_output_name(output), O_RDONLY);
+	igt_require_f(fd >= 0, "Cannot open %s debugfs\n", igt_output_name(output));
 
 	ret = igt_sysfs_write(fd, "i915_force_hdcp14", "0", 2);
 	igt_require_f(ret > 0, "i915_force_hdcp14 is not disabled\n");
@@ -747,7 +747,7 @@ static int get_hdcp_outputs(igt_display_t *display, int content_type,
 
 		if (is_output_hdcp_test_exempt(output)) {
 			igt_info("Skipping HDCP test on %s, as the panel is blocklisted\n",
-				 output->name);
+				 igt_output_name(output));
 			continue;
 		}
 
@@ -796,7 +796,7 @@ test_content_protection(enum igt_commit_style commit_style, int content_type)
 				set_i915_force_hdcp14(output);
 
 			igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc),
-				      output->name)
+				      igt_output_name(output))
 				test_content_protection_on_output(output,
 								  crtc,
 								  commit_style,
@@ -935,7 +935,7 @@ test_content_protection_mst(int content_type)
 			}
 		}
 
-		igt_assert_f(pipe_found, "No valid pipe found for %s\n", output->name);
+		igt_assert_f(pipe_found, "No valid pipe found for %s\n", igt_output_name(output));
 
 		igt_output_set_crtc(output, crtc);
 		prepare_modeset_on_mst_output(output, false);
@@ -1012,7 +1012,7 @@ static void test_content_protection_cleanup(void)
 		if (val == CP_UNDESIRED)
 			continue;
 
-		igt_info("CP Prop being UNDESIRED on %s\n", output->name);
+		igt_info("CP Prop being UNDESIRED on %s\n", igt_output_name(output));
 		test_cp_disable(output, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	}
 

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH i-g-t 2/4] lib/unigraf: Add HDCP management
  2026-07-31 18:21 [PATCH i-g-t 0/4] Add HDCP support for unigraf Louis Chauvet
  2026-07-31 18:21 ` [PATCH i-g-t 1/4] tests/kms_content_protection: Avoid using internal pointers Louis Chauvet
@ 2026-07-31 18:21 ` Louis Chauvet
  2026-07-31 18:23   ` Louis Chauvet
  2026-07-31 18:21 ` [PATCH i-g-t 3/4] tests/kms_content_protection: Enable HDCP for unigraf if available Louis Chauvet
  2026-07-31 18:21 ` [PATCH i-g-t 4/4] tests/kms_content_protection: Add test to ensure HDCP is properly detected by the DUT Louis Chauvet
  3 siblings, 1 reply; 6+ messages in thread
From: Louis Chauvet @ 2026-07-31 18:21 UTC (permalink / raw)
  To: igt-dev; +Cc: markyacoub, thomas.petazzoni, Louis Chauvet, fomys

From: fomys <fomys@google.com>

Unigraf is able to emulate HDCP, so add few helpers to enable/disable
it.

Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
 lib/vendor/unigraf/unigraf.c | 23 ++++++++++++++++++++++-
 lib/vendor/unigraf/unigraf.h |  4 ++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/lib/vendor/unigraf/unigraf.c b/lib/vendor/unigraf/unigraf.c
index 30ee3c72bc74..5b416f605428 100644
--- a/lib/vendor/unigraf/unigraf.c
+++ b/lib/vendor/unigraf/unigraf.c
@@ -549,9 +549,10 @@ void unigraf_reset(void)
 	unigraf_set_mst_stream_count(1);
 	unigraf_set_sst();
 	unigraf_load_default_edid();
-	unigraf_hpd_assert();
 	unigraf_set_max_lane_count(4);
 	unigraf_set_max_link_rate(UNIGRAF_RATE_8_10_GHZ);
+	unigraf_enable_hdcp();
+	unigraf_hpd_assert();
 }
 
 /**
@@ -911,3 +912,23 @@ int unigraf_rate_to_kbs(enum unigraf_rate rate)
 		return 0;
 	}
 }
+
+/**
+ * unigraf_enable_hdcp - Enable HDCP 2 support
+ *
+ * Unigraf is able to load production keys, but this will disable all recording
+ * features.
+ */
+void unigraf_enable_hdcp(void)
+{
+	unigraf_write_u32(TSI_HDCP_2X_COMMAND_W, H2_SINK_LOAD_PROD_KEYS);
+	unigraf_write_u32(TSI_HDCP_2X_COMMAND_W, H2_SINK_SET_CAPABLE);
+}
+
+/**
+ * unigraf_disable_hdcp - Disable HDCP support
+ */
+void unigraf_disable_hdcp(void)
+{
+	unigraf_write_u32(TSI_HDCP_2X_COMMAND_W, H2_SINK_CLEAR_CAPABLE);
+}
diff --git a/lib/vendor/unigraf/unigraf.h b/lib/vendor/unigraf/unigraf.h
index 1570be3feb96..498a2d4daab3 100644
--- a/lib/vendor/unigraf/unigraf.h
+++ b/lib/vendor/unigraf/unigraf.h
@@ -103,4 +103,8 @@ uint32_t unigraf_get_lt_rate(void);
 
 uint32_t unigraf_get_lt_lane_count(void);
 
+void unigraf_enable_hdcp(void);
+
+void unigraf_disable_hdcp(void);
+
 #endif // UNIGRAF_H

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH i-g-t 3/4] tests/kms_content_protection: Enable HDCP for unigraf if available
  2026-07-31 18:21 [PATCH i-g-t 0/4] Add HDCP support for unigraf Louis Chauvet
  2026-07-31 18:21 ` [PATCH i-g-t 1/4] tests/kms_content_protection: Avoid using internal pointers Louis Chauvet
  2026-07-31 18:21 ` [PATCH i-g-t 2/4] lib/unigraf: Add HDCP management Louis Chauvet
@ 2026-07-31 18:21 ` Louis Chauvet
  2026-07-31 18:21 ` [PATCH i-g-t 4/4] tests/kms_content_protection: Add test to ensure HDCP is properly detected by the DUT Louis Chauvet
  3 siblings, 0 replies; 6+ messages in thread
From: Louis Chauvet @ 2026-07-31 18:21 UTC (permalink / raw)
  To: igt-dev; +Cc: markyacoub, thomas.petazzoni, Louis Chauvet

As unigraf can be automatically connected and can emulate HDCP 2.2 sink,
enable it.

Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
 tests/kms_content_protection.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 133060af3c0a..680204981f58 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -42,6 +42,9 @@
 #include "igt_kmod.h"
 #include "igt_panel.h"
 
+#ifdef HAVE_UNIGRAF
+#include "unigraf/unigraf.h"
+#endif
 /**
  * SUBTEST: lic-type-0
  * Description: Test for the integrity of link for type-0 content.
@@ -769,6 +772,11 @@ test_content_protection(enum igt_commit_style commit_style, int content_type)
 	int hdcp_panel_count;
 	int i;
 
+#ifdef HAVE_UNIGRAF
+	if (content_type == HDCP_CONTENT_TYPE_1 && unigraf_open_device(data.drm_fd))
+		unigraf_enable_hdcp();
+#endif
+
 	if (data.cp_tests & CP_MEI_RELOAD)
 		igt_require_f(igt_kmod_is_loaded("mei_hdcp"),
 			      "mei_hdcp module is not loaded\n");

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH i-g-t 4/4] tests/kms_content_protection: Add test to ensure HDCP is properly detected by the DUT
  2026-07-31 18:21 [PATCH i-g-t 0/4] Add HDCP support for unigraf Louis Chauvet
                   ` (2 preceding siblings ...)
  2026-07-31 18:21 ` [PATCH i-g-t 3/4] tests/kms_content_protection: Enable HDCP for unigraf if available Louis Chauvet
@ 2026-07-31 18:21 ` Louis Chauvet
  3 siblings, 0 replies; 6+ messages in thread
From: Louis Chauvet @ 2026-07-31 18:21 UTC (permalink / raw)
  To: igt-dev; +Cc: markyacoub, thomas.petazzoni, Louis Chauvet

Add a tests that ensure that the DUT properly detect an HDCP 2.2 sink.

Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
 tests/kms_content_protection.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 680204981f58..30311f93a959 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -35,6 +35,7 @@
 #include <sys/epoll.h>
 #include <sys/stat.h>
 #include <libudev.h>
+#include <xf86drmMode.h>
 #include "igt.h"
 #include "igt_edid.h"
 #include "igt_sysfs.h"
@@ -89,7 +90,7 @@
  * @legacy-hdcp14:  Test HDCP1.4 content protection with legacy style commit.
  * @atomic-hdcp14:  Test HDCP1.4 content protection with atomic modesetting.
  * @atomic-dpms-hdcp14: Test HDCP1.4 content protection with atomic modesetting and DPMS.
- *
+ * @detection:      content type 1 that can be handled only through HDCP2.2.
  */
 
 /**
@@ -1271,6 +1272,25 @@ int igt_main()
 		}
 	}
 
+#if HAVE_UNIGRAF
+	igt_describe("Check if the HDCP connection is properly detected by the driver");
+	igt_subtest("detection") {
+		drmModeConnectorPtr connector;
+		igt_output_t *output;
+
+		unigraf_require_device(data.drm_fd);
+		connector = unigraf_get_connector(data.drm_fd);
+		output = igt_output_from_connector(&data.display, connector);
+		igt_assert(output);
+
+		unigraf_disable_hdcp();
+		igt_assert(!sink_hdcp2_capable(output));
+		unigraf_enable_hdcp();
+		sleep(igt_default_display_detect_timeout());
+		igt_assert(sink_hdcp2_capable(output));
+	}
+#endif
+
 	igt_fixture() {
 		test_content_protection_cleanup();
 		igt_display_fini(&data.display);

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH i-g-t 2/4] lib/unigraf: Add HDCP management
  2026-07-31 18:21 ` [PATCH i-g-t 2/4] lib/unigraf: Add HDCP management Louis Chauvet
@ 2026-07-31 18:23   ` Louis Chauvet
  0 siblings, 0 replies; 6+ messages in thread
From: Louis Chauvet @ 2026-07-31 18:23 UTC (permalink / raw)
  To: igt-dev; +Cc: markyacoub, thomas.petazzoni, fomys



On 7/31/26 20:21, Louis Chauvet wrote:
> From: fomys <fomys@google.com>

Tiny mistake on this patch, that indeed me. I will fix it for v2.

> Unigraf is able to emulate HDCP, so add few helpers to enable/disable
> it.
> 
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
>   lib/vendor/unigraf/unigraf.c | 23 ++++++++++++++++++++++-
>   lib/vendor/unigraf/unigraf.h |  4 ++++
>   2 files changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/vendor/unigraf/unigraf.c b/lib/vendor/unigraf/unigraf.c
> index 30ee3c72bc74..5b416f605428 100644
> --- a/lib/vendor/unigraf/unigraf.c
> +++ b/lib/vendor/unigraf/unigraf.c
> @@ -549,9 +549,10 @@ void unigraf_reset(void)
>   	unigraf_set_mst_stream_count(1);
>   	unigraf_set_sst();
>   	unigraf_load_default_edid();
> -	unigraf_hpd_assert();
>   	unigraf_set_max_lane_count(4);
>   	unigraf_set_max_link_rate(UNIGRAF_RATE_8_10_GHZ);
> +	unigraf_enable_hdcp();
> +	unigraf_hpd_assert();
>   }
>   
>   /**
> @@ -911,3 +912,23 @@ int unigraf_rate_to_kbs(enum unigraf_rate rate)
>   		return 0;
>   	}
>   }
> +
> +/**
> + * unigraf_enable_hdcp - Enable HDCP 2 support
> + *
> + * Unigraf is able to load production keys, but this will disable all recording
> + * features.
> + */
> +void unigraf_enable_hdcp(void)
> +{
> +	unigraf_write_u32(TSI_HDCP_2X_COMMAND_W, H2_SINK_LOAD_PROD_KEYS);
> +	unigraf_write_u32(TSI_HDCP_2X_COMMAND_W, H2_SINK_SET_CAPABLE);
> +}
> +
> +/**
> + * unigraf_disable_hdcp - Disable HDCP support
> + */
> +void unigraf_disable_hdcp(void)
> +{
> +	unigraf_write_u32(TSI_HDCP_2X_COMMAND_W, H2_SINK_CLEAR_CAPABLE);
> +}
> diff --git a/lib/vendor/unigraf/unigraf.h b/lib/vendor/unigraf/unigraf.h
> index 1570be3feb96..498a2d4daab3 100644
> --- a/lib/vendor/unigraf/unigraf.h
> +++ b/lib/vendor/unigraf/unigraf.h
> @@ -103,4 +103,8 @@ uint32_t unigraf_get_lt_rate(void);
>   
>   uint32_t unigraf_get_lt_lane_count(void);
>   
> +void unigraf_enable_hdcp(void);
> +
> +void unigraf_disable_hdcp(void);
> +
>   #endif // UNIGRAF_H
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-31 18:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 18:21 [PATCH i-g-t 0/4] Add HDCP support for unigraf Louis Chauvet
2026-07-31 18:21 ` [PATCH i-g-t 1/4] tests/kms_content_protection: Avoid using internal pointers Louis Chauvet
2026-07-31 18:21 ` [PATCH i-g-t 2/4] lib/unigraf: Add HDCP management Louis Chauvet
2026-07-31 18:23   ` Louis Chauvet
2026-07-31 18:21 ` [PATCH i-g-t 3/4] tests/kms_content_protection: Enable HDCP for unigraf if available Louis Chauvet
2026-07-31 18:21 ` [PATCH i-g-t 4/4] tests/kms_content_protection: Add test to ensure HDCP is properly detected by the DUT Louis Chauvet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox