drm/i915: Simplify fence finding
As the fences are stored in LRU order, we can simply reuse the oldest if we do not have an unused register. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
1c293ea3b1
commit
8fe301add5
@ -2352,7 +2352,7 @@ static struct drm_i915_fence_reg *
|
|||||||
i915_find_fence_reg(struct drm_device *dev)
|
i915_find_fence_reg(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||||
struct drm_i915_fence_reg *reg, *first, *avail;
|
struct drm_i915_fence_reg *reg, *avail;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* First try to find a free reg */
|
/* First try to find a free reg */
|
||||||
@ -2370,24 +2370,14 @@ i915_find_fence_reg(struct drm_device *dev)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* None available, try to steal one or wait for a user to finish */
|
/* 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) {
|
list_for_each_entry(reg, &dev_priv->mm.fence_list, lru_list) {
|
||||||
if (reg->pin_count)
|
if (reg->pin_count)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (first == NULL)
|
return reg;
|
||||||
first = reg;
|
|
||||||
|
|
||||||
if (reg->obj->last_fenced_seqno == 0) {
|
|
||||||
avail = reg;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avail == NULL)
|
return NULL;
|
||||||
avail = first;
|
|
||||||
|
|
||||||
return avail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user