Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>,
	Jeevan B <jeevan.b@intel.com>
Subject: [i-g-t V2 5/8] tests/kms_tiled_display: Test cleanup
Date: Fri, 14 Jun 2024 13:39:58 +0530	[thread overview]
Message-ID: <20240614080958.3869795-1-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20240611045348.3727239-6-bhanuprakash.modem@intel.com>

Make sure the below points in IGT cleanup:

- Sanitize the state before starting the subtest.
- Clear the states before exiting the subtest.
- Update existing libdrm APIs with IGT kms APIs.
- Other misc (Ex: update deprecated APIs/macros/enums, FB leaks etc..)

V2: - Drop few complex fixes

Cc: Jeevan B <jeevan.b@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_tiled_display.c | 77 +++++++++++++++------------------------
 1 file changed, 30 insertions(+), 47 deletions(-)

diff --git a/tests/kms_tiled_display.c b/tests/kms_tiled_display.c
index 3ffd6a9a4..2c9d63799 100644
--- a/tests/kms_tiled_display.c
+++ b/tests/kms_tiled_display.c
@@ -79,7 +79,6 @@ typedef struct {
 	igt_fb_t fb_test_pattern;
 	igt_display_t display;
 	data_connector_t *conns;
-	enum igt_commit_style commit;
 	struct timeval first_ts;
 	int linetime_us;
 
@@ -188,23 +187,10 @@ reset_plane(igt_output_t *output)
 	igt_plane_set_fb(primary, NULL);
 }
 
-static void reset_output(igt_output_t *output)
-{
-	igt_output_set_pipe(output, PIPE_NONE);
-}
-
 static void reset_mode(data_t *data)
 {
-	int count;
-	igt_output_t *output;
-	data_connector_t *conns = data->conns;
-
-	for (count = 0; count < data->num_h_tiles; count++) {
-		output = igt_output_from_connector(&data->display,
-						   conns[count].connector);
-		igt_output_set_pipe(output, PIPE_NONE);
-	}
-	igt_display_commit2(&data->display, data->commit);
+	igt_display_reset(&data->display);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 static void test_cleanup(data_t *data)
@@ -215,11 +201,11 @@ static void test_cleanup(data_t *data)
 	for (count = 0; count < data->num_h_tiles; count++) {
 		if (conns[count].output) {
 			reset_plane(conns[count].output);
-			reset_output(conns[count].output);
+			igt_output_set_pipe(conns[count].output, PIPE_NONE);
 		}
 	}
 	igt_remove_fb(data->drm_fd, &data->fb_test_pattern);
-	igt_display_commit2(&data->display, data->commit);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 	memset(conns, 0, sizeof(data_connector_t) * data->num_h_tiles);
 }
 
@@ -529,7 +515,6 @@ static void override_edid(data_t *data)
 	igt_output_t *output;
 	int num_outputs = 0;
 	int num_tiles = 0;
-	drmModeResPtr res;
 
 	igt_require(data->display.n_pipes >= 2);
 
@@ -551,10 +536,7 @@ static void override_edid(data_t *data)
 	num_tiles = min(num_outputs, data->display.n_pipes);
 
 	/* disable everything so that we are sure to get a full modeset */
-	res = drmModeGetResources(data->drm_fd);
-	igt_require(res);
-	kmstest_unset_all_crtcs(data->drm_fd, res);
-	drmModeFreeResources(res);
+	igt_display_reset(&data->display);
 
 	for (int i = 0; i < num_tiles; i++)
 		force_edid_with_tile(data, outputs[i],
@@ -563,28 +545,28 @@ static void override_edid(data_t *data)
 
 static void basic_test(data_t *data, drmEventContext *drm_event, struct pollfd *pfd)
 {
-		int ret;
-
-		get_number_of_h_tiles(data);
-		igt_debug("Number of Horizontal Tiles: %d\n",
-			  data->num_h_tiles);
-		igt_require(data->num_h_tiles > 0);
-		data->conns = calloc(data->num_h_tiles,
-				     sizeof(data_connector_t));
-		igt_assert(data->conns);
-
-		get_connectors(data);
-		setup_mode(data);
-		setup_framebuffer(data);
-		timerclear(&data->first_ts);
-		igt_display_commit_atomic(&data->display,
-			DRM_MODE_ATOMIC_NONBLOCK |
-			DRM_MODE_PAGE_FLIP_EVENT, data);
-		while (!got_all_page_flips(data)) {
-			ret = poll(pfd, 1, 1000);
-			igt_assert(ret == 1);
-			drmHandleEvent(data->drm_fd, drm_event);
-		}
+	int ret;
+
+	get_number_of_h_tiles(data);
+	igt_debug("Number of Horizontal Tiles: %d\n",
+		  data->num_h_tiles);
+	igt_require(data->num_h_tiles > 0);
+	data->conns = calloc(data->num_h_tiles,
+			     sizeof(data_connector_t));
+	igt_assert(data->conns);
+
+	get_connectors(data);
+	setup_mode(data);
+	setup_framebuffer(data);
+	timerclear(&data->first_ts);
+	igt_display_commit_atomic(&data->display,
+		DRM_MODE_ATOMIC_NONBLOCK |
+		DRM_MODE_PAGE_FLIP_EVENT, data);
+	while (!got_all_page_flips(data)) {
+		ret = poll(pfd, 1, 1000);
+		igt_assert(ret == 1);
+		drmHandleEvent(data->drm_fd, drm_event);
+	}
 }
 
 igt_main
@@ -596,14 +578,15 @@ igt_main
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
 		kmstest_set_vt_graphics_mode();
 		igt_display_require(&data.display, data.drm_fd);
+		igt_require(data.display.is_atomic);
+		igt_display_require_output(&data.display);
+
 		igt_display_reset(&data.display);
 
 		pfd.fd = data.drm_fd;
 		pfd.events = POLLIN;
 		drm_event.version = 3;
 		drm_event.page_flip_handler2 = page_flip_handler;
-		data.commit = data.display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY;
-		igt_require(data.commit == COMMIT_ATOMIC);
 
 		get_number_of_h_tiles(&data);
 		igt_debug("Number of real horizontal tiles: %d\n", data.num_h_tiles);
-- 
2.43.2


  parent reply	other threads:[~2024-06-14  8:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11  4:53 [PATCH i-g-t 0/8] IGT KMS Test cleanup Bhanuprakash Modem
2024-06-11  4:53 ` [PATCH i-g-t 1/8] tests/intel/kms_fence_pin_leak: " Bhanuprakash Modem
2024-06-14  5:28   ` B, Jeevan
2024-06-11  4:53 ` [PATCH i-g-t 2/8] tests/intel/kms_pipe_b_c_ivb: " Bhanuprakash Modem
2024-06-12 11:29   ` B, Jeevan
2024-06-11  4:53 ` [PATCH i-g-t 3/8] tests/intel/kms_pwrite_crc: " Bhanuprakash Modem
2024-06-12 11:30   ` B, Jeevan
2024-06-14  8:46     ` B, Jeevan
2024-06-11  4:53 ` [PATCH i-g-t 4/8] tests/kms_hdmi_inject: " Bhanuprakash Modem
2024-06-12 11:32   ` B, Jeevan
2024-06-11  4:53 ` [PATCH i-g-t 5/8] tests/kms_tiled_display: " Bhanuprakash Modem
2024-06-12 12:21   ` Kamil Konieczny
2024-06-14  8:09   ` Bhanuprakash Modem [this message]
2024-06-11  4:53 ` [PATCH i-g-t 6/8] tests/kms_tv_load_detect: " Bhanuprakash Modem
2024-06-12 11:34   ` B, Jeevan
2024-06-11  4:53 ` [PATCH i-g-t 7/8] tests/kms_universal_plane: " Bhanuprakash Modem
2024-06-12 11:35   ` B, Jeevan
2024-06-11  4:53 ` [PATCH i-g-t 8/8] tests/kms_properties: Create dynamic subtests Bhanuprakash Modem
2024-06-12 11:47   ` B, Jeevan
2024-06-11  7:14 ` ✓ Fi.CI.BAT: success for IGT KMS Test cleanup (rev2) Patchwork
2024-06-11  7:19 ` ✗ CI.xeBAT: failure " Patchwork
2024-06-11  9:35 ` ✗ CI.xeFULL: " Patchwork
2024-06-11 11:06 ` ✗ Fi.CI.IGT: " Patchwork
2024-06-14 13:18 ` ✓ CI.xeBAT: success for IGT KMS Test cleanup (rev3) Patchwork
2024-06-14 13:27 ` ✓ Fi.CI.BAT: " Patchwork
2024-06-14 23:06 ` ✓ CI.xeFULL: " Patchwork
2024-06-16 21:11 ` ✗ Fi.CI.IGT: failure " 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=20240614080958.3869795-1-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jeevan.b@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