drm/i915: Move request list retirement to i915_gem_request.c
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 4 Aug 2016 06:52:42 +0000 (07:52 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 4 Aug 2016 07:09:30 +0000 (08:09 +0100)
As the list retirement is now clean of implementation details, we can
move it closer to the request management.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470293567-10811-23-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_request.c

index 9541217f9da6065751d82a22af61bd571d2888a6..2afb435c3b4bae3cf58a8af8836bdc8ef4366bf7 100644 (file)
@@ -2534,50 +2534,6 @@ void i915_gem_reset(struct drm_device *dev)
        i915_gem_restore_fences(dev);
 }
 
-/**
- * This function clears the request list as sequence numbers are passed.
- * @engine: engine to retire requests on
- */
-void
-i915_gem_retire_requests_ring(struct intel_engine_cs *engine)
-{
-       while (!list_empty(&engine->request_list)) {
-               struct drm_i915_gem_request *request;
-
-               request = list_first_entry(&engine->request_list,
-                                          struct drm_i915_gem_request,
-                                          link);
-
-               if (!i915_gem_request_completed(request))
-                       break;
-
-               i915_gem_request_retire_upto(request);
-       }
-}
-
-void i915_gem_retire_requests(struct drm_i915_private *dev_priv)
-{
-       struct intel_engine_cs *engine;
-
-       lockdep_assert_held(&dev_priv->drm.struct_mutex);
-
-       if (dev_priv->gt.active_engines == 0)
-               return;
-
-       GEM_BUG_ON(!dev_priv->gt.awake);
-
-       for_each_engine(engine, dev_priv) {
-               i915_gem_retire_requests_ring(engine);
-               if (list_empty(&engine->request_list))
-                       dev_priv->gt.active_engines &= ~intel_engine_flag(engine);
-       }
-
-       if (dev_priv->gt.active_engines == 0)
-               queue_delayed_work(dev_priv->wq,
-                                  &dev_priv->gt.idle_work,
-                                  msecs_to_jiffies(100));
-}
-
 static void
 i915_gem_retire_work_handler(struct work_struct *work)
 {
index 8549375aa75eb66a47b4558d57061def0ce4e4fd..6faa84832ade9a5c90d6ebf63a170270c7550669 100644 (file)
@@ -731,3 +731,38 @@ complete:
 
        return ret;
 }
+
+void i915_gem_retire_requests_ring(struct intel_engine_cs *engine)
+{
+       struct drm_i915_gem_request *request, *next;
+
+       list_for_each_entry_safe(request, next, &engine->request_list, link) {
+               if (!i915_gem_request_completed(request))
+                       break;
+
+               i915_gem_request_retire(request);
+       }
+}
+
+void i915_gem_retire_requests(struct drm_i915_private *dev_priv)
+{
+       struct intel_engine_cs *engine;
+
+       lockdep_assert_held(&dev_priv->drm.struct_mutex);
+
+       if (dev_priv->gt.active_engines == 0)
+               return;
+
+       GEM_BUG_ON(!dev_priv->gt.awake);
+
+       for_each_engine(engine, dev_priv) {
+               i915_gem_retire_requests_ring(engine);
+               if (list_empty(&engine->request_list))
+                       dev_priv->gt.active_engines &= ~intel_engine_flag(engine);
+       }
+
+       if (dev_priv->gt.active_engines == 0)
+               queue_delayed_work(dev_priv->wq,
+                                  &dev_priv->gt.idle_work,
+                                  msecs_to_jiffies(100));
+}