drm/i915: Record the position of the workarounds in the tail of the request
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 9 Sep 2016 13:11:43 +0000 (14:11 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 9 Sep 2016 13:23:00 +0000 (14:23 +0100)
Rather than blindly assuming we need to advance the tail for
resubmitting the request via the ELSP, record the position.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160909131201.16673-3-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_request.h
drivers/gpu/drm/i915/intel_lrc.c

index 91014de8bfbcf9859659412ba93015c78ad132e5..2faa3bb4c39bfc1ae15b383b5dec4e978632a29a 100644 (file)
@@ -88,20 +88,23 @@ struct drm_i915_gem_request {
         */
        u32 previous_seqno;
 
-       /** Position in the ringbuffer of the start of the request */
+       /** Position in the ring of the start of the request */
        u32 head;
 
        /**
-        * Position in the ringbuffer of the start of the postfix.
-        * This is required to calculate the maximum available ringbuffer
-        * space without overwriting the postfix.
+        * Position in the ring of the start of the postfix.
+        * This is required to calculate the maximum available ring space
+        * without overwriting the postfix.
         */
        u32 postfix;
 
-       /** Position in the ringbuffer of the end of the whole request */
+       /** Position in the ring of the end of the whole request */
        u32 tail;
 
-       /** Preallocate space in the ringbuffer for the emitting the request */
+       /** Position in the ring of the end of any workarounds after the tail */
+       u32 wa_tail;
+
+       /** Preallocate space in the ring for the emitting the request */
        u32 reserved_space;
 
        /**
index 9bfe304c5256da4191b9ff470852c955d1c7e761..d7fa9b3a55c3b283f976b6b13e97b10d55cb24bc 100644 (file)
@@ -482,8 +482,7 @@ static void execlists_unqueue(struct intel_engine_cs *engine)
                 * resubmit the request. See gen8_emit_request() for where we
                 * prepare the padding after the end of the request.
                 */
-               req0->tail += 8;
-               req0->tail &= req0->ring->size - 1;
+               req0->tail = req0->wa_tail;
        }
 
        execlists_elsp_submit_contexts(req0, req1);
@@ -711,6 +710,7 @@ intel_logical_ring_advance(struct drm_i915_gem_request *request)
        intel_ring_emit(ring, MI_NOOP);
        intel_ring_emit(ring, MI_NOOP);
        intel_ring_advance(ring);
+       request->wa_tail = ring->tail;
 
        /* We keep the previous context alive until we retire the following
         * request. This ensures that any the context object is still pinned