From patchwork Fri Mar 24 23:45:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 9644247 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 0BD9E602C9 for ; Fri, 24 Mar 2017 23:45:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F077B26490 for ; Fri, 24 Mar 2017 23:45:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2A342787C; Fri, 24 Mar 2017 23:45:11 +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 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 8CCCA26490 for ; Fri, 24 Mar 2017 23:45:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2643D6E18D; Fri, 24 Mar 2017 23:45:09 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9BF546E18D for ; Fri, 24 Mar 2017 23:45:07 +0000 (UTC) Received: by mail-pf0-x243.google.com with SMTP id o126so685980pfb.1 for ; Fri, 24 Mar 2017 16:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jlekstrand-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=/GJd9dTUXzF/yQ1N4wZG2bLdevZddkzP+owt2aP7uUY=; b=jEWFK2RYoUowW5M+8YxQ/lXwkND0+BDlEjFoVwprD1TLnfLqmjRpnGc+30L0MJT3yF 68FrywBvbDq+gMMXq5n7XmbknnjW8jTiz2/2km5iaFe3lpu4XbCSYpiSLsGOJ473aGVT 0LVe8GUlXDw+3lCSy1HsBPM+63UcuoTF6tSj/8WfJcbqbcK3ccMi7hKQ+4VHXXpvJXcN nuagiy8PJUi+ga3BwQwh+IY2D5hG3OQBWzkjnIy9VH9i+sczICB0HD2uYh4NEy/uVhx2 chS7If8PZv8dBtttPlXb9WCNy6o5c/hhgGNj90B0VozR7/rQ2r188qo3fUxsK7/6/rsR QKlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/GJd9dTUXzF/yQ1N4wZG2bLdevZddkzP+owt2aP7uUY=; b=KS1eRek11DUXB0kLVQuLLwFCuOYPrdG7eq1uVEESMOA3UAElcds1Q5zCuWbFlwM9dG +hXum2gThb3TP0bthrg7CniT2d45laWquSAvF6gMDqDlus5eHUvwj+/EvW+yt5c6SxH7 XYPlBNFgKnMAH2wNr2a+4r3nzlxi3Kk4RJmua3PhjAWEukSxM8iZOTpiOVobAZetIvwi I9Dcx38CAMcOQpfzNGmcmDRO/Z2RzDciVDLDOMNdsTS8jfxQ2EwDDV1PBPF+PEX3IRrQ LfEuy5iB9E4aBEp8E74/X6XoAKxXTpdiJCImoewsBm5kTdZXbAUNl6qtX3zhL4Nx0p8b Z7Xw== X-Gm-Message-State: AFeK/H0TccZVgF4WISpmfAkDeEBckSFeGfbHHLjKT92ZLYgEnuAqzBkIsZDLUHRq5j3ToA== X-Received: by 10.99.173.69 with SMTP id y5mr11996923pgo.35.1490399107259; Fri, 24 Mar 2017 16:45:07 -0700 (PDT) Received: from omlet.jf.intel.com ([134.134.139.78]) by smtp.gmail.com with ESMTPSA id 80sm6661779pfy.67.2017.03.24.16.45.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Mar 2017 16:45:06 -0700 (PDT) From: Jason Ekstrand X-Google-Original-From: Jason Ekstrand To: intel-gfx@lists.freedesktop.org Date: Fri, 24 Mar 2017 16:45:01 -0700 Message-Id: <1490399101-6549-1-git-send-email-jason.ekstrand@intel.com> X-Mailer: git-send-email 2.5.0.400.gff86faf Cc: Jason Ekstrand Subject: [Intel-gfx] [PATCH] aubdump: Don't bail if a GEM handle of 0 is passed into execbuf 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 A gem handle of 0 can be used to check for whether or not 48-bit addressing is available. This keeps aubdump from failing on you if you try to do the check. Reviewed-by: Rafael Antognolli --- tools/aubdump.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/aubdump.c b/tools/aubdump.c index 8a89b8c..3aca7eb 100644 --- a/tools/aubdump.c +++ b/tools/aubdump.c @@ -131,7 +131,6 @@ get_bo(uint32_t handle) fail_if(handle >= MAX_BO_COUNT, "bo handle too large\n"); bo = &bos[handle]; - fail_if(bo->size == 0, "invalid bo handle (%d) in execbuf\n", handle); return bo; } @@ -442,7 +441,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2) offset = align_u32(offset + bo->size + 4095, 4096); } - if (bo->map == NULL) + if (bo->map == NULL && bo->size > 0) bo->map = gem_mmap(fd, obj->handle, 0, bo->size); fail_if(bo->map == MAP_FAILED, "intel_aubdump: bo mmap failed\n"); } @@ -583,7 +582,7 @@ maybe_init(void) } fclose(config); - bos = malloc(MAX_BO_COUNT * sizeof(bos[0])); + bos = calloc(MAX_BO_COUNT, sizeof(bos[0])); fail_if(bos == NULL, "intel_aubdump: out of memory\n"); }