[i-g-t] tests/i915/kms_frontbuffer_tracking: Add XE support

Bhanuprakash Modem bhanuprakash.modem at intel.com
Fri Jun 9 06:31:34 UTC 2023


Cc: Kunal Joshi <kunal1.joshi at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/i915/kms_frontbuffer_tracking.c | 83 ++++++++++++++++++++-------
 1 file changed, 61 insertions(+), 22 deletions(-)

diff --git a/tests/i915/kms_frontbuffer_tracking.c b/tests/i915/kms_frontbuffer_tracking.c
index 650e14a77..f04c12811 100644
--- a/tests/i915/kms_frontbuffer_tracking.c
+++ b/tests/i915/kms_frontbuffer_tracking.c
@@ -1307,10 +1307,14 @@ static void init_crcs(enum pixel_format format, enum tiling_type tiling,
 		for (r = 0; r < pattern->n_rects; r++)
 			for (r_ = 0; r_ <= r; r_++)
 				draw_rect_igt_fb(pattern, &tmp_fbs[r],
-						 IGT_DRAW_PWRITE, r_);
+						 igt_draw_supports_method(drm.fd, IGT_DRAW_PWRITE) ?
+							IGT_DRAW_PWRITE : IGT_DRAW_RENDER,
+						 r_);
 	} else {
 		for (r = 0; r < pattern->n_rects; r++)
-			draw_rect_igt_fb(pattern, &tmp_fbs[r], IGT_DRAW_PWRITE,
+			draw_rect_igt_fb(pattern, &tmp_fbs[r],
+					 igt_draw_supports_method(drm.fd, IGT_DRAW_PWRITE) ?
+						IGT_DRAW_PWRITE : IGT_DRAW_RENDER,
 					 r);
 	}
 
@@ -1338,9 +1342,22 @@ static void init_crcs(enum pixel_format format, enum tiling_type tiling,
 
 static void setup_drm(void)
 {
-	drm.fd = drm_open_driver_master(DRIVER_INTEL);
+	drm.fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
 	drm.debugfs = igt_debugfs_dir(drm.fd);
 
+	/*
+	 * Assert if xe device and tiling method specified
+	 * in opt_handler
+	 */
+	igt_assert(is_i915_device(drm.fd) ||
+		   (is_xe_device(drm.fd) && opt.tiling == TILING_LINEAR));
+
+	/*
+	 * XE only support linear tiling
+	 */
+	if (is_xe_device(drm.fd))
+		opt.tiling = TILING_LINEAR;
+
 	kmstest_set_vt_graphics_mode();
 	igt_display_require(&drm.display, drm.fd);
 
@@ -1560,7 +1577,8 @@ static void do_flush(const struct test_mode *t)
 	struct modeset_params *params = pick_params(t);
 	struct fb_region *target = pick_target(t, params);
 
-	gem_set_domain(drm.fd, target->fb->gem_handle, I915_GEM_DOMAIN_GTT, 0);
+	if (is_i915_device(drm.fd))
+		gem_set_domain(drm.fd, target->fb->gem_handle, I915_GEM_DOMAIN_GTT, 0);
 }
 
 #define DONT_ASSERT_CRC			(1 << 0)
@@ -2034,9 +2052,6 @@ static void draw_subtest(const struct test_mode *t)
 	struct modeset_params *params = pick_params(t);
 	struct fb_region *target;
 
-	igt_skip_on(t->method == IGT_DRAW_MMAP_GTT &&
-		    !gem_has_mappable_ggtt(drm.fd));
-
 	switch (t->screen) {
 	case SCREEN_PRIM:
 		if (t->method != IGT_DRAW_MMAP_GTT && t->plane == PLANE_PRI)
@@ -2136,9 +2151,8 @@ static void multidraw_subtest(const struct test_mode *t)
 				  igt_draw_get_method_name(m1),
 				  igt_draw_get_method_name(m2));
 
-			if ((m1 == IGT_DRAW_MMAP_GTT ||
-			     m2 == IGT_DRAW_MMAP_GTT) &&
-			    !gem_has_mappable_ggtt(drm.fd))
+			if (!igt_draw_supports_method(drm.fd, m1) ||
+			    !igt_draw_supports_method(drm.fd, m2))
 				continue;
 
 			for (r = 0; r < pattern->n_rects; r++) {
@@ -2407,9 +2421,6 @@ static void flip_subtest(const struct test_mode *t)
 	struct draw_pattern_info *pattern = &pattern1;
 	enum color bg_color;
 
-	igt_skip_on(t->method == IGT_DRAW_MMAP_GTT &&
-		    !gem_has_mappable_ggtt(drm.fd));
-
 	switch (t->screen) {
 	case SCREEN_PRIM:
 		assertions |= ASSERT_LAST_ACTION_CHANGED;
@@ -2469,9 +2480,6 @@ static void fliptrack_subtest(const struct test_mode *t, enum flip_type type)
 	struct modeset_params *params = pick_params(t);
 	struct draw_pattern_info *pattern = &pattern1;
 
-	igt_skip_on(t->method == IGT_DRAW_MMAP_GTT &&
-		    !gem_has_mappable_ggtt(drm.fd));
-
 	prepare_subtest(t, pattern);
 
 	create_fb(t->format, params->primary.fb->width, params->primary.fb->height,
@@ -2881,9 +2889,6 @@ static void farfromfence_subtest(const struct test_mode *t)
 	int max_height, assertions = 0;
 	int gen = intel_display_ver(intel_get_drm_devid(drm.fd));
 
-	igt_skip_on(t->method == IGT_DRAW_MMAP_GTT &&
-		    !gem_has_mappable_ggtt(drm.fd));
-
 	switch (gen) {
 	case 2:
 		max_height = 2048;
@@ -3167,8 +3172,7 @@ static void basic_subtest(const struct test_mode *t)
 	fb1 = params->primary.fb;
 
 	for (r = 0, method = 0; method < IGT_DRAW_METHOD_COUNT; method++) {
-		if (method == IGT_DRAW_MMAP_GTT &&
-		    !gem_has_mappable_ggtt(drm.fd))
+		if (!igt_draw_supports_method(drm.fd, method))
 			continue;
 
 		if (r == pattern->n_rects) {
@@ -3473,6 +3477,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 	}
 
 	TEST_MODE_ITER_BEGIN(t)
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		igt_subtest_f("%s-%s-%s-%s-%s-draw-%s",
 			      feature_str(t.feature),
 			      pipes_str(t.pipes),
@@ -3489,6 +3496,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		    (!opt.show_hidden && t.method != IGT_DRAW_BLT))
 			continue;
 
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		for (t.flip = 0; t.flip < FLIP_COUNT; t.flip++)
 			igt_subtest_f("%s-%s-%s-%s-%sflip-%s",
 				      feature_str(t.feature),
@@ -3507,6 +3517,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		    (t.feature & FEATURE_FBC) == 0)
 			continue;
 
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		igt_subtest_f("%s-%s-%s-fliptrack-%s",
 			      feature_str(t.feature),
 			      pipes_str(t.pipes),
@@ -3521,6 +3534,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		    t.plane == PLANE_PRI)
 			continue;
 
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		igt_subtest_f("%s-%s-%s-%s-%s-move",
 			      feature_str(t.feature),
 			      pipes_str(t.pipes),
@@ -3544,6 +3560,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		    t.plane != PLANE_SPR)
 			continue;
 
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		igt_subtest_f("%s-%s-%s-%s-%s-fullscreen",
 			      feature_str(t.feature),
 			      pipes_str(t.pipes),
@@ -3560,6 +3579,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		    (!opt.show_hidden && t.fbs != FBS_INDIVIDUAL))
 			continue;
 
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		igt_subtest_f("%s-%s-%s-%s-multidraw",
 			      feature_str(t.feature),
 			      pipes_str(t.pipes),
@@ -3576,6 +3598,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		    t.method != IGT_DRAW_MMAP_GTT)
 			continue;
 
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		igt_subtest_f("%s-farfromfence-%s",
 			      feature_str(t.feature),
 			      igt_draw_get_method_name(t.method))
@@ -3589,6 +3614,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		    t.fbs != FBS_INDIVIDUAL)
 			continue;
 
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		for (t.format = 0; t.format < FORMAT_COUNT; t.format++) {
 			/* Skip what we already tested. */
 			if (t.format == FORMAT_DEFAULT)
@@ -3608,6 +3636,10 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		    t.plane != PLANE_PRI ||
 		    t.method != IGT_DRAW_BLT)
 			continue;
+
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		igt_subtest_f("%s-%s-scaledprimary",
 			      feature_str(t.feature),
 			      fbs_str(t.fbs))
@@ -3622,6 +3654,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		    t.method != IGT_DRAW_BLT)
 			continue;
 
+		igt_fixture
+			igt_require(igt_draw_supports_method(drm.fd, t.method));
+
 		igt_subtest_f("%s-modesetfrombusy", feature_str(t.feature))
 			modesetfrombusy_subtest(&t);
 
@@ -3646,6 +3681,9 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 					      feature_str(t.feature),
 					      tiling_str(t.tiling)) {
 
+					if (is_xe_device(drm.fd))
+						igt_require(t.tiling == TILING_LINEAR);
+
 					/* Tiling Y is only supported on GEN9+ */
 					if (t.tiling == TILING_Y) {
 						igt_require(AT_LEAST_GEN(devid, 9));
@@ -3684,7 +3722,8 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 	t.flip = FLIP_PAGEFLIP;
 	t.tiling = opt.tiling;
 	igt_subtest("basic") {
-		igt_require_gem(drm.fd);
+		if (is_xe_device(drm.fd))
+			igt_require_gem(drm.fd);
 		basic_subtest(&t);
 	}
 
-- 
2.40.0



More information about the Intel-gfx-trybot mailing list