@@ -702,7 +702,11 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
request->ringbuf = request->ctx->engine[request->engine->id].ringbuf;
- ret = intel_ring_begin(request, 0);
+ /* Flush enough space to reduce the likelihood of waiting after
+ * we start building the request - in which case we will just
+ * have to repeat work.
+ */
+ ret = intel_ring_begin(request, MIN_SPACE_FOR_ADD_REQUEST);
if (ret)
return ret;
@@ -2333,7 +2333,12 @@ int intel_engine_idle(struct intel_engine_cs *engine)
int intel_ring_alloc_request_extras(struct drm_i915_gem_request *request)
{
request->ringbuf = request->engine->buffer;
- return intel_ring_begin(request, 0);
+
+ /* Flush enough space to reduce the likelihood of waiting after
+ * we start building the request - in which case we will just
+ * have to repeat work.
+ */
+ return intel_ring_begin(request, MIN_SPACE_FOR_ADD_REQUEST);
}
static int wait_for_space(struct drm_i915_gem_request *req, int bytes)
Rather than being interrupted when we run out of space halfway through the request, and having to restart from the beginning (and returning to userspace), flush a little more free space when we prepare the request. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/intel_lrc.c | 6 +++++- drivers/gpu/drm/i915/intel_ringbuffer.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-)