aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-01-09 16:05:44 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2011-01-11 17:15:30 -0500
commit0a58705b2fc3fa29525cf2fdae3d4276a5771280 (patch)
tree86286dbcc87b93c411adc22aae9e4ace1975b480
parentd9126400580e2caada85fa68799952956a6062fd (diff)
drm/i915: Periodically flush the active lists and requests
In order to retire active buffers whilst no client is active, we need to insert our own flush requests onto the ring. This is useful for servers that queue up some rendering and then go to sleep as it allows us to the complete processing of those requests, potentially making that memory available again much earlier. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 2873d068eb1f..87c2df714f66 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1935,6 +1935,8 @@ i915_gem_retire_work_handler(struct work_struct *work)
1935{ 1935{
1936 drm_i915_private_t *dev_priv; 1936 drm_i915_private_t *dev_priv;
1937 struct drm_device *dev; 1937 struct drm_device *dev;
1938 bool idle;
1939 int i;
1938 1940
1939 dev_priv = container_of(work, drm_i915_private_t, 1941 dev_priv = container_of(work, drm_i915_private_t,
1940 mm.retire_work.work); 1942 mm.retire_work.work);
@@ -1948,11 +1950,31 @@ i915_gem_retire_work_handler(struct work_struct *work)
1948 1950
1949 i915_gem_retire_requests(dev); 1951 i915_gem_retire_requests(dev);
1950 1952
1951 if (!dev_priv->mm.suspended && 1953 /* Send a periodic flush down the ring so we don't hold onto GEM
1952 (!list_empty(&dev_priv->ring[RCS].request_list) || 1954 * objects indefinitely.
1953 !list_empty(&dev_priv->ring[VCS].request_list) || 1955 */
1954 !list_empty(&dev_priv->ring[BCS].request_list))) 1956 idle = true;
1957 for (i = 0; i < I915_NUM_RINGS; i++) {
1958 struct intel_ring_buffer *ring = &dev_priv->ring[i];
1959
1960 if (!list_empty(&ring->gpu_write_list)) {
1961 struct drm_i915_gem_request *request;
1962 int ret;
1963
1964 ret = i915_gem_flush_ring(dev, ring, 0,
1965 I915_GEM_GPU_DOMAINS);
1966 request = kzalloc(sizeof(*request), GFP_KERNEL);
1967 if (ret || request == NULL ||
1968 i915_add_request(dev, NULL, request, ring))
1969 kfree(request);
1970 }
1971
1972 idle &= list_empty(&ring->request_list);
1973 }
1974
1975 if (!dev_priv->mm.suspended && !idle)
1955 queue_delayed_work(dev_priv->wq, &dev_priv->mm.retire_work, HZ); 1976 queue_delayed_work(dev_priv->wq, &dev_priv->mm.retire_work, HZ);
1977
1956 mutex_unlock(&dev->struct_mutex); 1978 mutex_unlock(&dev->struct_mutex);
1957} 1979}
1958 1980