[Intel-gfx] [RFC 11/37] drm/i915/guc: Add a second client, to be used for preemption
John.C.Harrison at Intel.com
John.C.Harrison at Intel.com
Mon Nov 23 03:41:46 PST 2015
From: Dave Gordon <david.s.gordon at intel.com>
This second client is created with priority KMD_HIGH, and marked
as preemptive.
For: VIZ-2021
Signed-off-by: Dave Gordon <david.s.gordon at intel.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 9 +++++++++
drivers/gpu/drm/i915/i915_guc_submission.c | 15 ++++++++++++++-
drivers/gpu/drm/i915/intel_guc.h | 1 +
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index fefe73c..9e8f624 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2690,6 +2690,7 @@ static int i915_guc_info(struct seq_file *m, void *data)
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_guc guc;
struct i915_guc_client client = {};
+ struct i915_guc_client preempt = {};
struct intel_engine_cs *ring;
enum intel_ring_id i;
u64 total = 0;
@@ -2705,6 +2706,11 @@ static int i915_guc_info(struct seq_file *m, void *data)
client = *guc.execbuf_client;
spin_unlock(&guc.execbuf_client->wq_lock);
}
+ if (guc.preempt_client) {
+ spin_lock(&guc.preempt_client->wq_lock);
+ preempt = *guc.preempt_client;
+ spin_unlock(&guc.preempt_client->wq_lock);
+ }
spin_unlock(&dev_priv->guc.host2guc_lock);
seq_printf(m, "GuC total action count: %llu\n", guc.action_count);
@@ -2725,6 +2731,9 @@ static int i915_guc_info(struct seq_file *m, void *data)
seq_printf(m, "\nGuC execbuf client @ %p:\n", guc.execbuf_client);
i915_guc_client_info(m, dev_priv, &client);
+ seq_printf(m, "\nGuC preempt client @ %p:\n", guc.preempt_client);
+ i915_guc_client_info(m, dev_priv, &preempt);
+
/* Add more as required ... */
return 0;
diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 55e10eb..d8fd644 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -395,6 +395,8 @@ static void guc_init_ctx_desc(struct intel_guc *guc,
memset(&desc, 0, sizeof(desc));
desc.attribute = GUC_CTX_DESC_ATTR_ACTIVE | GUC_CTX_DESC_ATTR_KERNEL;
+ if (client->priority <= GUC_CTX_PRIORITY_HIGH)
+ desc.attribute |= GUC_CTX_DESC_ATTR_PREEMPT;
desc.context_id = client->ctx_index;
desc.priority = client->priority;
desc.db_id = client->doorbell_id;
@@ -588,6 +590,9 @@ int i915_guc_submit(struct i915_guc_client *client,
unsigned long flags;
int q_ret, b_ret;
+ if (WARN_ON(ring_id >= I915_NUM_RINGS))
+ return -ENXIO;
+
/* Need this because of the deferred pin ctx and ring */
/* Shall we move this right after ring is pinned? */
lr_context_update(rq);
@@ -882,9 +887,15 @@ int i915_guc_submission_enable(struct drm_device *dev)
DRM_ERROR("Failed to create execbuf guc_client\n");
return -ENOMEM;
}
-
guc->execbuf_client = client;
+ /* 2nd client for preemptive submission */
+ client = guc_client_alloc(dev, GUC_CTX_PRIORITY_KMD_HIGH, ctx);
+ if (!client) {
+ DRM_ERROR("Failed to create preemptive guc_client\n");
+ }
+ guc->preempt_client = client;
+
host2guc_sample_forcewake(guc, client);
return 0;
@@ -895,6 +906,8 @@ void i915_guc_submission_disable(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_guc *guc = &dev_priv->guc;
+ guc_client_free(dev, guc->preempt_client);
+ guc->preempt_client = NULL;
guc_client_free(dev, guc->execbuf_client);
guc->execbuf_client = NULL;
}
diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h
index 386e79a..f56e0d9 100644
--- a/drivers/gpu/drm/i915/intel_guc.h
+++ b/drivers/gpu/drm/i915/intel_guc.h
@@ -94,6 +94,7 @@ struct intel_guc {
struct ida ctx_ids;
struct i915_guc_client *execbuf_client;
+ struct i915_guc_client *preempt_client;
spinlock_t host2guc_lock; /* Protects all data below */
--
1.9.1
More information about the Intel-gfx
mailing list