drm/i915/error: Capture WA ctx batch in error state
authorarun.siluvery@linux.intel.com <arun.siluvery@linux.intel.com>
Tue, 1 Mar 2016 11:24:36 +0000 (11:24 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 1 Mar 2016 15:09:13 +0000 (15:09 +0000)
execute during context save/restore, good to have them in error state.

v2: use wa_ctx->size and print only size values (Mika)
v3: simplify conditions when recording and freeing object (Chris)
v4: resolve checkpatch errors (Tvrtko)

Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Arun Siluvery <arun.siluvery@linux.intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1456831476-10782-1-git-send-email-arun.siluvery@linux.intel.com
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gpu_error.c

index 671295523317b117a823468401f871c013260aee..7d2b07fc16176234546cff45d11308520e9c458c 100644 (file)
@@ -561,6 +561,8 @@ struct drm_i915_error_state {
                        u32 *pages[0];
                } *ringbuffer, *batchbuffer, *wa_batchbuffer, *ctx, *hws_page;
 
+               struct drm_i915_error_object *wa_ctx;
+
                struct drm_i915_error_request {
                        long jiffies;
                        u32 seqno;
index 831895b8cb75d61ec00857e9f66b0d529386a071..3b6bfbf354820b896eff2c415353e48c26988ad9 100644 (file)
@@ -493,6 +493,28 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
                        }
                }
 
+               obj = error->ring[i].wa_ctx;
+               if (obj) {
+                       u64 wa_ctx_offset = obj->gtt_offset;
+                       u32 *wa_ctx_page = &obj->pages[0][0];
+                       struct intel_engine_cs *ring = &dev_priv->ring[RCS];
+                       u32 wa_ctx_size = (ring->wa_ctx.indirect_ctx.size +
+                                          ring->wa_ctx.per_ctx.size);
+
+                       err_printf(m, "%s --- WA ctx batch buffer = 0x%08llx\n",
+                                  dev_priv->ring[i].name, wa_ctx_offset);
+                       offset = 0;
+                       for (elt = 0; elt < wa_ctx_size; elt += 4) {
+                               err_printf(m, "[%04x] %08x %08x %08x %08x\n",
+                                          offset,
+                                          wa_ctx_page[elt + 0],
+                                          wa_ctx_page[elt + 1],
+                                          wa_ctx_page[elt + 2],
+                                          wa_ctx_page[elt + 3]);
+                               offset += 16;
+                       }
+               }
+
                if ((obj = error->ring[i].ctx)) {
                        err_printf(m, "%s --- HW Context = 0x%08x\n",
                                   dev_priv->ring[i].name,
@@ -585,6 +607,7 @@ static void i915_error_state_free(struct kref *error_ref)
                i915_error_object_free(error->ring[i].hws_page);
                i915_error_object_free(error->ring[i].ctx);
                kfree(error->ring[i].requests);
+               i915_error_object_free(error->ring[i].wa_ctx);
        }
 
        i915_error_object_free(error->semaphore_obj);
@@ -1067,6 +1090,12 @@ static void i915_gem_record_rings(struct drm_device *dev,
                error->ring[i].hws_page =
                        i915_error_ggtt_object_create(dev_priv, ring->status_page.obj);
 
+               if (ring->wa_ctx.obj) {
+                       error->ring[i].wa_ctx =
+                               i915_error_ggtt_object_create(dev_priv,
+                                                             ring->wa_ctx.obj);
+               }
+
                i915_gem_record_active_context(ring, error, &error->ring[i]);
 
                count = 0;