All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stylon Wang <stylon.wang@amd.com>
To: igt-dev@lists.freedesktop.org
Cc: nicholas.kazlauskas@amd.com, sunpeng.li@amd.com,
	rodrigo.siqueira@amd.com, Stylon Wang <stylon.wang@amd.com>
Subject: [igt-dev] [PATCH i-g-t 3/3] tests/amdgpu: Add tests for Freesync capability with suspend-resume
Date: Wed, 1 Sep 2021 20:10:17 +0800	[thread overview]
Message-ID: <20210901121017.12398-4-stylon.wang@amd.com> (raw)
In-Reply-To: <20210901121017.12398-1-stylon.wang@amd.com>

Add tests to check Freesync capability reporting after system resume
from suspend.

Signed-off-by: Stylon Wang <stylon.wang@amd.com>
---
 tests/amdgpu/amd_vrr_range.c | 50 ++++++++++++++++++++++++++++++------
 1 file changed, 42 insertions(+), 8 deletions(-)

diff --git a/tests/amdgpu/amd_vrr_range.c b/tests/amdgpu/amd_vrr_range.c
index c8a81e28..9b2c81a0 100644
--- a/tests/amdgpu/amd_vrr_range.c
+++ b/tests/amdgpu/amd_vrr_range.c
@@ -40,6 +40,12 @@ typedef struct range {
 	unsigned int max;
 } range_t;
 
+/* Test flags. */
+enum {
+	TEST_NONE = 1 << 0,
+	TEST_SUSPEND = 1 << 1,
+};
+
 struct {
 	const char *name;
 	uint32_t connector_type;
@@ -193,11 +199,24 @@ static range_t get_freesync_range(data_t *data, igt_output_t *output)
 	return range;
 }
 
+static void trigger_edid_parse(data_t *data, uint32_t test_flags)
+{
+	if (test_flags & TEST_SUSPEND)
+		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
+					      SUSPEND_TEST_NONE);
+	else
+		igt_amd_trigger_hotplug(data->fd, data->output->name);
+
+	/* more safe margin until resume and hotplug is completed */
+	usleep(1500000);
+}
+
 /* Check if EDID parsing is correctly reporting Freesync capability
  * by overriding EDID with ones from golden sample. Display under test
  * must still support Freesync.
  */
-static void test_freesync_parsing(data_t *data, uint32_t connector_type)
+static void test_freesync_parsing(data_t *data, uint32_t connector_type,
+		uint32_t test_flags)
 {
 	const struct edid *edid;
 	range_t range, expected_range;
@@ -212,7 +231,7 @@ static void test_freesync_parsing(data_t *data, uint32_t connector_type)
 
 	kmstest_force_edid(data->fd, data->output->config.connector, edid);
 
-	igt_amd_trigger_hotplug(data->fd, data->output->name);
+	trigger_edid_parse(data, test_flags);
 
 	range = get_freesync_range(data, data->output);
 
@@ -240,7 +259,8 @@ static bool has_vrr(igt_output_t *output)
 /* More relaxed checking on Freesync capability.
  * Only checks if frame rate range is within legal range.
  */
-static void test_freesync_range(data_t *data, uint32_t connector_type)
+static void test_freesync_range(data_t *data, uint32_t connector_type,
+		uint32_t test_flags)
 {
 	range_t range;
 
@@ -250,7 +270,7 @@ static void test_freesync_range(data_t *data, uint32_t connector_type)
 			"connector %s is not VRR capable\n",
 			data->output->name);
 
-	igt_amd_trigger_hotplug(data->fd, data->output->name);
+	trigger_edid_parse(data, test_flags);
 
 	range = get_freesync_range(data, data->output);
 
@@ -285,17 +305,31 @@ igt_main
 
 	igt_describe("Freesync EDID parsing on HDMI");
 	igt_subtest("freesync-parsing-hdmi") test_freesync_parsing(&data,
-			DRM_MODE_CONNECTOR_HDMIA);
+			DRM_MODE_CONNECTOR_HDMIA, TEST_NONE);
 	igt_describe("Freesync EDID parsing on DP");
 	igt_subtest("freesync-parsing-dp") test_freesync_parsing(&data,
-			DRM_MODE_CONNECTOR_DisplayPort);
+			DRM_MODE_CONNECTOR_DisplayPort, TEST_NONE);
+
+	igt_describe("Freesync EDID parsing on HDMI after suspend");
+	igt_subtest("freesync-parsing-hdmi-suspend") test_freesync_parsing(&data,
+			DRM_MODE_CONNECTOR_HDMIA, TEST_SUSPEND);
+	igt_describe("Freesync EDID parsing on DP after suspend");
+	igt_subtest("freesync-parsing-dp-suspend") test_freesync_parsing(&data,
+			DRM_MODE_CONNECTOR_DisplayPort, TEST_SUSPEND);
 
 	igt_describe("Freesync range on HDMI");
 	igt_subtest("freesync-range-hdmi") test_freesync_range(&data,
-			DRM_MODE_CONNECTOR_HDMIA);
+			DRM_MODE_CONNECTOR_HDMIA, TEST_NONE);
 	igt_describe("Freesync range on DP");
 	igt_subtest("freesync-range-dp") test_freesync_range(&data,
-			DRM_MODE_CONNECTOR_DisplayPort);
+			DRM_MODE_CONNECTOR_DisplayPort, TEST_NONE);
+
+	igt_describe("Freesync range on HDMI after suspend");
+	igt_subtest("freesync-range-hdmi-suspend") test_freesync_range(&data,
+			DRM_MODE_CONNECTOR_HDMIA, TEST_SUSPEND);
+	igt_describe("Freesync range on DP after suspend");
+	igt_subtest("freesync-range-dp-suspend") test_freesync_range(&data,
+			DRM_MODE_CONNECTOR_DisplayPort, TEST_SUSPEND);
 
 	igt_fixture
 	{
-- 
2.32.0

  parent reply	other threads:[~2021-09-01 12:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 12:10 [igt-dev] [PATCH i-g-t 0/3] Add tests to check Freesync capability reporting Stylon Wang
2021-09-01 12:10 ` [igt-dev] [PATCH i-g-t 1/3] tests/amdgpu: Add tests for Freesync capability reporting on HDMI & DP displays Stylon Wang
2021-09-01 12:10 ` [igt-dev] [PATCH i-g-t 2/3] tests/amdgpu: Add tests for relaxed reporting of Freesync capability Stylon Wang
2021-09-01 12:10 ` Stylon Wang [this message]
2021-09-01 12:42 ` [igt-dev] ✓ Fi.CI.BAT: success for Add tests to check Freesync capability reporting Patchwork
2021-09-01 14:12 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20210901121017.12398-4-stylon.wang@amd.com \
    --to=stylon.wang@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=nicholas.kazlauskas@amd.com \
    --cc=rodrigo.siqueira@amd.com \
    --cc=sunpeng.li@amd.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.