summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2022-05-24 12:00:00 +0100
committerMatthew Auld <matthew.auld@intel.com>2022-06-30 12:49:22 +0100
commitc741571e6b0aac782464a452376bd30ac6b130a5 (patch)
tree7b0bb98097ff566cddeb263bd7a655777394c98b
parentb0e377c287f387c19134c6a22d535d2a4e9ee97e (diff)
tests/i915/query: sanity check the probed_cpu_visible_size
Add some basic sanity checks for this, like checking if this falls within the probed_size. On older kernels the value reported here should be zero. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
-rw-r--r--tests/i915/i915_query.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/i915/i915_query.c b/tests/i915/i915_query.c
index b545fb4a..ea99dc8d 100644
--- a/tests/i915/i915_query.c
+++ b/tests/i915/i915_query.c
@@ -514,6 +514,11 @@ static bool query_regions_supported(int fd)
return __i915_query_items(fd, &item, 1) == 0 && item.length > 0;
}
+/**
+ * XXX: Remove these once we can safely sync the uapi header with the kernel.
+ * Should be source compatible either way though.
+ */
+#define probed_cpu_visible_size rsvd1[0]
static void test_query_regions_garbage_items(int fd)
{
struct drm_i915_query_memory_regions *regions;
@@ -552,7 +557,10 @@ static void test_query_regions_garbage_items(int fd)
igt_assert_eq_u32(info.rsvd0, 0);
- for (j = 0; j < ARRAY_SIZE(info.rsvd1); j++)
+ /*
+ * rsvd1[0] : probed_cpu_visible_size
+ */
+ for (j = 1; j < ARRAY_SIZE(info.rsvd1); j++)
igt_assert_eq_u32(info.rsvd1[j], 0);
}
@@ -587,13 +595,18 @@ static void test_query_regions_sanity_check(int fd)
found_system = false;
for (i = 0; i < regions->num_regions; i++) {
- struct drm_i915_gem_memory_class_instance r1 =
- regions->regions[i].region;
+ struct drm_i915_memory_region_info info = regions->regions[i];
+ struct drm_i915_gem_memory_class_instance r1 = info.region;
int j;
if (r1.memory_class == I915_MEMORY_CLASS_SYSTEM) {
igt_assert_eq(r1.memory_instance, 0);
found_system = true;
+
+ igt_assert(info.probed_cpu_visible_size == 0 ||
+ info.probed_cpu_visible_size == info.probed_size);
+ } else {
+ igt_assert(info.probed_cpu_visible_size <= info.probed_size);
}
igt_assert(r1.memory_class == I915_MEMORY_CLASS_SYSTEM ||