aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_ringbuffer.c
diff options
context:
space:
mode:
authorJohn Harrison <John.C.Harrison@Intel.com>2015-05-29 12:44:09 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-06-23 08:02:30 -0400
commitccd98fe4996cd22094cde7b6a1f7c569f261b3e9 (patch)
tree77855ea48506c5873ed6bf7d21f74e790c74c6ab /drivers/gpu/drm/i915/intel_ringbuffer.c
parent4d616a293a1071d19066808abccb40930f0ae5a0 (diff)
drm/i915: Add *_ring_begin() to request allocation
Now that the *_ring_begin() functions no longer call the request allocation code, it is finally safe for the request allocation code to call *_ring_begin(). This is important to guarantee that the space reserved for the subsequent i915_add_request() call does actually get reserved. v2: Renamed functions according to review feedback (Tomas Elf). For: VIZ-5115 Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index dfba3ee57382..a378360d0461 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2202,24 +2202,27 @@ int intel_ring_alloc_request_extras(struct drm_i915_gem_request *request)
2202 return 0; 2202 return 0;
2203} 2203}
2204 2204
2205int intel_ring_reserve_space(struct drm_i915_gem_request *request)
2206{
2207 /*
2208 * The first call merely notes the reserve request and is common for
2209 * all back ends. The subsequent localised _begin() call actually
2210 * ensures that the reservation is available. Without the begin, if
2211 * the request creator immediately submitted the request without
2212 * adding any commands to it then there might not actually be
2213 * sufficient room for the submission commands.
2214 */
2215 intel_ring_reserved_space_reserve(request->ringbuf, MIN_SPACE_FOR_ADD_REQUEST);
2216
2217 return intel_ring_begin(request, 0);
2218}
2219
2205void intel_ring_reserved_space_reserve(struct intel_ringbuffer *ringbuf, int size) 2220void intel_ring_reserved_space_reserve(struct intel_ringbuffer *ringbuf, int size)
2206{ 2221{
2207 /* NB: Until request management is fully tidied up and the OLR is 2222 WARN_ON(ringbuf->reserved_size);
2208 * removed, there are too many ways for get false hits on this
2209 * anti-recursion check! */
2210 /*WARN_ON(ringbuf->reserved_size);*/
2211 WARN_ON(ringbuf->reserved_in_use); 2223 WARN_ON(ringbuf->reserved_in_use);
2212 2224
2213 ringbuf->reserved_size = size; 2225 ringbuf->reserved_size = size;
2214
2215 /*
2216 * Really need to call _begin() here but that currently leads to
2217 * recursion problems! This will be fixed later but for now just
2218 * return and hope for the best. Note that there is only a real
2219 * problem if the create of the request never actually calls _begin()
2220 * but if they are not submitting any work then why did they create
2221 * the request in the first place?
2222 */
2223} 2226}
2224 2227
2225void intel_ring_reserved_space_cancel(struct intel_ringbuffer *ringbuf) 2228void intel_ring_reserved_space_cancel(struct intel_ringbuffer *ringbuf)