From patchwork Thu Sep 25 18:21:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Reese, Armin C" X-Patchwork-Id: 4976921 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E0F61BEEA6 for ; Thu, 25 Sep 2014 18:21:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8BF4D202BE for ; Thu, 25 Sep 2014 18:21:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4AB04202A1 for ; Thu, 25 Sep 2014 18:21:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 642F889316; Thu, 25 Sep 2014 11:21:44 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 28A03893BC for ; Thu, 25 Sep 2014 11:21:43 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 25 Sep 2014 11:21:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,598,1406617200"; d="scan'208";a="579047678" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 25 Sep 2014 11:21:38 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 25 Sep 2014 11:21:38 -0700 Received: from fmsmsx104.amr.corp.intel.com ([169.254.4.49]) by fmsmsx111.amr.corp.intel.com ([169.254.12.241]) with mapi id 14.03.0195.001; Thu, 25 Sep 2014 11:21:38 -0700 From: "Reese, Armin C" To: Mika Kuoppala , "intel-gfx@lists.freedesktop.org" Thread-Topic: [PATCH 1/3] tools/null_state_gen: add macro to emit commands with null state Thread-Index: AQHP1/YiVNVRyAmV/EWMlaJbD6bY5pwSKuDA Date: Thu, 25 Sep 2014 18:21:37 +0000 Message-ID: <07EEC142D30DAC40BA4DD9C0F9EE51094064362B@fmsmsx104.amr.corp.intel.com> References: <1411563032-9476-1-git-send-email-mika.kuoppala@intel.com> In-Reply-To: <1411563032-9476-1-git-send-email-mika.kuoppala@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Cc: "miku@iki.fi" Subject: Re: [Intel-gfx] [PATCH 1/3] tools/null_state_gen: add macro to emit commands with null state X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As far as I can tell, the patch series (1->3) looks good. I was wondering how the copyright header will be handled. Is that to be added manually later on? Thanks, Armin -----Original Message----- From: Mika Kuoppala [mailto:mika.kuoppala@linux.intel.com] Sent: Wednesday, September 24, 2014 5:51 AM To: intel-gfx@lists.freedesktop.org Cc: Reese, Armin C; miku@iki.fi Subject: [PATCH 1/3] tools/null_state_gen: add macro to emit commands with null state In null/golden context there are multiple state commands where the actual state is always zero. For more compact batch representation add a macro which just emits command and the rest of the state as zero. Signed-off-by: Mika Kuoppala --- tools/null_state_gen/intel_batchbuffer.c | 12 ++++++++++++ tools/null_state_gen/intel_batchbuffer.h | 6 +++++- tools/null_state_gen/intel_null_state_gen.c | 12 +++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) intel_batch_type_as_str(cmd), cmd->str); - if (i * 4 == batch->cmds_end_offset) + if (i * 4 == batch->cmds_end_offset) { + cmds = i + 1; printf("\t /* cmds end */"); + } if (intel_batch_is_reloc(batch, i)) printf("\t /* reloc */"); @@ -60,6 +65,11 @@ static int print_state(int gen, struct intel_batchbuffer *batch) printf("};\n\nRO_RENDERSTATE(%d);\n", gen); + fprintf(stderr, "Commands %lu (%lu bytes)\n", cmds, cmds * 4); + fprintf(stderr, "State %lu (%lu bytes)\n", batch->state->num_items, batch->state->num_items * 4); + fprintf(stderr, "Total %lu (%lu bytes)\n", batch->cmds->num_items, batch->cmds->num_items * 4); + fprintf(stderr, "\n"); + return 0; } -- 1.9.1 diff --git a/tools/null_state_gen/intel_batchbuffer.c b/tools/null_state_gen/intel_batchbuffer.c index 2a0b340..6e86aef 100644 --- a/tools/null_state_gen/intel_batchbuffer.c +++ b/tools/null_state_gen/intel_batchbuffer.c @@ -274,3 +274,15 @@ const char *intel_batch_type_as_str(const struct bb_item *item) return "UNKNOWN"; } + +void intel_batch_cmd_emit_null(struct intel_batchbuffer *batch, const +int cmd, const int len, const char *str) { + int i; + + assert(len > 1); + + bb_area_emit(batch->cmds, (cmd | (len - 2)), CMD, str); + + for (i = 1; i < len; i++) + OUT_BATCH(0); +} diff --git a/tools/null_state_gen/intel_batchbuffer.h b/tools/null_state_gen/intel_batchbuffer.h index e44c5c9..b4eed25 100644 --- a/tools/null_state_gen/intel_batchbuffer.h +++ b/tools/null_state_gen/intel_batchbuffer.h @@ -34,7 +34,7 @@ #include #define MAX_RELOCS 64 -#define MAX_ITEMS 4096 +#define MAX_ITEMS 1024 #define MAX_STRLEN 256 #define ALIGN(x, y) (((x) + (y)-1) & ~((y)-1)) @@ -69,6 +69,7 @@ struct intel_batchbuffer { struct intel_batchbuffer *intel_batchbuffer_create(void); +#define OUT_CMD(cmd, len) intel_batch_cmd_emit_null(batch, cmd, len, +#cmd " " #len) #define OUT_BATCH(d) bb_area_emit(batch->cmds, d, CMD, #d) #define OUT_BATCH_STATE_OFFSET(d) bb_area_emit(batch->cmds, d, STATE_OFFSET, #d) #define OUT_RELOC(batch, read_domain, write_domain, d) bb_area_emit(batch->cmds, d, RELOC, #d) @@ -81,6 +82,7 @@ uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch, void *d, unsign const char *name); uint32_t intel_batch_state_alloc(struct intel_batchbuffer *batch, unsigned bytes, unsigned align, const char *name); +uint32_t intel_batch_state_offset(struct intel_batchbuffer *batch, +unsigned align); unsigned intel_batch_num_cmds(struct intel_batchbuffer *batch); @@ -94,4 +96,6 @@ const char *intel_batch_type_as_str(const struct bb_item *item); void bb_area_emit(struct bb_area *a, uint32_t dword, item_type type, const char *str); void bb_area_emit_offset(struct bb_area *a, unsigned i, uint32_t dword, item_type type, const char *str); +void intel_batch_cmd_emit_null(struct intel_batchbuffer *batch, const +int cmd, const int len, const char *str); + #endif diff --git a/tools/null_state_gen/intel_null_state_gen.c b/tools/null_state_gen/intel_null_state_gen.c index b337706..a7eb22b 100644 --- a/tools/null_state_gen/intel_null_state_gen.c +++ b/tools/null_state_gen/intel_null_state_gen.c @@ -23,6 +23,9 @@ static void print_usage(char *s) static int print_state(int gen, struct intel_batchbuffer *batch) { int i; + unsigned long cmds; + + fprintf(stderr, "Generating for gen%d\n", gen); printf("#include \"intel_renderstate.h\"\n\n"); @@ -43,8 +46,10 @@ static int print_state(int gen, struct intel_batchbuffer *batch) printf("\t /* 0x%08x %s '%s' */", i * 4,