[Intel-gfx] [PATCH 3/3] drm/i915: Replace manual checking for idleness with active_requests counter

Chris Wilson chris at chris-wilson.co.uk
Sun Oct 8 13:43:22 UTC 2017


As we emit and retire requests, we track how many are still in flight.
As we have this knowledge, we can make use of that inside
i915_gem_evict_something() as a better test to see if the device is
idle.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index fc7e476448e3..00b8ca15784c 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -33,23 +33,6 @@
 #include "intel_drv.h"
 #include "i915_trace.h"
 
-static bool ggtt_is_idle(struct drm_i915_private *dev_priv)
-{
-	struct i915_ggtt *ggtt = &dev_priv->ggtt;
-	struct intel_engine_cs *engine;
-	enum intel_engine_id id;
-
-	for_each_engine(engine, dev_priv, id) {
-		struct intel_timeline *tl;
-
-		tl = &ggtt->base.timeline.engine[engine->id];
-		if (i915_gem_active_isset(&tl->last_request))
-			return false;
-	}
-
-	return true;
-}
-
 static int ggtt_flush(struct drm_i915_private *i915)
 {
 	int err;
@@ -191,7 +174,7 @@ i915_gem_evict_something(struct i915_address_space *vm,
 	if (!i915_is_ggtt(vm) || flags & PIN_NONBLOCK)
 		return -ENOSPC;
 
-	if (ggtt_is_idle(dev_priv)) {
+	if (!dev_priv->gt.active_requests) {
 		/* If we still have pending pageflip completions, drop
 		 * back to userspace to give our workqueues time to
 		 * acquire our locks and unpin the old scanouts.
-- 
2.14.2



More information about the Intel-gfx mailing list