[PATCH i-g-t v1 2/3] lib/intel_blt: Add helper function to ensure platform supports compression

Akshata Jahagirdar akshata.jahagirdar at intel.com
Tue Mar 26 09:54:37 UTC 2024


Add helper function to check if platform supports compression by
reading the flat_ccs value from struct drm_xe_query_config.

Signed-off-by: Akshata Jahagirdar <akshata.jahagirdar at intel.com>
---
 lib/intel_blt.c | 18 ++++++++++++++++++
 lib/intel_blt.h |  1 +
 2 files changed, 19 insertions(+)

diff --git a/lib/intel_blt.c b/lib/intel_blt.c
index fe0a45cb8..076b065c0 100644
--- a/lib/intel_blt.c
+++ b/lib/intel_blt.c
@@ -464,6 +464,24 @@ bool blt_block_copy_supports_compression(int fd)
 				    BLT_CMD_SUPPORTS_COMPRESSION);
 }
 
+/**
+ * blt_platform_supports_compression
+ * @fd: drm fd
+ *
+ * Check if platform provided by @fd device supports compression.
+ *
+ * Returns:
+ * true if it does, false otherwise.
+ */
+bool blt_platform_supports_compression(int fd)
+{
+	struct drm_xe_query_config *config = xe_config(fd);
+
+	igt_assert(config);
+	return  config->info[DRM_XE_QUERY_CONFIG_FLAGS] &
+		DRM_XE_QUERY_CONFIG_FLAG_HAS_FLAT_CCS;
+}
+
 /**
  * blt_uses_extended_block_copy
  * @fd: drm fd
diff --git a/lib/intel_blt.h b/lib/intel_blt.h
index 1f6c71359..a2c4a4adb 100644
--- a/lib/intel_blt.h
+++ b/lib/intel_blt.h
@@ -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_supports_compression(int fd);
 bool blt_uses_extended_block_copy(int fd);
 
 const char *blt_tiling_name(enum blt_tiling_type tiling);
-- 
2.34.1



More information about the igt-dev mailing list