summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-12-07 15:53:29 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2020-12-08 12:06:18 +0000
commitd99f644b1868b9c92435b05ebfafa230721cd677 (patch)
tree56651de5dc8a4abc4aba420c94f5df1d8ad37547
parent6c7572912320386c49ff1674b5202caf371f5dea (diff)
i915/query: Directly check query results against GETPARAM
Simplify the cross-check by asserting that the existence of an engine in the list matches the existence of the engine as reported by GETPARAM. By using the comparison, we check both directions at once. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
-rw-r--r--tests/i915/i915_query.c49
1 files changed, 9 insertions, 40 deletions
diff --git a/tests/i915/i915_query.c b/tests/i915/i915_query.c
index 07d78374..29b938e9 100644
--- a/tests/i915/i915_query.c
+++ b/tests/i915/i915_query.c
@@ -711,46 +711,15 @@ static void engines(int fd)
}
/* Check results match the legacy GET_PARAM (where we can). */
- for (i = 0; i < engines->num_engines; i++) {
- struct drm_i915_engine_info *engine =
- (struct drm_i915_engine_info *)&engines->engines[i];
-
- switch (engine->engine.engine_class) {
- case I915_ENGINE_CLASS_RENDER:
- /* Will be tested later. */
- break;
- case I915_ENGINE_CLASS_COPY:
- igt_assert(gem_has_blt(fd));
- break;
- case I915_ENGINE_CLASS_VIDEO:
- switch (engine->engine.engine_instance) {
- case 0:
- igt_assert(gem_has_bsd(fd));
- break;
- case 1:
- igt_assert(gem_has_bsd2(fd));
- break;
- }
- break;
- case I915_ENGINE_CLASS_VIDEO_ENHANCE:
- igt_assert(gem_has_vebox(fd));
- break;
- default:
- igt_assert(0);
- }
- }
-
- /* Reverse check to the above - all GET_PARAM engines are present. */
- igt_assert(has_engine(engines, I915_ENGINE_CLASS_RENDER, 0));
- if (gem_has_blt(fd))
- igt_assert(has_engine(engines, I915_ENGINE_CLASS_COPY, 0));
- if (gem_has_bsd(fd))
- igt_assert(has_engine(engines, I915_ENGINE_CLASS_VIDEO, 0));
- if (gem_has_bsd2(fd))
- igt_assert(has_engine(engines, I915_ENGINE_CLASS_VIDEO, 1));
- if (gem_has_vebox(fd))
- igt_assert(has_engine(engines, I915_ENGINE_CLASS_VIDEO_ENHANCE,
- 0));
+ igt_assert_eq(has_engine(engines, I915_ENGINE_CLASS_RENDER, 0), 1);
+ igt_assert_eq(has_engine(engines, I915_ENGINE_CLASS_COPY, 0),
+ gem_has_blt(fd));
+ igt_assert_eq(has_engine(engines, I915_ENGINE_CLASS_VIDEO, 0),
+ gem_has_bsd(fd));
+ igt_assert_eq(has_engine(engines, I915_ENGINE_CLASS_VIDEO, 1),
+ gem_has_bsd2(fd));
+ igt_assert_eq(has_engine(engines, I915_ENGINE_CLASS_VIDEO_ENHANCE, 0),
+ gem_has_vebox(fd));
free(engines);
}