From 97764b08658612e5e86f87075563482603588cd8 Mon Sep 17 00:00:00 2001 From: Dave Gordon Date: Thu, 22 Oct 2015 16:46:25 +0100 Subject: drm/i915: set request 'head' on allocation not in add_request() The current setting of request 'head' in add_request() isn't useful and has been replaced for purposes of knowing how full the ring is by 'postfix'. So we can instead use 'head' to define and locate the entire range spanned by a request. Pictorially, head postfix tail | | | v v v ringbuffer: [......S......P.......I.....] where S, P, and I are the Start of the request, start of the Postfix, and the user-Interrupt respectively. To help with debugging, this request's tail should also be the next request's head, this showing that all ringbuffer usage is accounted for. For: VIZ-2021 Signed-off-by: Dave Gordon --- drivers/gpu/drm/i915/i915_gem.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 2e5434d2bed8..a866a9d0c8d9 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2632,7 +2632,6 @@ void __i915_add_request(struct drm_i915_gem_request *request, struct intel_engine_cs *engine; struct drm_i915_private *dev_priv; struct intel_ringbuffer *ringbuf; - u32 request_start; int ret; if (WARN_ON(request == NULL)) @@ -2649,7 +2648,6 @@ void __i915_add_request(struct drm_i915_gem_request *request, */ intel_ring_reserved_space_use(ringbuf); - request_start = intel_ring_get_tail(ringbuf); /* * Emit any outstanding flushes - execbuf can fail to emit the flush * after having emitted the batchbuffer command. Hence we need to fix @@ -2701,8 +2699,6 @@ void __i915_add_request(struct drm_i915_gem_request *request, /* Not allowed to fail! */ WARN(ret, "emit|add_request failed: %d!\n", ret); - request->head = request_start; - /* Whilst this request exists, batch_obj will be on the * active_list, and so will hold the active reference. Only when this * request is retired will the the batch_obj be moved onto the @@ -3226,6 +3222,7 @@ __i915_gem_request_alloc(struct intel_engine_cs *engine, i915_gem_request_cancel(req); return ret; } + req->head = intel_ring_get_tail(req->ringbuf); *req_out = req; return 0; -- cgit v1.2.3