Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com,
	Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
Subject: [PATCH i-g-t 1/1] tests/kms_async_flips: add async flips suspend resume tests
Date: Fri,  6 Sep 2024 12:58:24 +0530	[thread overview]
Message-ID: <20240906072824.509607-2-santhosh.reddy.guddati@intel.com> (raw)
In-Reply-To: <20240906072824.509607-1-santhosh.reddy.guddati@intel.com>

---
 tests/kms_async_flips.c | 53 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index 5b70c4033..fd851397e 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -66,6 +66,9 @@
  *
  * SUBTEST: invalid-async-flip
  * Description: Negative case to verify if changes in fb are rejected from kernel as expected
+ *
+ * SUBTEST: async-flip-suspend-resume
+ * Description: Verify the async flip functionality with suspend and resume cycle
  */
 
 #define CURSOR_POS 128
@@ -672,6 +675,51 @@ static void run_test_with_modifiers(data_t *data, void (*test)(data_t *))
 	}
 }
 
+static void test_async_flip_suspend_resume(data_t *data)
+{
+	int ret, frame;
+	long long int fps;
+	struct timeval start, end, diff;
+	int suspend_time = 1;
+	int resume_time = 1;
+
+	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	gettimeofday(&start, NULL);
+	frame = 1;
+	do {
+		int flags = DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT;
+
+		ret = drmModePageFlip(data->drm_fd, data->crtc_id,
+				      data->bufs[frame % NUM_FBS].fb_id,
+				      flags, data);
+		igt_assert_eq(ret, 0);
+
+		wait_flip_event(data);
+
+		gettimeofday(&end, NULL);
+		timersub(&end, &start, &diff);
+
+		if (diff.tv_sec == suspend_time) {
+			igt_info("system suspending\n");
+			igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+			suspend_time = 0;
+		}
+
+		if (diff.tv_sec == resume_time) {
+			igt_info("system resuming\n");
+			igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+			resume_time = 0;
+		}
+
+		frame++;
+	} while (diff.tv_sec < RUN_TIME);
+
+	fps = frame * 1000 / RUN_TIME;
+	igt_assert_f((fps / 1000) > (data->refresh_rate * MIN_FLIPS_PER_FRAME),
+		     "FPS should be significantly higher than the refresh rate\n");
+}
+
 static data_t data;
 
 igt_main
@@ -750,6 +798,11 @@ igt_main
 		run_test(&data, test_crc);
 	}
 
+	igt_describe("Verify the async flip functionality after suspend and resume cycle");
+	igt_subtest_with_dynamic("async-flip-suspend-resume") {
+		run_test(&data, test_async_flip_suspend_resume);
+	}
+
 	igt_fixture {
 		for (i = 0; i < NUM_FBS; i++)
 			igt_remove_fb(data.drm_fd, &data.bufs[i]);
-- 
2.34.1


  reply	other threads:[~2024-09-06  7:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  7:28 [PATCH i-g-t 0/1] validate async flips during suspend resume Santhosh Reddy Guddati
2024-09-06  7:28 ` Santhosh Reddy Guddati [this message]
2024-09-09 18:00   ` [PATCH i-g-t 1/1] tests/kms_async_flips: add async flips suspend resume tests Sharma, Swati2
2024-09-11  6:53   ` [PATCH i-g-t v2] tests/kms_async_flips: Async flips suspend resume test Santhosh Reddy Guddati
2024-09-06 13:17 ` ✓ Fi.CI.BAT: success for validate async flips during suspend resume Patchwork
2024-09-06 13:23 ` ✓ CI.xeBAT: " Patchwork
2024-09-09  9:00 ` ✗ CI.xeFULL: failure " Patchwork
2024-09-10  9:16 ` ✗ Fi.CI.IGT: " Patchwork
2024-09-10 18:06 ` [PATCH i-g-t] tests/kms_async_flips: Async flips suspend resume test Santhosh Reddy Guddati
2024-09-12  4:17 ` ✗ Fi.CI.BAT: failure for tests/kms_async_flips: Async flips suspend resume test (rev2) Patchwork
2024-09-12  4:30 ` ✗ CI.xeBAT: " Patchwork
2024-09-12  9:28 ` ✗ CI.xeFULL: " 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=20240906072824.509607-2-santhosh.reddy.guddati@intel.com \
    --to=santhosh.reddy.guddati@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.b.s@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox