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 6/7] tests/i915/kms_psr: Add XE support
Date: Thu, 13 Apr 2023 21:57:31 +0530	[thread overview]
Message-ID: <20230413162732.1155058-7-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230413162732.1155058-1-bhanuprakash.modem@intel.com>

Add XE driver support for kms tests.

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/i915/kms_psr.c             | 39 +++++++++++++++++++++++++++-----
 tests/i915/kms_psr2_sf.c         |  2 +-
 tests/i915/kms_psr2_su.c         |  2 +-
 tests/i915/kms_psr_stress_test.c |  2 +-
 4 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/tests/i915/kms_psr.c b/tests/i915/kms_psr.c
index 3efe1faec8e..7d49377e95a 100644
--- a/tests/i915/kms_psr.c
+++ b/tests/i915/kms_psr.c
@@ -29,6 +29,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
+#include "xe/xe_ioctl.h"
 
 enum operations {
 	PAGE_FLIP,
@@ -181,7 +182,8 @@ static void fill_blt(data_t *data, const struct igt_fb *fb, unsigned char color)
 	intel_bb_destroy(ibb);
 	intel_buf_destroy(dst);
 
-	gem_bo_busy(data->drm_fd, fb->gem_handle);
+	if (is_i915_device(data->drm_fd))
+		gem_bo_busy(data->drm_fd, fb->gem_handle);
 }
 
 static void fill_render(data_t *data, const struct igt_fb *fb,
@@ -204,7 +206,16 @@ static void fill_render(data_t *data, const struct igt_fb *fb,
 
 	src = intel_buf_create(data->bops, width, height, fb->plane_bpp[0],
 			       0, tiling, 0);
-	gem_write(data->drm_fd, src->handle, 0, buf, 4);
+
+	if (is_i915_device(data->drm_fd)) {
+		gem_write(data->drm_fd, src->handle, 0, buf, 4);
+	} else {
+		void *map = xe_bo_mmap_ext(data->drm_fd, src->handle, 4,
+					   PROT_READ | PROT_WRITE);
+
+		memcpy(map, buf, 4);
+		gem_munmap(map, 4);
+	}
 
 	rendercopy(ibb,
 		   src, 0, 0, 0xff, 0xff,
@@ -214,7 +225,8 @@ static void fill_render(data_t *data, const struct igt_fb *fb,
 	intel_buf_destroy(src);
 	intel_buf_destroy(dst);
 
-	gem_bo_busy(data->drm_fd, fb->gem_handle);
+	if (is_i915_device(data->drm_fd))
+		gem_bo_busy(data->drm_fd, fb->gem_handle);
 }
 
 static bool sink_support(data_t *data, enum psr_mode mode)
@@ -256,6 +268,11 @@ static bool drrs_disabled(data_t *data)
 {
 	char buf[512];
 
+	/*
+	 * FIXME: As of now, XE's debugfs is using i915 namespace, once Kernel
+	 * changes got landed, please update this logic to use XE specific
+	 * debugfs.
+	 */
 	igt_debugfs_simple_read(data->debugfs_fd, "i915_drrs_status",
 			 buf, sizeof(buf));
 
@@ -388,7 +405,8 @@ static void setup_test_plane(data_t *data, int test_plane)
 	igt_create_color_fb(data->drm_fd,
 			    data->mode->hdisplay, data->mode->vdisplay,
 			    DRM_FORMAT_XRGB8888,
-			    I915_FORMAT_MOD_X_TILED,
+			    is_i915_device(data->drm_fd) ?
+				I915_FORMAT_MOD_X_TILED : DRM_FORMAT_MOD_LINEAR,
 			    0.0, 1.0, 0.0,
 			    &data->fb_green);
 
@@ -416,7 +434,8 @@ static void setup_test_plane(data_t *data, int test_plane)
 		igt_create_color_fb(data->drm_fd,
 				    white_h, white_v,
 				    DRM_FORMAT_XRGB8888,
-				    I915_FORMAT_MOD_X_TILED,
+				    is_i915_device(data->drm_fd) ?
+					I915_FORMAT_MOD_X_TILED : DRM_FORMAT_MOD_LINEAR,
 				    1.0, 1.0, 1.0,
 				    &data->fb_white);
 		break;
@@ -510,7 +529,7 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
 	};
 
 	igt_fixture {
-		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
 		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
 		data.devid = intel_get_drm_devid(data.drm_fd);
@@ -542,6 +561,10 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
 		}
 
 		for (op = PAGE_FLIP; op <= RENDER; op++) {
+			if (is_xe_device(data.drm_fd) &&
+			    (op == MMAP_CPU || op == MMAP_GTT))
+				continue;
+
 			igt_describe("Check if psr is detecting page-flipping,memory mapping and "
 					"rendering operations performed on primary planes");
 			igt_subtest_f("%sprimary_%s",
@@ -556,6 +579,10 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
 		}
 
 		for (op = MMAP_GTT; op <= PLANE_ONOFF; op++) {
+			if (is_xe_device(data.drm_fd) &&
+			    (op == MMAP_CPU || op == MMAP_GTT))
+				continue;
+
 			igt_describe("Check if psr is detecting memory mapping,rendering "
 					"and plane operations performed on sprite planes");
 			igt_subtest_f("%ssprite_%s",
diff --git a/tests/i915/kms_psr2_sf.c b/tests/i915/kms_psr2_sf.c
index ffaae68b3e6..4cf9864409c 100644
--- a/tests/i915/kms_psr2_sf.c
+++ b/tests/i915/kms_psr2_sf.c
@@ -898,7 +898,7 @@ igt_main
 	igt_fixture {
 		drmModeResPtr res;
 
-		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
 		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
 
diff --git a/tests/i915/kms_psr2_su.c b/tests/i915/kms_psr2_su.c
index 3e0a78f24b2..65e67b8c9be 100644
--- a/tests/i915/kms_psr2_su.c
+++ b/tests/i915/kms_psr2_su.c
@@ -297,7 +297,7 @@ igt_main
 	igt_fixture {
 		struct itimerspec interval;
 
-		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
 		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
 
diff --git a/tests/i915/kms_psr_stress_test.c b/tests/i915/kms_psr_stress_test.c
index 26e222a27b6..a4cb3194ebe 100644
--- a/tests/i915/kms_psr_stress_test.c
+++ b/tests/i915/kms_psr_stress_test.c
@@ -331,7 +331,7 @@ igt_main
 	data_t data = {};
 
 	igt_fixture {
-		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
 		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
 		data.bops = buf_ops_create(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
-- 
2.40.0

  parent reply	other threads:[~2023-04-13 16:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 16:27 [igt-dev] [i-g-t 0/7] Enable KMS tests in XE BAT Bhanuprakash Modem
2023-04-13 16:27 ` [igt-dev] [i-g-t 1/7] lib/intel_bufops: Fix bops creation to support XE Bhanuprakash Modem
2023-04-17 10:57   ` Zbigniew Kempczyński
2023-04-13 16:27 ` [igt-dev] [i-g-t 2/7] lib/igt_fb: Add copy engine support for XE Bhanuprakash Modem
2023-04-13 16:27 ` [igt-dev] [i-g-t 3/7] lib: Use i915 namespace for XE debugfs Bhanuprakash Modem
2023-04-17  5:07   ` Karthik B S
2023-04-17  7:05   ` [igt-dev] [i-g-t V2 " Bhanuprakash Modem
2023-04-17 10:59   ` [igt-dev] [i-g-t " Zbigniew Kempczyński
2023-04-13 16:27 ` [igt-dev] [i-g-t 4/7] tests/kms_cursor_legacy: Add XE support Bhanuprakash Modem
2023-04-17  5:03   ` Karthik B S
2023-04-13 16:27 ` [igt-dev] [i-g-t 5/7] tests/kms_flip: " Bhanuprakash Modem
2023-04-18  9:34   ` Karthik B S
2023-04-13 16:27 ` Bhanuprakash Modem [this message]
2023-04-13 16:27 ` [igt-dev] [i-g-t 7/7] xe-fast-feedback: Add kms tests to XE BAT Bhanuprakash Modem
2023-04-18  9:38   ` Karthik B S
2023-04-13 17:39 ` [igt-dev] ✓ Fi.CI.BAT: success for Enable KMS tests in " Patchwork
2023-04-13 22:11 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-04-17 11:01 ` [igt-dev] ✓ Fi.CI.BAT: success for Enable KMS tests in XE BAT (rev2) Patchwork
2023-04-17 16:43 ` [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=20230413162732.1155058-7-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