From patchwork Tue Nov 1 21:50:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francisco Jerez X-Patchwork-Id: 9408173 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 2904960721 for ; Tue, 1 Nov 2016 21:52:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19A15299EC for ; Tue, 1 Nov 2016 21:52:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D13D299F6; Tue, 1 Nov 2016 21:52:31 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 826A4299EC for ; Tue, 1 Nov 2016 21:52:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 050396E157; Tue, 1 Nov 2016 21:52:30 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.riseup.net (mx1.riseup.net [198.252.153.129]) by gabe.freedesktop.org (Postfix) with ESMTPS id E61896E157 for ; Tue, 1 Nov 2016 21:52:28 +0000 (UTC) Received: from piha.riseup.net (unknown [10.0.1.163]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.riseup.net (Postfix) with ESMTPS id B706F1A1A2D; Tue, 1 Nov 2016 21:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1478037148; bh=EOREF1jernk1cRd8e2IzBeNPc1sHQ+NnAT7GWyyRzAc=; h=From:To:Cc:Subject:Date:From; b=aGG4NW82J6CuR3X7so/S2Pw7SDU9WngyDTtUtLk6PZf/7HyB9SBMULxysbMhmXp3A ZpjZdFAB26QBZ/nqTqudH/OYplOvA2hqKBZ7mDqmPhTu+x+PTZ9JwbJknxpOmBLGuI 57ZQUHjU+U3KO8wQ6mCPwX8GqA2hbKG42dw4Bnh4= Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: currojerez) with ESMTPSA id 837E61C01A6 From: Francisco Jerez To: intel-gfx@lists.freedesktop.org Date: Tue, 1 Nov 2016 14:50:38 -0700 Message-Id: <20161101215039.22654-1-currojerez@riseup.net> Subject: [Intel-gfx] [PATCH 1/2] aubdump: Fix GTT setup for Gen8+. 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 Gen8+ have 64 bit GTT entries, so we need to allocate twice as much space for the GTT table in order to cover the same number of GTT pages. Fixes sporadic page-fault crashes on the simulator. --- tools/aubdump.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tools/aubdump.c b/tools/aubdump.c index 30dc742..d0774c1 100644 --- a/tools/aubdump.c +++ b/tools/aubdump.c @@ -54,7 +54,6 @@ static char *filename; static FILE *file; static int gen = 0; static int verbose = 0; -static const uint32_t gtt_size = 0x10000; static bool device_override; static uint32_t device; @@ -149,9 +148,18 @@ data_out(const void *data, size_t size) fwrite(data, 1, size, file); } +static uint32_t +gtt_size(void) +{ + /* Enough for 64MB assuming 4kB pages. */ + const unsigned entries = 0x4000; + return entries * (gen >= 8 ? 8 : 4); +} + static void write_header(void) { + const unsigned gtt_entry_size = gen >= 8 ? 8 : 4; uint32_t entry = 0x200003; /* Start with a (required) version packet. */ @@ -171,11 +179,14 @@ write_header(void) AUB_TRACE_TYPE_NOTYPE | AUB_TRACE_OP_DATA_WRITE); dword_out(0); /* subtype */ dword_out(0); /* offset */ - dword_out(gtt_size); /* size */ + dword_out(gtt_size()); /* size */ if (gen >= 8) dword_out(0); - for (uint32_t i = 0; i < gtt_size; i += 4, entry += 0x1000) - dword_out(entry); + for (uint32_t i = 0; i * gtt_entry_size < gtt_size(); i++) { + dword_out(entry + 0x1000 * i); + if (gen >= 8) + dword_out(0); + } } /** @@ -332,7 +343,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2) struct drm_i915_gem_exec_object2 *exec_objects = (struct drm_i915_gem_exec_object2 *) (uintptr_t) execbuffer2->buffers_ptr; uint32_t ring_flag = execbuffer2->flags & I915_EXEC_RING_MASK; - uint32_t offset = gtt_size; + uint32_t offset = gtt_size(); struct drm_i915_gem_exec_object2 *obj; struct bo *bo, *batch_bo; void *data;