From patchwork Wed Nov 17 04:25:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Clifton X-Patchwork-Id: 330741 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 oAH4PnGh015107 for ; Wed, 17 Nov 2010 04:26:10 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C8369E8D1 for ; Tue, 16 Nov 2010 20:25:49 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from ppsw-52.csi.cam.ac.uk (ppsw-52.csi.cam.ac.uk [131.111.8.152]) by gabe.freedesktop.org (Postfix) with ESMTP id AA1439E7A4 for ; Tue, 16 Nov 2010 20:25:27 -0800 (PST) X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from cpc1-cmbg11-0-0-cust238.5-4.cable.virginmedia.com ([86.22.72.239]:40224 helo=[192.168.1.4]) by ppsw-52.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:465) with esmtpsa (LOGIN:pcjc2) (SSLv3:DHE-RSA-CAMELLIA256-SHA:256) id 1PIZaI-00075j-DE (Exim 4.72) for intel-gfx@lists.freedesktop.org (return-path ); Wed, 17 Nov 2010 04:25:26 +0000 From: Peter Clifton To: Intel Date: Wed, 17 Nov 2010 04:25:25 +0000 Message-ID: <1289967925.30171.1.camel@pcjc2lap> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Subject: [Intel-gfx] [PATCH] Encorage dead-code elimination for unused interpolation channels 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: , 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.3 (demeter1.kernel.org [140.211.167.41]); Wed, 17 Nov 2010 04:26:10 +0000 (UTC) From 5b20588a1eb4eb08d6762157a39d828015456d8b Mon Sep 17 00:00:00 2001 From: Peter Clifton Date: Wed, 17 Nov 2010 04:05:48 +0000 Subject: [PATCH] Enable dead code elimination for unused interpolated channels Work around limitations in the dead-code eliminator, and use separate virtual registers for the PLN and MOV results. This allows the dead-code eliminator to track the usage of the MOV result and the PLN result separately. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4648298..b4777aa 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -440,10 +440,13 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) fs_reg * fs_visitor::emit_general_interpolation(ir_variable *ir) { - fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); + fs_reg *reg1 = new(this->mem_ctx) fs_reg(this, ir->type); + fs_reg *reg2 = new(this->mem_ctx) fs_reg(this, ir->type); /* Interpolation is always in floating point regs. */ - reg->type = BRW_REGISTER_TYPE_F; - fs_reg attr = *reg; + reg1->type = BRW_REGISTER_TYPE_F; + reg2->type = BRW_REGISTER_TYPE_F; + fs_reg attr1 = *reg1; + fs_reg attr2 = *reg2; unsigned int array_elements; const glsl_type *type; @@ -466,7 +469,8 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) /* If there's no incoming setup data for this slot, don't * emit interpolation for it. */ - attr.reg_offset += type->vector_elements; + attr1.reg_offset += type->vector_elements; + attr2.reg_offset += type->vector_elements; location++; continue; } @@ -474,28 +478,29 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) for (unsigned int c = 0; c < type->vector_elements; c++) { struct brw_reg interp = interp_reg(location, c); emit(fs_inst(FS_OPCODE_LINTERP, - attr, + attr1, this->delta_x, this->delta_y, fs_reg(interp))); - attr.reg_offset++; + attr1.reg_offset++; } if (intel->gen < 6) { - attr.reg_offset -= type->vector_elements; + attr1.reg_offset -= type->vector_elements; for (unsigned int c = 0; c < type->vector_elements; c++) { emit(fs_inst(BRW_OPCODE_MUL, - attr, - attr, + attr2, + attr1, this->pixel_w)); - attr.reg_offset++; + attr1.reg_offset++; + attr2.reg_offset++; } } location++; } } - return reg; + return reg2; } fs_reg * -- 1.7.1