[PATCH i-g-t 4/4] tests/kms_content_protection: Add test to ensure HDCP is properly detected by the DUT

Louis Chauvet <[email protected]> Fri, 31 Jul 2026 20:21:57 +0200
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
Add a tests that ensure that the DUT properly detect an HDCP 2.2 sink.

Signed-off-by: Louis Chauvet <[email protected]>
---
 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