Commit ed2922c0 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Remove redundant trailing request flush

Now that we perform the request flushing inline with emitting the
breadcrumb, we can remove the now redundant manual flush. And we can
also remove the infrastructure that remained only for its purpose.

v2: emit_breadcrumb_sz is in dwords, but rq->reserved_space is in bytes
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181228171641.16531-1-chris@chris-wilson.co.uk
parent 6bf19817
...@@ -521,10 +521,6 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx) ...@@ -521,10 +521,6 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
reserve_gt(i915); reserve_gt(i915);
ret = intel_ring_wait_for_space(ce->ring, MIN_SPACE_FOR_ADD_REQUEST);
if (ret)
goto err_unreserve;
/* Move our oldest request to the slab-cache (if not in use!) */ /* Move our oldest request to the slab-cache (if not in use!) */
rq = list_first_entry(&ce->ring->request_list, typeof(*rq), ring_link); rq = list_first_entry(&ce->ring->request_list, typeof(*rq), ring_link);
if (!list_is_last(&rq->ring_link, &ce->ring->request_list) && if (!list_is_last(&rq->ring_link, &ce->ring->request_list) &&
...@@ -616,9 +612,13 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx) ...@@ -616,9 +612,13 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
* i915_request_add() call can't fail. Note that the reserve may need * i915_request_add() call can't fail. Note that the reserve may need
* to be redone if the request is not actually submitted straight * to be redone if the request is not actually submitted straight
* away, e.g. because a GPU scheduler has deferred it. * away, e.g. because a GPU scheduler has deferred it.
*
* Note that due to how we add reserved_space to intel_ring_begin()
* we need to double our request to ensure that if we need to wrap
* around inside i915_request_add() there is sufficient space at
* the beginning of the ring as well.
*/ */
rq->reserved_space = MIN_SPACE_FOR_ADD_REQUEST; rq->reserved_space = 2 * engine->emit_breadcrumb_sz * sizeof(u32);
GEM_BUG_ON(rq->reserved_space < engine->emit_breadcrumb_sz);
/* /*
* Record the position of the start of the request so that * Record the position of the start of the request so that
...@@ -860,8 +860,8 @@ void i915_request_add(struct i915_request *request) ...@@ -860,8 +860,8 @@ void i915_request_add(struct i915_request *request)
* should already have been reserved in the ring buffer. Let the ring * should already have been reserved in the ring buffer. Let the ring
* know that it is time to use that space up. * know that it is time to use that space up.
*/ */
GEM_BUG_ON(request->reserved_space > request->ring->space);
request->reserved_space = 0; request->reserved_space = 0;
engine->emit_flush(request, EMIT_FLUSH);
/* /*
* Record the position of the start of the breadcrumb so that * Record the position of the start of the breadcrumb so that
......
...@@ -1904,22 +1904,6 @@ static noinline int wait_for_space(struct intel_ring *ring, unsigned int bytes) ...@@ -1904,22 +1904,6 @@ static noinline int wait_for_space(struct intel_ring *ring, unsigned int bytes)
return 0; return 0;
} }
int intel_ring_wait_for_space(struct intel_ring *ring, unsigned int bytes)
{
GEM_BUG_ON(bytes > ring->effective_size);
if (unlikely(bytes > ring->effective_size - ring->emit))
bytes += ring->size - ring->emit;
if (unlikely(bytes > ring->space)) {
int ret = wait_for_space(ring, bytes);
if (unlikely(ret))
return ret;
}
GEM_BUG_ON(ring->space < bytes);
return 0;
}
u32 *intel_ring_begin(struct i915_request *rq, unsigned int num_dwords) u32 *intel_ring_begin(struct i915_request *rq, unsigned int num_dwords)
{ {
struct intel_ring *ring = rq->ring; struct intel_ring *ring = rq->ring;
......
...@@ -754,7 +754,6 @@ void intel_legacy_submission_resume(struct drm_i915_private *dev_priv); ...@@ -754,7 +754,6 @@ void intel_legacy_submission_resume(struct drm_i915_private *dev_priv);
int __must_check intel_ring_cacheline_align(struct i915_request *rq); int __must_check intel_ring_cacheline_align(struct i915_request *rq);
int intel_ring_wait_for_space(struct intel_ring *ring, unsigned int bytes);
u32 __must_check *intel_ring_begin(struct i915_request *rq, unsigned int n); u32 __must_check *intel_ring_begin(struct i915_request *rq, unsigned int n);
static inline void intel_ring_advance(struct i915_request *rq, u32 *cs) static inline void intel_ring_advance(struct i915_request *rq, u32 *cs)
...@@ -895,15 +894,6 @@ static inline bool intel_engine_has_started(struct intel_engine_cs *engine, ...@@ -895,15 +894,6 @@ static inline bool intel_engine_has_started(struct intel_engine_cs *engine,
void intel_engine_get_instdone(struct intel_engine_cs *engine, void intel_engine_get_instdone(struct intel_engine_cs *engine,
struct intel_instdone *instdone); struct intel_instdone *instdone);
/*
* Arbitrary size for largest possible 'add request' sequence. The code paths
* are complex and variable. Empirical measurement shows that the worst case
* is BDW at 192 bytes (6 + 6 + 36 dwords), then ILK at 136 bytes. However,
* we need to allocate double the largest single packet within that emission
* to account for tail wraparound (so 6 + 6 + 72 dwords for BDW).
*/
#define MIN_SPACE_FOR_ADD_REQUEST 336
static inline u32 intel_hws_seqno_address(struct intel_engine_cs *engine) static inline u32 intel_hws_seqno_address(struct intel_engine_cs *engine)
{ {
return engine->status_page.ggtt_offset + I915_GEM_HWS_INDEX_ADDR; return engine->status_page.ggtt_offset + I915_GEM_HWS_INDEX_ADDR;
......
...@@ -148,8 +148,6 @@ static struct intel_ring *mock_ring(struct intel_engine_cs *engine) ...@@ -148,8 +148,6 @@ static struct intel_ring *mock_ring(struct intel_engine_cs *engine)
const unsigned long sz = PAGE_SIZE / 2; const unsigned long sz = PAGE_SIZE / 2;
struct mock_ring *ring; struct mock_ring *ring;
BUILD_BUG_ON(MIN_SPACE_FOR_ADD_REQUEST > sz);
ring = kzalloc(sizeof(*ring) + sz, GFP_KERNEL); ring = kzalloc(sizeof(*ring) + sz, GFP_KERNEL);
if (!ring) if (!ring)
return NULL; return NULL;
......
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