[Intel-gfx] [PATCH 59/59] drm/i915: Remove the almost obsolete i915_gem_object_flush_active()

John.C.Harrison at Intel.com John.C.Harrison at Intel.com
Thu Mar 19 05:31:04 PDT 2015


From: John Harrison <John.C.Harrison at Intel.com>

The i915_gem_object_flush_active() call used to do lots. Over time it has done
less and less. Now all it does call i915_gem_retire_requests_ring(). Hence it is
pretty much redundant as the two callers could just call retire directly. This
patch makes that change.

For: VIZ-5115
Signed-off-by: John Harrison <John.C.Harrison at Intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c |   43 +++++++++++----------------------------
 1 file changed, 12 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index acb824c..aef4748 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2825,25 +2825,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
 }
 
 /**
- * Ensures that an object will eventually get non-busy by flushing any required
- * write domains, emitting any outstanding lazy request and retiring and
- * completed requests.
- */
-static int
-i915_gem_object_flush_active(struct drm_i915_gem_object *obj)
-{
-	struct intel_engine_cs *ring;
-
-	if (obj->active) {
-		ring = i915_gem_request_get_ring(obj->last_read_req);
-
-		i915_gem_retire_requests_ring(ring);
-	}
-
-	return 0;
-}
-
-/**
  * i915_gem_wait_ioctl - implements DRM_IOCTL_I915_GEM_WAIT
  * @DRM_IOCTL_ARGS: standard ioctl arguments
  *
@@ -2888,10 +2869,12 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 		return -ENOENT;
 	}
 
-	/* Need to make sure the object gets inactive eventually. */
-	ret = i915_gem_object_flush_active(obj);
-	if (ret)
-		goto out;
+	/* Make sure the object is not pending cleanup. */
+	if (obj->last_read_req) {
+		struct intel_engine_cs *ring;
+		ring = i915_gem_request_get_ring(obj->last_read_req);
+		i915_gem_retire_requests_ring(ring);
+	}
 
 	if (!obj->active || !obj->last_read_req)
 		goto out;
@@ -4335,19 +4318,17 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
 		goto unlock;
 	}
 
-	/* Count all active objects as busy, even if they are currently not used
-	 * by the gpu. Users of this interface expect objects to eventually
-	 * become non-busy without any further actions, therefore emit any
-	 * necessary flushes here.
-	 */
-	ret = i915_gem_object_flush_active(obj);
-
 	args->busy = obj->active;
 	if (obj->last_read_req) {
 		struct intel_engine_cs *ring;
 		BUILD_BUG_ON(I915_NUM_RINGS > 16);
 		ring = i915_gem_request_get_ring(obj->last_read_req);
-		args->busy |= intel_ring_flag(ring) << 16;
+
+		/* Check that the object wasn't simply pending cleanup */
+		i915_gem_retire_requests_ring(ring);
+
+		if (obj->last_read_req)
+			args->busy |= intel_ring_flag(ring) << 16;
 	}
 
 	drm_gem_object_unreference(&obj->base);
-- 
1.7.9.5



More information about the Intel-gfx mailing list