From patchwork Tue Apr 25 22:32:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 9699885 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 90199601D3 for ; Tue, 25 Apr 2017 22:33:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88CD9284EE for ; Tue, 25 Apr 2017 22:33:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D9382857F; Tue, 25 Apr 2017 22:33:09 +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 C1B2E284EE for ; Tue, 25 Apr 2017 22:33:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6992F6E19B; Tue, 25 Apr 2017 22:33:06 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E8A46E0EE for ; Tue, 25 Apr 2017 22:33:05 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 25 Apr 2017 15:33:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,251,1488873600"; d="scan'208";a="93786906" Received: from ezarza-mobl5.amr.corp.intel.com (HELO delly.amr.corp.intel.com) ([10.254.68.206]) by fmsmga005.fm.intel.com with ESMTP; 25 Apr 2017 15:33:04 -0700 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Tue, 25 Apr 2017 15:32:33 -0700 Message-Id: <20170425223301.23733-2-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170425223301.23733-1-lionel.g.landwerlin@intel.com> References: <20170425223301.23733-1-lionel.g.landwerlin@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 01/29] igt/perf: generalize lookup for test metric set 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: Robert Bragg Signed-off-by: Robert Bragg Reviewed-by: Lionel Landwerlin --- tests/perf.c | 85 ++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/tests/perf.c b/tests/perf.c index 2a66bb63..0422e517 100644 --- a/tests/perf.c +++ b/tests/perf.c @@ -195,7 +195,7 @@ static int drm_fd = -1; static uint32_t devid; static int card = -1; -static uint64_t hsw_render_basic_id = UINT64_MAX; +static uint64_t test_metric_set_id = UINT64_MAX; static uint64_t gt_min_freq_mhz_saved = 0; static uint64_t gt_max_freq_mhz_saved = 0; static uint64_t gt_min_freq_mhz = 0; @@ -348,17 +348,46 @@ read_debugfs_u64_record(int fd, const char *file, const char *key) } static bool -lookup_hsw_render_basic_id(void) +lookup_test_metric_set_id(void) { + const char *test_set_name = NULL; + const char *test_set_uuid = NULL; char buf[256]; igt_assert_neq(card, -1); + igt_assert_neq(devid, 0); + + if (IS_HASWELL(devid)) { + /* We don't have a TestOa metric set for Haswell so use + * RenderBasic + */ + test_set_name = "RenderBasic"; + test_set_uuid = "403d8832-1a27-4aa6-a64e-f5389ce7b212"; + } else if (IS_BROADWELL(devid)) { + test_set_name = "TestOa"; + test_set_uuid = "d6de6f55-e526-4f79-a6a6-d7315c09044e"; + } else if (IS_CHERRYVIEW(devid)) { + test_set_name = "TestOa"; + test_set_uuid = "4a534b07-cba3-414d-8d60-874830e883aa"; + } else if (IS_SKYLAKE(devid)) { + test_set_name = "TestOa"; + test_set_uuid = "544a0c1f-5863-4682-bc59-778b7eab8303"; + } else if (IS_BROXTON(devid)) { + test_set_name = "TestOa"; + test_set_uuid = "5ee72f5c-092f-421e-8b70-225f7c3e9612"; + } else + return false; + + igt_debug("%s metric set UUID = %s\n", + test_set_name, + test_set_uuid); snprintf(buf, sizeof(buf), - "/sys/class/drm/card%d/metrics/403d8832-1a27-4aa6-a64e-f5389ce7b212/id", - card); + "/sys/class/drm/card%d/metrics/%s/id", + card, + test_set_uuid); - return try_read_u64_file(buf, &hsw_render_basic_id); + return try_read_u64_file(buf, &test_metric_set_id); } static void @@ -426,7 +455,7 @@ test_system_wide_paranoid(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, 13, /* 1 millisecond */ }; @@ -452,7 +481,7 @@ test_system_wide_paranoid(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, 13, /* 1 millisecond */ }; @@ -486,7 +515,7 @@ test_invalid_open_flags(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, 13, /* 1 millisecond */ }; @@ -525,7 +554,7 @@ test_invalid_oa_metric_set_id(void) do_ioctl_err(drm_fd, DRM_IOCTL_I915_PERF_OPEN, ¶m, EINVAL); /* Check that we aren't just seeing false positives... */ - properties[ARRAY_SIZE(properties) - 1] = hsw_render_basic_id; + properties[ARRAY_SIZE(properties) - 1] = test_metric_set_id; stream_fd = __perf_open(drm_fd, ¶m); close(stream_fd); @@ -542,7 +571,7 @@ test_invalid_oa_format_id(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_EXPONENT, 13, /* 1 millisecond */ DRM_I915_PERF_PROP_OA_FORMAT, UINT64_MAX, }; @@ -576,7 +605,7 @@ test_missing_sample_flags(void) /* No _PROP_SAMPLE_xyz flags */ /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_EXPONENT, 13, /* 1 millisecond */ DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, }; @@ -729,7 +758,7 @@ open_and_read_2_oa_reports(int format_id, DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, format_id, DRM_I915_PERF_PROP_OA_EXPONENT, exponent, @@ -1041,7 +1070,7 @@ test_invalid_oa_exponent(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, 31, /* maximum exponent expected to be accepted */ @@ -1098,7 +1127,7 @@ test_low_oa_exponent_permissions(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, bad_exponent, }; @@ -1163,7 +1192,7 @@ test_per_context_mode_unprivileged(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, 13, /* 1 millisecond */ }; @@ -1250,7 +1279,7 @@ test_blocking(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; @@ -1342,7 +1371,7 @@ test_polling(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; @@ -1460,7 +1489,7 @@ test_buffer_fill(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; @@ -1534,7 +1563,7 @@ test_enable_disable(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; @@ -1605,7 +1634,7 @@ test_short_reads(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; @@ -1692,7 +1721,7 @@ test_non_sampling_read_error(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, /* XXX: no sampling exponent */ @@ -1726,7 +1755,7 @@ test_disabled_read_error(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; @@ -1788,7 +1817,7 @@ test_mi_rpc(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, /* Note: no OA exponent specified in this case */ @@ -1918,7 +1947,7 @@ test_per_ctx_mi_rpc(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, /* Note: no OA exponent specified in this case */ @@ -2129,7 +2158,7 @@ test_rc6_disable(void) DRM_I915_PERF_PROP_SAMPLE_OA, true, /* OA unit configuration */ - DRM_I915_PERF_PROP_OA_METRICS_SET, hsw_render_basic_id, + DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id, DRM_I915_PERF_PROP_OA_FORMAT, I915_OA_FORMAT_A45_B8_C8, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; @@ -2230,8 +2259,8 @@ test_i915_ref_count(void) card = drm_get_card(); igt_require(IS_HASWELL(devid)); - igt_require(lookup_hsw_render_basic_id()); - properties[3] = hsw_render_basic_id; + igt_require(lookup_test_metric_set_id()); + properties[3] = test_metric_set_id; ref_count0 = read_i915_module_ref(); igt_debug("initial ref count with drm_fd open = %u\n", ref_count0); @@ -2301,7 +2330,7 @@ igt_main card = drm_get_card(); igt_require(IS_HASWELL(devid)); - igt_require(lookup_hsw_render_basic_id()); + igt_require(lookup_test_metric_set_id()); gt_frequency_range_save();