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 5/6] tests/i915/kms_psr*: Add XE support
Date: Wed, 19 Apr 2023 16:52:42 +0530	[thread overview]
Message-ID: <20230419112243.1719789-6-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230419112243.1719789-1-bhanuprakash.modem@intel.com>

Add XE driver support for kms tests.

V2: - Fix unknown subtest error on CI
V3: - Rebase

Cc: Karthik B S <karthik.b.s@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/i915/kms_psr.c             | 34 ++++++++++++++++++++++++++++----
 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, 33 insertions(+), 7 deletions(-)

diff --git a/tests/i915/kms_psr.c b/tests/i915/kms_psr.c
index dfc2fbb65..0e8d7f4f0 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));
 
@@ -510,7 +527,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 +564,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 +581,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 +596,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 ffaae68b3..4cf986440 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 3e0a78f24..65e67b8c9 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 26e222a27..a4cb3194e 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-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 ` [igt-dev] [i-g-t V4 3/6] tests/kms_flip: " Bhanuprakash Modem
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 ` Bhanuprakash Modem [this message]
2023-04-20  5:08   ` [igt-dev] [i-g-t V4 5/6] tests/i915/kms_psr*: Add XE support 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-6-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