From patchwork Fri Sep 14 12:05:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 10600637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D2549157B for ; Fri, 14 Sep 2018 12:05:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A07722B214 for ; Fri, 14 Sep 2018 12:05:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 914912B4D4; Fri, 14 Sep 2018 12:05:59 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 05E482B214 for ; Fri, 14 Sep 2018 12:05:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 861456E5EA; Fri, 14 Sep 2018 12:05:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from honk.sigxcpu.org (honk.sigxcpu.org [24.134.29.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 279336E5EA for ; Fri, 14 Sep 2018 12:05:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 8EDB3FB03; Fri, 14 Sep 2018 14:05:54 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0-C9rynOrUs4; Fri, 14 Sep 2018 14:05:53 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 12A4843511; Fri, 14 Sep 2018 14:05:53 +0200 (CEST) Date: Fri, 14 Sep 2018 14:05:53 +0200 From: Guido =?iso-8859-1?q?G=FCnther?= To: Lucas Stach , Christian Gmeiner Subject: [PATCH libdrm] tests: Test mapping different caching types on etnaviv Message-ID: <20180914120553.GA19648@bogon.m.sigxcpu.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This makes it simple to test if all cache types are mappable. Signed-off-by: Guido Günther Acked-by: Emil Velikov --- Prompted by https://lists.freedesktop.org/archives/etnaviv/2018-September/001946.html tests/etnaviv/etnaviv_bo_cache_test.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/etnaviv/etnaviv_bo_cache_test.c b/tests/etnaviv/etnaviv_bo_cache_test.c index 7fb06293..0ad37e19 100644 --- a/tests/etnaviv/etnaviv_bo_cache_test.c +++ b/tests/etnaviv/etnaviv_bo_cache_test.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -78,6 +79,28 @@ static void test_size_rounding(struct etna_device *dev) printf("ok\n"); } + +static void test_write(struct etna_device *dev, uint32_t flags) +{ + struct etna_bo *bo; + uint32_t *buf; + + /* allocate, map, write to, and free of a bo */ + printf("testing bo map with flags 0x%"PRIx32"... ", flags); + fflush(stdout); + + bo = etna_bo_new(dev, 0x100, flags); + assert(bo); + buf = etna_bo_map(bo); + assert(buf); + assert(!etna_bo_cpu_prep(bo, DRM_ETNA_PREP_WRITE)); + memset(buf, 0, 0x100); + etna_bo_cpu_fini(bo); + etna_bo_del(bo); + + printf("ok\n"); +} + int main(int argc, char *argv[]) { struct etna_device *dev; @@ -107,6 +130,9 @@ int main(int argc, char *argv[]) test_cache(dev); test_size_rounding(dev); + test_write(dev, ETNA_BO_CACHED); + test_write(dev, ETNA_BO_WC); + test_write(dev, ETNA_BO_UNCACHED); etna_device_del(dev);