drm/i915: Separate fence pin counting from normal bind pin counting
In order to correctly account for reserving space in the GTT and fences for a batch buffer, we need to independently track whether the fence is pinned due to a fenced GPU access in the batch or whether the buffer is pinned in the aperture. Currently we count the fenced as pinned if the buffer has already been seen in the execbuffer. This leads to a false accounting of available fence registers, causing frequent mass evictions. Worse, if coupled with the change to make i915_gem_object_get_fence() report EDADLK upon fence starvation, the batchbuffer can fail with only one fence required... Fixes intel-gpu-tools/tests/gem_fenced_exec_thrash Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38735 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Tested-by: Paul Neumann <paul104x@yahoo.de> [danvet: Resolve the functional conflict with Jesse Barnes sprite patches, acked by Chris Wilson on irc.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:

committed by
Daniel Vetter

szülő
6a233c7887
commit
1690e1eb7a
@@ -2435,6 +2435,8 @@ i915_gem_object_put_fence(struct drm_i915_gem_object *obj)
|
||||
|
||||
if (obj->fence_reg != I915_FENCE_REG_NONE) {
|
||||
struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
|
||||
|
||||
WARN_ON(dev_priv->fence_regs[obj->fence_reg].pin_count);
|
||||
i915_gem_clear_fence_reg(obj->base.dev,
|
||||
&dev_priv->fence_regs[obj->fence_reg]);
|
||||
|
||||
@@ -2459,7 +2461,7 @@ i915_find_fence_reg(struct drm_device *dev,
|
||||
if (!reg->obj)
|
||||
return reg;
|
||||
|
||||
if (!reg->obj->pin_count)
|
||||
if (!reg->pin_count)
|
||||
avail = reg;
|
||||
}
|
||||
|
||||
@@ -2469,7 +2471,7 @@ i915_find_fence_reg(struct drm_device *dev,
|
||||
/* None available, try to steal one or wait for a user to finish */
|
||||
avail = first = NULL;
|
||||
list_for_each_entry(reg, &dev_priv->mm.fence_list, lru_list) {
|
||||
if (reg->obj->pin_count)
|
||||
if (reg->pin_count)
|
||||
continue;
|
||||
|
||||
if (first == NULL)
|
||||
@@ -2664,6 +2666,7 @@ i915_gem_clear_fence_reg(struct drm_device *dev,
|
||||
list_del_init(®->lru_list);
|
||||
reg->obj = NULL;
|
||||
reg->setup_seqno = 0;
|
||||
reg->pin_count = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user