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
Subject: [igt-dev] [i-g-t V4 3/6] tests/kms_flip: Add XE support
Date: Wed, 19 Apr 2023 16:52:40 +0530	[thread overview]
Message-ID: <20230419112243.1719789-4-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230419112243.1719789-1-bhanuprakash.modem@intel.com>

Add XE driver support for kms tests.

V2: - Minor cleanups
V3: - Don't run the test instead of SKIP

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
---
 tests/kms_flip.c | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 5e82f4a2f..e4c98b8ec 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -44,6 +44,7 @@
 
 #include "i915/gem_create.h"
 #include "igt_stats.h"
+#include "xe/xe_query.h"
 
 #define TEST_DPMS		(1 << 0)
 
@@ -1353,9 +1354,13 @@ restart:
 	/* 256 MB is usually the maximum mappable aperture,
 	 * (make it 4x times that to ensure failure) */
 	if (o->flags & TEST_BO_TOOBIG) {
-		igt_skip_on(!is_i915_device(drm_fd));
+		igt_skip_on(!is_intel_device(drm_fd));
 		bo_size = 4*gem_mappable_aperture_size(drm_fd);
-		igt_require(bo_size < gem_global_aperture_size(drm_fd));
+
+		if (is_i915_device(drm_fd))
+			igt_require(bo_size < gem_global_aperture_size(drm_fd));
+		else
+			igt_require(bo_size < (1ULL << xe_va_bits(drm_fd)));
 	}
 
 	o->fb_ids[0] = igt_create_fb(drm_fd, o->fb_width, o->fb_height,
@@ -1552,14 +1557,19 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 		__run_test_on_crtc_set(o, crtc_idxs, crtc_count, duration_ms);
 }
 
-static int run_test(int duration, int flags)
+static void run_test(int duration, int flags)
 {
 	struct test_output o;
 	int i, n, modes = 0;
 
-	igt_require((flags & TEST_HANG) == 0 || !is_wedged(drm_fd));
+	/* No tiling support in XE. */
+	if (is_xe_device(drm_fd) && flags & TEST_FENCE_STRESS)
+		return;
+
+	igt_require((flags & TEST_HANG) == 0 ||
+		    (is_i915_device(drm_fd) && !is_wedged(drm_fd)));
 	igt_require(!(flags & TEST_FENCE_STRESS) ||
-		    gem_available_fences(drm_fd));
+		    (is_i915_device(drm_fd) && gem_available_fences(drm_fd)));
 
 	resources = drmModeGetResources(drm_fd);
 	igt_require(resources);
@@ -1618,17 +1628,21 @@ static int run_test(int duration, int flags)
 	}
 
 	drmModeFreeResources(resources);
-	return 1;
 }
 
-static int run_pair(int duration, int flags)
+static void run_pair(int duration, int flags)
 {
 	struct test_output o;
 	int i, j, m, n, modes = 0;
 
-	igt_require((flags & TEST_HANG) == 0 || !is_wedged(drm_fd));
+	/* No tiling support in XE. */
+	if (is_xe_device(drm_fd) && flags & TEST_FENCE_STRESS)
+		return;
+
+	igt_require((flags & TEST_HANG) == 0 ||
+		    (is_i915_device(drm_fd) && !is_wedged(drm_fd)));
 	igt_require(!(flags & TEST_FENCE_STRESS) ||
-		    gem_available_fences(drm_fd));
+		    (is_i915_device(drm_fd) && gem_available_fences(drm_fd)));
 
 	resources = drmModeGetResources(drm_fd);
 	igt_require(resources);
@@ -1693,7 +1707,6 @@ static int run_pair(int duration, int flags)
 	}
 
 	drmModeFreeResources(resources);
-	return 1;
 }
 
 static void get_timestamp_format(void)
@@ -1813,6 +1826,9 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)
 		igt_install_exit_handler(kms_flip_exit_handler);
 		get_timestamp_format();
 
+		if (is_xe_device(drm_fd))
+			xe_device_get(drm_fd);
+
 		if (is_i915_device(drm_fd)) {
 			bops = buf_ops_create(drm_fd);
 		}
@@ -1878,6 +1894,10 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)
 	}
 	igt_stop_signal_helper();
 
-	igt_fixture
+	igt_fixture {
+		if (is_xe_device(drm_fd))
+			xe_device_put(drm_fd);
+
 		close(drm_fd);
+	}
 }
-- 
2.40.0

  parent reply	other threads:[~2023-04-19 11:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19 11:22 [igt-dev] [i-g-t V4 0/6] Enable KMS tests in XE BAT Bhanuprakash Modem
2023-04-19 11:22 ` [igt-dev] [i-g-t V4 1/6] lib: Use i915 namespace for XE debugfs Bhanuprakash Modem
2023-04-19 11:22 ` [igt-dev] [i-g-t V4 2/6] tests/kms_cursor_legacy: Add XE support Bhanuprakash Modem
2023-04-19 11:22 ` Bhanuprakash Modem [this message]
2023-04-19 11:22 ` [igt-dev] [i-g-t V4 4/6] tests/i915/kms_psr: Use linear modifier to create FB Bhanuprakash Modem
2023-04-20  5:04   ` Nautiyal, Ankit K
2023-04-20  5:12     ` Karthik B S
2023-04-20  5:19       ` Modem, Bhanuprakash
2023-04-19 11:22 ` [igt-dev] [i-g-t V4 5/6] tests/i915/kms_psr*: Add XE support Bhanuprakash Modem
2023-04-20  5:08   ` Karthik B S
2023-04-19 11:22 ` [igt-dev] [i-g-t V4 6/6] xe-fast-feedback: Add kms tests to XE BAT Bhanuprakash Modem
2023-04-19 16:52 ` [igt-dev] ✓ Fi.CI.BAT: success for Enable KMS tests in XE BAT (rev5) Patchwork
2023-04-19 20:20 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20230419112243.1719789-4-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.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