From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 8/8] drm/i915: Improve GuC request coalescing
Date: Wed, 20 Sep 2017 17:37:05 +0300 [thread overview]
Message-ID: <20170920143705.11277-9-mika.kuoppala@intel.com> (raw)
In-Reply-To: <20170920143705.11277-1-mika.kuoppala@intel.com>
Now that we can keep track of what ports we have
dequeued, coalesce only those ports instead of iterating
through all ports.
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
drivers/gpu/drm/i915/i915_guc_submission.c | 31 +++++++++++++++++-------------
drivers/gpu/drm/i915/intel_ringbuffer.h | 9 +++++++++
2 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 359f57a59cba..1057a0fb9f27 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -485,11 +485,13 @@ static void guc_ring_doorbell(struct i915_guc_client *client)
/**
* i915_guc_submit() - Submit commands through GuC
* @engine: engine associated with the commands
+ * @first: index of first execlist port to start coalescing from
*
* The only error here arises if the doorbell hardware isn't functioning
* as expected, which really shouldn't happen.
*/
-static void i915_guc_submit(struct intel_engine_cs *engine)
+static void i915_guc_submit(struct intel_engine_cs *engine,
+ const unsigned int first)
{
struct drm_i915_private *dev_priv = engine->i915;
struct intel_guc *guc = &dev_priv->guc;
@@ -498,7 +500,7 @@ static void i915_guc_submit(struct intel_engine_cs *engine)
const unsigned int engine_id = engine->id;
unsigned int n;
- for (n = 0; n < execlist_active_ports(el); n++) {
+ for (n = first; n < execlist_active_ports(el); n++) {
struct execlist_port *port;
struct drm_i915_gem_request *rq;
unsigned int count;
@@ -506,21 +508,22 @@ static void i915_guc_submit(struct intel_engine_cs *engine)
port = execlist_port_index(el, n);
rq = port_unpack(port, &count);
- if (rq && count == 0) {
- port_set(port, port_pack(rq, ++count));
+ GEM_BUG_ON(!rq);
+ GEM_BUG_ON(count);
- if (i915_vma_is_map_and_fenceable(rq->ring->vma))
- POSTING_READ_FW(GUC_STATUS);
+ port_set(port, port_pack(rq, ++count));
- spin_lock(&client->wq_lock);
+ if (i915_vma_is_map_and_fenceable(rq->ring->vma))
+ POSTING_READ_FW(GUC_STATUS);
- guc_wq_item_append(client, rq);
- guc_ring_doorbell(client);
+ spin_lock(&client->wq_lock);
- client->submissions[engine_id] += 1;
+ guc_wq_item_append(client, rq);
+ guc_ring_doorbell(client);
- spin_unlock(&client->wq_lock);
- }
+ client->submissions[engine_id] += 1;
+
+ spin_unlock(&client->wq_lock);
}
}
@@ -566,6 +569,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine)
struct drm_i915_gem_request *last = NULL;
bool submit = false;
struct rb_node *rb;
+ unsigned int first_idx;
spin_lock_irq(&engine->timeline->lock);
rb = el->first;
@@ -575,6 +579,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine)
goto done;
port = execlist_request_port(el);
+ first_idx = execlist_get_port_index(el, port);
do {
struct i915_priolist *p = rb_entry(rb, typeof(*p), node);
@@ -614,7 +619,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine)
el->first = rb;
if (submit) {
port_assign(port, last);
- i915_guc_submit(engine);
+ i915_guc_submit(engine, first_idx);
}
spin_unlock_irq(&engine->timeline->lock);
}
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index efa5a8ea1ecb..f2eb32539300 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -556,6 +556,15 @@ execlist_port_index(struct intel_engine_execlist * const el,
return &el->port[__port_idx(el->port_head, n, el->port_mask)];
}
+static inline unsigned int
+execlist_get_port_index(const struct intel_engine_execlist * const el,
+ const struct execlist_port * const port)
+{
+ const unsigned int n = port_index(port, el);
+
+ return __port_idx(n, -el->port_head, el->port_mask);
+}
+
static inline struct execlist_port *
execlist_port_head(struct intel_engine_execlist * const el)
{
--
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-09-20 14:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 14:36 [PATCH 0/8] Support for more than two execlist ports (v2) Mika Kuoppala
2017-09-20 14:36 ` [PATCH 1/8] drm/i915: Make own struct for execlist items Mika Kuoppala
2017-09-21 11:55 ` Michał Winiarski
2017-09-21 12:19 ` Chris Wilson
2017-09-21 15:13 ` Joonas Lahtinen
2017-09-20 14:36 ` [PATCH 2/8] drm/i915: Move execlist initialization into intel_engine_cs.c Mika Kuoppala
2017-09-21 12:20 ` Chris Wilson
2017-09-20 14:37 ` [PATCH 3/8] drm/i915: Wrap port cancellation into a function Mika Kuoppala
2017-09-21 12:18 ` Michał Winiarski
2017-09-21 14:02 ` Mika Kuoppala
2017-09-21 12:20 ` Chris Wilson
2017-09-20 14:37 ` [PATCH 4/8] drm/i915: Add execlist_port_complete Mika Kuoppala
2017-09-21 12:21 ` Chris Wilson
2017-09-20 14:37 ` [PATCH 5/8] drm/i915: Make execlist port count variable Mika Kuoppala
2017-09-21 12:21 ` Chris Wilson
2017-09-20 14:37 ` [PATCH 6/8] drm/i915: Introduce execlist_port_* accessors Mika Kuoppala
2017-09-21 12:26 ` Chris Wilson
2017-09-21 14:45 ` Mika Kuoppala
2017-09-20 14:37 ` [PATCH 7/8] drm/i915: Keep track of reserved execlist ports Mika Kuoppala
2017-09-21 12:08 ` Mika Kuoppala
2017-09-21 12:30 ` Chris Wilson
2017-09-20 14:37 ` Mika Kuoppala [this message]
2017-09-21 12:34 ` [PATCH 8/8] drm/i915: Improve GuC request coalescing Chris Wilson
2017-09-21 12:53 ` Michał Winiarski
2017-09-20 15:19 ` ✓ Fi.CI.BAT: success for Support for more than two execlist ports (rev2) Patchwork
2017-09-20 16:34 ` ✓ Fi.CI.IGT: " 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=20170920143705.11277-9-mika.kuoppala@intel.com \
--to=mika.kuoppala@linux.intel.com \
--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