From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> When submitting work against existing contexts userspace knows that: a) context state can be relied upon b) submitted batches will complete in order. By adding an option to mark its context as "concurrent" we allow userspace to notify the kernel that it does not care about both of the above. i915 is then at liberty to break the above guarantees if and when appropriate. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> --- drivers/gpu/drm/i915/i915_gem_context.c | 12 ++++++++++++ drivers/gpu/drm/i915/i915_gem_context.h | 18 ++++++++++++++++++ include/uapi/drm/i915_drm.h | 1 + 3 files changed, 31 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 2db040695035..3ea1251924ea 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -1043,6 +1043,9 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data, case I915_CONTEXT_PARAM_PRIORITY: args->value = ctx->priority; break; + case I915_CONTEXT_PARAM_CONCURRENT: + args->value = i915_gem_context_is_concurrent(ctx); + break; default: ret = -EINVAL; break; @@ -1118,6 +1121,15 @@ int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data, } break; + case I915_CONTEXT_PARAM_CONCURRENT: + if (args->size) + ret = -EINVAL; + else if (args->value) + i915_gem_context_set_concurrent(ctx); + else + i915_gem_context_clear_concurrent(ctx); + break; + default: ret = -EINVAL; break; diff --git a/drivers/gpu/drm/i915/i915_gem_context.h b/drivers/gpu/drm/i915/i915_gem_context.h index 4bfb72f8e1cb..0531c5eedb2a 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.h +++ b/drivers/gpu/drm/i915/i915_gem_context.h @@ -115,6 +115,7 @@ struct i915_gem_context { #define CONTEXT_BANNABLE 3 #define CONTEXT_BANNED 4 #define CONTEXT_FORCE_SINGLE_SUBMISSION 5 +#define CONTEXT_CONCURRENT 6 /** * @hw_id: - unique identifier for the context @@ -254,6 +255,23 @@ static inline void i915_gem_context_set_force_single_submission(struct i915_gem_ __set_bit(CONTEXT_FORCE_SINGLE_SUBMISSION, &ctx->flags); } +static inline bool +i915_gem_context_is_concurrent(const struct i915_gem_context *ctx) +{ + return test_bit(CONTEXT_CONCURRENT, &ctx->flags); +} + +static inline void i915_gem_context_set_concurrent(struct i915_gem_context *ctx) +{ + __set_bit(CONTEXT_CONCURRENT, &ctx->flags); +} + +static inline void +i915_gem_context_clear_concurrent(struct i915_gem_context *ctx) +{ + __clear_bit(CONTEXT_CONCURRENT, &ctx->flags); +} + static inline bool i915_gem_context_is_default(const struct i915_gem_context *c) { return c->user_handle == DEFAULT_CONTEXT_HANDLE; diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index ad5fa26fc9e7..bef377c4b4fc 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -1482,6 +1482,7 @@ struct drm_i915_gem_context_param { #define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */ #define I915_CONTEXT_DEFAULT_PRIORITY 0 #define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */ +#define I915_CONTEXT_PARAM_CONCURRENT 0x7 __u64 value; }; -- 2.14.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx