[PATCH i-g-t v1] tests/kms_content_protection: Add force HDCP 1.4 subtest

Kandpal, Suraj suraj.kandpal at intel.com
Mon Apr 28 04:08:09 UTC 2025



> -----Original Message-----
> From: Reddy Guddati, Santhosh <santhosh.reddy.guddati at intel.com>
> Sent: Wednesday, April 23, 2025 3:51 PM
> To: igt-dev at lists.freedesktop.org
> Cc: B S, Karthik <karthik.b.s at intel.com>; Thasleem, Mohammed
> <mohammed.thasleem at intel.com>; Kandpal, Suraj <suraj.kandpal at intel.com>;
> Reddy Guddati, Santhosh <santhosh.reddy.guddati at intel.com>
> Subject: [PATCH i-g-t v1] tests/kms_content_protection: Add force HDCP 1.4
> subtest
> 
> 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.
> 

I think having just one test was not why this debug fs entry was added.
We need to have a whole suite of tests of the top of my mind these are some.
Legacy-hdcp14
Atomic-hdcp14
Dpmst-hdcp14
This patch should be a part of the series that adds these tests

> Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
> ---
>  tests/kms_content_protection.c | 62 ++++++++++++++++++++++++++++++++++
>  1 file changed, 62 insertions(+)
> 
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index 6fe1edbc4..aea842bdf 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -63,6 +63,9 @@
>   * Description: Test to detect the HDCP status change when we are reading the
>   *              uevent sent with the corresponding connector id and property id.
>   *
> + * SUBTEST: force-hdcp14
> + * Description: Test to force hdcp1.4 on the connector and verify content
> protection.
> + *
>   * SUBTEST: %s
>   * Description: Test content protection with %arg[1]
>   *
> @@ -102,6 +105,7 @@ struct data {
>  #define CP_MEI_RELOAD				(1 << 2)
>  #define CP_TYPE_CHANGE				(1 << 3)
>  #define CP_UEVENT				(1 << 4)
> +#define CP_FORCE14				(1 << 5)
> 
>  #define CP_UNDESIRED				0
>  #define CP_DESIRED				1
> @@ -565,6 +569,51 @@ static bool output_hdcp_capable(igt_output_t *output,
> int content_type)
>  		return true;
>  }
> 
> +static void enable_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("force_hdcp14 not supported\n");
> +		close(fd);
> +		return;
> +	}
> +
> +	ret = igt_sysfs_write(fd, "i915_force_hdcp14", "1", 2);
> +	igt_require_f(ret > 0, "force hdcp is not enabled\n");
> +
> +	ret = igt_debugfs_simple_read(fd, "i915_force_hdcp14", buf,
> sizeof(buf));
> +	igt_assert_f(ret > 0 && strstr(buf, "yes"),
> +			 "force_hdcp14 is not set to 'yes' on %s debugfs\n",

 Shouldn't this be i915_force_hdcp14
Maybe set_i915_force_hdcp14
And reset_i915_force_hdcp14
Instead of enable and disable

Regards,
Suraj Kandpal

> +			 output->name);
> +
> +	close(fd);
> +}
> +
> +static void disable_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, "force hdcp 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,9 +656,15 @@ test_content_protection(enum igt_commit_style
> commit_style, int content_type)
>  			if (!output_hdcp_capable(output, content_type))
>  				continue;
> 
> +			if (data.cp_tests & CP_FORCE14)
> +				enable_force_hdcp14(output);
> +
>  			igt_dynamic_f("pipe-%s-%s",
> kmstest_pipe_name(pipe), output->name)
>  				test_content_protection_on_output(output,
> pipe, commit_style, content_type);
> 
> +			if (data.cp_tests & CP_FORCE14)
> +				disable_force_hdcp14(output);
> +
>  			test_fini(output, commit_style);
>  			/*
>  			 * Testing a output with a pipe is enough for HDCP @@
> -830,6 +885,8 @@ static void create_fbs(void)
>  			    0.f, 1.f, 0.f, &data.green);
>  }
> 
> +
> +
>  static const struct {
>  	const char *desc;
>  	const char *name;
> @@ -893,6 +950,11 @@ static const struct {
>  	  .cp_tests = 0,
>  	  .content_type = HDCP_CONTENT_TYPE_0,
>  	},
> +	{ .desc = "This test forces hdcp1.4 and tests the content protection.",
> +	  .name = "force-hdcp14",
> +	  .cp_tests = CP_FORCE14,
> +	  .content_type = HDCP_CONTENT_TYPE_0,
> +	},
>  };
> 
>  static const struct {
> --
> 2.34.1



More information about the igt-dev mailing list