From patchwork Sat Mar 2 10:04:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10836539 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 1BA9B139A for ; Sat, 2 Mar 2019 10:05:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F22B32C615 for ; Sat, 2 Mar 2019 10:05:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E60CE2C942; Sat, 2 Mar 2019 10:05: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=-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 8912F2C615 for ; Sat, 2 Mar 2019 10:05:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 024F46E36E; Sat, 2 Mar 2019 10:05:17 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id C381C6E36D; Sat, 2 Mar 2019 10:05:14 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 15752340-1500050 for multiple; Sat, 02 Mar 2019 10:04:18 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sat, 2 Mar 2019 10:04:17 +0000 Message-Id: <20190302100417.10473-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_busy: Another year, another ABI bump X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The ABI ring ids are dead. Long live our classes. Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Joonas Lahtinen Reviewed-by: Tvrtko Ursulin --- tests/i915/gem_busy.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/tests/i915/gem_busy.c b/tests/i915/gem_busy.c index eb3d3ef2b..ad8534687 100644 --- a/tests/i915/gem_busy.c +++ b/tests/i915/gem_busy.c @@ -66,6 +66,19 @@ static void __gem_busy(int fd, *read = busy.busy >> 16; } +static uint32_t ring_to_class(unsigned int ring) +{ + uint32_t class[] = { + [I915_EXEC_DEFAULT] = I915_ENGINE_CLASS_RENDER, + [I915_EXEC_RENDER] = I915_ENGINE_CLASS_RENDER, + [I915_EXEC_BLT] = I915_ENGINE_CLASS_COPY, + [I915_EXEC_BSD] = I915_ENGINE_CLASS_VIDEO, + [I915_EXEC_VEBOX] = I915_ENGINE_CLASS_VIDEO_ENHANCE, + }; + igt_assert(ring < ARRAY_SIZE(class)); + return class[ring]; +} + static bool exec_noop(int fd, uint32_t *handles, unsigned ring, @@ -100,6 +113,7 @@ static bool still_busy(int fd, uint32_t handle) static void semaphore(int fd, unsigned ring, uint32_t flags) { uint32_t bbe = MI_BATCH_BUFFER_END; + const unsigned uabi = ring_to_class(ring & 63); igt_spin_t *spin; uint32_t handle[3]; uint32_t read, write; @@ -122,26 +136,26 @@ static void semaphore(int fd, unsigned ring, uint32_t flags) igt_assert(exec_noop(fd, handle, ring | flags, false)); igt_assert(still_busy(fd, handle[BUSY])); __gem_busy(fd, handle[TEST], &read, &write); - igt_assert_eq(read, 1 << ring); + igt_assert_eq(read, 1 << uabi); igt_assert_eq(write, 0); /* Requeue with a write */ igt_assert(exec_noop(fd, handle, ring | flags, true)); igt_assert(still_busy(fd, handle[BUSY])); __gem_busy(fd, handle[TEST], &read, &write); - igt_assert_eq(read, 1 << ring); - igt_assert_eq(write, ring); + igt_assert_eq(read, 1 << uabi); + igt_assert_eq(write, 1 + uabi); /* Now queue it for a read across all available rings */ active = 0; for (i = I915_EXEC_RENDER; i <= I915_EXEC_VEBOX; i++) { if (exec_noop(fd, handle, i | flags, false)) - active |= 1 << i; + active |= 1 << ring_to_class(i); } igt_assert(still_busy(fd, handle[BUSY])); __gem_busy(fd, handle[TEST], &read, &write); igt_assert_eq(read, active); - igt_assert_eq(write, ring); /* from the earlier write */ + igt_assert_eq(write, 1 + uabi); /* from the earlier write */ /* Check that our long batch was long enough */ igt_assert(still_busy(fd, handle[BUSY])); @@ -168,7 +182,7 @@ static void one(int fd, unsigned ring, unsigned test_flags) struct drm_i915_gem_relocation_entry store[1024+1]; struct drm_i915_gem_execbuffer2 execbuf; unsigned size = ALIGN(ARRAY_SIZE(store)*16 + 4, 4096); - const unsigned uabi = ring & 63; + const unsigned uabi = ring_to_class(ring & 63); uint32_t read[2], write[2]; struct timespec tv; uint32_t *batch, *bbe; @@ -270,7 +284,7 @@ static void one(int fd, unsigned ring, unsigned test_flags) timeout = 1; } - igt_assert_eq(write[SCRATCH], uabi); + igt_assert_eq(write[SCRATCH], 1 + uabi); igt_assert_eq_u32(read[SCRATCH], 1 << uabi); igt_assert_eq(write[BATCH], 0);