Commit e620f7b3 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Extend I915_CONTEXT_PARAM_SSEU to support local ctx->engine[]

Allow the user to specify a local engine index (as opposed to
class:index) that they can use to refer to a preset engine inside the
ctx->engine[] array defined by an earlier I915_CONTEXT_PARAM_ENGINES.
This will be useful for setting SSEU parameters on virtual engines that
are local to the context and do not have a valid global class:instance
lookup.

Note that due to the ambiguity in using class:instance with
ctx->engines[], if a user supplied engine map is active the user must
specify the engine to alter by its index into the ctx->engines[].
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190521211134.16117-3-chris@chris-wilson.co.uk
parent 976b55f0
...@@ -1363,6 +1363,7 @@ static int set_sseu(struct i915_gem_context *ctx, ...@@ -1363,6 +1363,7 @@ static int set_sseu(struct i915_gem_context *ctx,
struct drm_i915_gem_context_param_sseu user_sseu; struct drm_i915_gem_context_param_sseu user_sseu;
struct intel_context *ce; struct intel_context *ce;
struct intel_sseu sseu; struct intel_sseu sseu;
unsigned long lookup;
int ret; int ret;
if (args->size < sizeof(user_sseu)) if (args->size < sizeof(user_sseu))
...@@ -1375,10 +1376,17 @@ static int set_sseu(struct i915_gem_context *ctx, ...@@ -1375,10 +1376,17 @@ static int set_sseu(struct i915_gem_context *ctx,
sizeof(user_sseu))) sizeof(user_sseu)))
return -EFAULT; return -EFAULT;
if (user_sseu.flags || user_sseu.rsvd) if (user_sseu.rsvd)
return -EINVAL; return -EINVAL;
ce = lookup_user_engine(ctx, 0, &user_sseu.engine); if (user_sseu.flags & ~(I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX))
return -EINVAL;
lookup = 0;
if (user_sseu.flags & I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX)
lookup |= LOOKUP_USER_INDEX;
ce = lookup_user_engine(ctx, lookup, &user_sseu.engine);
if (IS_ERR(ce)) if (IS_ERR(ce))
return PTR_ERR(ce); return PTR_ERR(ce);
...@@ -1821,6 +1829,7 @@ static int get_sseu(struct i915_gem_context *ctx, ...@@ -1821,6 +1829,7 @@ static int get_sseu(struct i915_gem_context *ctx,
{ {
struct drm_i915_gem_context_param_sseu user_sseu; struct drm_i915_gem_context_param_sseu user_sseu;
struct intel_context *ce; struct intel_context *ce;
unsigned long lookup;
int err; int err;
if (args->size == 0) if (args->size == 0)
...@@ -1832,10 +1841,17 @@ static int get_sseu(struct i915_gem_context *ctx, ...@@ -1832,10 +1841,17 @@ static int get_sseu(struct i915_gem_context *ctx,
sizeof(user_sseu))) sizeof(user_sseu)))
return -EFAULT; return -EFAULT;
if (user_sseu.flags || user_sseu.rsvd) if (user_sseu.rsvd)
return -EINVAL; return -EINVAL;
ce = lookup_user_engine(ctx, 0, &user_sseu.engine); if (user_sseu.flags & ~(I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX))
return -EINVAL;
lookup = 0;
if (user_sseu.flags & I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX)
lookup |= LOOKUP_USER_INDEX;
ce = lookup_user_engine(ctx, lookup, &user_sseu.engine);
if (IS_ERR(ce)) if (IS_ERR(ce))
return PTR_ERR(ce); return PTR_ERR(ce);
......
...@@ -1576,9 +1576,10 @@ struct drm_i915_gem_context_param_sseu { ...@@ -1576,9 +1576,10 @@ struct drm_i915_gem_context_param_sseu {
struct i915_engine_class_instance engine; struct i915_engine_class_instance engine;
/* /*
* Unused for now. Must be cleared to zero. * Unknown flags must be cleared to zero.
*/ */
__u32 flags; __u32 flags;
#define I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX (1u << 0)
/* /*
* Mask of slices to enable for the context. Valid values are a subset * Mask of slices to enable for the context. Valid values are a subset
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment