From patchwork Thu Jun 16 21:22:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 9181575 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 7B15860573 for ; Thu, 16 Jun 2016 21:23:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BD3828379 for ; Thu, 16 Jun 2016 21:23:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60B5028386; Thu, 16 Jun 2016 21:23:13 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B3B528379 for ; Thu, 16 Jun 2016 21:23:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04A616EAA7; Thu, 16 Jun 2016 21:23:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 968276EAA0; Thu, 16 Jun 2016 21:22:55 +0000 (UTC) Received: by mail-qk0-x244.google.com with SMTP id b136so9307301qkg.2; Thu, 16 Jun 2016 14:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N7BcQGdkiEG5Gb9oJoxtd5J/TmnuW4yl7p/3Vflr3Ok=; b=qOcDJUtjaZH2ixQJLbwaXBbQ8YhZOnMnDJSlTY/VA/k6GqbLR8FpXG3VBZwpFvHZgS 53PKo9OCuOS2nR4YVau+FTPGuWk0xxyZnakFAyY7MhcV5NJPLoJ5kGBRv/Q4D7XTPeNL vIe4k5UIpYXD0G8op/mC0oGCQZZCeij4GJdznGbhrsIoUpFvz+D9i0uvlZy+upVotyk7 c+tp+q7vaClgtjiv+rkgMBN45P/HFuadU2Z6cWd1/rMUNhvbfPWP6RpUpe8Zgj0cAP+z qUWsbk2Z9xY2zWHPcQqFRau3rZ+A11ar3RkeQQT3iInzII9B1Lze4do4oztNLUc3u9Wi OKaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N7BcQGdkiEG5Gb9oJoxtd5J/TmnuW4yl7p/3Vflr3Ok=; b=VmhJSDS7omLyALXMMd8Qcdl6ccVtcmgYlD+D+1jc2Lzj0KtQGg3ebslc42E1C+AOd+ nhvpnv3QgzYkVDSbbj0q51zEEnK1EMxkXt3Gk4/T+bozs+h59nDUYeoZqslkjG1h1x2k 1Teew7tKzeTzCI2RDn23eWRp00+jGRc8UWKcYaC2grTaCDOdOmPrSoG3oSzJQnxK5bVf xfeKjL7q4OCaRxlwA8qDwkdMlVbHbNfjM5wycollCq1DT/0BqJtnFav5k+bySFg7fZnl P43VcSa9gD42x+bsJ0lK0Lc5AF7mOWZnr7q60IA2mjI0SoHXihzzYiPkRanBKIErnNKi ODWA== X-Gm-Message-State: ALyK8tJSaxQUJcG14u5aJliDbwjiuTZm9dny/s2hHFxaSYT6EeIpojswPy8ZUd3PXZQcRg== X-Received: by 10.55.159.72 with SMTP id i69mr7387069qke.29.1466112173936; Thu, 16 Jun 2016 14:22:53 -0700 (PDT) Received: from localhost (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id p92sm7115422qge.22.2016.06.16.14.22.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Jun 2016 14:22:53 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 10/10] drm/msm/rd: add module param to dump all bo's Date: Thu, 16 Jun 2016 17:22:35 -0400 Message-Id: <1466112155-25061-11-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466112155-25061-1-git-send-email-robdclark@gmail.com> References: <1466112155-25061-1-git-send-email-robdclark@gmail.com> Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP By default, if using $debugfs/.../rd to log cmdstream, only the cmdstream buffers themselves are logged. But in some cases we want to capture other buffers in the submit (to see VBO's or shaders). So add a mod-param knob to control this. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_rd.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c index fa02b5a..24254e0 100644 --- a/drivers/gpu/drm/msm/msm_rd.c +++ b/drivers/gpu/drm/msm/msm_rd.c @@ -27,6 +27,11 @@ * This bypasses drm_debugfs_create_files() mainly because we need to use * our own fops for a bit more control. In particular, we don't want to * do anything if userspace doesn't have the debugfs file open. + * + * The module-param "rd_full", which defaults to false, enables snapshotting + * all (non-written) buffers in the submit, rather than just cmdstream bo's. + * This is useful to capture the contents of (for example) vbo's or textures, + * or shader programs (if not emitted inline in cmdstream). */ #ifdef CONFIG_DEBUG_FS @@ -40,6 +45,10 @@ #include "msm_gpu.h" #include "msm_gem.h" +static bool rd_full = false; +MODULE_PARM_DESC(rd_full, "If true, $debugfs/.../rd will snapshot all buffer contents"); +module_param_named(rd_full, rd_full, bool, 0600); + enum rd_sect_type { RD_NONE, RD_TEST, /* ascii text */ @@ -288,7 +297,12 @@ static void snapshot_buf(struct msm_rd_state *rd, if (IS_ERR(buf)) return; - buf += iova - submit->bos[idx].iova; + if (iova) { + buf += iova - submit->bos[idx].iova; + } else { + iova = submit->bos[idx].iova; + size = obj->base.size; + } rd_write_section(rd, RD_GPUADDR, (uint32_t[2]){ iova, size }, 8); @@ -320,17 +334,27 @@ void msm_rd_dump_submit(struct msm_gem_submit *submit) rd_write_section(rd, RD_CMD, msg, ALIGN(n, 4)); - /* could be nice to have an option (module-param?) to snapshot - * all the bo's associated with the submit. Handy to see vtx - * buffers, etc. For now just the cmdstream bo's is enough. - */ + if (rd_full) { + for (i = 0; i < submit->nr_bos; i++) { + /* buffers that are written to probably don't start out + * with anything interesting: + */ + if (submit->bos[i].flags & MSM_SUBMIT_BO_WRITE) + continue; + + snapshot_buf(rd, submit, i, 0, 0); + } + } for (i = 0; i < submit->nr_cmds; i++) { uint32_t iova = submit->cmd[i].iova; uint32_t szd = submit->cmd[i].size; /* in dwords */ - snapshot_buf(rd, submit, submit->cmd[i].idx, - submit->cmd[i].iova, szd * 4); + /* snapshot cmdstream bo's (if we haven't already): */ + if (!rd_full) { + snapshot_buf(rd, submit, submit->cmd[i].idx, + submit->cmd[i].iova, szd * 4); + } switch (submit->cmd[i].type) { case MSM_SUBMIT_CMD_IB_TARGET_BUF: