[PATCH] tests/intel/gem_ctx_param: Add GTT size test

Mikolaj Wasiak mikolaj.wasiak at intel.com
Tue Dec 3 10:16:10 UTC 2024


Create test checking if driver reports total GTT size.

Signed-off-by: Mikolaj Wasiak <mikolaj.wasiak at intel.com>
---
 tests/intel/gem_ctx_param.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/intel/gem_ctx_param.c b/tests/intel/gem_ctx_param.c
index 2e39a519b..bb208cf22 100644
--- a/tests/intel/gem_ctx_param.c
+++ b/tests/intel/gem_ctx_param.c
@@ -107,6 +107,9 @@
  *
  * SUBTEST: vm
  * Description: Tests that multiple contexts can share the same VMA
+ *
+ * SUBTEST: gtt-size
+ * Description: Tests that total size of GTT is power of two
  */
 
 IGT_TEST_DESCRIPTION("Basic test for context set/get param input validation.");
@@ -468,6 +471,16 @@ igt_main
 	igt_subtest("vm")
 		test_vm(fd);
 
+	arg.param = I915_CONTEXT_PARAM_GTT_SIZE;
+
+	igt_describe("Tests that total size of GTT is power of two");
+	igt_subtest("gtt-size") {
+		gem_context_get_param(fd, &arg);
+
+		igt_assert_neq_u64(arg.value, 0);
+		igt_assert(is_power_of_two(arg.value));
+	}
+
 	arg.param = I915_CONTEXT_PARAM_PRIORITY;
 
 	igt_describe("Verify that context set param ioctl returns relevant error if driver "
-- 
2.47.1



More information about the igt-dev mailing list