public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Ramalingam C <ramalingam.c@intel.com>
Cc: igt-dev@lists.freedesktop.org, daniel@ffwll.ch
Subject: Re: [igt-dev] [PATCH i-g-t 1/3] kms_content_protection: modularizing the CP test steps
Date: Thu, 7 Feb 2019 18:02:35 +0100	[thread overview]
Message-ID: <20190207170235.GY3271@phenom.ffwll.local> (raw)
In-Reply-To: <1549556602-27228-1-git-send-email-ramalingam.c@intel.com>

On Thu, Feb 07, 2019 at 09:53:20PM +0530, Ramalingam C wrote:
> Modularizing the CP test steps for the convenience of reusing it for
> other subtests.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>

lgtm, Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  tests/kms_content_protection.c | 99 +++++++++++++++++++++++++-----------------
>  1 file changed, 60 insertions(+), 39 deletions(-)
> 
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index 50ae82862949..f6b441d891e5 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -33,6 +33,7 @@ IGT_TEST_DESCRIPTION("Test content protection (HDCP)");
>  struct data {
>  	int drm_fd;
>  	igt_display_t display;
> +	struct igt_fb red, green;
>  } data;
>  
>  
> @@ -116,16 +117,12 @@ commit_display_and_wait_for_flip(enum igt_commit_style s)
>  	}
>  }
>  
> -static void
> -test_cp_enable_disable(const enum pipe pipe, igt_output_t *output,
> -		       enum igt_commit_style s)
> +static void modeset_with_fb(const enum pipe pipe, igt_output_t *output,
> +			    enum igt_commit_style s)
>  {
>  	igt_display_t *display = &data.display;
>  	drmModeModeInfo mode;
>  	igt_plane_t *primary;
> -	struct igt_fb red, green;
> -	bool ret;
> -	int retry = 3;
>  
>  	igt_assert(kmstest_get_connector_default_mode(
>  			display->drm_fd, output->config.connector, &mode));
> @@ -135,58 +132,75 @@ test_cp_enable_disable(const enum pipe pipe, igt_output_t *output,
>  
>  	igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay,
>  			    DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
> -			    1.f, 0.f, 0.f, &red);
> +			    1.f, 0.f, 0.f, &data.red);
>  	igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay,
>  			    DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
> -			    0.f, 1.f, 0.f, &green);
> +			    0.f, 1.f, 0.f, &data.green);
>  
>  	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>  	igt_display_commit2(display, s);
> -
> -	igt_plane_set_fb(primary, &red);
> +	igt_plane_set_fb(primary, &data.red);
>  
>  	/* Wait for Flip completion before starting the HDCP authentication */
>  	commit_display_and_wait_for_flip(s);
> +}
>  
> -	do {
> -		igt_output_set_prop_value(output,
> -					  IGT_CONNECTOR_CONTENT_PROTECTION, 0);
> -		igt_display_commit2(display, s);
> +static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s)
> +{
> +	igt_display_t *display = &data.display;
> +	igt_plane_t *primary;
> +	bool ret;
> +
> +	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>  
> -		/* Wait for HDCP to be disabled for fresh start. */
> -		ret = wait_for_prop_value(output, 0, 1000);
> -		igt_assert_f(ret, "Content Protection not cleared\n");
> +	igt_output_set_prop_value(output,
> +				  IGT_CONNECTOR_CONTENT_PROTECTION, 1);
> +	igt_display_commit2(display, s);
>  
> -		igt_output_set_prop_value(output,
> -					  IGT_CONNECTOR_CONTENT_PROTECTION, 1);
> +	/* Wait for 18000mSec (3 authentication * 6Sec) */
> +	ret = wait_for_prop_value(output, 2, 18000);
> +	if (ret) {
> +		igt_plane_set_fb(primary, &data.green);
>  		igt_display_commit2(display, s);
> +	}
>  
> -		/* Wait for 18000mSec (3 authentication * 6Sec) */
> -		ret = wait_for_prop_value(output, 2, 18000);
> -		if (ret) {
> -			igt_plane_set_fb(primary, &green);
> -			igt_display_commit2(display, s);
> -		}
> +	return ret;
> +}
>  
> -		if (!ret && --retry)
> -			igt_debug("Retry (%d/2) ...\n", 3 - retry);
> -	} while (retry && !ret);
> +static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
> +{
> +	igt_display_t *display = &data.display;
> +	igt_plane_t *primary;
> +	bool ret;
> +
> +	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>  
>  	/*
>  	 * Even on HDCP enable failed scenario, IGT should exit leaving the
>  	 * "content protection" at "UNDESIRED".
>  	 */
>  	igt_output_set_prop_value(output, IGT_CONNECTOR_CONTENT_PROTECTION, 0);
> -	igt_plane_set_fb(primary, &red);
> +	igt_plane_set_fb(primary, &data.red);
>  	igt_display_commit2(display, s);
>  
> -	igt_assert_f(ret, "Content Protection not enabled\n");
> -
>  	/* Wait for HDCP to be disabled, before crtc off */
> -	wait_for_prop_value(output, 0, 1000);
> +	ret = wait_for_prop_value(output, 0, 1000);
> +	igt_assert_f(ret, "Content Protection not cleared\n");
> +}
> +
> +static void test_cp_enable_with_retry(igt_output_t *output,
> +				      enum igt_commit_style s, int retry)
> +{
> +	bool ret;
>  
> -	igt_plane_set_fb(primary, NULL);
> -	igt_output_set_pipe(output, PIPE_NONE);
> +	do {
> +		test_cp_disable(output, s);
> +		ret = test_cp_enable(output, s);
> +
> +		if (!ret && --retry)
> +			igt_debug("Retry (%d/2) ...\n", 3 - retry);
> +	} while (retry && !ret);
> +	igt_assert_f(ret, "Content Protection not enabled\n");
>  }
>  
>  static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
> @@ -200,11 +214,12 @@ static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
>  	return true;
>  }
>  
> -static void
> -test_content_protection_on_output(igt_output_t *output,
> -				  enum igt_commit_style s)
> +
> +static void test_content_protection_on_output(igt_output_t *output,
> +					      enum igt_commit_style s)
>  {
>  	igt_display_t *display = &data.display;
> +	igt_plane_t *primary;
>  	enum pipe pipe;
>  
>  	for_each_pipe(display, pipe) {
> @@ -220,7 +235,14 @@ test_content_protection_on_output(igt_output_t *output,
>  		if (!igt_pipe_is_free(display, pipe))
>  			continue;
>  
> -		test_cp_enable_disable(pipe, output, s);
> +		modeset_with_fb(pipe, output, s);
> +		test_cp_enable_with_retry(output, s, 3);
> +		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
> @@ -229,7 +251,6 @@ test_content_protection_on_output(igt_output_t *output,
>  		 */
>  		break;
>  	}
> -
>  }
>  
>  static void __debugfs_read(int fd, const char *param, char *buf, int len)
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-02-07 17:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 16:23 [igt-dev] [PATCH i-g-t 1/3] kms_content_protection: modularizing the CP test steps Ramalingam C
2019-02-07 16:23 ` [igt-dev] [PATCH i-g-t 2/3] kms_content_protection: Test CP along with modeset Ramalingam C
2019-02-07 17:03   ` Daniel Vetter
2019-02-07 18:58     ` C, Ramalingam
2019-02-07 16:23 ` [igt-dev] [PATCH i-g-t 3/3] kms_content_protection: Confirm that LIC is passed Ramalingam C
2019-02-07 17:06   ` Daniel Vetter
2019-02-07 19:02     ` C, Ramalingam
2019-02-07 17:02 ` Daniel Vetter [this message]
2019-02-07 17:08 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] kms_content_protection: modularizing the CP test steps Patchwork
2019-02-07 18:04 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-02-07 19:31 [igt-dev] [PATCH i-g-t 1/3] " Ramalingam C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190207170235.GY3271@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=ramalingam.c@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox