From: Ramalingam C <ramalingam.c@intel.com>
To: igt-dev@lists.freedesktop.org, daniel@ffwll.ch
Subject: [igt-dev] [PATCH i-g-t v4 4/4] kms_content_protection: Macros repalces the constants
Date: Fri, 8 Feb 2019 22:27:10 +0530 [thread overview]
Message-ID: <1549645030-7494-5-git-send-email-ramalingam.c@intel.com> (raw)
In-Reply-To: <1549645030-7494-1-git-send-email-ramalingam.c@intel.com>
For better readability numeric values are replaced with macros.
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
tests/kms_content_protection.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index c43e08b71a83..7fc8542e769a 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -36,6 +36,16 @@ struct data {
struct igt_fb red, green;
} data;
+#define CP_UNDESIRED 0
+#define CP_DESIRED 1
+#define CP_ENABLED 2
+
+#define LIC_PERIOD_MSEC (4 * 1000)
+/* Kernel retry count=3, Max time per authentication allowed = 6Sec */
+#define KERNEL_AUTH_TIME_ALLOWED_MSEC (3 * 6 * 1000)
+#define KERNEL_DISABLE_TIME_ALLOWED_MSEC (1 * 1000)
+#define FLIP_EVENT_POLLING_TIMEOUT_MSEC 1000
+
static void flip_handler(int fd, unsigned int sequence, unsigned int tv_sec,
unsigned int tv_usec, void *_data)
@@ -57,7 +67,7 @@ static int wait_flip_event(void)
pfd.events = POLLIN;
pfd.revents = 0;
- rc = poll(&pfd, 1, 1000);
+ rc = poll(&pfd, 1, FLIP_EVENT_POLLING_TIMEOUT_MSEC);
switch (rc) {
case 0:
igt_info("Poll timeout. 1Sec.\n");
@@ -154,11 +164,11 @@ static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s)
primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_output_set_prop_value(output,
- IGT_CONNECTOR_CONTENT_PROTECTION, 1);
+ IGT_CONNECTOR_CONTENT_PROTECTION, CP_DESIRED);
igt_display_commit2(display, s);
- /* Wait for 18000mSec (3 authentication * 6Sec) */
- ret = wait_for_prop_value(output, 2, 18000);
+ ret = wait_for_prop_value(output, CP_ENABLED,
+ KERNEL_AUTH_TIME_ALLOWED_MSEC);
if (ret) {
igt_plane_set_fb(primary, &data.green);
igt_display_commit2(display, s);
@@ -179,12 +189,14 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
* 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_output_set_prop_value(output, IGT_CONNECTOR_CONTENT_PROTECTION,
+ CP_UNDESIRED);
igt_plane_set_fb(primary, &data.red);
igt_display_commit2(display, s);
/* Wait for HDCP to be disabled, before crtc off */
- ret = wait_for_prop_value(output, 0, 1000);
+ ret = wait_for_prop_value(output, CP_UNDESIRED,
+ KERNEL_DISABLE_TIME_ALLOWED_MSEC);
igt_assert_f(ret, "Content Protection not cleared\n");
}
@@ -219,7 +231,7 @@ static void test_cp_lic(igt_output_t *output)
bool ret;
/* Wait for 4Secs (min 2 cycles of Link Integrity Check) */
- ret = wait_for_prop_value(output, 1, 4 * 1000);
+ ret = wait_for_prop_value(output, CP_DESIRED, LIC_PERIOD_MSEC);
igt_assert_f(!ret, "Content Protection LIC Failed\n");
}
@@ -258,7 +270,8 @@ static void test_content_protection_on_output(igt_output_t *output,
IGT_CRTC_ACTIVE, 1);
igt_display_commit2(display, s);
- ret = wait_for_prop_value(output, 2, 18000);
+ ret = wait_for_prop_value(output, CP_ENABLED,
+ KERNEL_AUTH_TIME_ALLOWED_MSEC);
if (!ret)
test_cp_enable_with_retry(output, s, 2);
}
--
2.7.4
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-02-08 17:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-08 16:57 [igt-dev] [PATCH i-g-t v4 0/4] HDCP test on modeset Ramalingam C
2019-02-08 16:57 ` [igt-dev] [PATCH i-g-t v4 1/4] kms_content_protection: modularizing the CP test steps Ramalingam C
2019-02-08 16:57 ` [igt-dev] [PATCH i-g-t v4 2/4] kms_content_protection: Test CP along with modeset Ramalingam C
2019-02-08 16:57 ` [igt-dev] [PATCH i-g-t v4 3/4] kms_content_protection: Confirm that LIC is passed Ramalingam C
2019-02-08 16:57 ` Ramalingam C [this message]
2019-02-11 17:26 ` [igt-dev] [PATCH i-g-t v4 4/4] kms_content_protection: Macros repalces the constants Daniel Vetter
2019-02-08 17:41 ` [igt-dev] ✓ Fi.CI.BAT: success for HDCP test on modeset Patchwork
2019-02-08 22:10 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
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=1549645030-7494-5-git-send-email-ramalingam.c@intel.com \
--to=ramalingam.c@intel.com \
--cc=daniel@ffwll.ch \
--cc=igt-dev@lists.freedesktop.org \
/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