Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
On Sat, Jan 6, 2018 at 10:52 AM, Ramalingam Cwrote: > > > On Saturday 06 January 2018 08:34 PM, Sean Paul wrote: >> >> On Sat, Jan 6, 2018 at 8:10 AM, Ramalingam C >> wrote: >>> >>> >>> On Saturday 06 January 2018 06:30 PM, Sean Paul wrote: On Sat, Jan 6, 2018 at 5:44 AM, Ramalingam C wrote: > > On Saturday 06 January 2018 12:59 AM, Sean Paul wrote: >> >> On Tue, Dec 19, 2017 at 9:28 AM, Ramalingam C >> wrote: >>> >>> Adding few more findings from the IGT usage with kernel solutions. >>> >>> >>> >>> On Wednesday 13 December 2017 04:07 PM, Ramalingam C wrote: Sean, Adding few more observations. On Thursday 07 December 2017 05:47 AM, 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 > > Does this for both legacy and atomic. > > Changes in v2: > - Don't check for i915 gen > - Skip test if Content Protection property is absent > > Signed-off-by: Sean Paul > --- > lib/igt_kms.c | 3 +- > lib/igt_kms.h | 1 + > tests/Makefile.sources | 1 + > tests/kms_content_protection.c | 129 > + > tests/meson.build | 1 + > 5 files changed, 134 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 ..5d61b257 > --- /dev/null > +++ b/tests/kms_content_protection.c > @@ -0,0 +1,129 @@ > +/* > + * 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
Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
On Saturday 06 January 2018 08:34 PM, Sean Paul wrote: On Sat, Jan 6, 2018 at 8:10 AM, Ramalingam Cwrote: On Saturday 06 January 2018 06:30 PM, Sean Paul wrote: On Sat, Jan 6, 2018 at 5:44 AM, Ramalingam C wrote: On Saturday 06 January 2018 12:59 AM, Sean Paul wrote: On Tue, Dec 19, 2017 at 9:28 AM, Ramalingam C wrote: Adding few more findings from the IGT usage with kernel solutions. On Wednesday 13 December 2017 04:07 PM, Ramalingam C wrote: Sean, Adding few more observations. On Thursday 07 December 2017 05:47 AM, 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 Does this for both legacy and atomic. Changes in v2: - Don't check for i915 gen - Skip test if Content Protection property is absent Signed-off-by: Sean Paul --- lib/igt_kms.c | 3 +- lib/igt_kms.h | 1 + tests/Makefile.sources | 1 + tests/kms_content_protection.c | 129 + tests/meson.build | 1 + 5 files changed, 134 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 ..5d61b257 --- /dev/null +++ b/tests/kms_content_protection.c @@ -0,0 +1,129 @@ +/* + * 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++) { we need 5+Sec to complete the Second part of authentication, in case of repeater with max downstream topology. So we might need to wait for 6000(6Sec) loops!? +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, )); + +
Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
On Sat, Jan 6, 2018 at 8:10 AM, Ramalingam Cwrote: > > > On Saturday 06 January 2018 06:30 PM, Sean Paul wrote: >> >> On Sat, Jan 6, 2018 at 5:44 AM, Ramalingam C >> wrote: >>> >>> On Saturday 06 January 2018 12:59 AM, Sean Paul wrote: On Tue, Dec 19, 2017 at 9:28 AM, Ramalingam C wrote: > > Adding few more findings from the IGT usage with kernel solutions. > > > > On Wednesday 13 December 2017 04:07 PM, Ramalingam C wrote: >> >> Sean, >> >> Adding few more observations. >> >> >> On Thursday 07 December 2017 05:47 AM, 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 >>> >>> Does this for both legacy and atomic. >>> >>> Changes in v2: >>> - Don't check for i915 gen >>> - Skip test if Content Protection property is absent >>> >>> Signed-off-by: Sean Paul >>> --- >>> lib/igt_kms.c | 3 +- >>> lib/igt_kms.h | 1 + >>> tests/Makefile.sources | 1 + >>> tests/kms_content_protection.c | 129 >>> + >>> tests/meson.build | 1 + >>> 5 files changed, 134 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 ..5d61b257 >>> --- /dev/null >>> +++ b/tests/kms_content_protection.c >>> @@ -0,0 +1,129 @@ >>> +/* >>> + * 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; >>> +
Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
On Saturday 06 January 2018 06:30 PM, Sean Paul wrote: On Sat, Jan 6, 2018 at 5:44 AM, Ramalingam Cwrote: On Saturday 06 January 2018 12:59 AM, Sean Paul wrote: On Tue, Dec 19, 2017 at 9:28 AM, Ramalingam C wrote: Adding few more findings from the IGT usage with kernel solutions. On Wednesday 13 December 2017 04:07 PM, Ramalingam C wrote: Sean, Adding few more observations. On Thursday 07 December 2017 05:47 AM, 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 Does this for both legacy and atomic. Changes in v2: - Don't check for i915 gen - Skip test if Content Protection property is absent Signed-off-by: Sean Paul --- lib/igt_kms.c | 3 +- lib/igt_kms.h | 1 + tests/Makefile.sources | 1 + tests/kms_content_protection.c | 129 + tests/meson.build | 1 + 5 files changed, 134 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 ..5d61b257 --- /dev/null +++ b/tests/kms_content_protection.c @@ -0,0 +1,129 @@ +/* + * 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++) { we need 5+Sec to complete the Second part of authentication, in case of repeater with max downstream topology. So we might need to wait for 6000(6Sec) loops!? +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, )); + +igt_output_override_mode(output, ); +igt_output_set_pipe(output, pipe); + +igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB,
Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
On Sat, Jan 6, 2018 at 5:44 AM, Ramalingam Cwrote: > > On Saturday 06 January 2018 12:59 AM, Sean Paul wrote: >> >> On Tue, Dec 19, 2017 at 9:28 AM, Ramalingam C >> wrote: >>> >>> Adding few more findings from the IGT usage with kernel solutions. >>> >>> >>> >>> On Wednesday 13 December 2017 04:07 PM, Ramalingam C wrote: Sean, Adding few more observations. On Thursday 07 December 2017 05:47 AM, 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 > > Does this for both legacy and atomic. > > Changes in v2: > - Don't check for i915 gen > - Skip test if Content Protection property is absent > > Signed-off-by: Sean Paul > --- >lib/igt_kms.c | 3 +- >lib/igt_kms.h | 1 + >tests/Makefile.sources | 1 + >tests/kms_content_protection.c | 129 > + >tests/meson.build | 1 + >5 files changed, 134 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 ..5d61b257 > --- /dev/null > +++ b/tests/kms_content_protection.c > @@ -0,0 +1,129 @@ > +/* > + * 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++) { we need 5+Sec to complete the Second part of authentication, in case of repeater with max downstream topology. So we might need to wait for 6000(6Sec) loops!? > > +val = igt_output_get_prop(output, > +
Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
On Saturday 06 January 2018 12:59 AM, Sean Paul wrote: On Tue, Dec 19, 2017 at 9:28 AM, Ramalingam Cwrote: Adding few more findings from the IGT usage with kernel solutions. On Wednesday 13 December 2017 04:07 PM, Ramalingam C wrote: Sean, Adding few more observations. On Thursday 07 December 2017 05:47 AM, 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 Does this for both legacy and atomic. Changes in v2: - Don't check for i915 gen - Skip test if Content Protection property is absent Signed-off-by: Sean Paul --- lib/igt_kms.c | 3 +- lib/igt_kms.h | 1 + tests/Makefile.sources | 1 + tests/kms_content_protection.c | 129 + tests/meson.build | 1 + 5 files changed, 134 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 ..5d61b257 --- /dev/null +++ b/tests/kms_content_protection.c @@ -0,0 +1,129 @@ +/* + * 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++) { we need 5+Sec to complete the Second part of authentication, in case of repeater with max downstream topology. So we might need to wait for 6000(6Sec) loops!? +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, )); + +igt_output_override_mode(output, ); +igt_output_set_pipe(output, pipe); + +igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB, LOCAL_DRM_FORMAT_MOD_NONE, +1.f, 0.f, 0.f, ); +primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); +
Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
On Tue, Dec 19, 2017 at 9:28 AM, Ramalingam Cwrote: > Adding few more findings from the IGT usage with kernel solutions. > > > > On Wednesday 13 December 2017 04:07 PM, Ramalingam C wrote: >> >> Sean, >> >> Adding few more observations. >> >> >> On Thursday 07 December 2017 05:47 AM, 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 >>> >>> Does this for both legacy and atomic. >>> >>> Changes in v2: >>> - Don't check for i915 gen >>> - Skip test if Content Protection property is absent >>> >>> Signed-off-by: Sean Paul >>> --- >>> lib/igt_kms.c | 3 +- >>> lib/igt_kms.h | 1 + >>> tests/Makefile.sources | 1 + >>> tests/kms_content_protection.c | 129 >>> + >>> tests/meson.build | 1 + >>> 5 files changed, 134 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 ..5d61b257 >>> --- /dev/null >>> +++ b/tests/kms_content_protection.c >>> @@ -0,0 +1,129 @@ >>> +/* >>> + * 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++) { >> >> we need 5+Sec to complete the Second part of authentication, in case of >> repeater with max downstream topology. >> So we might need to wait for 6000(6Sec) loops!? >>> >>> +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; >>> +
Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
Adding few more findings from the IGT usage with kernel solutions. On Wednesday 13 December 2017 04:07 PM, Ramalingam C wrote: Sean, Adding few more observations. On Thursday 07 December 2017 05:47 AM, 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 Does this for both legacy and atomic. Changes in v2: - Don't check for i915 gen - Skip test if Content Protection property is absent Signed-off-by: Sean Paul--- lib/igt_kms.c | 3 +- lib/igt_kms.h | 1 + tests/Makefile.sources | 1 + tests/kms_content_protection.c | 129 + tests/meson.build | 1 + 5 files changed, 134 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 ..5d61b257 --- /dev/null +++ b/tests/kms_content_protection.c @@ -0,0 +1,129 @@ +/* + * 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++) { we need 5+Sec to complete the Second part of authentication, in case of repeater with max downstream topology. So we might need to wait for 6000(6Sec) loops!? + 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, )); + + igt_output_override_mode(output, ); + igt_output_set_pipe(output, pipe); + + igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB, LOCAL_DRM_FORMAT_MOD_NONE, + 1.f, 0.f, 0.f, ); + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, ); + igt_display_commit2(display, s); + + igt_output_set_prop_value(output, IGT_CONNECTOR_CONTENT_PROTECTION, 0); +
Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
Sean, Adding few more observations. On Thursday 07 December 2017 05:47 AM, 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 Does this for both legacy and atomic. Changes in v2: - Don't check for i915 gen - Skip test if Content Protection property is absent Signed-off-by: Sean Paul--- lib/igt_kms.c | 3 +- lib/igt_kms.h | 1 + tests/Makefile.sources | 1 + tests/kms_content_protection.c | 129 + tests/meson.build | 1 + 5 files changed, 134 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 ..5d61b257 --- /dev/null +++ b/tests/kms_content_protection.c @@ -0,0 +1,129 @@ +/* + * 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++) { we need 5+Sec to complete the Second part of authentication, in case of repeater with max downstream topology. So we might need to wait for 6000(6Sec) loops!? + 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, )); + + igt_output_override_mode(output, ); + igt_output_set_pipe(output, pipe); + + igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB, LOCAL_DRM_FORMAT_MOD_NONE, + 1.f, 0.f, 0.f, ); + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, ); + igt_display_commit2(display, s); + + igt_output_set_prop_value(output,
Re: [Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
On Thursday 07 December 2017 05:47 AM, 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 Does this for both legacy and atomic. Changes in v2: - Don't check for i915 gen - Skip test if Content Protection property is absent Signed-off-by: Sean Paul--- lib/igt_kms.c | 3 +- lib/igt_kms.h | 1 + tests/Makefile.sources | 1 + tests/kms_content_protection.c | 129 + tests/meson.build | 1 + 5 files changed, 134 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 ..5d61b257 --- /dev/null +++ b/tests/kms_content_protection.c @@ -0,0 +1,129 @@ +/* + * 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, )); + + igt_output_override_mode(output, ); + igt_output_set_pipe(output, pipe); + + igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB, LOCAL_DRM_FORMAT_MOD_NONE, + 1.f, 0.f, 0.f, ); + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, ); + 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"); + +
[Intel-gfx] [PATCH v2 2/2] kms_content_protection: Add Content Protection test
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 Does this for both legacy and atomic. Changes in v2: - Don't check for i915 gen - Skip test if Content Protection property is absent Signed-off-by: Sean Paul--- lib/igt_kms.c | 3 +- lib/igt_kms.h | 1 + tests/Makefile.sources | 1 + tests/kms_content_protection.c | 129 + tests/meson.build | 1 + 5 files changed, 134 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 ..5d61b257 --- /dev/null +++ b/tests/kms_content_protection.c @@ -0,0 +1,129 @@ +/* + * 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, )); + + igt_output_override_mode(output, ); + igt_output_set_pipe(output, pipe); + + igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB, LOCAL_DRM_FORMAT_MOD_NONE, + 1.f, 0.f, 0.f, ); + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, ); + 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); +