Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: igt-dev@lists.freedesktop.org
Cc: Rob Clark <robdclark@chromium.org>
Subject: [PATCH] tests/kms_universal_plane: Re-work expectations for non-intel hw
Date: Wed, 10 Jan 2024 12:04:34 -0800	[thread overview]
Message-ID: <20240110200434.218120-1-robdclark@gmail.com> (raw)

From: Rob Clark <robdclark@chromium.org>

The expectation assumptions do not fit for non-intel hw.  So re-work the
expectations and add msm support.

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 tests/kms_universal_plane.c | 102 +++++++++++++++++++++++++-----------
 1 file changed, 72 insertions(+), 30 deletions(-)

diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index 6a39f93cc5aa..3158ff816046 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -402,8 +402,7 @@ sanity_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 	sanity_test_t test = { .data = data };
 	igt_plane_t *primary;
 	drmModeModeInfo *mode;
-	int i;
-	int expect = 0;
+	int i, ret;
 
 	igt_output_set_pipe(output, pipe);
 	mode = igt_output_get_mode(output);
@@ -418,43 +417,86 @@ sanity_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 
 	/*
 	 * Try to use universal plane API to set primary plane that
-	 * doesn't cover CRTC (should fail on pre-gen9 and succeed on
-	 * gen9+).
+	 * doesn't cover CRTC.
 	 */
 	igt_plane_set_fb(primary, &test.undersized_fb);
-	if (is_intel_device(data->drm_fd))
-		expect = (data->display_ver < 9) ? -EINVAL : 0;
-	igt_assert(igt_display_try_commit2(&data->display, COMMIT_UNIVERSAL) == expect);
+	ret = igt_display_try_commit2(&data->display, COMMIT_UNIVERSAL);
+
+	if (is_intel_device(data->drm_fd)) {
+		/* should fail on pre-gen9 and succeed on gen9+: */
+		if (data->display_ver < 9)
+			igt_assert_eq(ret, -EINVAL);
+		else
+			igt_assert_eq(ret, 0);
+	} else if (is_msm_device(data->drm_fd)) {
+		/* Should be supported on all gens: */
+		igt_assert_eq(ret, 0);
+	} else {
+		igt_assert_eq(ret, 0);
+	}
 
-	/* Same as above, but different plane positioning. */
+	/* Same as above, but different plane positioning: */
 	igt_plane_set_position(primary, 100, 100);
-	igt_assert(igt_display_try_commit2(&data->display, COMMIT_UNIVERSAL) == expect);
+	ret = igt_display_try_commit2(&data->display, COMMIT_UNIVERSAL);
+
+	if (is_intel_device(data->drm_fd)) {
+		/* should fail on pre-gen9 and succeed on gen9+: */
+		if (data->display_ver < 9)
+			igt_assert_eq(ret, -EINVAL);
+		else
+			igt_assert_eq(ret, 0);
+	} else if (is_msm_device(data->drm_fd)) {
+		/* Should be supported on all gens: */
+		igt_assert_eq(ret, 0);
+	} else {
+		igt_assert_eq(ret, 0);
+	}
 
 	igt_plane_set_position(primary, 0, 0);
 
-	/* Try to use universal plane API to scale down (should fail on pre-gen9) */
-	if (is_intel_device(data->drm_fd))
-		expect = (data->display_ver < 9) ? -ERANGE : 0;
-	igt_assert(drmModeSetPlane(data->drm_fd, primary->drm_plane->plane_id,
-				   output->config.crtc->crtc_id,
-				   test.oversized_fb.fb_id, 0,
-				   0, 0,
-				   mode->hdisplay + 100,
-				   mode->vdisplay + 100,
-				   IGT_FIXED(0,0), IGT_FIXED(0,0),
-				   IGT_FIXED(mode->hdisplay,0),
-				   IGT_FIXED(mode->vdisplay,0)) == expect);
+	/* Try to use universal plane API to scale down */
+	ret = drmModeSetPlane(data->drm_fd, primary->drm_plane->plane_id,
+			      output->config.crtc->crtc_id,
+			      test.oversized_fb.fb_id, 0,
+			      0, 0,
+			      mode->hdisplay + 100,
+			      mode->vdisplay + 100,
+			      IGT_FIXED(0,0), IGT_FIXED(0,0),
+			      IGT_FIXED(mode->hdisplay,0),
+			      IGT_FIXED(mode->vdisplay,0));
+
+	if (is_intel_device(data->drm_fd)) {
+		/* should fail on pre-gen9 and succeed on gen9+: */
+		if (data->display_ver < 9)
+			igt_assert_eq(ret, -ERANGE);
+		else
+			igt_assert_eq(ret, 0);
+	} else {
+		/* Could succeed or fail with -ERANGE depending on hw limits: */
+		igt_assert((ret == 0) || (ret == -ERANGE));
+	}
 
 	/* Try to use universal plane API to scale up (should fail on pre-gen9) */
-	igt_assert(drmModeSetPlane(data->drm_fd, primary->drm_plane->plane_id,
-				   output->config.crtc->crtc_id,
-				   test.oversized_fb.fb_id, 0,
-				   0, 0,
-				   mode->hdisplay,
-				   mode->vdisplay,
-				   IGT_FIXED(0,0), IGT_FIXED(0,0),
-				   IGT_FIXED(mode->hdisplay - 100,0),
-				   IGT_FIXED(mode->vdisplay - 100,0)) == expect);
+	ret = drmModeSetPlane(data->drm_fd, primary->drm_plane->plane_id,
+			      output->config.crtc->crtc_id,
+			      test.oversized_fb.fb_id, 0,
+			      0, 0,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      IGT_FIXED(0,0), IGT_FIXED(0,0),
+			      IGT_FIXED(mode->hdisplay - 100,0),
+			      IGT_FIXED(mode->vdisplay - 100,0));
+
+	if (is_intel_device(data->drm_fd)) {
+		/* should fail on pre-gen9 and succeed on gen9+: */
+		if (data->display_ver < 9)
+			igt_assert_eq(ret, -ERANGE);
+		else
+			igt_assert_eq(ret, 0);
+	} else {
+		/* Could succeed or fail with -ERANGE depending on hw limits: */
+		igt_assert((ret == 0) || (ret == -ERANGE));
+	}
 
 	/* Find other crtcs and try to program our primary plane on them */
 	for (i = 0; i < test.moderes->count_crtcs; i++)
-- 
2.43.0

             reply	other threads:[~2024-01-10 20:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 20:04 Rob Clark [this message]
2024-01-10 20:59 ` ✗ Fi.CI.BAT: failure for tests/kms_universal_plane: Re-work expectations for non-intel hw Patchwork
2024-01-10 22:06 ` ✓ CI.xeBAT: success " Patchwork
2024-01-11 13:36 ` [PATCH] " Kamil Konieczny
2024-01-11 17:30   ` Rob Clark
2024-01-16  9:42     ` Kamil Konieczny
2024-01-16 15:55       ` Rob Clark
2024-01-18 11:18         ` Kamil Konieczny

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=20240110200434.218120-1-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=robdclark@chromium.org \
    /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