From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58E56C5321D for ; Tue, 20 Aug 2024 08:15:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77A8610E51A; Tue, 20 Aug 2024 08:15:11 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="MTiJvsLI"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5CFDE10E504 for ; Tue, 20 Aug 2024 08:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724141709; x=1755677709; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LjlMWp8OcvlbVduDH7j0cM+r/o/P1IRNAe+0v42cvyM=; b=MTiJvsLIqOoXopOACoauXFPmfr3X/MDJUtY9o+E7n5jhJOK+9UV5sNpq Kgl5JDj10GeiM+Lsrll1cTNX+5X66PU7yNLRtJV4pYWux7OQs9s8PEH9Z mcORLqAakqEnTAqf6FgMGBSiNmupLuSGB7y4URWltX6CIZEAlGXl8bIPG YADZUzSfSk2/FWh5McctluRoteO165Vtb7X//QzoHfC8mVZlOIHeXi8vl uiURCNP+MI7dcbToGS+mlCqpchdIv2w0CPAKA6ZS11uEU0GPktS9rtI08 LG7wDB35kHg2DM7+iIrotulJ9XVqG0fd8VnprJM6uqKeBhASO//p2F8Lk w==; X-CSE-ConnectionGUID: /XE2+KJ0Ttig0oKKSBje3g== X-CSE-MsgGUID: 6YjXiJupTCm9Br1b+3SQ+Q== X-IronPort-AV: E=McAfee;i="6700,10204,11169"; a="44948245" X-IronPort-AV: E=Sophos;i="6.10,161,1719903600"; d="scan'208";a="44948245" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2024 01:15:08 -0700 X-CSE-ConnectionGUID: abHAkkecS+6L8fJuAQRJIg== X-CSE-MsgGUID: AXqBlcUKScyypraCtKaf9A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,161,1719903600"; d="scan'208";a="91418393" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 20 Aug 2024 01:15:06 -0700 From: Suraj Kandpal To: igt-dev@lists.freedesktop.org Cc: pranay.samala@intel.com, ankit.k.nautiyal@intel.com, jeevan.b@intel.com, Suraj Kandpal Subject: [PATCH i-g-t 4/5] tests/kms_content_protection: Add retry logic for mst usecase Date: Tue, 20 Aug 2024 13:42:31 +0530 Message-ID: <20240820081233.4092203-5-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240820081233.4092203-1-suraj.kandpal@intel.com> References: <20240820081233.4092203-1-suraj.kandpal@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" Add mst retry logic where it retries 3 times before failing the test. After every retry mst setup needs to be disabled so we need to add a function which disables mst in one commit. --v2 -Fix enum declaration name [Jeevan] -Add more elaborate debug message [Jeevan] Signed-off-by: Suraj Kandpal --- tests/kms_content_protection.c | 85 +++++++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 11 deletions(-) diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c index 473686939..87d7526ee 100644 --- a/tests/kms_content_protection.c +++ b/tests/kms_content_protection.c @@ -278,6 +278,36 @@ static bool test_cp_enable(igt_output_t *output, enum igt_commit_style commit_st return ret; } +static void test_mst_cp_disable(igt_output_t *hdcp_mst_output[], + enum igt_commit_style commit_style, + int valid_outputs) +{ + igt_display_t *display = &data.display; + igt_plane_t *primary; + bool ret; + int count; + u64 val; + + for (count = 0; count < valid_outputs; count++) { + primary = igt_output_get_plane_type(hdcp_mst_output[count], DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, &data.red); + igt_output_set_prop_value(hdcp_mst_output[count], IGT_CONNECTOR_CONTENT_PROTECTION, + CP_UNDESIRED); + } + + igt_display_commit2(display, commit_style); + + ret = wait_for_prop_value(hdcp_mst_output[0], CP_UNDESIRED, + KERNEL_DISABLE_TIME_ALLOWED_MSEC); + for (count = 1; count < valid_outputs; count++) { + val = igt_output_get_prop(hdcp_mst_output[count], + IGT_CONNECTOR_CONTENT_PROTECTION); + ret &= (val == CP_UNDESIRED); + } + + igt_assert_f(ret, "Content Protection not cleared on all MST outputs\n"); +} + static void test_cp_disable(igt_output_t *output, enum igt_commit_style commit_style) { igt_display_t *display = &data.display; @@ -631,6 +661,49 @@ static void test_cp_lic_on_mst(igt_output_t *mst_outputs[], int valid_outputs, b } } +static bool +test_mst_cp_enable_with_retry(igt_output_t *hdcp_mst_output[], int valid_outputs, + int retries, int content_type) +{ + igt_display_t *display = &data.display; + int retry_orig = retries, count; + bool ret; + u64 val; + + do { + if (retry_orig != retries) + test_mst_cp_disable(hdcp_mst_output, COMMIT_ATOMIC, valid_outputs); + + for (count = 0; count < valid_outputs; count++) { + igt_output_set_prop_value(hdcp_mst_output[count], + IGT_CONNECTOR_CONTENT_PROTECTION, CP_DESIRED); + + if (hdcp_mst_output[count]->props[IGT_CONNECTOR_HDCP_CONTENT_TYPE]) + igt_output_set_prop_value(hdcp_mst_output[count], + IGT_CONNECTOR_HDCP_CONTENT_TYPE, + content_type); + } + + igt_display_commit2(display, COMMIT_ATOMIC); + + ret = wait_for_prop_value(hdcp_mst_output[0], CP_ENABLED, + KERNEL_AUTH_TIME_ALLOWED_MSEC); + for (count = 1; count < valid_outputs; count++) { + val = igt_output_get_prop(hdcp_mst_output[count], + IGT_CONNECTOR_CONTENT_PROTECTION); + ret &= (val == CP_ENABLED); + } + + retries -= 1; + if (!ret || retries) + igt_debug("Retry %d/3\n", 3 - retries); + } while (retries && !ret); + + igt_assert_f(ret, "Content Protection not enabled on MST outputs\n"); + + return ret; +} + static void test_content_protection_mst(int content_type) { @@ -685,19 +758,9 @@ test_content_protection_mst(int content_type) igt_require_f(ret == 0, "Commit failure during MST modeset\n"); } - for (count = 0; count < valid_outputs; count++) { - igt_output_set_prop_value(hdcp_mst_output[count], IGT_CONNECTOR_CONTENT_PROTECTION, CP_DESIRED); - - if (output->props[IGT_CONNECTOR_HDCP_CONTENT_TYPE]) - igt_output_set_prop_value(hdcp_mst_output[count], IGT_CONNECTOR_HDCP_CONTENT_TYPE, content_type); - } - igt_display_commit2(display, COMMIT_ATOMIC); - for (count = 0; count < valid_outputs; count++) { - ret = wait_for_prop_value(hdcp_mst_output[count], CP_ENABLED, KERNEL_AUTH_TIME_ALLOWED_MSEC); - igt_assert_f(ret, "Content Protection not enabled on %s\n", hdcp_mst_output[count]->name); - } + ret = test_mst_cp_enable_with_retry(hdcp_mst_output, valid_outputs, 2, content_type); if (data.cp_tests & CP_LIC) test_cp_lic_on_mst(hdcp_mst_output, valid_outputs, 0); -- 2.43.2