From patchwork Tue Apr 18 11:41:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9685399 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 CF030601C2 for ; Tue, 18 Apr 2017 11:41:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8CB228414 for ; Tue, 18 Apr 2017 11:41:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAEE92841E; Tue, 18 Apr 2017 11:41:27 +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=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 9A13528414 for ; Tue, 18 Apr 2017 11:41:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 148F489950; Tue, 18 Apr 2017 11:41:24 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8FD6B89950 for ; Tue, 18 Apr 2017 11:41:22 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id q125so14137936wmd.3 for ; Tue, 18 Apr 2017 04:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L4OHzh5sZcebNs3xNDDQPBSDHI5jMj6co2a89fiW9TY=; b=mzxzT4gcKicYs5ZbAecqmd8w6KwNeb06d/VlNignA+Ufhi+WblU0W+oK+z4931Rcl5 0Yaqy+OYhWTE+ffIm/KlWUk5k92cLN+mxdgAvwnyNcwGDNWq1u3IiSMEAlfJesspe3t+ cRdlapYOEV1v3J3FIqK7pv2n7JPT2burxivSamPFEpMReR72LZuhGOrXoyOWaNOvNmP3 zRXXd0GMOIppngahqAJAIjhM690ZxZOFJtk2BBn2CVOkS2zzoQ0TCKylf3UpDOK3NgLL xFB4nTbj9tUJDFSDEK1xMUpeKu62WJHjyD34M36g6SuqFDy9hamcffi6pD3d6zbbAzAs 44+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L4OHzh5sZcebNs3xNDDQPBSDHI5jMj6co2a89fiW9TY=; b=hPRSuD2NQFncrLQJtIyI3YpXf2HwUYzx77AwBinFk0nsgEjl1wNM4CwhkQcgGDpjLh Y2JNGAdFUe03Cv/vu6joFAgpNQfShdh/9CXTuK5EpsoAskQFresYTqqdrEHmU5xQ8w58 aMJTA+a4S5teG4uqVvUTH9MG2R1DRC64talIsH8QdUjhqOFq9STwxUAwfF4qprV60onE oSattHNLhFTuRvw9VOm+n+599bBB87F9Xb8zoW/xE12GnbO/OpgL/u0up5mypTcqu0mo uGdV8+r+EhugtXoLXGdw3RHlRpKPTTNfnuuKnVSryy5pnezzFUTZr55F288jC/3BcFe+ YllQ== X-Gm-Message-State: AN3rC/4NmQPv4VuyXevfYNj61DAd6qiMrvkB6ad9uvDQjWMWQdkgM+6O WnlE3n33bepAcQ== X-Received: by 10.28.238.213 with SMTP id j82mr13066483wmi.43.1492515681206; Tue, 18 Apr 2017 04:41:21 -0700 (PDT) Received: from t460p.intel ([94.15.199.60]) by smtp.gmail.com with ESMTPSA id 11sm13578715wrz.8.2017.04.18.04.41.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Apr 2017 04:41:20 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Tue, 18 Apr 2017 12:41:14 +0100 Message-Id: <20170418114114.11945-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170413211158.GA26266@nuc-i3427.alporthouse.com> References: <20170413211158.GA26266@nuc-i3427.alporthouse.com> Subject: [Intel-gfx] [PATCH i-g-t v2] igt/gem_exec_nop/headless: Verify GT performance in headless mode 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 From: Tvrtko Ursulin Check that no-op execution speed is the same in headless mode and with the display active. v2: * Set graphics mode for the test to disable blanking. (Imre) * Use igt stats framework as suggested by Chris. Signed-off-by: Tvrtko Ursulin Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100572 Cc: Imre Deak Cc: Chris Wilson Reviewed-by: Chris Wilson --- tests/gem_exec_nop.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c index 5d0d4957545e..1710bf4599fb 100644 --- a/tests/gem_exec_nop.c +++ b/tests/gem_exec_nop.c @@ -112,6 +112,74 @@ static void single(int fd, uint32_t handle, ring_name, count, time*1e6 / count); } +static double +stable_nop_on_ring(int fd, uint32_t handle, unsigned int engine, + int timeout, int reps) +{ + igt_stats_t s; + double n; + + igt_assert(reps >= 5); + + igt_stats_init_with_size(&s, reps); + s.is_float = true; + + while (reps--) { + unsigned long count; + double time; + + time = nop_on_ring(fd, handle, engine, timeout, &count); + igt_stats_push_float(&s, time / count); + } + + n = igt_stats_get_median(&s); + igt_stats_fini(&s); + + return n; +} + +#define assert_within_epsilon(x, ref, tolerance) \ + igt_assert_f((x) <= (1.0 + tolerance) * ref && \ + (x) >= (1.0 - tolerance) * ref, \ + "'%s' != '%s' (%f not within %f%% tolerance of %f)\n",\ + #x, #ref, x, tolerance * 100.0, ref) + +static void headless(int fd, uint32_t handle) +{ + const struct intel_execution_engine *e = &intel_execution_engines[0]; + unsigned int nr_connected = 0; + drmModeConnector *connector; + drmModeRes *res; + double n[2]; + + res = drmModeGetResources(fd); + igt_assert(res); + + /* require at least one connected connector for the test */ + for (int i = 0; i < res->count_connectors; i++) { + connector = drmModeGetConnectorCurrent(fd, res->connectors[i]); + if (connector->connection == DRM_MODE_CONNECTED) + nr_connected++; + drmModeFreeConnector(connector); + } + igt_require(nr_connected > 0); + + /* set graphics mode to prevent blanking */ + kmstest_set_vt_graphics_mode(); + + /* benchmark nops */ + n[0] = stable_nop_on_ring(fd, handle, e->exec_id | e->flags, 1, 5); + + /* force all connectors off */ + kmstest_unset_all_crtcs(fd, res); + + /* benchmark nops again */ + n[1] = stable_nop_on_ring(fd, handle, e->exec_id | e->flags, 1, 5); + + /* check that the two execution speeds are roughly the same */ + assert_within_epsilon(n[1], n[0], 0.1f); +} + static bool ignore_engine(int fd, unsigned engine) { if (engine == 0) @@ -494,6 +562,9 @@ igt_main igt_subtest("context-sequential") sequential(device, handle, FORKED | CONTEXT, 150); + igt_subtest("headless") + headless(device, handle); + igt_fixture { igt_stop_hang_detector(); gem_close(device, handle);