[Intel-gfx] [RFC 23/37] drm/i915: set request 'head' on allocation not in add_request()

John.C.Harrison at Intel.com John.C.Harrison at Intel.com
Mon Nov 23 03:41:58 PST 2015


From: Dave Gordon <david.s.gordon at intel.com>

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 <david.s.gordon at intel.com>
---
 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 1131fe3..55317b1ca 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2555,7 +2555,6 @@ void __i915_add_request(struct drm_i915_gem_request *request,
 	struct intel_engine_cs *ring;
 	struct drm_i915_private *dev_priv;
 	struct intel_ringbuffer *ringbuf;
-	u32 request_start;
 	int ret;
 
 	if (WARN_ON(request == NULL))
@@ -2572,7 +2571,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
@@ -2624,8 +2622,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
@@ -3127,6 +3123,7 @@ int i915_gem_request_alloc(struct intel_engine_cs *ring,
 		i915_gem_request_cancel(req);
 		return ret;
 	}
+	req->head = intel_ring_get_tail(req->ringbuf);
 
 	*req_out = req;
 	return 0;
-- 
1.9.1



More information about the Intel-gfx mailing list