drm/i915: Convert 'trace_irq' to use requests rather than seqnos
authorJohn Harrison <John.C.Harrison@Intel.com>
Mon, 24 Nov 2014 18:49:39 +0000 (18:49 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 3 Dec 2014 08:35:24 +0000 (09:35 +0100)
Updated the trace_irq code to use requests instead of seqnos. This includes
reference counting the request object to ensure it sticks around when required.
Note that getting access to the reference counting functions means moving the
inline i915_trace_irq_get() function from intel_ringbuffer.h to i915_drv.h.

For: VIZ-4377
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Thomas Daniel <Thomas.Daniel@intel.com>
[danvet: Resolve conflict due to shuffled merge order.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_trace.h
drivers/gpu/drm/i915/intel_ringbuffer.h

index 97804a3be67c84cae6f94a3a6d22c40e0cb8cc16..049482f5d9ac14d825edc1e8c26eb10a8c1f7db4 100644 (file)
@@ -3132,4 +3132,11 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
        }
 }
 
+static inline void i915_trace_irq_get(struct intel_engine_cs *ring,
+                                     struct drm_i915_gem_request *req)
+{
+       if (ring->trace_irq_req == NULL && ring->irq_get(ring))
+               i915_gem_request_assign(&ring->trace_irq_req, req);
+}
+
 #endif
index b9222a76e52fc56185dafefecb2cf52cbf5ef4e0..0751ec9a96f1c42f40fc9bfb35552adb47b1194a 100644 (file)
@@ -2786,11 +2786,10 @@ i915_gem_retire_requests_ring(struct intel_engine_cs *ring)
                i915_gem_free_request(request);
        }
 
-       if (unlikely(ring->trace_irq_seqno &&
-                    i915_seqno_passed(ring->get_seqno(ring, true),
-                                      ring->trace_irq_seqno))) {
+       if (unlikely(ring->trace_irq_req &&
+                    i915_gem_request_completed(ring->trace_irq_req, true))) {
                ring->irq_put(ring);
-               ring->trace_irq_seqno = 0;
+               i915_gem_request_assign(&ring->trace_irq_req, NULL);
        }
 
        WARN_ON(i915_verify_lists(ring->dev));
index 2c0327b6661863f95190f7108f0a2127941b3264..2ade958f28f8358432130888bf1095b83fde49e5 100644 (file)
@@ -369,7 +369,7 @@ TRACE_EVENT(i915_gem_ring_dispatch,
                           __entry->ring = ring->id;
                           __entry->seqno = i915_gem_request_get_seqno(req);
                           __entry->flags = flags;
-                          i915_trace_irq_get(ring, __entry->seqno);
+                          i915_trace_irq_get(ring, req);
                           ),
 
            TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x",
index 2a84bd9688a8718a7b6c3209998bd1196374808a..39e303d83e915b9c1a2298883ee6bbed055c20fa 100644 (file)
@@ -142,7 +142,7 @@ struct  intel_engine_cs {
 
        unsigned irq_refcount; /* protected by dev_priv->irq_lock */
        u32             irq_enable_mask;        /* bitmask to enable ring interrupt */
-       u32             trace_irq_seqno;
+       struct drm_i915_gem_request *trace_irq_req;
        bool __must_check (*irq_get)(struct intel_engine_cs *ring);
        void            (*irq_put)(struct intel_engine_cs *ring);
 
@@ -442,10 +442,4 @@ intel_ring_get_request(struct intel_engine_cs *ring)
        return ring->outstanding_lazy_request;
 }
 
-static inline void i915_trace_irq_get(struct intel_engine_cs *ring, u32 seqno)
-{
-       if (ring->trace_irq_seqno == 0 && ring->irq_get(ring))
-               ring->trace_irq_seqno = seqno;
-}
-
 #endif /* _INTEL_RINGBUFFER_H_ */