igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: matthew.auld@intel.com
Subject: [PATCH v2] tests/intel/xe_pat: Add subtest to validate NO_COMPRESSION flag
Date: Wed, 26 Nov 2025 19:46:35 +0530	[thread overview]
Message-ID: <20251126141634.309190-2-sanjay.kumar.yadav@intel.com> (raw)

Add bo-comp-disable-bind subtest to verify that a BO created with
DRM_XE_GEM_CREATE_FLAG_NO_COMPRESSION cannot be bind with a compressed
PAT index on Xe2+ (bind should fail with -EINVAL).

This ensures the flag works as intended to skip CCS operations and
related state management for such BOs.

v2: (Matt A)
- Added has_no_compression_hint() helper to query device capability
- Improved skip logic for unsupported platforms

Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
Suggested-by: Matthew Auld <matthew.auld@intel.com>
---
 .../drm-uapi-experimental/intel_drm_local.h   |  3 +
 tests/intel/xe_pat.c                          | 59 +++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/include/drm-uapi-experimental/intel_drm_local.h b/include/drm-uapi-experimental/intel_drm_local.h
index b48c9e219..9949d5350 100644
--- a/include/drm-uapi-experimental/intel_drm_local.h
+++ b/include/drm-uapi-experimental/intel_drm_local.h
@@ -20,6 +20,9 @@ extern "C" {
  * clean these up when kernel uapi headers are sync'd.
  */
 
+#define DRM_XE_GEM_CREATE_FLAG_NO_COMPRESSION (1 << 3)
+#define DRM_XE_QUERY_CONFIG_FLAG_HAS_NO_COMPRESSION_HINT (1 << 3)
+
 #if defined(__cplusplus)
 }
 #endif
diff --git a/tests/intel/xe_pat.c b/tests/intel/xe_pat.c
index 59dfb6b11..fe4238529 100644
--- a/tests/intel/xe_pat.c
+++ b/tests/intel/xe_pat.c
@@ -753,6 +753,62 @@ static void prime_external_import_coh(void)
 	drm_close_driver(fd2);
 }
 
+static bool has_no_compression_hint(int fd)
+{
+	struct drm_xe_query_config *config = xe_config(fd);
+
+	return config->info[DRM_XE_QUERY_CONFIG_FLAGS] &
+		DRM_XE_QUERY_CONFIG_FLAG_HAS_NO_COMPRESSION_HINT;
+}
+
+/**
+ * SUBTEST: bo-comp-disable-bind
+ * Test category: functionality test
+ * Description: Validates that binding a BO created with
+ * the NO_COMPRESSION flag using a compressed PAT index fails
+ * with -EINVAL on Xe2+ platforms.
+ */
+
+static void bo_comp_disable_bind(int fd)
+{
+	size_t size = xe_get_default_alignment(fd);
+	uint8_t comp_pat_index, uncomp_pat_index;
+	bool supported;
+	uint32_t vm, bo;
+	int ret;
+
+	supported = has_no_compression_hint(fd);
+	ret = __xe_bo_create_caching(fd, 0, size, vram_if_possible(fd, 0),
+				     DRM_XE_GEM_CREATE_FLAG_NO_COMPRESSION,
+				     DRM_XE_GEM_CPU_CACHING_WC, &bo);
+
+	if (!supported) {
+		igt_assert_neq(ret, 0);
+		igt_skip("Missing NO_COMPRESSION support, skipping.\n");
+	}
+
+	igt_assert_eq(ret, 0);
+	vm = xe_vm_create(fd, 0, 0);
+
+	comp_pat_index = intel_get_pat_idx_uc_comp(fd);
+	uncomp_pat_index = intel_get_pat_idx_uc(fd);
+
+	igt_assert_eq(__xe_vm_bind(fd, vm, 0, bo, 0, 0x100000,
+				   size, 0, 0, NULL, 0,
+				   0, comp_pat_index, 0),
+		      -EINVAL);
+
+	igt_assert_eq(__xe_vm_bind(fd, vm, 0, bo, 0, 0x100000,
+				   size, 0, 0, NULL, 0,
+				   0, uncomp_pat_index, 0),
+		      0);
+	xe_vm_unbind_sync(fd, vm, 0, 0x100000, size);
+
+	gem_close(fd, bo);
+
+	xe_vm_destroy(fd, vm);
+}
+
 /**
  * SUBTEST: display-vs-wb-transient
  * Test category: functionality test
@@ -1185,6 +1241,9 @@ igt_main_args("V", NULL, help_str, opt_handler, NULL)
 	igt_subtest("prime-external-import-coh")
 		prime_external_import_coh();
 
+	igt_subtest("bo-comp-disable-bind")
+		bo_comp_disable_bind(fd);
+
 	igt_subtest_with_dynamic("pat-index-xelp") {
 		igt_require(intel_graphics_ver(dev_id) <= IP_VER(12, 55));
 		subtest_pat_index_modes_with_regions(fd, xelp_pat_index_modes,
-- 
2.52.0


             reply	other threads:[~2025-11-26 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 14:16 Sanjay Yadav [this message]
2025-11-26 14:58 ` [PATCH v2] tests/intel/xe_pat: Add subtest to validate NO_COMPRESSION flag Matthew Auld
2025-11-26 15:31 ` ✓ i915.CI.BAT: success for tests/intel/xe_pat: Add subtest to validate NO_COMPRESSION flag (rev2) Patchwork
2025-11-26 15:54 ` ✓ Xe.CI.BAT: " Patchwork
2025-11-26 17:49 ` ✗ Xe.CI.Full: failure " Patchwork
2025-11-26 22:09 ` ✗ i915.CI.Full: " 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=20251126141634.309190-2-sanjay.kumar.yadav@intel.com \
    --to=sanjay.kumar.yadav@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=matthew.auld@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;
as well as URLs for NNTP newsgroup(s).