[igt-dev] [PATCH i-g-t 4/5] tests/xe/query: extend for CPU visible accounting

Matthew Auld matthew.auld at intel.com
Wed Mar 29 11:56:41 UTC 2023


Print the visible size and how much is used. Also sanity check the
values.

Signed-off-by: Matthew Auld <matthew.auld at intel.com>
Cc: Gwan-gyeong Mun <gwan-gyeong.mun at intel.com>
---
 tests/xe/xe_query.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/xe/xe_query.c b/tests/xe/xe_query.c
index 3f038225..9367d65e 100644
--- a/tests/xe/xe_query.c
+++ b/tests/xe/xe_query.c
@@ -228,6 +228,21 @@ test_query_mem_usage(int fd)
 		igt_info("min_page_size=0x%x, max_page_size=0x%x\n",
 		       mem_usage->regions[i].min_page_size,
 		       mem_usage->regions[i].max_page_size);
+
+		igt_info("visible size=%lluMiB\n",
+			 mem_usage->regions[i].cpu_visible_size >> 20);
+		igt_info("visible used=%lluMiB\n",
+			 mem_usage->regions[i].cpu_visible_used >> 20);
+
+		igt_assert_lte_u64(mem_usage->regions[i].cpu_visible_size,
+				   mem_usage->regions[i].total_size);
+		igt_assert_lte_u64(mem_usage->regions[i].cpu_visible_used,
+				   mem_usage->regions[i].cpu_visible_size);
+		igt_assert_lte_u64(mem_usage->regions[i].cpu_visible_used,
+				   mem_usage->regions[i].used);
+		igt_assert_lte_u64(mem_usage->regions[i].used -
+				   mem_usage->regions[i].cpu_visible_used,
+				   mem_usage->regions[i].total_size);
 	}
 	dump_hex_debug(mem_usage, query.size);
 	free(mem_usage);
-- 
2.39.2



More information about the igt-dev mailing list