diff options
-rw-r--r-- | lib/i915/gem_context.c | 7 | ||||
-rw-r--r-- | lib/i915/gem_engine_topology.c | 40 | ||||
-rw-r--r-- | lib/i915/gem_engine_topology.h | 2 | ||||
-rw-r--r-- | tests/i915/gem_ctx_engines.c | 11 | ||||
-rw-r--r-- | tests/i915/gem_exec_balancer.c | 11 | ||||
-rw-r--r-- | tests/i915/gem_exec_schedule.c | 11 |
6 files changed, 13 insertions, 69 deletions
diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c index 3428cf7a..fe989a8d 100644 --- a/lib/i915/gem_context.c +++ b/lib/i915/gem_context.c @@ -70,12 +70,13 @@ static int create_ext_ioctl(int i915, bool gem_has_contexts(int fd) { uint32_t ctx_id = 0; + int err; - __gem_context_create(fd, &ctx_id); - if (ctx_id) + err = __gem_context_create(fd, &ctx_id); + if (!err) gem_context_destroy(fd, ctx_id); - return ctx_id; + return !err; } /** diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c index 7c60daf0..4e497a5c 100644 --- a/lib/i915/gem_engine_topology.c +++ b/lib/i915/gem_engine_topology.c @@ -86,20 +86,9 @@ * Limit what we support for simplicity due limitation in how much we * can address via execbuf2. */ -#define SIZEOF_CTX_PARAM offsetof(struct i915_context_param_engines, \ - engines[GEM_MAX_ENGINES]) #define SIZEOF_QUERY offsetof(struct drm_i915_query_engine_info, \ engines[GEM_MAX_ENGINES]) -#define DEFINE_CONTEXT_ENGINES_PARAM(e__, p__, c__, N__) \ - I915_DEFINE_CONTEXT_PARAM_ENGINES(e__, N__); \ - struct drm_i915_gem_context_param p__ = { \ - .param = I915_CONTEXT_PARAM_ENGINES, \ - .ctx_id = c__, \ - .size = SIZEOF_CTX_PARAM, \ - .value = to_user_pointer(memset(&e__, 0, sizeof(e__))), \ - } - static int __gem_query(int fd, struct drm_i915_query *q) { int err = 0; @@ -321,17 +310,17 @@ intel_engine_list_for_ctx_cfg(int fd, const intel_ctx_cfg_t *cfg) * gem_has_engine_topology: * @fd: open i915 drm file descriptor * - * Queries whether the engine topology API is supported or not. + * Queries whether the engine topology API is supported or not. Every + * kernel that has the global engines query should have the + * CONTEXT_PARAM_ENGINES and vice versa so this one check can be used for + * either. * * Returns: Engine topology API availability. */ bool gem_has_engine_topology(int fd) { - struct drm_i915_gem_context_param param = { - .param = I915_CONTEXT_PARAM_ENGINES, - }; - - return !__gem_context_get_param(fd, ¶m); + struct intel_engine_data ed; + return !__query_engine_list(fd, &ed); } struct intel_execution_engine2 gem_eb_flags_to_engine(unsigned int flags) @@ -360,23 +349,6 @@ struct intel_execution_engine2 gem_eb_flags_to_engine(unsigned int flags) return e2__; } -bool gem_context_has_engine_map(int fd, uint32_t ctx) -{ - struct drm_i915_gem_context_param param = { - .param = I915_CONTEXT_PARAM_ENGINES, - .ctx_id = ctx - }; - - /* - * If the kernel is too old to support PARAM_ENGINES, - * then naturally the context has no engine map. - */ - if (__gem_context_get_param(fd, ¶m)) - return false; - - return param.size; -} - bool gem_engine_is_equal(const struct intel_execution_engine2 *e1, const struct intel_execution_engine2 *e2) { diff --git a/lib/i915/gem_engine_topology.h b/lib/i915/gem_engine_topology.h index 991d0ff8..4cfab560 100644 --- a/lib/i915/gem_engine_topology.h +++ b/lib/i915/gem_engine_topology.h @@ -61,8 +61,6 @@ intel_get_current_physical_engine(struct intel_engine_data *ed); void intel_next_engine(struct intel_engine_data *ed); -bool gem_context_has_engine_map(int fd, uint32_t ctx); - bool gem_engine_is_equal(const struct intel_execution_engine2 *e1, const struct intel_execution_engine2 *e2); diff --git a/tests/i915/gem_ctx_engines.c b/tests/i915/gem_ctx_engines.c index caa97774..bd622b0e 100644 --- a/tests/i915/gem_ctx_engines.c +++ b/tests/i915/gem_ctx_engines.c @@ -46,15 +46,6 @@ #define engine_class(e, n) ((e)->engines[(n)].engine_class) #define engine_instance(e, n) ((e)->engines[(n)].engine_instance) -static bool has_context_engines(int i915) -{ - struct drm_i915_gem_context_param param = { - .ctx_id = 0, - .param = I915_CONTEXT_PARAM_ENGINES, - }; - return __gem_context_set_param(i915, ¶m) == 0; -} - static void invalid_engines(int i915) { struct i915_context_param_engines stack = {}, *engines; @@ -561,7 +552,7 @@ igt_main igt_require_gem(i915); gem_require_contexts(i915); - igt_require(has_context_engines(i915)); + igt_require(gem_has_engine_topology(i915)); igt_fork_hang_detector(i915); } diff --git a/tests/i915/gem_exec_balancer.c b/tests/i915/gem_exec_balancer.c index 95242829..85f94d79 100644 --- a/tests/i915/gem_exec_balancer.c +++ b/tests/i915/gem_exec_balancer.c @@ -2786,15 +2786,6 @@ static bool has_persistence(int i915) return __gem_context_set_param(i915, &p) == 0; } -static bool has_context_engines(int i915) -{ - struct drm_i915_gem_context_param p = { - .param = I915_CONTEXT_PARAM_ENGINES, - }; - - return __gem_context_set_param(i915, &p) == 0; -} - static bool has_load_balancer(int i915) { const intel_ctx_cfg_t cfg = { @@ -2819,7 +2810,7 @@ igt_main igt_require_gem(i915); gem_require_contexts(i915); - igt_require(has_context_engines(i915)); + igt_require(gem_has_engine_topology(i915)); igt_require(has_load_balancer(i915)); igt_require(has_perf_engines(i915)); diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c index 3a51b51d..a75faeb6 100644 --- a/tests/i915/gem_exec_schedule.c +++ b/tests/i915/gem_exec_schedule.c @@ -1665,15 +1665,6 @@ static void preempt_queue(int fd, const intel_ctx_cfg_t *cfg, } } -static bool has_context_engines(int i915) -{ - struct drm_i915_gem_context_param param = { - .ctx_id = 0, - .param = I915_CONTEXT_PARAM_ENGINES, - }; - return __gem_context_set_param(i915, ¶m) == 0; -} - static void preempt_engines(int i915, const struct intel_execution_engine2 *e, unsigned int flags) @@ -1694,7 +1685,7 @@ static void preempt_engines(int i915, * timeline that we can reprioritise and shuffle amongst themselves. */ - igt_require(has_context_engines(i915)); + igt_require(gem_has_engine_topology(i915)); for (int n = 0; n < GEM_MAX_ENGINES; n++) { cfg.engines[n].engine_class = e->class; |