Return-Path: Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2062.outbound.protection.outlook.com [40.107.243.62]) by gabe.freedesktop.org (Postfix) with ESMTPS id 664086E1F8 for ; Wed, 25 Aug 2021 12:27:57 +0000 (UTC) From: Stylon Wang Date: Wed, 25 Aug 2021 20:24:13 +0800 Message-ID: <20210825122413.1708578-3-stylon.wang@amd.com> In-Reply-To: <20210825122413.1708578-1-stylon.wang@amd.com> References: <20210719125835.652219-1-stylon.wang@amd.com> <20210825122413.1708578-1-stylon.wang@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Subject: [igt-dev] [PATCH i-g-t v4 2/2] tests/amdgpu: Add suspend and DPMS subtests to ASSR test List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: igt-dev@lists.freedesktop.org Cc: nicholas.kazlauskas@amd.com, sunpeng.li@amd.com, rodrigo.siqueira@amd.com, Stylon Wang List-ID: Test if ASSR is correctly enabled/disabled after suspend and DPMS. Signed-off-by: Stylon Wang --- tests/amdgpu/amd_assr.c | 42 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/tests/amdgpu/amd_assr.c b/tests/amdgpu/amd_assr.c index 21e8da7f..80cbbe8e 100644 --- a/tests/amdgpu/amd_assr.c +++ b/tests/amdgpu/amd_assr.c @@ -40,6 +40,14 @@ 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 +192,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 +220,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 +245,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 +260,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 +288,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