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, vandita.kulkarni@intel.com,
	Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
Subject: [PATCH i-g-t 1/2] tests/kms_async_flips: subtests to validate async flips on atomic path
Date: Tue, 27 Aug 2024 11:41:10 +0530	[thread overview]
Message-ID: <20240827061111.472460-2-santhosh.reddy.guddati@intel.com> (raw)
In-Reply-To: <20240827061111.472460-1-santhosh.reddy.guddati@intel.com>

Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
---
 tests/kms_async_flips.c | 154 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 141 insertions(+), 13 deletions(-)

diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index 5b70c4033..21cf0d302 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -66,6 +66,25 @@
  *
  * SUBTEST: invalid-async-flip
  * Description: Negative case to verify if changes in fb are rejected from kernel as expected
+ *
+ * SUBTEST: alternate-sync-async-flip-atomic
+ * Description: Verify the async flip functionality and the fps during async flips using atomic path
+ *
+ * SUBTEST: async-flip-with-page-flip-events-atomic
+ * Description: Wait for page flip events in between successive asynchronous flips using atomic path
+ *
+ * SUBTEST: test-time-stamp-atomic
+ * Description: Verify that the async flip timestamp does not coincide with either previous or next vblank
+ * 				when async flip is done using atomic path
+ *
+ * SUBTEST: test-cursor-atomic
+ * Description: Verify that the DRM_IOCTL_MODE_CURSOR passes after async flip with atomic commit
+ *
+ * SUBTEST: invalid-async-flip-atomic
+ * Description: Negative case to verify if changes in fb are rejected from kernel as expected when async flip is done using atomic path
+ *
+ * SUBTEST: crc-atomic
+ * Description: Use CRC to verify async flip scans out the correct framebuffer with atomic commit
  */
 
 #define CURSOR_POS 128
@@ -101,6 +120,7 @@ typedef struct {
 	bool alternate_sync_async;
 	bool allow_fail;
 	struct buf_ops *bops;
+	bool atomic_path;
 } data_t;
 
 static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
