summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_ringbuffer.c
diff options
context:
space:
mode:
authorChris Wilson2016-04-28 10:56:49 +0200
committerChris Wilson2016-04-28 13:17:32 +0200
commit6310346e75cabb79f1c6acb3f801eecda09f0980 (patch)
tree56b8f081f8c0dd4f4e49d90d59930fd0b7c66e84 /drivers/gpu/drm/i915/intel_ringbuffer.c
parentdrm/i915: Manually unwind after a failed request allocation (diff)
downloadkernel-qcow2-linux-6310346e75cabb79f1c6acb3f801eecda09f0980.tar.gz
kernel-qcow2-linux-6310346e75cabb79f1c6acb3f801eecda09f0980.tar.xz
kernel-qcow2-linux-6310346e75cabb79f1c6acb3f801eecda09f0980.zip
drm/i915: Preallocate enough space for the average request
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> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1461833819-3991-15-git-send-email-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index c2a699230809..b5e79ac29ebc 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2339,8 +2339,22 @@ int intel_engine_idle(struct intel_engine_cs *engine)
int intel_ring_alloc_request_extras(struct drm_i915_gem_request *request)
{
+ int ret;
+
+ /* 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.
+ */
+ request->reserved_space += MIN_SPACE_FOR_ADD_REQUEST;
+
request->ringbuf = request->engine->buffer;
- return intel_ring_begin(request, 0);
+
+ ret = intel_ring_begin(request, 0);
+ if (ret)
+ return ret;
+
+ request->reserved_space -= MIN_SPACE_FOR_ADD_REQUEST;
+ return 0;
}
static int wait_for_space(struct drm_i915_gem_request *req, int bytes)