drm/i915: Add unique id to the request structure for debugging
authorJohn Harrison <John.C.Harrison@Intel.com>
Fri, 5 Dec 2014 13:49:35 +0000 (13:49 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sat, 6 Dec 2014 00:46:27 +0000 (01:46 +0100)
For debugging purposes, it is useful to be able to uniquely identify a given
request structure as it works its way through the system. This becomes
especially tricky once the seqno value is lazily allocated as then the request
has nothing but its pointer to identify it for much of its life.

Change-Id: Ie76b2268b940467f4cdf5a4ba6f5a54cbb96445d
For: VIZ-4377
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Thomas Daniel <Thomas.Daniel@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_ringbuffer.c

index 502a01bef1ed65c67df6f66112bcfc16e3b052c1..95dfa2dd35b921756ec5643372534098da516d80 100644 (file)
@@ -1787,6 +1787,8 @@ struct drm_i915_private {
                void (*stop_ring)(struct intel_engine_cs *ring);
        } gt;
 
+       uint32_t request_uniq;
+
        /*
         * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
         * will be rejected. Instead look for a better place.
@@ -2019,6 +2021,8 @@ struct drm_i915_gem_request {
        struct drm_i915_file_private *file_priv;
        /** file_priv list entry for this request */
        struct list_head client_list;
+
+       uint32_t uniq;
 };
 
 void i915_gem_request_free(struct kref *req_ref);
index 782e97638ed8bb640048d2818c6ed5fb3441ca18..a82020ea9d0a9856cbeaf3b10397a8e83a7fa929 100644 (file)
@@ -880,6 +880,7 @@ static int logical_ring_alloc_request(struct intel_engine_cs *ring,
                                      struct intel_context *ctx)
 {
        struct drm_i915_gem_request *request;
+       struct drm_i915_private *dev_private = ring->dev->dev_private;
        int ret;
 
        if (ring->outstanding_lazy_request)
@@ -899,6 +900,7 @@ static int logical_ring_alloc_request(struct intel_engine_cs *ring,
 
        kref_init(&request->ref);
        request->ring = ring;
+       request->uniq = dev_private->request_uniq++;
 
        ret = i915_gem_get_seqno(ring->dev, &request->seqno);
        if (ret) {
index 8828219139374ae8f4273388f8b3ea1d239df613..3887f1aaf057ff813378593293eb0596e923e82c 100644 (file)
@@ -2028,6 +2028,7 @@ intel_ring_alloc_request(struct intel_engine_cs *ring)
 {
        int ret;
        struct drm_i915_gem_request *request;
+       struct drm_i915_private *dev_private = ring->dev->dev_private;
 
        if (ring->outstanding_lazy_request)
                return 0;
@@ -2038,6 +2039,7 @@ intel_ring_alloc_request(struct intel_engine_cs *ring)
 
        kref_init(&request->ref);
        request->ring = ring;
+       request->uniq = dev_private->request_uniq++;
 
        ret = i915_gem_get_seqno(ring->dev, &request->seqno);
        if (ret) {