[Intel-gfx] [PATCH 4/4] drm/i915: Add GuC support for engine busy stats

Tvrtko Ursulin tursulin at ursulin.net
Tue Nov 28 12:41:30 UTC 2017


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

Wire up the engine busy stats accounting to the GuC submission backend.

Since there is not context out interrupt we need to place the accounting
callbacks per-request.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/intel_guc_submission.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c
index a8e63779de79..d80d2a3214da 100644
--- a/drivers/gpu/drm/i915/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/intel_guc_submission.c
@@ -781,6 +781,7 @@ static void guc_dequeue(struct intel_engine_cs *engine)
 			INIT_LIST_HEAD(&rq->priotree.link);
 
 			__i915_gem_request_submit(rq);
+			intel_engine_context_in(rq->engine);
 			trace_i915_gem_request_in(rq,
 						  port_index(port, execlists));
 			last = rq;
@@ -813,6 +814,7 @@ static void guc_submission_tasklet(unsigned long data)
 
 	rq = port_request(&port[0]);
 	while (rq && i915_gem_request_completed(rq)) {
+		intel_engine_context_out(rq->engine);
 		trace_i915_gem_request_out(rq);
 		i915_gem_request_put(rq);
 
@@ -1453,8 +1455,6 @@ int intel_guc_submission_enable(struct intel_guc *guc)
 		execlists->tasklet.func = guc_submission_tasklet;
 		engine->park = guc_submission_park;
 		engine->unpark = guc_submission_unpark;
-
-		engine->flags &= ~I915_ENGINE_SUPPORTS_STATS;
 	}
 
 	return 0;
@@ -1467,8 +1467,6 @@ int intel_guc_submission_enable(struct intel_guc *guc)
 void intel_guc_submission_disable(struct intel_guc *guc)
 {
 	struct drm_i915_private *dev_priv = guc_to_i915(guc);
-	struct intel_engine_cs *engine;
-	enum intel_engine_id id;
 
 	GEM_BUG_ON(dev_priv->gt.awake); /* GT should be parked first */
 
@@ -1477,9 +1475,6 @@ void intel_guc_submission_disable(struct intel_guc *guc)
 	/* Revert back to manual ELSP submission */
 	intel_engines_reset_default_submission(dev_priv);
 
-	for_each_engine(engine, dev_priv, id)
-		engine->flags |= I915_ENGINE_SUPPORTS_STATS;
-
 	guc_clients_destroy(guc);
 }
 
-- 
2.14.1



More information about the Intel-gfx mailing list