From patchwork Fri Apr 28 14:37:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Praveen Paneri X-Patchwork-Id: 9704845 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 8382660225 for ; Fri, 28 Apr 2017 14:29:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75659283BA for ; Fri, 28 Apr 2017 14:29:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A4EC2865A; Fri, 28 Apr 2017 14:29:50 +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 2E180283BA for ; Fri, 28 Apr 2017 14:29:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C0F8E6E7DC; Fri, 28 Apr 2017 14:29:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id B71B56E7D6 for ; Fri, 28 Apr 2017 14:29:45 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2017 07:29:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,388,1488873600"; d="scan'208";a="95374121" Received: from intel-desktop.iind.intel.com ([10.223.25.10]) by fmsmga006.fm.intel.com with ESMTP; 28 Apr 2017 07:29:43 -0700 From: Praveen Paneri To: intel-gfx@lists.freedesktop.org Date: Fri, 28 Apr 2017 20:07:31 +0530 Message-Id: <1493390254-5232-5-git-send-email-praveen.paneri@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1493390254-5232-1-git-send-email-praveen.paneri@intel.com> References: <1493390254-5232-1-git-send-email-praveen.paneri@intel.com> Cc: Akash Goel , paulo.r.zanoni@intel.com, Praveen Paneri Subject: [Intel-gfx] [PATCH v2 4/7] lib/igt_draw: Add Y-tiling support for IGT_DRAW_BLT method 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 From: Akash Goel v2: Moved identical code into a single function (Paulo) Signed-off-by: Akash Goel Signed-off-by: Praveen Paneri Reviewed-by: Paulo Zanoni --- lib/igt_draw.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/igt_draw.c b/lib/igt_draw.c index fcf8fba..27a69cd 100644 --- a/lib/igt_draw.c +++ b/lib/igt_draw.c @@ -31,6 +31,7 @@ #include "igt_core.h" #include "igt_fb.h" #include "ioctl_wrappers.h" +#include "i830_reg.h" /** * SECTION:igt_draw @@ -242,6 +243,34 @@ static void set_pixel(void *_ptr, int index, uint32_t color, int bpp) } } +static void switch_blt_tiling(struct intel_batchbuffer *batch, uint32_t tiling, bool on) +{ + uint32_t bcs_swctrl; + + /* Default is X-tile */ + if (tiling != I915_TILING_Y) + return; + + bcs_swctrl = (0x3 << 16) | (on ? 0x3 : 0x0); + + /* To change the tile register, insert an MI_FLUSH_DW followed by an + * MI_LOAD_REGISTER_IMM + */ + BEGIN_BATCH(4, 0); + OUT_BATCH(MI_FLUSH_DW | 2); + OUT_BATCH(0x0); + OUT_BATCH(0x0); + OUT_BATCH(0x0); + ADVANCE_BATCH(); + + BEGIN_BATCH(4, 0); + OUT_BATCH(MI_LOAD_REGISTER_IMM); + OUT_BATCH(0x22200); /* BCS_SWCTRL */ + OUT_BATCH(bcs_swctrl); + OUT_BATCH(MI_NOOP); + ADVANCE_BATCH(); +} + static void draw_rect_ptr_linear(void *ptr, uint32_t stride, struct rect *rect, uint32_t color, int bpp) { @@ -487,6 +516,8 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data, blt_cmd_tiling = (tiling) ? XY_COLOR_BLT_TILED : 0; pitch = (tiling) ? buf->stride / 4 : buf->stride; + switch_blt_tiling(batch, tiling, true); + BEGIN_BATCH(6, 1); OUT_BATCH(XY_COLOR_BLT_CMD_NOLEN | XY_COLOR_BLT_WRITE_ALPHA | XY_COLOR_BLT_WRITE_RGB | blt_cmd_tiling | blt_cmd_len); @@ -497,6 +528,8 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data, OUT_BATCH(color); ADVANCE_BATCH(); + switch_blt_tiling(batch, tiling, false); + intel_batchbuffer_flush(batch); intel_batchbuffer_free(batch); }