Commit d4433c76 authored by Jason Ekstrand's avatar Jason Ekstrand Committed by Daniel Vetter

drm/i915/gem: Use the proto-context to handle create parameters (v5)

This means that the proto-context needs to grow support for engine
configuration information as well as setparam logic.  Fortunately, we'll
be deleting a lot of setparam logic on the primary context shortly so it
will hopefully balance out.

There's an extra bit of fun here when it comes to setting SSEU and the
way it interacts with PARAM_ENGINES.  Unfortunately, thanks to
SET_CONTEXT_PARAM and not being allowed to pick the order in which we
handle certain parameters, we have think about those interactions.

v2 (Daniel Vetter):
 - Add a proto_context_free_user_engines helper
 - Comment on SSEU in the commit message
 - Use proto_context_set_persistence in set_proto_ctx_param

v3 (Daniel Vetter):
 - Fix a doc comment
 - Do an explicit HAS_FULL_PPGTT check in set_proto_ctx_vm instead of
   relying on pc->vm != NULL.
 - Handle errors for CONTEXT_PARAM_PERSISTENCE
 - Don't allow more resetting user engines
 - Rework initialization of UCONTEXT_PERSISTENCE

v4 (Jason Ekstrand):
 - Move hand-rolled initialization of UCONTEXT_PERSISTENCE to an
   earlier patch

v5 (Jason Ekstrand):
 - Move proto_context_set_persistence to this patch
Signed-off-by: default avatarJason Ekstrand <jason@jlekstrand.net>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210708154835.528166-22-jason@jlekstrand.net
parent def25b7b
This diff is collapsed.
......@@ -66,6 +66,55 @@ struct i915_gem_engines_iter {
const struct i915_gem_engines *engines;
};
/**
* enum i915_gem_engine_type - Describes the type of an i915_gem_proto_engine
*/
enum i915_gem_engine_type {
/** @I915_GEM_ENGINE_TYPE_INVALID: An invalid engine */
I915_GEM_ENGINE_TYPE_INVALID = 0,
/** @I915_GEM_ENGINE_TYPE_PHYSICAL: A single physical engine */
I915_GEM_ENGINE_TYPE_PHYSICAL,
/** @I915_GEM_ENGINE_TYPE_BALANCED: A load-balanced engine set */
I915_GEM_ENGINE_TYPE_BALANCED,
};
/**
* struct i915_gem_proto_engine - prototype engine
*
* This struct describes an engine that a context may contain. Engines
* have three types:
*
* - I915_GEM_ENGINE_TYPE_INVALID: Invalid engines can be created but they
* show up as a NULL in i915_gem_engines::engines[i] and any attempt to
* use them by the user results in -EINVAL. They are also useful during
* proto-context construction because the client may create invalid
* engines and then set them up later as virtual engines.
*
* - I915_GEM_ENGINE_TYPE_PHYSICAL: A single physical engine, described by
* i915_gem_proto_engine::engine.
*
* - I915_GEM_ENGINE_TYPE_BALANCED: A load-balanced engine set, described
* i915_gem_proto_engine::num_siblings and i915_gem_proto_engine::siblings.
*/
struct i915_gem_proto_engine {
/** @type: Type of this engine */
enum i915_gem_engine_type type;
/** @engine: Engine, for physical */
struct intel_engine_cs *engine;
/** @num_siblings: Number of balanced siblings */
unsigned int num_siblings;
/** @siblings: Balanced siblings */
struct intel_engine_cs **siblings;
/** @sseu: Client-set SSEU parameters */
struct intel_sseu sseu;
};
/**
* struct i915_gem_proto_context - prototype context
*
......@@ -84,6 +133,15 @@ struct i915_gem_proto_context {
/** @sched: See &i915_gem_context.sched */
struct i915_sched_attr sched;
/** @num_user_engines: Number of user-specified engines or -1 */
int num_user_engines;
/** @user_engines: User-specified engines */
struct i915_gem_proto_engine *user_engines;
/** @legacy_rcs_sseu: Client-set SSEU parameters for the legacy RCS */
struct intel_sseu legacy_rcs_sseu;
/** @single_timeline: See See &i915_gem_context.syncobj */
bool single_timeline;
};
......
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