diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-08-04 10:36:30 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-08-09 14:24:30 -0400 |
commit | 0be555b66a871d711a89c301b37e763058d34d33 (patch) | |
tree | 0ffba3830fa95017b499b109d2a03a1a67af0b9f | |
parent | 403c89ff3960c540ac4d203035078f82082411cb (diff) |
drm/i915: report all active objects as busy
Incorporates a similar patch by Daniel Vetter, the alteration being to
report the current busy state after retiring.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index fc61542cce8a..24ee4622484f 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -4365,22 +4365,34 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
4365 | } | 4365 | } |
4366 | 4366 | ||
4367 | mutex_lock(&dev->struct_mutex); | 4367 | mutex_lock(&dev->struct_mutex); |
4368 | /* Update the active list for the hardware's current position. | ||
4369 | * Otherwise this only updates on a delayed timer or when irqs are | ||
4370 | * actually unmasked, and our working set ends up being larger than | ||
4371 | * required. | ||
4372 | */ | ||
4373 | i915_gem_retire_requests(dev); | ||
4374 | 4368 | ||
4375 | obj_priv = to_intel_bo(obj); | 4369 | /* Count all active objects as busy, even if they are currently not used |
4376 | /* Don't count being on the flushing list against the object being | 4370 | * by the gpu. Users of this interface expect objects to eventually |
4377 | * done. Otherwise, a buffer left on the flushing list but not getting | 4371 | * become non-busy without any further actions, therefore emit any |
4378 | * flushed (because nobody's flushing that domain) won't ever return | 4372 | * necessary flushes here. |
4379 | * unbusy and get reused by libdrm's bo cache. The other expected | ||
4380 | * consumer of this interface, OpenGL's occlusion queries, also specs | ||
4381 | * that the objects get unbusy "eventually" without any interference. | ||
4382 | */ | 4373 | */ |
4383 | args->busy = obj_priv->active && obj_priv->last_rendering_seqno != 0; | 4374 | obj_priv = to_intel_bo(obj); |
4375 | args->busy = obj_priv->active; | ||
4376 | if (args->busy) { | ||
4377 | /* Unconditionally flush objects, even when the gpu still uses this | ||
4378 | * object. Userspace calling this function indicates that it wants to | ||
4379 | * use this buffer rather sooner than later, so issuing the required | ||
4380 | * flush earlier is beneficial. | ||
4381 | */ | ||
4382 | if (obj->write_domain) { | ||
4383 | i915_gem_flush(dev, 0, obj->write_domain); | ||
4384 | (void)i915_add_request(dev, file_priv, obj->write_domain, obj_priv->ring); | ||
4385 | } | ||
4386 | |||
4387 | /* Update the active list for the hardware's current position. | ||
4388 | * Otherwise this only updates on a delayed timer or when irqs | ||
4389 | * are actually unmasked, and our working set ends up being | ||
4390 | * larger than required. | ||
4391 | */ | ||
4392 | i915_gem_retire_requests_ring(dev, obj_priv->ring); | ||
4393 | |||
4394 | args->busy = obj_priv->active; | ||
4395 | } | ||
4384 | 4396 | ||
4385 | drm_gem_object_unreference(obj); | 4397 | drm_gem_object_unreference(obj); |
4386 | mutex_unlock(&dev->struct_mutex); | 4398 | mutex_unlock(&dev->struct_mutex); |