All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Sean Paul <seanpaul@chromium.org>
Cc: intel-gfx@lists.freedesktop.org, seanpaul@google.com
Subject: Re: [PATCH i-g-t 2/2] kms_content_protection: Add Content Protection test
Date: Tue, 5 Dec 2017 18:07:11 +0200	[thread overview]
Message-ID: <20171205160711.GW10981@intel.com> (raw)
In-Reply-To: <20171205052333.10035-2-seanpaul@chromium.org>

On Tue, Dec 05, 2017 at 12:23:33AM -0500, Sean Paul wrote:
> Pretty simple test:
> - initializes the output
> - clears the content protection property
> - verifies that it clears
> - sets the content protection property to desired
> - verifies that it transitions to enabled

Can we get a chamelium based test that actually verfifies
that the other end can correctly decrypt the data?

> 
> Does this for both legacy and atomic.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  lib/igt_kms.c                  |   3 +-
>  lib/igt_kms.h                  |   1 +
>  tests/Makefile.sources         |   1 +
>  tests/kms_content_protection.c | 128 +++++++++++++++++++++++++++++++++++++++++
>  tests/meson.build              |   1 +
>  5 files changed, 133 insertions(+), 1 deletion(-)
>  create mode 100644 tests/kms_content_protection.c
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 125ecb19..907db694 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -190,7 +190,8 @@ const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
>  	"scaling mode",
>  	"CRTC_ID",
>  	"DPMS",
> -	"Broadcast RGB"
> +	"Broadcast RGB",
> +	"Content Protection"
>  };
>  
>  /*
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 2a480bf3..93e59dc7 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -118,6 +118,7 @@ enum igt_atomic_connector_properties {
>         IGT_CONNECTOR_CRTC_ID,
>         IGT_CONNECTOR_DPMS,
>         IGT_CONNECTOR_BROADCAST_RGB,
> +       IGT_CONNECTOR_CONTENT_PROTECTION,
>         IGT_NUM_CONNECTOR_PROPS
>  };
>  
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 34ca71a0..e0466411 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -179,6 +179,7 @@ TESTS_progs = \
>  	kms_chv_cursor_fail \
>  	kms_color \
>  	kms_concurrent \
> +	kms_content_protection\
>  	kms_crtc_background_color \
>  	kms_cursor_crc \
>  	kms_cursor_legacy \
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> new file mode 100644
> index 00000000..7bfe9a69
> --- /dev/null
> +++ b/tests/kms_content_protection.c
> @@ -0,0 +1,128 @@
> +/*
> + * Copyright © 2017 Google, Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + */
> +
> +#include "igt.h"
> +
> +IGT_TEST_DESCRIPTION("Test content protection (HDCP)");
> +
> +typedef struct {
> +	int drm_fd;
> +	igt_display_t display;
> +} data_t;
> +
> +static bool
> +wait_for_prop_value(igt_output_t *output, uint64_t expected)
> +{
> +	uint64_t val;
> +	int i;
> +
> +	for (i = 0; i < 2000; i++) {
> +		val = igt_output_get_prop(output,
> +					  IGT_CONNECTOR_CONTENT_PROTECTION);
> +		if (val == expected)
> +			return true;
> +		usleep(1000);
> +	}
> +	igt_info("prop_value mismatch %ld != %ld\n", val, expected);
> +	return false;
> +}
> +
> +static void
> +test_pipe_output(igt_display_t *display, const enum pipe pipe,
> +		 igt_output_t *output, enum igt_commit_style s)
> +{
> +	drmModeModeInfo mode;
> +	igt_plane_t *primary;
> +	struct igt_fb red;
> +	bool ret;
> +
> +	igt_assert(kmstest_get_connector_default_mode(
> +			display->drm_fd, output->config.connector, &mode));
> +
> +	igt_output_override_mode(output, &mode);
> +	igt_output_set_pipe(output, pipe);
> +
> +	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);
> +	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> +	igt_plane_set_fb(primary, &red);
> +	igt_display_commit2(display, s);
> +
> +	igt_output_set_prop_value(output, IGT_CONNECTOR_CONTENT_PROTECTION, 0);
> +	igt_display_commit2(display, s);
> +
> +	ret = wait_for_prop_value(output, 0);
> +	igt_require_f(ret, "Content Protection not cleared\n");
> +
> +	igt_output_set_prop_value(output, IGT_CONNECTOR_CONTENT_PROTECTION, 1);
> +	igt_display_commit2(display, s);
> +
> +	ret = wait_for_prop_value(output, 2);
> +	igt_require_f(ret, "Content Protection not enabled\n");
> +
> +	igt_plane_set_fb(primary, NULL);
> +	igt_output_set_pipe(output, PIPE_NONE);
> +}
> +
> +static void
> +test_content_protection(igt_display_t *display, enum igt_commit_style s)
> +{
> +	igt_output_t *output;
> +	enum pipe pipe;
> +
> +	for_each_pipe_with_valid_output(display, pipe, output) {
> +		if (!output->props[IGT_CONNECTOR_CONTENT_PROTECTION])
> +			continue;
> +
> +		test_pipe_output(display, pipe, output, s);
> +	}
> +}
> +
> +igt_main
> +{
> +	data_t data = {};
> +
> +	igt_fixture {
> +		igt_skip_on_simulation();
> +
> +		data.drm_fd = drm_open_driver(DRIVER_ANY);
> +
> +		igt_require(intel_gen(intel_get_drm_devid(data.drm_fd)) >= 9);
> +
> +		igt_display_init(&data.display, data.drm_fd);
> +	}
> +
> +
> +	igt_subtest("legacy")
> +		test_content_protection(&data.display, COMMIT_LEGACY);
> +
> +	igt_subtest("atomic") {
> +		igt_require(data.display.is_atomic);
> +		test_content_protection(&data.display, COMMIT_ATOMIC);
> +	}
> +
> +	igt_fixture
> +		igt_display_fini(&data.display);
> +}
> diff --git a/tests/meson.build b/tests/meson.build
> index 59ccd9a6..b12c35c0 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -157,6 +157,7 @@ test_progs = [
>  	'kms_chv_cursor_fail',
>  	'kms_color',
>  	'kms_concurrent',
> +	'kms_content_protection',
>  	'kms_crtc_background_color',
>  	'kms_cursor_crc',
>  	'kms_cursor_legacy',
> -- 
> 2.15.0.531.g2ccb3012c9-goog
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-12-05 16:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05  5:23 [PATCH i-g-t 1/2] CONTRIBUTING: Fix spelling mistake and line length Sean Paul
2017-12-05  5:23 ` [PATCH i-g-t 2/2] kms_content_protection: Add Content Protection test Sean Paul
2017-12-05  8:22   ` Petri Latvala
2017-12-05 15:48     ` Sean Paul
2017-12-05 17:18     ` Daniel Vetter
2017-12-05 16:07   ` Ville Syrjälä [this message]
2017-12-05 16:13     ` Sean Paul
2017-12-05  5:49 ` ✓ Fi.CI.BAT: success for series starting with [1/2] CONTRIBUTING: Fix spelling mistake and line length Patchwork
2017-12-05  6:35 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-12-05  8:26   ` Petri Latvala
2017-12-05  9:27     ` Petri Latvala
2017-12-05  8:19 ` [PATCH i-g-t 1/2] " Petri Latvala

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=20171205160711.GW10981@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=seanpaul@chromium.org \
    --cc=seanpaul@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.