Skip to contentSkip to conversation

Update compression check based on platform

PATCH Superseded Akshata Jahagirdar 1 participant 3 messages Apr 16, 2024 Library code

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v5 cover Update compression check based on platform

In Xe2+ platforms, we need to run the xe_ccs test regardless of the status of flat-ccs.
Check if the platform supports compression and has flat ccs enabled, and if it doesn't, then update the check on compression
and proceed with the test.

Akshata Jahagirdar (2):
lib/intel_blt: Add helper function to ensure platform has flat-ccs
enabled
tests/xe_ccs: Update compression check based on flat-ccs enablement

 lib/intel_blt.c      | 14 ++++++++++++++
 lib/intel_blt.h      |  1 +
 tests/intel/xe_ccs.c | 20 ++++++++++++++++----
 3 files changed, 31 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v5 1/2 lib/intel_blt: Add helper function to ensure platform has flat-ccs enabled

Add helper function to check if platform has flat-ccs enabled by reading from debugfs entry.

---
 lib/intel_blt.c | 14 ++++++++++++++
 lib/intel_blt.h |  1 +
 2 files changed, 15 insertions(+)
lib/intel_blt.c +14 -0
index dc6669889..4da5cc855 100644
@@ -464,6 +464,20 @@ bool blt_block_copy_supports_compression(int fd)
 				    BLT_CMD_SUPPORTS_COMPRESSION);
 }
 
+/**
+ * blt_platform_has_flat_ccs_enabled
+ * @fd: drm fd
+ *
+ * Check if platform provided by @fd device has flat-ccs enabled.
+ *
+ * Returns:
+ * true if it does, false otherwise.
+ */
+bool blt_platform_has_flat_ccs_enabled(int fd)
+{
+	return igt_debugfs_search(fd, "info", "has_flat_ccs yes");
+}
+
 /**
  * blt_uses_extended_block_copy
  * @fd: drm fd
lib/intel_blt.h +1 -0
index d9c4d107f..cc5966686 100644
@@ -209,6 +209,7 @@ bool blt_fast_copy_supports_tiling(int fd, enum blt_tiling_type tiling);
 bool blt_block_copy_supports_tiling(int fd, enum blt_tiling_type tiling);
 bool blt_xy_src_copy_supports_tiling(int fd, enum blt_tiling_type tiling);
 bool blt_block_copy_supports_compression(int fd);
+bool blt_platform_has_flat_ccs_enabled(int fd);
 bool blt_uses_extended_block_copy(int fd);
 
 const char *blt_tiling_name(enum blt_tiling_type tiling);
Signature · 1 line
2.34.1
#2 lore raw

PATCH v5 2/2 tests/xe_ccs: Update compression check based on flat-ccs enablement

In reply to Akshata Jahagirdar

In Xe2+ platforms,we need to run this test regardless of the status of flat-ccs. Check if the platform supports compression and has flat ccs enabled, and if it doesn't, then update the checks accordingly and proceed with the test.

Additionally, On Xe2 dGPU, compression is only supported with VRAM. When copying from VRAM -> sysmem the KMD uses mapping with uncompressed PAT so the copy in system memory is guaranteed to be uncompressed. When restoring such buffers from sysmem -> VRAM the KMD can't easily know which pages were originally compressed, so we always use uncompressed -> uncompressed here. so this means there's no need for extra CCS storage on such platforms.
Thats why we shouldn't need to run suspend-resume on xe2 dgpu.

---
 tests/intel/xe_ccs.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
tests/intel/xe_ccs.c +16 -4
index b3bf97af7..a358f69d1 100644
@@ -162,8 +162,18 @@ static void surf_copy(int xe,
 						      (void *)mid->ptr, mid->size);
 
 		munmap(ccsmap2, ccssize);
-		igt_assert(!strcmp(orig, newsum));
-		igt_assert(!strcmp(orig2, newsum2));
+		if (IS_GEN(xe, 12) && is_intel_dgfx()) {
+			igt_assert(!strcmp(orig, newsum));
+			igt_assert(!strcmp(orig2, newsum2));
+		} else if (AT_LEAST_GEN(xe, 20)) {
+			if (is_dgfx()) {
+				igt_assert(strcmp(orig, newsum));
+				igt_assert(strcmp(orig2, newsum2));
+			} else {
+				igt_assert(!strcmp(orig, newsum));
+				igt_assert(!strcmp(orig2, newsum2));
+			}
+		}
 		g_free(orig);
 		g_free(orig2);
 		g_free(newsum);
@@ -193,7 +203,8 @@ static void surf_copy(int xe,
 	intel_ctx_xe_sync(ctx, true);
 	WRITE_PNG(xe, run_id, "corrupted", &blt.dst, dst->x2, dst->y2, bpp);
 	result = memcmp(src->ptr, dst->ptr, src->size);
-	igt_assert(result != 0);
+	if (AT_LEAST_GEN(xe, 20) && !blt_platform_has_flat_ccs_enabled(xe))
+		igt_assert(result != 0);
 
 	/* retrieve back ccs */
 	memcpy(ccsmap, ccscopy, ccssize);
@@ -365,7 +376,8 @@ static void block_copy(int xe,
 	 * occurs and ctrl surface will be filled with some not-zeroed values.
 	 */
 	if (mid->compression && FROM_EXP_WH(width, height))
-		igt_assert(blt_surface_is_compressed(xe, ctx, NULL, ahnd, mid));
+		if (AT_LEAST_GEN(xe, 20) && !blt_platform_has_flat_ccs_enabled(xe))
+			igt_assert(blt_surface_is_compressed(xe, ctx, NULL, ahnd, mid));
 
 	WRITE_PNG(xe, run_id, "mid", &blt.dst, width, height, bpp);
 
Signature · 1 line
2.34.1