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 V2 4/5] tests/i915/kms_psr*: Add XE support
Date: Tue, 18 Apr 2023 20:58:21 +0530	[thread overview]
Message-ID: <20230418152822.1655272-5-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230418152822.1655272-1-bhanuprakash.modem@intel.com>

Add XE driver support for kms tests.

V2: - Fix unknown subtest error on CI

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/i915/kms_psr.c             | 40 +++++++++++++++++++++++++++-----
 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, 37 insertions(+), 9 deletions(-)

diff --git a/tests/i915/kms_psr.c b/tests/i915/kms_psr.c
index 3efe1faec8e..4565acd8a1e 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);
@@ -547,6 +566,9 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
 			igt_subtest_f("%sprimary_%s",
 				      append_subtest_name[data.op_psr_mode],
 				      op_str(op)) {
+				igt_skip_on(is_xe_device(data.drm_fd) &&
+					    (op == MMAP_CPU || op == MMAP_GTT));
+
 				data.op = op;
 				data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
 				test_setup(&data);
@@ -561,6 +583,9 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
 			igt_subtest_f("%ssprite_%s",
 				      append_subtest_name[data.op_psr_mode],
 				      op_str(op)) {
+				igt_skip_on(is_xe_device(data.drm_fd) &&
+					    (op == MMAP_CPU || op == MMAP_GTT));
+
 				data.op = op;
 				data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
 				test_setup(&data);
@@ -573,6 +598,9 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
 			igt_subtest_f("%scursor_%s",
 				      append_subtest_name[data.op_psr_mode],
 				      op_str(op)) {
+				igt_skip_on(is_xe_device(data.drm_fd) &&
+					    (op == MMAP_CPU || op == MMAP_GTT));
+
 				data.op = op;
 				data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
 				test_setup(&data);
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-18 15:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 15:28 [igt-dev] [i-g-t V2 0/5] Enable KMS tests in XE BAT Bhanuprakash Modem
2023-04-18 15:28 ` [igt-dev] [i-g-t V2 1/5] lib: Use i915 namespace for XE debugfs Bhanuprakash Modem
2023-04-18 15:28 ` [igt-dev] [i-g-t V2 2/5] tests/kms_cursor_legacy: Add XE support Bhanuprakash Modem
2023-04-18 15:28 ` [igt-dev] [i-g-t V2 3/5] tests/kms_flip: " Bhanuprakash Modem
2023-04-19  5:18   ` Karthik B S
2023-04-19  6:30   ` [igt-dev] [i-g-t V3 " Bhanuprakash Modem
2023-04-19 10:22     ` Karthik B S
2023-04-18 15:28 ` Bhanuprakash Modem [this message]
2023-04-18 15:28 ` [igt-dev] [i-g-t V2 5/5] xe-fast-feedback: Add kms tests to XE BAT Bhanuprakash Modem
2023-04-18 16:26 ` [igt-dev] ✓ Fi.CI.BAT: success for Enable KMS tests in XE BAT (rev3) Patchwork
2023-04-18 19:45 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-04-19  7:14 ` [igt-dev] ✓ Fi.CI.BAT: success for Enable KMS tests in XE BAT (rev4) Patchwork
2023-04-19  8:33 ` [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=20230418152822.1655272-5-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