Return-Path: Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2082.outbound.protection.outlook.com [40.107.236.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0BCB689AB6 for ; Mon, 19 Jul 2021 12:59:01 +0000 (UTC) From: Stylon Wang Date: Mon, 19 Jul 2021 20:58:35 +0800 Message-ID: <20210719125835.652219-3-stylon.wang@amd.com> In-Reply-To: <20210719125835.652219-1-stylon.wang@amd.com> References: <20210716131622.103320-2-stylon.wang@amd.com> <20210719125835.652219-1-stylon.wang@amd.com> MIME-Version: 1.0 Subject: [igt-dev] [PATCH i-g-t v3 2/2] tests/kms_assr: Add suspend and DPMS subtests to ASSR test List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: petri.latvala@intel.com, arek@hiler.eu, markyacoub@google.com, igt-dev@lists.freedesktop.org Cc: Anson.Jacob@amd.com, Nicholas.Choi@amd.com List-ID: Test if ASSR is correctly enabled/disabled after suspend and DPMS. Signed-off-by: Stylon Wang --- tests/kms_assr.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/tests/kms_assr.c b/tests/kms_assr.c index 066973d3..11e92184 100644 --- a/tests/kms_assr.c +++ b/tests/kms_assr.c @@ -40,6 +40,13 @@ typedef struct data { int fd; } data_t; +/* Test flags. */ +enum { + TEST_NONE = 1 << 0, + TEST_DPMS = 1 << 1, + TEST_SUSPEND = 1 << 2, +}; + /* Common test setup. */ static void test_init(data_t *data) { @@ -184,7 +191,25 @@ static void present_visual_pattern(data_t *data, igt_output_t *output) igt_display_commit2(&data->display, COMMIT_ATOMIC); } -static void test_assr(data_t *data, igt_output_t *output) +static void test_cycle_flags(data_t *data, igt_output_t *output, + uint32_t test_flags) +{ + if (test_flags & TEST_DPMS) { + igt_info("Link DPMS off then on\n"); + kmstest_set_connector_dpms(data->fd, + output->config.connector, + DRM_MODE_DPMS_OFF); + kmstest_set_connector_dpms(data->fd, + output->config.connector, + DRM_MODE_DPMS_ON); + } + + if (test_flags & TEST_SUSPEND) + igt_system_suspend_autoresume(SUSPEND_STATE_MEM, + SUSPEND_TEST_NONE); +} + +static void test_assr(data_t *data, igt_output_t *output, uint32_t test_flags) { drmModeConnector *connector = output->config.connector; int connector_type = connector->connector_type; @@ -194,6 +219,8 @@ static void test_assr(data_t *data, igt_output_t *output) igt_info("Test ASSR on link %s\n", output->name); + test_cycle_flags(data, output, test_flags); + igt_assert_f(find_aux_dev(data, output, aux_dev, sizeof(aux_dev)), "Cannot find AUX device for link %s\n", output->name); igt_info("Link %s aux %s\n", output->name, aux_dev); @@ -217,7 +244,7 @@ static void test_assr(data_t *data, igt_output_t *output) igt_assert(!assr_enabled); } -static void test_assr_links(data_t *data) +static void test_assr_links(data_t *data, uint32_t test_flags) { for (int i = 0; i < data->display.n_outputs; ++i) { igt_output_t *output = &data->display.outputs[i]; @@ -232,7 +259,7 @@ static void test_assr_links(data_t *data) test_init(data); - test_assr(data, output); + test_assr(data, output, test_flags); test_fini(data); } @@ -260,7 +287,13 @@ igt_main igt_describe("Test ASSR on connected DP/eDP links"); igt_subtest("assr-links") - test_assr_links(&data); + test_assr_links(&data, TEST_NONE); + igt_describe("Test ASSR with DPMS "); + igt_subtest("assr-links-dpms") + test_assr_links(&data, TEST_DPMS); + igt_describe("Test ASSR with suspend "); + igt_subtest("assr-links-suspend") + test_assr_links(&data, TEST_SUSPEND); igt_fixture { -- 2.32.0 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev