[igt-dev] [PATCH i-g-t] i915: Fix gem_context_has_engine_map() for older kernels

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 2 10:50:34 UTC 2019


CI is currently breaking on linus/drm-intel-fixes due to the assert that
the kernel supports context engine maps. Report the lack of maps on
older kernels gracefully!

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
---
 lib/i915/gem_engine_topology.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c
index cae5a0292..cc2b3ff6e 100644
--- a/lib/i915/gem_engine_topology.c
+++ b/lib/i915/gem_engine_topology.c
@@ -321,10 +321,13 @@ bool gem_context_has_engine_map(int fd, uint32_t ctx)
 		.param = I915_CONTEXT_PARAM_ENGINES,
 		.ctx_id = ctx
 	};
-	int ret;
 
-	ret = __gem_context_get_param(fd, &param);
-	igt_assert_eq(ret, 0);
+	/*
+	 * If the kernel is too old to support PARAM_ENGINES,
+	 * then naturally is has no engine map.
+	 */
+	if (__gem_context_get_param(fd, &param))
+		return false;
 
 	return param.size;
 }
-- 
2.20.1



More information about the igt-dev mailing list