From patchwork Fri May 6 18:34:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 762912 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p46IZNKp022555 for ; Fri, 6 May 2011 18:35:44 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C36AC9E94A for ; Fri, 6 May 2011 11:35:23 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from cloud01.chad-versace.us (184-106-247-128.static.cloud-ips.com [184.106.247.128]) by gabe.freedesktop.org (Postfix) with ESMTP id 390589E752 for ; Fri, 6 May 2011 11:34:36 -0700 (PDT) Received: from localhost.localdomain (unknown [134.134.139.76]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id 70E001D408F; Fri, 6 May 2011 18:35:53 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Fri, 6 May 2011 11:34:27 -0700 Message-Id: <1304706867-29308-3-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1304706867-29308-1-git-send-email-ben@bwidawsk.net> References: <1304706867-29308-1-git-send-email-ben@bwidawsk.net> Subject: [Intel-gfx] [PATCH 2/2] intel-gen4asm: take gen<4|5|6> as an argument X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 06 May 2011 18:35:44 +0000 (UTC) Signed-off-by: Ben Widawsky --- src/disasm-main.c | 32 +++++++++++++++++++++++++------- 1 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/disasm-main.c b/src/disasm-main.c index f41cd75..7b41c71 100644 --- a/src/disasm-main.c +++ b/src/disasm-main.c @@ -28,10 +28,24 @@ #include "gen4asm.h" +static long int gen_level = 5; + static const struct option longopts[] = { + {"binary", no_argument, 0, 'b'}, + {"output", required_argument, 0, 'o'}, + {"gen", required_argument, 0, 'g'}, { NULL, 0, NULL, 0 } }; +static void usage(void) +{ + fprintf(stderr, "usage: intel-gen4disasm [options] inputfile\n"); + fprintf(stderr, "OPTIONS:\n"); + fprintf(stderr, "\t-b, --binary C style binary output\n"); + fprintf(stderr, "\t-o, --output {outputfile} Specify output file\n"); + fprintf(stderr, "\t-g, --gen <4|5|6> Specify GPU generation\n"); +} + static struct brw_program * read_program (FILE *input) { @@ -93,11 +107,6 @@ read_program_binary (FILE *input) return program; } -static void usage(void) -{ - fprintf(stderr, "usage: intel-gen4disasm [-o outputfile] [-b] inputfile\n"); -} - int main(int argc, char **argv) { struct brw_program *program; @@ -109,7 +118,7 @@ int main(int argc, char **argv) int o; struct brw_program_instruction *inst; - while ((o = getopt_long(argc, argv, "o:b", longopts, NULL)) != -1) { + while ((o = getopt_long(argc, argv, "o:bg:", longopts, NULL)) != -1) { switch (o) { case 'o': if (strcmp(optarg, "-") != 0) @@ -118,6 +127,15 @@ int main(int argc, char **argv) case 'b': byte_array_input = 1; break; + case 'g': + gen_level = strtol(optarg, NULL, 0); + + if (gen_level < 4 || gen_level > 6) { + usage(); + exit(1); + } + + break; default: usage(); exit(1); @@ -153,6 +171,6 @@ int main(int argc, char **argv) } for (inst = program->first; inst; inst = inst->next) - brw_disasm (output, &inst->instruction, 5); + brw_disasm (output, &inst->instruction, gen_level); exit (0); }