drm/i915: Refactor i915_gem_retire_requests()
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 23 Jul 2010 22:18:49 +0000 (23:18 +0100)
committerEric Anholt <eric@anholt.net>
Mon, 2 Aug 2010 02:52:57 +0000 (19:52 -0700)
Combine the iteration over active render rings into a common function.
This is in preparation for reusing the idle function to also retire
deferred free requests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c

index 119692f3ce9de41a9aa50f659d9f813a981cfd6f..5044f653e8ea981d46729360b5dc609836a319ab 100644 (file)
@@ -340,7 +340,7 @@ int i965_reset(struct drm_device *dev, u8 flags)
        /*
         * Clear request list
         */
-       i915_gem_retire_requests(dev, &dev_priv->render_ring);
+       i915_gem_retire_requests(dev);
 
        if (need_display)
                i915_save_display(dev);
index 46a544abbd6d4388355a6a1fa8d51d18ffb8ebf1..a27780b7aef2d09157efa31b4d0ec2335dc44e80 100644 (file)
@@ -960,8 +960,7 @@ uint32_t i915_get_gem_seqno(struct drm_device *dev,
 bool i915_seqno_passed(uint32_t seq1, uint32_t seq2);
 int i915_gem_object_get_fence_reg(struct drm_gem_object *obj);
 int i915_gem_object_put_fence_reg(struct drm_gem_object *obj);
-void i915_gem_retire_requests(struct drm_device *dev,
-                struct intel_ring_buffer *ring);
+void i915_gem_retire_requests(struct drm_device *dev);
 void i915_gem_retire_work_handler(struct work_struct *work);
 void i915_gem_clflush_object(struct drm_gem_object *obj);
 int i915_gem_object_set_domain(struct drm_gem_object *obj,
index b1069dc09611294d106a3132fab3d3628f762485..138ca6ea5ef797779ceb503a919a78565df9fe1a 100644 (file)
@@ -1709,9 +1709,9 @@ i915_get_gem_seqno(struct drm_device *dev,
 /**
  * This function clears the request list as sequence numbers are passed.
  */
-void
-i915_gem_retire_requests(struct drm_device *dev,
-               struct intel_ring_buffer *ring)
+static void
+i915_gem_retire_requests_ring(struct drm_device *dev,
+                             struct intel_ring_buffer *ring)
 {
        drm_i915_private_t *dev_priv = dev->dev_private;
        uint32_t seqno;
@@ -1750,6 +1750,16 @@ i915_gem_retire_requests(struct drm_device *dev,
        }
 }
 
+void
+i915_gem_retire_requests(struct drm_device *dev)
+{
+       drm_i915_private_t *dev_priv = dev->dev_private;
+
+       i915_gem_retire_requests_ring(dev, &dev_priv->render_ring);
+       if (HAS_BSD(dev))
+               i915_gem_retire_requests_ring(dev, &dev_priv->bsd_ring);
+}
+
 void
 i915_gem_retire_work_handler(struct work_struct *work)
 {
@@ -1761,10 +1771,7 @@ i915_gem_retire_work_handler(struct work_struct *work)
        dev = dev_priv->dev;
 
        mutex_lock(&dev->struct_mutex);
-       i915_gem_retire_requests(dev, &dev_priv->render_ring);
-
-       if (HAS_BSD(dev))
-               i915_gem_retire_requests(dev, &dev_priv->bsd_ring);
+       i915_gem_retire_requests(dev);
 
        if (!dev_priv->mm.suspended &&
                (!list_empty(&dev_priv->render_ring.request_list) ||
@@ -1832,7 +1839,7 @@ i915_do_wait_request(struct drm_device *dev, uint32_t seqno,
         * a separate wait queue to handle that.
         */
        if (ret == 0)
-               i915_gem_retire_requests(dev, ring);
+               i915_gem_retire_requests_ring(dev, ring);
 
        return ret;
 }
@@ -2107,10 +2114,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size)
        struct intel_ring_buffer *render_ring = &dev_priv->render_ring;
        struct intel_ring_buffer *bsd_ring = &dev_priv->bsd_ring;
        for (;;) {
-               i915_gem_retire_requests(dev, render_ring);
-
-               if (HAS_BSD(dev))
-                       i915_gem_retire_requests(dev, bsd_ring);
+               i915_gem_retire_requests(dev);
 
                /* If there's an inactive buffer available now, grab it
                 * and be done.
@@ -4330,7 +4334,6 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
        struct drm_i915_gem_busy *args = data;
        struct drm_gem_object *obj;
        struct drm_i915_gem_object *obj_priv;
-       drm_i915_private_t *dev_priv = dev->dev_private;
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL) {
@@ -4345,10 +4348,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
         * actually unmasked, and our working set ends up being larger than
         * required.
         */
-       i915_gem_retire_requests(dev, &dev_priv->render_ring);
-
-       if (HAS_BSD(dev))
-               i915_gem_retire_requests(dev, &dev_priv->bsd_ring);
+       i915_gem_retire_requests(dev);
 
        obj_priv = to_intel_bo(obj);
        /* Don't count being on the flushing list against the object being
@@ -5054,10 +5054,7 @@ rescan:
                        continue;
 
                spin_unlock(&shrink_list_lock);
-               i915_gem_retire_requests(dev, &dev_priv->render_ring);
-
-               if (HAS_BSD(dev))
-                       i915_gem_retire_requests(dev, &dev_priv->bsd_ring);
+               i915_gem_retire_requests(dev);
 
                list_for_each_entry_safe(obj_priv, next_obj,
                                         &dev_priv->mm.inactive_list,