From patchwork Thu Sep 14 01:11:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Justen X-Patchwork-Id: 9952313 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 8C14B603FB for ; Thu, 14 Sep 2017 01:11:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E6322625B for ; Thu, 14 Sep 2017 01:11:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 733A428A03; Thu, 14 Sep 2017 01:11:41 +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 B5A5B289DF for ; Thu, 14 Sep 2017 01:11:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 88E8A6E921; Thu, 14 Sep 2017 01:11:34 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 674C36E90B for ; Thu, 14 Sep 2017 01:11:28 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP; 13 Sep 2017 18:11:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,390,1500966000"; d="scan'208"; a="1194865442" Received: from cwbutler-mobl.amr.corp.intel.com (HELO jljusten-skl.amr.corp.intel.com) ([10.254.13.190]) by fmsmga001.fm.intel.com with ESMTP; 13 Sep 2017 18:11:28 -0700 From: Jordan Justen To: Intel GFX discussion Date: Wed, 13 Sep 2017 18:11:00 -0700 Message-Id: <20170914011100.7743-6-jordan.l.justen@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914011100.7743-1-jordan.l.justen@intel.com> References: <20170914011100.7743-1-jordan.l.justen@intel.com> Subject: [Intel-gfx] [PATCH 6/6] intel_aubdump: Add --no-exec command option 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 In some cases it is preferable to not send exec commands to the kernel, but to otherwise record the exec command into the AUB file. For example, when using the --device override option, it might be best to avoid passing the EXEC ioctls through to the kernel. Signed-off-by: Jordan Justen --- tools/aubdump.c | 13 +++++++++++-- tools/intel_aubdump.in | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/aubdump.c b/tools/aubdump.c index 4392e589..6961cd51 100644 --- a/tools/aubdump.c +++ b/tools/aubdump.c @@ -58,6 +58,7 @@ static int gen = 0; static int verbose = 0; static bool device_override; static uint32_t device; +static bool no_exec = false; #define MAX_BO_COUNT 64 * 1024 @@ -567,6 +568,8 @@ maybe_init(void) "intel_aubdump: failed to parse device id '%s'", value); device_override = true; + } else if (!strcmp(key, "no_exec")) { + no_exec = true; } else if (!strcmp(key, "file")) { filename = strdup(value); files[0] = fopen(filename, "w+"); @@ -645,7 +648,10 @@ ioctl(int fd, unsigned long request, ...) "application uses DRM_IOCTL_I915_GEM_EXECBUFFER, not handled\n"); once = true; } - return libc_ioctl(fd, request, argp); + if (verbose && no_exec) + printf("Skipping DRM_IOCTL_I915_GEM_EXECBUFFER " + "ioctl (--no-exec)\n"); + return no_exec ? 0 : libc_ioctl(fd, request, argp); } case DRM_IOCTL_I915_GEM_EXECBUFFER2: @@ -654,7 +660,10 @@ ioctl(int fd, unsigned long request, ...) if (device_override) return 0; - return libc_ioctl(fd, request, argp); + if (verbose && no_exec) + printf("Skipping DRM_IOCTL_I915_GEM_EXECBUFFER2 " + "ioctl (--no-exec)\n"); + return no_exec ? 0 : libc_ioctl(fd, request, argp); } case DRM_IOCTL_I915_GEM_CREATE: { diff --git a/tools/intel_aubdump.in b/tools/intel_aubdump.in index 8bc6b19d..ce77c849 100755 --- a/tools/intel_aubdump.in +++ b/tools/intel_aubdump.in @@ -15,6 +15,9 @@ contents and execution of the GEM application. --device=ID Override PCI ID of the reported device + -n, --no-exec Record exec commands in the AUB file, but don't send + them to the kernel + -v Enable verbose output --help Display this help message and exit @@ -79,6 +82,10 @@ while true; do add_arg "device=${1##--device=}" shift ;; + -n|--no-exec) + add_arg "no_exec=1" + shift + ;; --help) show_help ;;