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, zbigniew.kempczynski@intel.com,
	mchehab@kernel.org, jani.nikula@intel.com
Subject: [igt-dev] [i-g-t 3/5] tests/kms_addfb_basic: Add XE support
Date: Mon, 20 Mar 2023 15:30:15 +0530	[thread overview]
Message-ID: <20230320100017.2913328-4-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230320100017.2913328-1-bhanuprakash.modem@intel.com>

Add XE driver support for kms tests.

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_addfb_basic.c | 42 +++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index b4526eee6..bf90a9aa1 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -41,6 +41,8 @@
 #include "igt_rand.h"
 #include "igt_device.h"
 #include "i915/intel_memory_region.h"
+#include "xe/xe_ioctl.h"
+#include "xe/xe_query.h"
 
 uint32_t gem_bo;
 uint32_t gem_bo_small;
@@ -121,7 +123,7 @@ static void invalid_tests(int fd)
 
 	igt_describe("Check if addfb2 call works for clobbered modifier");
 	igt_subtest("clobberred-modifier") {
-		igt_require_intel(fd);
+		igt_require_i915(fd);
 		igt_require(gem_available_fences(fd) > 0);
 		f.flags = 0;
 		f.modifier[0] = 0;
@@ -139,10 +141,17 @@ static void invalid_tests(int fd)
 		uint64_t size;
 
 		igt_require_intel(fd);
-		igt_require(gem_has_lmem(fd));
 		igt_calc_fb_size(fd, f.width, f.height,
 				DRM_FORMAT_XRGB8888, 0, &size, &stride);
-		handle = gem_create_in_memory_regions(fd, size, REGION_SMEM);
+
+		if (is_i915_device(fd)) {
+			igt_require(gem_has_lmem(fd));
+			handle = gem_create_in_memory_regions(fd, size, REGION_SMEM);
+		} else {
+			igt_require(xe_has_vram(fd));
+			handle = xe_bo_create_flags(fd, 0, size, vram_memory(fd, 0));
+		}
+
 		f.handles[0] = handle;
 		do_ioctl_err(fd, DRM_IOCTL_MODE_ADDFB2, &f, EREMOTE);
 	}
@@ -323,7 +332,7 @@ static void tiling_tests(int fd)
 
 	igt_subtest_group {
 		igt_fixture {
-			igt_require_intel(fd);
+			igt_require_i915(fd);
 			tiled_x_bo = igt_create_bo_with_dimensions(fd, 1024, 1024,
 				DRM_FORMAT_XRGB8888, I915_FORMAT_MOD_X_TILED,
 				1024*4, NULL, NULL, NULL);
@@ -494,7 +503,7 @@ static void size_tests(int fd)
 
 	igt_describe("Test that addfb2 call fails correctly with small buffer object after changing tile");
 	igt_subtest("bo-too-small-due-to-tiling") {
-		igt_require_intel(fd);
+		igt_require_i915(fd);
 		igt_require(gem_available_fences(fd) > 0);
 		gem_set_tiling(fd, gem_bo_small, I915_TILING_X, 1024*4);
 		do_ioctl_err(fd, DRM_IOCTL_MODE_ADDFB2, &f, EINVAL);
@@ -548,7 +557,7 @@ static void addfb25_tests(int fd)
 
 	igt_subtest_group {
 		igt_fixture {
-			igt_require_intel(fd);
+			igt_require_i915(fd);
 			igt_require(gem_available_fences(fd) > 0);
 			gem_set_tiling(fd, gem_bo, I915_TILING_X, 1024*4);
 			igt_require_fb_modifiers(fd);
@@ -594,6 +603,7 @@ static void addfb25_ytile(int fd)
 	igt_display_t display;
 
 	igt_fixture {
+		igt_require_i915(fd);
 		igt_display_require(&display, fd);
 
 		gem_bo = igt_create_bo_with_dimensions(fd, 1024, 1024,
@@ -618,7 +628,6 @@ static void addfb25_ytile(int fd)
 	igt_describe("Check if addfb2 call works for y-tiling");
 	igt_subtest("addfb25-y-tiled-legacy") {
 		igt_require_fb_modifiers(fd);
-		igt_require_intel(fd);
 
 		f.modifier[0] = I915_FORMAT_MOD_Y_TILED;
 		igt_assert_eq(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f),
@@ -631,7 +640,6 @@ static void addfb25_ytile(int fd)
 	igt_describe("Check if addfb2 call works for yf-tiling");
 	igt_subtest("addfb25-yf-tiled-legacy") {
 		igt_require_fb_modifiers(fd);
-		igt_require_intel(fd);
 
 		f.modifier[0] = I915_FORMAT_MOD_Yf_TILED;
 		igt_assert_eq(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f),
@@ -644,7 +652,6 @@ static void addfb25_ytile(int fd)
 	igt_describe("Test that addfb2 call fails correctly for y-tiling with given height and modifier");
 	igt_subtest("addfb25-y-tiled-small-legacy") {
 		igt_require_fb_modifiers(fd);
-		igt_require_intel(fd);
 
 		f.modifier[0] = I915_FORMAT_MOD_Y_TILED;
 		f.height = 1023;
@@ -667,6 +674,7 @@ static void addfb25_4tile(int fd)
 	igt_display_t display;
 
 	igt_fixture {
+		igt_require_i915(fd);
 		igt_display_require(&display, fd);
 
 		gem_bo = igt_create_bo_with_dimensions(fd, 1024, 1024,
@@ -689,7 +697,6 @@ static void addfb25_4tile(int fd)
 	igt_describe("Check if addfb2 call works for tiling-4");
 	igt_subtest("addfb25-4-tiled") {
 		igt_require_fb_modifiers(fd);
-		igt_require_intel(fd);
 
 		f.modifier[0] = I915_FORMAT_MOD_4_TILED;
 		igt_assert_eq(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f),
@@ -839,6 +846,9 @@ igt_main
 	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_ANY);
 		igt_require(has_addfb2_iface(fd));
+
+		if (is_xe_device(fd))
+			xe_device_get(fd);
 	}
 
 	invalid_tests(fd);
@@ -847,6 +857,10 @@ igt_main
 
 	size_tests(fd);
 
+	prop_tests(fd);
+
+	master_tests(fd);
+
 	addfb25_tests(fd);
 
 	addfb25_ytile(fd);
@@ -855,10 +869,10 @@ igt_main
 
 	tiling_tests(fd);
 
-	prop_tests(fd);
-
-	master_tests(fd);
+	igt_fixture {
+		if (is_xe_device(fd))
+			xe_device_put(fd);
 
-	igt_fixture
 		close(fd);
+	}
 }
-- 
2.40.0



  parent reply	other threads:[~2023-03-20 10:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 10:00 [igt-dev] [i-g-t 0/5] Enable ADDFB tests for XE Bhanuprakash Modem
2023-03-20 10:00 ` [igt-dev] [i-g-t 1/5] lib/xe/xe_ioctl: Add a helper to map the buffer Bhanuprakash Modem
2023-03-20 14:28   ` Das, Nirmoy
2023-03-23 18:57   ` Zbigniew Kempczyński
2023-03-20 10:00 ` [igt-dev] [i-g-t 2/5] lib/igt_fb: Add support for allocating buffers for XE Bhanuprakash Modem
2023-03-23 19:01   ` Zbigniew Kempczyński
2023-03-20 10:00 ` Bhanuprakash Modem [this message]
2023-03-22  8:49   ` [igt-dev] [i-g-t 3/5] tests/kms_addfb_basic: Add XE support Kamil Konieczny
2023-03-23 19:04   ` Zbigniew Kempczyński
2023-03-31 13:51     ` Modem, Bhanuprakash
2023-03-20 10:00 ` [igt-dev] [i-g-t 4/5] tests/kms_force_connector_basic: " Bhanuprakash Modem
2023-03-23 19:06   ` Zbigniew Kempczyński
2023-03-31 13:53     ` Modem, Bhanuprakash
2023-03-20 10:00 ` [igt-dev] [i-g-t 5/5] xe-fast-feedback: Add basic kms tests to XE BAT Bhanuprakash Modem
2023-03-20 13:43 ` [igt-dev] ✗ Fi.CI.BAT: failure for Enable ADDFB tests for XE Patchwork
2023-03-20 14:40 ` [igt-dev] ✓ Fi.CI.BAT: success for Enable ADDFB tests for XE (rev2) Patchwork
2023-03-20 17:29 ` [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=20230320100017.2913328-4-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=mchehab@kernel.org \
    --cc=zbigniew.kempczynski@intel.com \
    /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