From patchwork Thu Dec 22 08:36:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9484529 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 A1BC2601D3 for ; Thu, 22 Dec 2016 08:43:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CBF128285 for ; Thu, 22 Dec 2016 08:43:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91C7828305; Thu, 22 Dec 2016 08:43:18 +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=unavailable 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 5D9D228285 for ; Thu, 22 Dec 2016 08:43:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D3796F1AD; Thu, 22 Dec 2016 08:43:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wj0-x244.google.com (mail-wj0-x244.google.com [IPv6:2a00:1450:400c:c01::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 123266F16E; Thu, 22 Dec 2016 08:36:56 +0000 (UTC) Received: by mail-wj0-x244.google.com with SMTP id ez4so669769wjd.1; Thu, 22 Dec 2016 00:36:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=u3AuRbAtlHIChNM3+m5o7ySUyGWI4r/FG4VYcOLDsyo=; b=EwUMLYVuQr9Y+FltYk1xuRLPspyNocudOL8AH7A28LB8MRvfBzPzTKN414Z3OicA3v yEukU84D3gmLpf+YncF6VvSQZEnvJiTGW+Y3G4Is8nFRc0XFuje9Hh2ggxy9WRYoAmM5 ShG/VnjEkcaAyHWqr384xs6Y5f1ZFgV0riSfD6dMc2nqMlbtXC4eKK3g/ZQjgcFmW0fh aZO2XPgVEihcHLYoxEtRXDvY4RcnRUvQBGBDmLNDY3PvPLw6HOYI5K27NjtTGAGatIxu /q83q6F/42y3HG3cVqYNpsvg8v5thKhRMgkF0YJT4JivBAjNeBUgJgkqPGbEJOPCwy5+ reCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=u3AuRbAtlHIChNM3+m5o7ySUyGWI4r/FG4VYcOLDsyo=; b=D2pTOccV/F4CCxLwieukpcZF4Z6i1z5lNsGLvIdatWTuSguMZ1ynQ8JeYVx3+QxHYh M1WJW0VOzomRb3zW3WdA9za11pScqAy+Qv7iU8S7dsW2LbUt0R12S/8EBRNOJPxP1Mk3 nYDttgWbkcP37PHtiwfu3F/p1G4jaNcyMoKOkSf7gilCb7hj3JZt6kv4YoIvnfeIzXMu fNHim7Gr6PoqRiDyR09Lj7YLwoJ4xbk0ilIhchePn2NhlI/x8dE0i80XYSGNOecilKMl dwz8gGQF9AHRHE+4oUYC47/9o1IMO3sAg+3B36xHGdg5jX6RYjZdw5ZZMsNSXLP3mttz /UQQ== X-Gm-Message-State: AIkVDXIm84VHAxsxDa4K3LcAUMa6Yki2J1bvAj5qPOoU4Dd9pKtuirX43/Gr8P+WRaphYQ== X-Received: by 10.194.14.73 with SMTP id n9mr8592752wjc.189.1482395814007; Thu, 22 Dec 2016 00:36:54 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id di9sm34442318wjc.37.2016.12.22.00.36.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 00:36:53 -0800 (PST) From: Chris Wilson To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 08/38] drm: kselftest for drm_mm_debug() Date: Thu, 22 Dec 2016 08:36:11 +0000 Message-Id: <20161222083641.2691-9-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161222083641.2691-1-chris@chris-wilson.co.uk> References: <20161222083641.2691-1-chris@chris-wilson.co.uk> Cc: intel-gfx@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Simple test to just exercise calling the debug dumper on the drm_mm. Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/selftests/drm_mm_selftests.h | 1 + drivers/gpu/drm/selftests/test-drm_mm.c | 35 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/selftests/drm_mm_selftests.h b/drivers/gpu/drm/selftests/drm_mm_selftests.h index 844dd29db540..0265f09e92fa 100644 --- a/drivers/gpu/drm/selftests/drm_mm_selftests.h +++ b/drivers/gpu/drm/selftests/drm_mm_selftests.h @@ -7,3 +7,4 @@ */ selftest(sanitycheck, igt_sanitycheck) /* keep first (selfcheck for igt) */ selftest(init, igt_init) +selftest(debug, igt_debug) diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c index 87ad147670da..434320061d9e 100644 --- a/drivers/gpu/drm/selftests/test-drm_mm.c +++ b/drivers/gpu/drm/selftests/test-drm_mm.c @@ -141,6 +141,41 @@ static int igt_init(void *ignored) return ret; } +static int igt_debug(void *ignored) +{ + struct drm_mm mm; + struct drm_mm_node nodes[2]; + int ret; + + /* Create a small drm_mm with a couple of nodes and a few holes, and + * check that the debug iterator doesn't explode over a trivial drm_mm. + */ + + drm_mm_init(&mm, 0, 4096); + + memset(nodes, 0, sizeof(nodes)); + nodes[0].start = 512; + nodes[0].size = 1024; + ret = drm_mm_reserve_node(&mm, &nodes[0]); + if (ret) { + pr_err("failed to reserve node[0] {start=%lld, size=%lld)\n", + nodes[0].start, nodes[0].size); + return ret; + } + + nodes[1].size = 1024; + nodes[1].start = 4096 - 512 - nodes[1].size; + ret = drm_mm_reserve_node(&mm, &nodes[1]); + if (ret) { + pr_err("failed to reserve node[1] {start=%lld, size=%lld)\n", + nodes[1].start, nodes[1].size); + return ret; + } + + drm_mm_debug_table(&mm, __func__); + return 0; +} + #include "drm_selftest.c" static int __init test_drm_mm_init(void)