From patchwork Mon Dec 11 12:37:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10104911 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 D3086602A7 for ; Mon, 11 Dec 2017 12:37:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC8CB2957A for ; Mon, 11 Dec 2017 12:37:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B025A2957D; Mon, 11 Dec 2017 12:37:25 +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.2 required=2.0 tests=BAYES_00, 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 4CD822957A for ; Mon, 11 Dec 2017 12:37:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A8EB89D63; Mon, 11 Dec 2017 12:37:24 +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 7347D89D63 for ; Mon, 11 Dec 2017 12:37:22 +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 9948836-1500050 for multiple; Mon, 11 Dec 2017 12:37:14 +0000 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Mon, 11 Dec 2017 12:37:14 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Mon, 11 Dec 2017 12:37:14 +0000 Message-Id: <20171211123714.16075-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.15.1 X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Subject: [Intel-gfx] [PATCH igt] igt/pm_rps: Always allocate spin[0] 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 Avoid having to test for spin[0] existing by starting the load-loop with it allocated. References: https://bugs.freedesktop.org/show_bug.cgi?id=104060 Signed-off-by: Chris Wilson --- tests/pm_rps.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 57633c547..8f16ea47f 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -231,24 +231,24 @@ static void load_helper_run(enum load load) igt_debug("Applying %s load...\n", lh.load ? "high" : "low"); + spin[0] = igt_spin_batch_new(drm_fd, 0, 0, 0); while (!lh.exit) { - if (spin[0]) { - handle = spin[0]->handle; - igt_spin_batch_end(spin[0]); - while (gem_bo_busy(drm_fd, handle)) - usleep(100); - igt_spin_batch_free(drm_fd, spin[0]); + handle = spin[0]->handle; + igt_spin_batch_end(spin[0]); + while (gem_bo_busy(drm_fd, handle)) usleep(100); - } + + igt_spin_batch_free(drm_fd, spin[0]); + usleep(100); + spin[0] = spin[1]; spin[lh.load == HIGH] = - igt_spin_batch_new(drm_fd, 0, 0, 0); + __igt_spin_batch_new(drm_fd, 0, 0, 0); } - if (spin[0]) { - handle = spin[0]->handle; - igt_spin_batch_end(spin[0]); - } + handle = spin[0]->handle; + igt_spin_batch_end(spin[0]); + if (spin[1]) { handle = spin[1]->handle; igt_spin_batch_end(spin[1]);