Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Nidhi Gupta <nidhi1.gupta@intel.com>
Subject: [igt-dev] [PATCH i-g-t 2/2] Revert "tests/kms_invalid_mode: Test Cleanup"
Date: Mon,  7 Nov 2022 17:20:52 +0200	[thread overview]
Message-ID: <20221107152052.29137-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20221107152052.29137-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

This reverts commit 6725767a84109e934ca138d94df0482386c44532.

This was no cleanup. It does fifteen different things and
in the process flat out breaks the test at least on all
non-atomic drivers/platforms.

Cc: Nidhi Gupta <nidhi1.gupta@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_invalid_mode.c | 39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/tests/kms_invalid_mode.c b/tests/kms_invalid_mode.c
index 8c345766d192..40042d4e81a5 100644
--- a/tests/kms_invalid_mode.c
+++ b/tests/kms_invalid_mode.c
@@ -35,6 +35,7 @@ struct _data {
 	enum pipe pipe;
 	igt_display_t display;
 	igt_output_t *output;
+	drmModeResPtr res;
 	int max_dotclock;
 	bool (*adjust_mode)(data_t *data, drmModeModeInfoPtr mode);
 };
@@ -181,29 +182,35 @@ static void
 test_output(data_t *data)
 {
 	igt_output_t *output = data->output;
+	drmModeModeInfo mode;
 	struct igt_fb fb;
 	int ret;
-	drmModeModeInfo *mode;
+	uint32_t crtc_id;
 
-	igt_output_set_pipe(output, data->pipe);
+	/*
+	 * FIXME test every mode we have to be more
+	 * sure everything is really getting rejected?
+	 */
+	mode = *igt_output_get_mode(output);
+	igt_require(data->adjust_mode(data, &mode));
 
-	igt_create_fb(data->drm_fd, 512, 512, DRM_FORMAT_XRGB8888,
+	igt_create_fb(data->drm_fd,
+		      max_t(uint16_t, mode.hdisplay, 64),
+		      max_t(uint16_t, mode.vdisplay, 64),
+		      DRM_FORMAT_XRGB8888,
 		      DRM_FORMAT_MOD_LINEAR,
 		      &fb);
 
-	for_each_connector_mode(output) {
-		mode = &output->config.connector->modes[j__];
-		igt_require(data->adjust_mode(data, mode));
-		igt_output_override_mode(output, mode);
-		ret = igt_display_try_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
-		igt_assert(ret == -EINVAL);
-	}
+	kmstest_unset_all_crtcs(data->drm_fd, data->res);
+
+	crtc_id = data->display.pipes[data->pipe].crtc_id;
+
+	ret = drmModeSetCrtc(data->drm_fd, crtc_id,
+			     fb.fb_id, 0, 0,
+			     &output->id, 1, &mode);
+	igt_assert_lt(ret, 0);
 
 	igt_remove_fb(data->drm_fd, &fb);
-	igt_output_override_mode(output, NULL);
-	/*unset_all_crtcs*/
-	igt_display_reset(&data->display);
-	igt_display_commit(&data->display);
 }
 
 static int i915_max_dotclock(data_t *data)
@@ -283,10 +290,11 @@ igt_main
 		kmstest_set_vt_graphics_mode();
 
 		igt_display_require(&data.display, data.drm_fd);
+		data.res = drmModeGetResources(data.drm_fd);
+		igt_assert(data.res);
 
 		data.max_dotclock = i915_max_dotclock(&data);
 		igt_info("Max dotclock: %d kHz\n", data.max_dotclock);
-		igt_display_require_output(&data.display);
 	}
 
 	igt_describe("Make sure all modesets are rejected when the requested mode is invalid");
@@ -306,6 +314,7 @@ igt_main
 	igt_fixture {
 		igt_display_fini(&data.display);
 		igt_reset_connectors();
+		drmModeFreeResources(data.res);
 		close(data.drm_fd);
 	}
 }
-- 
2.37.4

  reply	other threads:[~2022-11-07 15:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 15:20 [igt-dev] [PATCH i-g-t 1/2] Revert "tests/kms_invalid_mode: Avoid usage of same pipe on multiple outputs" Ville Syrjala
2022-11-07 15:20 ` Ville Syrjala [this message]
2022-11-08 23:55   ` [igt-dev] [PATCH i-g-t 2/2] Revert "tests/kms_invalid_mode: Test Cleanup" Gupta, Nidhi1
2022-11-07 16:21 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] Revert "tests/kms_invalid_mode: Avoid usage of same pipe on multiple outputs" Patchwork
2022-11-08 16:54 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] Revert "tests/kms_invalid_mode: Avoid usage of same pipe on multiple outputs" (rev2) Patchwork
2022-11-08 22:09 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-11-09  0:22 ` [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [i-g-t,1/2] Revert "tests/kms_invalid_mode: Avoid usage of same pipe on multiple outputs" (rev3) 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=20221107152052.29137-2-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=nidhi1.gupta@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