All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Intel-gfx@lists.freedesktop.org
Subject: [RFC 3/5] drm/i915: Concurrent context uAPI
Date: Mon, 13 Nov 2017 13:09:07 +0000	[thread overview]
Message-ID: <20171113130909.31345-4-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20171113130909.31345-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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@intel.com>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-11-13 13:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 13:09 [RFC 0/5] Class/instance based execbuf plus more Tvrtko Ursulin
2017-11-13 13:09 ` [RFC 1/5] drm/i915: Select engines via class and instance in execbuffer2 Tvrtko Ursulin
2017-11-13 13:09 ` [RFC 2/5] drm/i915: Engine capabilities uAPI Tvrtko Ursulin
2017-11-13 13:13   ` Chris Wilson
2017-11-13 13:17   ` Chris Wilson
2017-11-13 13:09 ` Tvrtko Ursulin [this message]
2017-11-13 13:19   ` [RFC 3/5] drm/i915: Concurrent context uAPI Chris Wilson
2017-11-13 13:23     ` Chris Wilson
2017-11-13 13:28   ` Chris Wilson
2017-11-13 13:09 ` [RFC 4/5] drm/i915: Re-arrange execbuf so context is known before engine Tvrtko Ursulin
2017-11-13 13:09 ` [RFC 5/5] drm/i915: Per batch buffer VCS balancing Tvrtko Ursulin
2017-11-16  0:21   ` Oscar Mateo
2017-11-16  9:57     ` Chris Wilson
2017-11-13 13:13 ` ✗ Fi.CI.BAT: failure for Class/instance based execbuf plus more Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171113130909.31345-4-tvrtko.ursulin@linux.intel.com \
    --to=tursulin@ursulin.net \
    --cc=Intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.