From patchwork Wed Feb 3 21:41:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 8209331 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DDF87BEEE5 for ; Wed, 3 Feb 2016 21:41:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 08E75202F0 for ; Wed, 3 Feb 2016 21:41:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1B0AF20260 for ; Wed, 3 Feb 2016 21:41:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E71D6E80D; Wed, 3 Feb 2016 13:41:49 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from annarchy.freedesktop.org (annarchy.freedesktop.org [131.252.210.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 011F06E34B; Wed, 3 Feb 2016 13:41:45 -0800 (PST) Received: from eliezer.anholt.net (annarchy.freedesktop.org [127.0.0.1]) by annarchy.freedesktop.org (Postfix) with ESMTP id E758A181EA; Wed, 3 Feb 2016 13:41:44 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 73806F1B134; Wed, 3 Feb 2016 13:41:43 -0800 (PST) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Wed, 3 Feb 2016 13:41:41 -0800 Message-Id: <1454535703-660-7-git-send-email-eric@anholt.net> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1454535703-660-1-git-send-email-eric@anholt.net> References: <1454535703-660-1-git-send-email-eric@anholt.net> Subject: [Intel-gfx] [PATCH igt 7/9] igt: Add a helper function for creating VC4 BOs. 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-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Eric Anholt --- lib/igt_vc4.c | 21 +++++++++++++++------ lib/igt_vc4.h | 1 + tests/vc4_wait_bo.c | 10 ++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/igt_vc4.c b/lib/igt_vc4.c index 15804e9..0233f2b 100644 --- a/lib/igt_vc4.c +++ b/lib/igt_vc4.c @@ -68,9 +68,7 @@ uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval) /* A single row will be a page. */ uint32_t width = 1024; uint32_t height = size / (width * 4); - struct drm_vc4_create_bo create = { - .size = size, - }; + uint32_t handle = igt_vc4_create_bo(fd, size); struct drm_vc4_submit_cl submit = { .color_write = { .hindex = 0, @@ -84,7 +82,7 @@ uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval) .msaa_color_write = { .hindex = ~0 }, .msaa_zs_write = { .hindex = ~0 }, - .bo_handles = (uint64_t)(uintptr_t)&create.handle, + .bo_handles = (uint64_t)(uintptr_t)&handle, .bo_handle_count = 1, .width = width, .height = height, @@ -97,10 +95,21 @@ uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval) igt_assert(width * height * 4 == size); - ret = ioctl(fd, DRM_IOCTL_VC4_CREATE_BO, &create); + ret = ioctl(fd, DRM_IOCTL_VC4_SUBMIT_CL, &submit); igt_assert(ret == 0); - ret = ioctl(fd, DRM_IOCTL_VC4_SUBMIT_CL, &submit); + return handle; +} + +int +igt_vc4_create_bo(int fd, size_t size) +{ + struct drm_vc4_create_bo create = { + .size = size, + }; + int ret; + + ret = ioctl(fd, DRM_IOCTL_VC4_CREATE_BO, &create); igt_assert(ret == 0); return create.handle; diff --git a/lib/igt_vc4.h b/lib/igt_vc4.h index d428f39..e925246 100644 --- a/lib/igt_vc4.h +++ b/lib/igt_vc4.h @@ -25,6 +25,7 @@ #define IGT_VC4_H uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval); +int igt_vc4_create_bo(int fd, size_t size); void *igt_vc4_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot); #endif /* IGT_VC4_H */ diff --git a/tests/vc4_wait_bo.c b/tests/vc4_wait_bo.c index 081ee09..642b941 100644 --- a/tests/vc4_wait_bo.c +++ b/tests/vc4_wait_bo.c @@ -22,6 +22,7 @@ */ #include "igt.h" +#include "igt_vc4.h" #include #include #include @@ -40,15 +41,8 @@ igt_main int bo_handle; igt_fixture { - struct drm_vc4_create_bo create = { - .size = 4096, - }; - fd = drm_open_driver(DRIVER_VC4); - - ret = ioctl(fd, DRM_IOCTL_VC4_CREATE_BO, &create); - igt_assert(ret == 0); - bo_handle = create.handle; + bo_handle = igt_vc4_create_bo(fd, 4096); } igt_subtest("bad-bo") {