From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Intel-gfx@lists.freedesktop.org
Subject: [RFC 04/10] drm/i915: Engine capabilities uAPI
Date: Thu, 25 Jan 2018 13:33:27 +0000 [thread overview]
Message-ID: <20180125133333.13425-5-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20180125133333.13425-1-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
To add the knowledge that VCS1 engine does not support HEVC,
we introduce the concept of engine capabilities. These are
flags defined in per-engine class space which can be passed
in during execbuf time. The driver is then able to fail the
execbuf in case of mismatch between the requested capabilities
and the selected target engine.
v2: Use BIT_ULL for flags. (Chris Wilson)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 19 +++++++++++++++----
drivers/gpu/drm/i915/intel_engine_cs.c | 3 +++
drivers/gpu/drm/i915/intel_ringbuffer.h | 2 ++
include/uapi/drm/i915_drm.h | 17 ++++++++++++++++-
4 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 29e346ca0898..3abe8a69e313 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -56,9 +56,10 @@ enum {
#define __EXEC_OBJECT_INTERNAL_FLAGS (~0u << 27) /* all of the above */
#define __EXEC_OBJECT_RESERVED (__EXEC_OBJECT_HAS_PIN | __EXEC_OBJECT_HAS_FENCE)
-#define __EXEC_HAS_RELOC BIT(31)
-#define __EXEC_VALIDATED BIT(30)
-#define __EXEC_INTERNAL_FLAGS (~0u << 30)
+#define __EXEC_HAS_RELOC BIT_ULL(63)
+#define __EXEC_VALIDATED BIT_ULL(62)
+#define __EXEC_INTERNAL_FLAGS (~0ULL << 62)
+
#define UPDATE PIN_OFFSET_FIXED
#define BATCH_OFFSET_BIAS (256*1024)
@@ -2021,8 +2022,16 @@ eb_select_engine_class_instance(struct drm_i915_private *i915, u64 eb_flags)
u8 class = eb_flags & I915_EXEC_RING_MASK;
u8 instance = (eb_flags & I915_EXEC_INSTANCE_MASK) >>
I915_EXEC_INSTANCE_SHIFT;
+ u8 caps = (eb_flags & I915_EXEC_ENGINE_CAP_MASK) >>
+ I915_EXEC_ENGINE_CAP_SHIFT;
+ struct intel_engine_cs *engine;
- return intel_engine_lookup_user(i915, class, instance);
+ engine = intel_engine_lookup_user(i915, class, instance);
+
+ if (engine && ((caps & engine->caps) != caps))
+ return NULL;
+
+ return engine;
}
#define I915_USER_RINGS (4)
@@ -2232,6 +2241,8 @@ i915_gem_do_execbuffer(struct drm_device *dev,
BUILD_BUG_ON(__EXEC_OBJECT_INTERNAL_FLAGS &
~__EXEC_OBJECT_UNKNOWN_FLAGS);
+ BUILD_BUG_ON(__EXEC_INTERNAL_FLAGS & ~__I915_EXEC_UNKNOWN_FLAGS);
+
eb.i915 = to_i915(dev);
eb.file = file;
eb.args = args;
diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index 5d49f319220b..e02627618bc5 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -234,6 +234,9 @@ intel_engine_setup(struct drm_i915_private *dev_priv,
engine->irq_shift = info->irq_shift;
engine->class = info->class;
engine->instance = info->instance;
+ if (INTEL_GEN(dev_priv) >= 8 && engine->class == VIDEO_DECODE_CLASS &&
+ engine->instance == 0)
+ engine->caps = I915_BSD_CAP_HEVC;
engine->uabi_id = info->uabi_id;
engine->uabi_class = class_info->uabi_class;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index aab7bd61ae10..76f7fdc926ae 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -297,6 +297,8 @@ struct intel_engine_cs {
u8 class;
u8 instance;
+ u8 caps;
+
u32 context_size;
u32 mmio_base;
unsigned int irq_shift;
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 28ae31a2accf..8b8b70c5a50b 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -1068,7 +1068,18 @@ struct drm_i915_gem_execbuffer2 {
#define I915_EXEC_INSTANCE_SHIFT (21)
#define I915_EXEC_INSTANCE_MASK (0xff << I915_EXEC_INSTANCE_SHIFT)
-#define __I915_EXEC_UNKNOWN_FLAGS (-((1 << 29) << 1))
+/*
+ * Inform the kernel of what engine capabilities this batch buffer
+ * requires. For example only the first VCS engine has the HEVC block.
+ *
+ * We reserve four bits for the capabilities where each can be shared
+ * between different engines. Eg. first bit can mean one feature for
+ * one engine and something else for the other.
+ */
+#define I915_EXEC_ENGINE_CAP_SHIFT (29)
+#define I915_EXEC_ENGINE_CAP_MASK (0xf << I915_EXEC_ENGINE_CAP_SHIFT)
+
+#define __I915_EXEC_UNKNOWN_FLAGS (-((1ULL << 33) << 1))
#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
#define i915_execbuffer2_set_context_id(eb2, context) \
@@ -1081,6 +1092,10 @@ struct drm_i915_gem_execbuffer2 {
(class) | \
((instance) << I915_EXEC_INSTANCE_SHIFT))
+#define I915_BSD_CAP_HEVC (1 << 0)
+
+#define I915_ENGINE_CAP_FLAG(v) ((v) << I915_EXEC_ENGINE_CAP_SHIFT)
+
struct drm_i915_gem_pin {
/** Handle of the buffer to be pinned. */
__u32 handle;
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-01-25 13:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 13:33 [RFC 00/10] Virtual queue/engine uAPI prototype Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 01/10] move-timeline-to-ctx Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 02/10] drm/i915: Extend CREATE_CONTEXT to allow inheritance ala clone() Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 03/10] drm/i915: Select engines via class and instance in execbuffer2 Tvrtko Ursulin
2018-01-25 13:33 ` Tvrtko Ursulin [this message]
2018-01-25 13:33 ` [RFC 05/10] drm/i915: Re-arrange execbuf so context is known before engine Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 06/10] drm/i915: Refactor eb_select_engine to take eb Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 07/10] drm/i915: Track latest request per engine class Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 08/10] drm/i915: Allow creating virtual contexts Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 09/10] drm/i915: Trivial virtual engine implementation Tvrtko Ursulin
2018-01-25 13:57 ` Chris Wilson
2018-01-25 14:26 ` Tvrtko Ursulin
2018-01-25 14:32 ` Chris Wilson
2018-01-25 14:36 ` Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 10/10] drm/i915: Naive engine busyness based load balancing Tvrtko Ursulin
2018-01-25 14:12 ` ✗ Fi.CI.BAT: failure for Virtual queue/engine uAPI prototype 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=20180125133333.13425-5-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox