[i-g-t,2/3] kms_content_protection: Test CP along with modeset

Submitted by Ramalingam C on Feb. 7, 2019, 4:23 p.m.

Details

Message ID 1549556602-27228-2-git-send-email-ramalingam.c@intel.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Ramalingam C Feb. 7, 2019, 4:23 p.m.
As we have two different patch for commitng the HDCP request
	1. DDI_enable (during the modeset)
	2. update_pipe (during fastset execution)

Currently our kms_content_protection covers only fastset path.
So this test adds the coverage for the HDCP during the modeset by
performing DPMS off-on and check for HDCP status.

But with respect to HDCP we allow few retries from userspace before
reporting the failure. So only first attempt at kernel will be on
modeset path, next retries will become fastset commiting of HDCP.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 tests/kms_content_protection.c | 79 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index f6b441d891e5..895e9e8d8b11 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -306,6 +306,80 @@  test_content_protection(enum igt_commit_style s)
 	igt_require_f(valid_tests, "No connector found with HDCP capability\n");
 }
 
+static void test_cp_dpms_on_output(igt_output_t *output,
+				   enum igt_commit_style s)
+{
+	igt_display_t *display = &data.display;
+	igt_plane_t *primary;
+	enum pipe pipe;
+	bool ret;
+
+	for_each_pipe(display, pipe) {
+		if (!igt_pipe_connector_valid(pipe, output))
+			continue;
+
+		/*
+		 * If previous subtest of connector failed, pipe
+		 * attached to that connector is not released.
+		 * Because of that we have to choose the non
+		 * attached pipe for this subtest.
+		 */
+		if (!igt_pipe_is_free(display, pipe))
+			continue;
+
+		modeset_with_fb(pipe, output, s);
+		test_cp_enable_with_retry(output, s, 3);
+
+		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 0);
+		igt_display_commit2(display, s);
+
+		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 1);
+		igt_display_commit2(display, s);
+
+		ret = wait_for_prop_value(output, 2, 18000);
+		if (!ret)
+			test_cp_enable_with_retry(output, s, 2);
+
+		test_cp_disable(output, s);
+
+		primary = igt_output_get_plane_type(output,
+						    DRM_PLANE_TYPE_PRIMARY);
+		igt_plane_set_fb(primary, NULL);
+		igt_output_set_pipe(output, PIPE_NONE);
+
+		/*
+		 * Testing a output with a pipe is enough for HDCP
+		 * testing. No ROI in testing the connector with other
+		 * pipes. So Break the loop on pipe.
+		 */
+		break;
+	}
+}
+
+static void test_cp_dpms(enum igt_commit_style s)
+{
+	igt_display_t *display = &data.display;
+	igt_output_t *output;
+	int valid_tests = 0;
+
+	for_each_connected_output(display, output) {
+		if (!output->props[IGT_CONNECTOR_CONTENT_PROTECTION])
+			continue;
+
+		igt_info("CP Test execution on %s\n", output->name);
+		if (!sink_hdcp_capable(output)) {
+			igt_info("\tSkip %s (Sink has no HDCP support)\n",
+				 output->name);
+			continue;
+		}
+
+		test_cp_dpms_on_output(output, s);
+		valid_tests++;
+	}
+
+	igt_require_f(valid_tests, "No connector found with HDCP capability\n");
+}
+
 igt_main
 {
 	igt_fixture {
@@ -324,6 +398,11 @@  igt_main
 		test_content_protection(COMMIT_ATOMIC);
 	}
 
+	igt_subtest("atomic-dpms") {
+		igt_require(data.display.is_atomic);
+		test_cp_dpms(COMMIT_ATOMIC);
+	}
+
 	igt_fixture
 		igt_display_fini(&data.display);
 }

Comments

Daniel Vetter Feb. 7, 2019, 5:03 p.m.
On Thu, Feb 07, 2019 at 09:53:21PM +0530, Ramalingam C wrote:
> As we have two different patch for commitng the HDCP request
> 	1. DDI_enable (during the modeset)
> 	2. update_pipe (during fastset execution)
> 
> Currently our kms_content_protection covers only fastset path.
> So this test adds the coverage for the HDCP during the modeset by
> performing DPMS off-on and check for HDCP status.
> 
> But with respect to HDCP we allow few retries from userspace before
> reporting the failure. So only first attempt at kernel will be on
> modeset path, next retries will become fastset commiting of HDCP.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  tests/kms_content_protection.c | 79 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 79 insertions(+)
> 
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index f6b441d891e5..895e9e8d8b11 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -306,6 +306,80 @@ test_content_protection(enum igt_commit_style s)
>  	igt_require_f(valid_tests, "No connector found with HDCP capability\n");
>  }
>  
> +static void test_cp_dpms_on_output(igt_output_t *output,
> +				   enum igt_commit_style s)
> +{
> +	igt_display_t *display = &data.display;
> +	igt_plane_t *primary;
> +	enum pipe pipe;
> +	bool ret;
> +
> +	for_each_pipe(display, pipe) {
> +		if (!igt_pipe_connector_valid(pipe, output))
> +			continue;
> +
> +		/*
> +		 * If previous subtest of connector failed, pipe
> +		 * attached to that connector is not released.
> +		 * Because of that we have to choose the non
> +		 * attached pipe for this subtest.
> +		 */
> +		if (!igt_pipe_is_free(display, pipe))
> +			continue;
> +
> +		modeset_with_fb(pipe, output, s);
> +		test_cp_enable_with_retry(output, s, 3);
> +
> +		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 0);
> +		igt_display_commit2(display, s);
> +
> +		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 1);
> +		igt_display_commit2(display, s);
> +
> +		ret = wait_for_prop_value(output, 2, 18000);
> +		if (!ret)
> +			test_cp_enable_with_retry(output, s, 2);
> +
> +		test_cp_disable(output, s);
> +
> +		primary = igt_output_get_plane_type(output,
> +						    DRM_PLANE_TYPE_PRIMARY);
> +		igt_plane_set_fb(primary, NULL);
> +		igt_output_set_pipe(output, PIPE_NONE);
> +
> +		/*
> +		 * Testing a output with a pipe is enough for HDCP
> +		 * testing. No ROI in testing the connector with other
> +		 * pipes. So Break the loop on pipe.
> +		 */
> +		break;
> +	}
> +}
> +
> +static void test_cp_dpms(enum igt_commit_style s)
> +{
> +	igt_display_t *display = &data.display;
> +	igt_output_t *output;
> +	int valid_tests = 0;
> +
> +	for_each_connected_output(display, output) {
> +		if (!output->props[IGT_CONNECTOR_CONTENT_PROTECTION])
> +			continue;
> +
> +		igt_info("CP Test execution on %s\n", output->name);
> +		if (!sink_hdcp_capable(output)) {
> +			igt_info("\tSkip %s (Sink has no HDCP support)\n",
> +				 output->name);
> +			continue;
> +		}
> +
> +		test_cp_dpms_on_output(output, s);
> +		valid_tests++;
> +	}
> +
> +	igt_require_f(valid_tests, "No connector found with HDCP capability\n");
> +}
> +
>  igt_main
>  {
>  	igt_fixture {
> @@ -324,6 +398,11 @@ igt_main
>  		test_content_protection(COMMIT_ATOMIC);
>  	}
>  
> +	igt_subtest("atomic-dpms") {
> +		igt_require(data.display.is_atomic);
> +		test_cp_dpms(COMMIT_ATOMIC);

Hm instead of duplicating a bunch of things I'd add a new flag paramater
to test_content_protection (0 for all existing tests), so that we can
reuse the code with the same flow, and only do the dpms when a TEST_DPMS
flag is set.
-Daniel

> +	}
> +
>  	igt_fixture
>  		igt_display_fini(&data.display);
>  }
> -- 
> 2.7.4
>
Ramalingam C Feb. 7, 2019, 6:58 p.m.
On 2/7/2019 10:33 PM, Daniel Vetter wrote:
> On Thu, Feb 07, 2019 at 09:53:21PM +0530, Ramalingam C wrote:
>> As we have two different patch for commitng the HDCP request
>> 	1. DDI_enable (during the modeset)
>> 	2. update_pipe (during fastset execution)
>>
>> Currently our kms_content_protection covers only fastset path.
>> So this test adds the coverage for the HDCP during the modeset by
>> performing DPMS off-on and check for HDCP status.
>>
>> But with respect to HDCP we allow few retries from userspace before
>> reporting the failure. So only first attempt at kernel will be on
>> modeset path, next retries will become fastset commiting of HDCP.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   tests/kms_content_protection.c | 79 ++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 79 insertions(+)
>>
>> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
>> index f6b441d891e5..895e9e8d8b11 100644
>> --- a/tests/kms_content_protection.c
>> +++ b/tests/kms_content_protection.c
>> @@ -306,6 +306,80 @@ test_content_protection(enum igt_commit_style s)
>>   	igt_require_f(valid_tests, "No connector found with HDCP capability\n");
>>   }
>>   
>> +static void test_cp_dpms_on_output(igt_output_t *output,
>> +				   enum igt_commit_style s)
>> +{
>> +	igt_display_t *display = &data.display;
>> +	igt_plane_t *primary;
>> +	enum pipe pipe;
>> +	bool ret;
>> +
>> +	for_each_pipe(display, pipe) {
>> +		if (!igt_pipe_connector_valid(pipe, output))
>> +			continue;
>> +
>> +		/*
>> +		 * If previous subtest of connector failed, pipe
>> +		 * attached to that connector is not released.
>> +		 * Because of that we have to choose the non
>> +		 * attached pipe for this subtest.
>> +		 */
>> +		if (!igt_pipe_is_free(display, pipe))
>> +			continue;
>> +
>> +		modeset_with_fb(pipe, output, s);
>> +		test_cp_enable_with_retry(output, s, 3);
>> +
>> +		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 0);
>> +		igt_display_commit2(display, s);
>> +
>> +		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_ACTIVE, 1);
>> +		igt_display_commit2(display, s);
>> +
>> +		ret = wait_for_prop_value(output, 2, 18000);
>> +		if (!ret)
>> +			test_cp_enable_with_retry(output, s, 2);
>> +
>> +		test_cp_disable(output, s);
>> +
>> +		primary = igt_output_get_plane_type(output,
>> +						    DRM_PLANE_TYPE_PRIMARY);
>> +		igt_plane_set_fb(primary, NULL);
>> +		igt_output_set_pipe(output, PIPE_NONE);
>> +
>> +		/*
>> +		 * Testing a output with a pipe is enough for HDCP
>> +		 * testing. No ROI in testing the connector with other
>> +		 * pipes. So Break the loop on pipe.
>> +		 */
>> +		break;
>> +	}
>> +}
>> +
>> +static void test_cp_dpms(enum igt_commit_style s)
>> +{
>> +	igt_display_t *display = &data.display;
>> +	igt_output_t *output;
>> +	int valid_tests = 0;
>> +
>> +	for_each_connected_output(display, output) {
>> +		if (!output->props[IGT_CONNECTOR_CONTENT_PROTECTION])
>> +			continue;
>> +
>> +		igt_info("CP Test execution on %s\n", output->name);
>> +		if (!sink_hdcp_capable(output)) {
>> +			igt_info("\tSkip %s (Sink has no HDCP support)\n",
>> +				 output->name);
>> +			continue;
>> +		}
>> +
>> +		test_cp_dpms_on_output(output, s);
>> +		valid_tests++;
>> +	}
>> +
>> +	igt_require_f(valid_tests, "No connector found with HDCP capability\n");
>> +}
>> +
>>   igt_main
>>   {
>>   	igt_fixture {
>> @@ -324,6 +398,11 @@ igt_main
>>   		test_content_protection(COMMIT_ATOMIC);
>>   	}
>>   
>> +	igt_subtest("atomic-dpms") {
>> +		igt_require(data.display.is_atomic);
>> +		test_cp_dpms(COMMIT_ATOMIC);
> Hm instead of duplicating a bunch of things I'd add a new flag paramater
> to test_content_protection (0 for all existing tests), so that we can
> reuse the code with the same flow, and only do the dpms when a TEST_DPMS
> flag is set.
Ok. sounds good idea. I will do that.

-Ram
> -Daniel
>
>> +	}
>> +
>>   	igt_fixture
>>   		igt_display_fini(&data.display);
>>   }
>> -- 
>> 2.7.4
>>