From: Dave Gordon <david.s.gordon@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v3 6/7] drm/i915/guc: replace assign_doorbell() with select_doorbell_register()
Date: Mon, 13 Jun 2016 17:57:33 +0100 [thread overview]
Message-ID: <1465837054-16245-7-git-send-email-david.s.gordon@intel.com> (raw)
In-Reply-To: <1465837054-16245-1-git-send-email-david.s.gordon@intel.com>
This version doesn't update the doorbell bitmap, as that will
be done when the selected doorbell is associated with a client.
The call is now slightly earlier, just on the general principle
that potentially-failing operations should be done as early as
possible, to eliminate late failures and simplify recovery.
Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_guc_submission.c | 62 +++++++++++++++---------------
1 file changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 62bf4bd..a252505 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -232,6 +232,32 @@ static void guc_disable_doorbell(struct intel_guc *guc,
/* XXX: wait for workqueue to drain */
}
+static uint16_t
+select_doorbell_register(struct intel_guc *guc, uint32_t priority)
+{
+ /*
+ * The bitmap tracks which doorbell registers are currently in use.
+ * It is split into two halves; the first half is used for normal
+ * priority contexts, the second half for high-priority ones.
+ * Note that logically higher priorities are numerically less than
+ * normal ones, so the test below means "is it high-priority?"
+ */
+ const bool hi_pri = (priority <= GUC_CTX_PRIORITY_HIGH);
+ const uint16_t half = GUC_MAX_DOORBELLS / 2;
+ const uint16_t start = hi_pri ? half : 0;
+ const uint16_t end = start + half;
+ uint16_t id;
+
+ id = find_next_zero_bit(guc->doorbell_bitmap, end, start);
+ if (id == end)
+ id = GUC_INVALID_DOORBELL_ID;
+
+ DRM_DEBUG_DRIVER("assigned %s priority doorbell id 0x%x\n",
+ hi_pri ? "high" : "normal", id);
+
+ return id;
+}
+
/*
* Select, assign and relase doorbell cachelines
*
@@ -256,32 +282,6 @@ static uint32_t select_doorbell_cacheline(struct intel_guc *guc)
return offset;
}
-static uint16_t assign_doorbell(struct intel_guc *guc, uint32_t priority)
-{
- /*
- * The bitmap is split into two halves; the first half is used for
- * normal priority contexts, the second half for high-priority ones.
- * Note that logically higher priorities are numerically less than
- * normal ones, so the test below means "is it high-priority?"
- */
- const bool hi_pri = (priority <= GUC_CTX_PRIORITY_HIGH);
- const uint16_t half = GUC_MAX_DOORBELLS / 2;
- const uint16_t start = hi_pri ? half : 0;
- const uint16_t end = start + half;
- uint16_t id;
-
- id = find_next_zero_bit(guc->doorbell_bitmap, end, start);
- if (id == end)
- id = GUC_INVALID_DOORBELL_ID;
- else
- __set_bit(id, guc->doorbell_bitmap);
-
- DRM_DEBUG_DRIVER("assigned %s priority doorbell id 0x%x\n",
- hi_pri ? "high" : "normal", id);
-
- return id;
-}
-
/*
* Initialise the process descriptor shared with the GuC firmware.
*/
@@ -742,6 +742,11 @@ static void gem_release_guc_obj(struct drm_i915_gem_object *obj)
client->wq_offset = GUC_DB_SIZE;
client->wq_size = GUC_WQ_SIZE;
+ db_id = select_doorbell_register(guc, client->priority);
+ if (db_id == GUC_INVALID_DOORBELL_ID)
+ /* XXX: evict a doorbell instead? */
+ goto err;
+
client->doorbell_offset = select_doorbell_cacheline(guc);
/*
@@ -754,11 +759,6 @@ static void gem_release_guc_obj(struct drm_i915_gem_object *obj)
else
client->proc_desc_offset = (GUC_DB_SIZE / 2);
- db_id = assign_doorbell(guc, client->priority);
- if (db_id == GUC_INVALID_DOORBELL_ID)
- /* XXX: evict a doorbell instead */
- goto err;
-
guc_init_proc_desc(guc, client);
guc_init_ctx_desc(guc, client);
if (guc_init_doorbell(guc, client, db_id))
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-06-13 16:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 16:57 [PATCH v3 0/7] drm/i915/guc: updates to GuC doorbell handling Dave Gordon
2016-06-13 16:57 ` [PATCH v3 1/7] drm/i915/guc: add doorbell map to debugfs/i915_guc_info Dave Gordon
2016-06-13 16:57 ` [PATCH v3 2/7] drm/i915/guc: prefer __set/clear_bit() to bitmap_set/clear() Dave Gordon
2016-06-13 16:57 ` [PATCH v3 3/7] drm/i915/guc: remove writes to GEN8_DRBREG registers Dave Gordon
2016-06-13 16:57 ` [PATCH v3 4/7] drm/i915/guc: move guc_ring_doorbell() nearer to callsite Dave Gordon
2016-06-13 16:57 ` [PATCH v3 5/7] drm/i915/guc: refactor doorbell management code Dave Gordon
2016-06-14 12:20 ` Tvrtko Ursulin
2016-06-13 16:57 ` Dave Gordon [this message]
2016-06-14 12:23 ` [PATCH v3 6/7] drm/i915/guc: replace assign_doorbell() with select_doorbell_register() Tvrtko Ursulin
2016-06-13 16:57 ` [PATCH v3 7/7] drm/i915/guc: (re)initialise doorbell h/w when enabling GuC submission Dave Gordon
2016-06-14 5:27 ` ✗ Ro.CI.BAT: failure for drm/i915/guc: updates to GuC doorbell handling (rev2) Patchwork
2016-06-14 13:42 ` Dave Gordon
2016-06-14 14:05 ` Tvrtko Ursulin
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=1465837054-16245-7-git-send-email-david.s.gordon@intel.com \
--to=david.s.gordon@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