@@ -271,9 +291,14 @@ static void test_async_flip(data_t *data)
 		if (data->alternate_sync_async) {
 			flags &= ~DRM_MODE_PAGE_FLIP_ASYNC;
 
-			ret = drmModePageFlip(data->drm_fd, data->crtc_id,
+			if (!data->atomic_path) {
+				ret = drmModePageFlip(data->drm_fd, data->crtc_id,
 					      data->bufs[frame % NUM_FBS].fb_id,
 					      flags, data);
+			} else {
+				igt_plane_set_fb(data->plane, &data->bufs[frame % NUM_FBS]);
+				ret = igt_display_try_commit_atomic(&data->display, flags, data);
+			}
 
 			igt_assert_eq(ret, 0);
 
@@ -282,19 +307,30 @@ static void test_async_flip(data_t *data)
 			flags |= DRM_MODE_PAGE_FLIP_ASYNC;
 
 			if (async_flip_needs_extra_frame(data)) {
-				ret = drmModePageFlip(data->drm_fd, data->crtc_id,
+				if (!data->atomic_path) {
+					ret = drmModePageFlip(data->drm_fd, data->crtc_id,
 						      data->bufs[frame % NUM_FBS].fb_id,
 						      flags, data);
-
+				} else {
+					igt_plane_set_fb(data->plane, &data->bufs[frame % NUM_FBS]);
+					ret = igt_display_try_commit_atomic(&data->display, flags, data);
+				}
 				igt_assert_eq(ret, 0);
 
 				wait_flip_event(data);
 			}
 		}
 
-		ret = drmModePageFlip(data->drm_fd, data->crtc_id,
+		if (!data->atomic_path) {
+			ret = drmModePageFlip(data->drm_fd, data->crtc_id,
 				      data->bufs[frame % NUM_FBS].fb_id,
 				      flags, data);
+		} else {
+			igt_plane_set_fb(data->plane, &data->bufs[frame % NUM_FBS]);
+			ret = igt_display_try_commit_atomic(&data->display, flags, data);
+			igt_skip_on(ret == -EINVAL);
+		}
+
 		if (frame == 1 && data->allow_fail)
 			igt_skip_on(ret == -EINVAL);
 		else
@@ -419,9 +455,14 @@ static void test_cursor(data_t *data)
 
 	do_ioctl(data->drm_fd, DRM_IOCTL_MODE_CURSOR, &cur);
 
-	ret = drmModePageFlip(data->drm_fd, data->crtc_id,
-			      data->bufs[0].fb_id,
-			      flags, data);
+	if (!data->atomic_path) {
+		ret = drmModePageFlip(data->drm_fd, data->crtc_id,
+				      data->bufs[0].fb_id,
+				      flags, data);
+	} else {
+		igt_plane_set_fb(data->plane, &data->bufs[0]);
+		ret = igt_display_try_commit_atomic(&data->display, flags, data);
+	}
 
 	igt_assert_eq(ret, 0);
 
@@ -457,14 +498,24 @@ static void test_invalid(data_t *data)
 	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
 	/* first async flip is expected to allow modifier changes */
-	ret = drmModePageFlip(data->drm_fd, data->crtc_id, fb[1].fb_id,
-			      DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT, data);
+	if(!data->atomic_path) {
+		ret = drmModePageFlip(data->drm_fd, data->crtc_id, fb[1].fb_id,
+				      DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT, data);
+	} else {
+		igt_plane_set_fb(data->plane, &fb[1]);
+		ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_PAGE_FLIP_ASYNC, data);
+	}
 	igt_assert_eq(ret, 0);
 	wait_flip_event(data);
 
 	/* subsequent async flips should reject modifier changes */
-	ret = drmModePageFlip(data->drm_fd, data->crtc_id, fb[0].fb_id,
-			      DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT, data);
+	if(!data->atomic_path) {
+		ret = drmModePageFlip(data->drm_fd, data->crtc_id, fb[0].fb_id,
+				      DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT, data);
+	} else {
+		igt_plane_set_fb(data->plane, &fb[0]);
+		ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_PAGE_FLIP_ASYNC, data);
+	}
 	igt_assert(ret == -EINVAL);
 
 	/* TODO: Add verification for changes in stride, pixel format */
@@ -611,8 +662,26 @@ static void test_crc(data_t *data)
 		paint_fb(data, &data->bufs[frame], 1, height, 0xff0000ff);
 
 		data->flip_pending = true;
-		ret = drmModePageFlip(data->drm_fd, data->crtc_id, data->bufs[frame].fb_id,
-				      DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT, data);
+
+		if (!data->atomic_path) {
+			ret = drmModePageFlip(data->drm_fd, data->crtc_id, data->bufs[frame].fb_id,
+					      DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT, data);
+		} else {
+			 // TODO: Check if the first frame modeset is required.
+			 // Atomic commit is failing with invalid parameter when async flip with atomic is done
+			 // for crc test. So, skipping the first frame modeset.
+			if (data->frame_count == 0) {
+				igt_plane_set_fb(data->plane, &data->bufs[frame]);
+				igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET , data);
+				data->frame_count++;
+				continue;
+			} else {
+				igt_plane_set_fb(data->plane, &data->bufs[frame]);
+				ret = igt_display_try_commit_atomic(&data->display, 
+						DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT, data);
+			}
+		}
+
 		igt_assert_eq(ret, 0);
 
 		wait_events_crc(data);
@@ -705,15 +774,38 @@ igt_main
 				run_test(&data, test_async_flip);
 		}
 
+		igt_describe("Wait for page flip events in between successive asynchronous flips using atomic path");
+		igt_subtest_with_dynamic("async-flip-with-page-flip-events-atomic") {
+			data.alternate_sync_async = false;
+			data.atomic_path = true;
+			if (is_intel_device(data.drm_fd))
+				run_test_with_modifiers(&data, test_async_flip);
+			else
+				run_test(&data, test_async_flip);
+		}
+
 		igt_describe("Alternate between sync and async flips");
 		igt_subtest_with_dynamic("alternate-sync-async-flip") {
 			data.alternate_sync_async = true;
 			run_test(&data, test_async_flip);
 		}
 
+		igt_describe("Alternate between sync and async flips using atomic path");
+		igt_subtest_with_dynamic("alternate-sync-async-flip-atomic") {
+			data.alternate_sync_async = true;
+			data.atomic_path = true;
+			run_test(&data, test_async_flip);
+		}
+
 		igt_describe("Verify that the async flip timestamp does not coincide with either previous or next vblank");
 		igt_subtest_with_dynamic("test-time-stamp")
 			run_test(&data, test_timestamp);
+
+		igt_describe("Verify that the async flip timestamp does not coincide with either previous or next vblank with atomic path");
+		igt_subtest_with_dynamic("test-time-stamp-atomic") {
+			data.atomic_path = true;
+			run_test(&data, test_timestamp);
+		}
 	}
 
 	igt_describe("Verify that the DRM_IOCTL_MODE_CURSOR passes after async flip");
@@ -730,6 +822,20 @@ igt_main
 		run_test(&data, test_cursor);
 	}
 
+	igt_describe("Verify that the DRM_IOCTL_MODE_CURSOR passes after async flip with atomic commit");
+	igt_subtest_with_dynamic("test-cursor-atomic") {
+		/*
+		 * Intel's PSR2 selective fetch adds other planes to state when
+		 * necessary, causing the async flip to fail because async flip is not
+		 * supported in cursor plane.
+		 */
+		igt_skip_on_f(i915_psr2_selective_fetch_check(data.drm_fd, NULL),
+			      "PSR2 sel fetch causes cursor to be added to primary plane " \
+			      "pages flips and async flip is not supported in cursor\n");
+		data.atomic_path = true;
+		run_test(&data, test_cursor);
+	}
+
 	igt_describe("Negative case to verify if changes in fb are rejected from kernel as expected");
 	igt_subtest_with_dynamic("invalid-async-flip") {
 		/* TODO: support more vendors */
@@ -742,6 +848,19 @@ igt_main
 		run_test(&data, test_invalid);
 	}
 
+	igt_describe("Negative case to verify if changes in fb are rejected from kernel as expected when async flip is done using atomic path");
+	igt_subtest_with_dynamic("invalid-async-flip-atomic") {
+		data.atomic_path = true;
+		/* TODO: support more vendors */
+		igt_require(is_intel_device(data.drm_fd));
+		igt_require(igt_display_has_format_mod(&data.display, DRM_FORMAT_XRGB8888,
+						       I915_FORMAT_MOD_X_TILED));
+		igt_require(igt_display_has_format_mod(&data.display, DRM_FORMAT_XRGB8888,
+						       I915_FORMAT_MOD_Y_TILED));
+
+		run_test(&data, test_invalid);
+	}
+
 	igt_describe("Use CRC to verify async flip scans out the correct framebuffer");
 	igt_subtest_with_dynamic("crc") {
 		/* Devices without CRC can't run this test */
@@ -750,6 +869,15 @@ igt_main
 		run_test(&data, test_crc);
 	}
 
+	igt_describe("Use CRC to verify async flip scans out the correct framebuffer with atomic commit");
+	igt_subtest_with_dynamic("crc-atomic") {
+		/* Devices without CRC can't run this test */
+		igt_require_pipe_crc(data.drm_fd);
+
+		data.atomic_path = true;
+		run_test(&data, test_crc);
+	}
+
 	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-08-27  6:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  6:11 [PATCH i-g-t 1/2] tests/kms_async_flips: subtests to validate async flips on atomic path Santhosh Reddy Guddati
2024-08-27  6:11 ` Santhosh Reddy Guddati [this message]
2024-09-20  5:10   ` Karthik B S
2024-08-27  6:11 ` [PATCH i-g-t 2/2] HAX patch do not merge Santhosh Reddy Guddati
2024-08-27 10:20 ` ✓ CI.xeBAT: success for series starting with [i-g-t,1/2] tests/kms_async_flips: subtests to validate async flips on atomic path Patchwork
2024-08-27 10:26 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-08-27 17:02 ` ✗ CI.xeFULL: " Patchwork
2024-09-21 15:34 ` [PATCH i-g-t v2 0/2] Async flips with atomic commit Santhosh Reddy Guddati
2024-09-21 15:34   ` [PATCH i-g-t v2 1/2] tests/kms_async_flips: subtests to validate async flips on atomic path Santhosh Reddy Guddati
2024-09-21 15:34   ` [PATCH i-g-t v2 2/2] HAX patch do not merge Santhosh Reddy Guddati
2024-09-23  4:50 ` [PATCH i-g-t v3 0/2] Async flip with atomic path Santhosh Reddy Guddati
2024-09-23  4:50   ` [PATCH i-g-t v3 1/2] tests/kms_async_flips: subtests to validate async flips on " Santhosh Reddy Guddati
2024-09-23  4:50   ` [PATCH i-g-t v3 2/2] HAX patch do not merge Santhosh Reddy Guddati
2024-09-25 15:29 ` ✗ Fi.CI.BAT: failure for series starting with [i-g-t,v3,1/2] tests/kms_async_flips: subtests to validate async flips on atomic path (rev3) Patchwork
2024-09-25 15:32 ` ✗ CI.xeBAT: " Patchwork
2024-09-25 16:25 ` ✗ CI.xeFULL: " Patchwork
2024-09-25 16:46 ` Patchwork
2024-09-25 17:10 ` [PATCH i-g-t v4 0/2] Async Flips with atomic commit Santhosh Reddy Guddati
2024-09-25 17:10   ` [PATCH i-g-t v4 1/2] tests/kms_async_flips: subtests to validate async flips on atomic path Santhosh Reddy Guddati
2024-09-25 17:10   ` [PATCH i-g-t v4 2/2] HAX patch do not merge Santhosh Reddy Guddati
2024-09-26  7:23 ` ✗ Fi.CI.BAT: failure for series starting with [i-g-t,v4,1/2] tests/kms_async_flips: subtests to validate async flips on atomic path (rev4) Patchwork
2024-09-26  7:49 ` ✓ Fi.CI.IGT: success for series starting with [i-g-t,v3,1/2] tests/kms_async_flips: subtests to validate async flips on atomic path (rev3) Patchwork
2024-09-26  7:51 ` ✓ CI.xeBAT: success for series starting with [i-g-t,v4,1/2] tests/kms_async_flips: subtests to validate async flips on atomic path (rev4) Patchwork
2024-09-26 13:54 ` [PATCH i-g-t v5 1/2] tests/kms_async_flips: subtests to validate async flips on atomic path Santhosh Reddy Guddati
2024-09-26 13:55   ` [PATCH i-g-t v5 2/2] HAX patch do not merge Santhosh Reddy Guddati
2024-09-26 15:04 ` ✗ Fi.CI.BUILD: failure for series starting with [i-g-t,v5,2/2] HAX patch do not merge (rev6) Patchwork
2024-09-26 21:14 ` ✗ CI.xeFULL: failure for series starting with [i-g-t,v4,1/2] tests/kms_async_flips: subtests to validate async flips on atomic path (rev4) 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=20240827061111.472460-2-santhosh.reddy.guddati@intel.com \
    --to=santhosh.reddy.guddati@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.b.s@intel.com \
    --cc=vandita.kulkarni@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