From patchwork Fri Oct 27 18:01:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: oscar.mateo@intel.com X-Patchwork-Id: 10030413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 25F306022E for ; Fri, 27 Oct 2017 18:01:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23AA828FBB for ; Fri, 27 Oct 2017 18:01:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18B6D28FBE; Fri, 27 Oct 2017 18:01:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AB56E28FC2 for ; Fri, 27 Oct 2017 18:01:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 029E06E9C7; Fri, 27 Oct 2017 18:01:26 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id D45AA6E9B0 for ; Fri, 27 Oct 2017 18:01:16 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Oct 2017 11:01:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.44,304,1505804400"; d="scan'208"; a="1236250390" Received: from omateolo-linux.fm.intel.com ([10.1.27.13]) by fmsmga002.fm.intel.com with ESMTP; 27 Oct 2017 11:01:14 -0700 From: Oscar Mateo To: intel-gfx@lists.freedesktop.org Date: Fri, 27 Oct 2017 11:01:08 -0700 Message-Id: <1509127275-22121-6-git-send-email-oscar.mateo@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509127275-22121-1-git-send-email-oscar.mateo@intel.com> References: <1509127275-22121-1-git-send-email-oscar.mateo@intel.com> Cc: Chris Wilson , Mika Kuoppala Subject: [Intel-gfx] [RFC PATCH 05/12] drm/i915: Capture the renderstate batchbuffer X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP It can be useful if it's in play at the time of the crash, and I will be needing it in AubCrash. Signed-off-by: Oscar Mateo Cc: Mika Kuoppala Cc: Chris Wilson --- drivers/gpu/drm/i915/i915_drv.h | 3 ++- drivers/gpu/drm/i915/i915_gem_render_state.c | 11 +++++++++++ drivers/gpu/drm/i915/i915_gem_render_state.h | 1 + drivers/gpu/drm/i915/i915_gpu_error.c | 13 +++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index f64871b..23d746b 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -996,7 +996,8 @@ struct i915_gpu_state { int page_count; int unused; u32 *pages[0]; - } *ringbuffer, *batchbuffer, *wa_batchbuffer, *ctx, *hws_page; + } *ringbuffer, *batchbuffer, *wa_batchbuffer, + *renderstate, *ctx, *hws_page; struct drm_i915_error_object **user_bo; long user_bo_count; diff --git a/drivers/gpu/drm/i915/i915_gem_render_state.c b/drivers/gpu/drm/i915/i915_gem_render_state.c index 3703dc9..47454fb 100644 --- a/drivers/gpu/drm/i915/i915_gem_render_state.c +++ b/drivers/gpu/drm/i915/i915_gem_render_state.c @@ -266,6 +266,17 @@ int i915_gem_render_state_emit(struct drm_i915_gem_request *req) return ret; } +struct i915_vma *i915_gem_render_state_get(struct intel_engine_cs *engine) +{ + struct intel_render_state *so; + + so = engine->render_state; + if (!so) + return NULL; + + return so->vma; +} + void i915_gem_render_state_fini(struct intel_engine_cs *engine) { struct intel_render_state *so; diff --git a/drivers/gpu/drm/i915/i915_gem_render_state.h b/drivers/gpu/drm/i915/i915_gem_render_state.h index 8748184..c760cf9 100644 --- a/drivers/gpu/drm/i915/i915_gem_render_state.h +++ b/drivers/gpu/drm/i915/i915_gem_render_state.h @@ -28,6 +28,7 @@ int i915_gem_render_state_init(struct intel_engine_cs *engine); int i915_gem_render_state_emit(struct drm_i915_gem_request *req); +struct i915_vma *i915_gem_render_state_get(struct intel_engine_cs *engine); void i915_gem_render_state_fini(struct intel_engine_cs *engine); #endif /* _I915_GEM_RENDER_STATE_H_ */ diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index befd17c..a14aa29 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -755,6 +755,9 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m, "HW context", ee->ctx); print_error_obj(m, dev_priv->engine[i], + "Renderstate", ee->renderstate); + + print_error_obj(m, dev_priv->engine[i], "WA context", ee->wa_ctx); print_error_obj(m, dev_priv->engine[i], @@ -850,6 +853,7 @@ void __i915_gpu_state_free(struct kref *error_ref) i915_error_object_free(ee->hws_page); i915_error_object_free(ee->ctx); i915_error_object_free(ee->wa_ctx); + i915_error_object_free(ee->renderstate); kfree(ee->requests); if (!IS_ERR_OR_NULL(ee->waiters)) @@ -1434,6 +1438,7 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv, request = i915_gem_find_active_request(engine); if (request) { struct intel_ring *ring; + struct i915_vma *renderstate_vma; ee->vm = request->ctx->ppgtt ? &request->ctx->ppgtt->base : &ggtt->base; @@ -1454,6 +1459,14 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv, request_record_user_bo(request, ee); + renderstate_vma = i915_gem_render_state_get(engine); + if (renderstate_vma && + i915_vma_is_active(renderstate_vma)) { + ee->renderstate = + i915_error_object_create(dev_priv, + renderstate_vma); + } + ee->ctx = i915_error_object_create(dev_priv, request->ctx->engine[i].state);