Commit cbcc80df authored by Mika Kuoppala's avatar Mika Kuoppala Committed by Daniel Vetter

drm/i915: Split intel_ring_begin

In preparation for handling ring seqno wrapping, split
intel_ring_begin into helper part which doesn't allocate
seqno.
Signed-off-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 43a7b924
...@@ -1363,11 +1363,31 @@ intel_ring_alloc_seqno(struct intel_ring_buffer *ring) ...@@ -1363,11 +1363,31 @@ intel_ring_alloc_seqno(struct intel_ring_buffer *ring)
return i915_gem_get_seqno(ring->dev, &ring->outstanding_lazy_request); return i915_gem_get_seqno(ring->dev, &ring->outstanding_lazy_request);
} }
static int __intel_ring_begin(struct intel_ring_buffer *ring,
int bytes)
{
int ret;
if (unlikely(ring->tail + bytes > ring->effective_size)) {
ret = intel_wrap_ring_buffer(ring);
if (unlikely(ret))
return ret;
}
if (unlikely(ring->space < bytes)) {
ret = ring_wait_for_space(ring, bytes);
if (unlikely(ret))
return ret;
}
ring->space -= bytes;
return 0;
}
int intel_ring_begin(struct intel_ring_buffer *ring, int intel_ring_begin(struct intel_ring_buffer *ring,
int num_dwords) int num_dwords)
{ {
drm_i915_private_t *dev_priv = ring->dev->dev_private; drm_i915_private_t *dev_priv = ring->dev->dev_private;
int n = 4*num_dwords;
int ret; int ret;
ret = i915_gem_check_wedge(dev_priv, dev_priv->mm.interruptible); ret = i915_gem_check_wedge(dev_priv, dev_priv->mm.interruptible);
...@@ -1379,20 +1399,7 @@ int intel_ring_begin(struct intel_ring_buffer *ring, ...@@ -1379,20 +1399,7 @@ int intel_ring_begin(struct intel_ring_buffer *ring,
if (ret) if (ret)
return ret; return ret;
if (unlikely(ring->tail + n > ring->effective_size)) { return __intel_ring_begin(ring, num_dwords * sizeof(uint32_t));
ret = intel_wrap_ring_buffer(ring);
if (unlikely(ret))
return ret;
}
if (unlikely(ring->space < n)) {
ret = ring_wait_for_space(ring, n);
if (unlikely(ret))
return ret;
}
ring->space -= n;
return 0;
} }
void intel_ring_advance(struct intel_ring_buffer *ring) void intel_ring_advance(struct intel_ring_buffer *ring)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment