summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/i915/gem_context.c7
-rw-r--r--lib/i915/gem_engine_topology.c40
-rw-r--r--lib/i915/gem_engine_topology.h2
3 files changed, 10 insertions, 39 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, &param);
+ 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, &param))
- 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);