All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t v2 5/7] tests/perf: query CS timestamp frequency if available
Date: Fri,  8 Dec 2017 11:39:31 +0000	[thread overview]
Message-ID: <20171208113933.26384-6-lionel.g.landwerlin@intel.com> (raw)
In-Reply-To: <20171208113933.26384-1-lionel.g.landwerlin@intel.com>

On Cannonlake+ the CS timestamp frequency might vary from one part to
another. We have a new param to query this from the kernel (which
reads the value from registers).

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 tests/perf.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/tests/perf.c b/tests/perf.c
index 7f988d7c..ef37ceb3 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -969,6 +969,29 @@ gen8_sanity_check_test_oa_reports(uint32_t *oa_report0, uint32_t *oa_report1,
 	}
 }
 
+static uint64_t
+get_cs_timestamp_frequency(void)
+{
+	int cs_ts_freq = 0;
+	drm_i915_getparam_t gp;
+
+	gp.param = I915_PARAM_CS_TIMESTAMP_FREQUENCY;
+	gp.value = &cs_ts_freq;
+	if (igt_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp) == 0)
+		return cs_ts_freq;
+
+	igt_debug("Couldn't query CS timestamp frequency, trying to guess based on PCI-id\n");
+
+	if (IS_GEN7(devid) || IS_GEN8(devid))
+		return 12500000;
+	if (IS_SKYLAKE(devid) || IS_KABYLAKE(devid) || IS_COFFEELAKE(devid))
+		return 12000000;
+	if (IS_BROXTON(devid) || IS_GEMINILAKE(devid))
+		return 19200000;
+
+	igt_assert(!"You need to run this on a kernel with PARAM_CS_TIMESTAMP_FREQUENCY support\n");
+}
+
 static bool
 init_sys_info(void)
 {
@@ -979,7 +1002,8 @@ init_sys_info(void)
 	igt_assert_neq(card, -1);
 	igt_assert_neq(devid, 0);
 
-	timestamp_frequency = 12500000;
+	timestamp_frequency = get_cs_timestamp_frequency();
+	igt_assert_neq(timestamp_frequency, 0);
 
 	if (IS_HASWELL(devid)) {
 		/* We don't have a TestOa metric set for Haswell so use
@@ -1030,10 +1054,8 @@ init_sys_info(void)
 				igt_debug("unsupported Skylake GT size\n");
 				return false;
 			}
-			timestamp_frequency = 12000000;
 		} else if (IS_BROXTON(devid)) {
 			test_set_uuid = "5ee72f5c-092f-421e-8b70-225f7c3e9612";
-			timestamp_frequency = 19200000;
 		} else if (IS_KABYLAKE(devid)) {
 			switch (intel_gt(devid)) {
 			case 1:
@@ -1046,10 +1068,8 @@ init_sys_info(void)
 				igt_debug("unsupported Kabylake GT size\n");
 				return false;
 			}
-			timestamp_frequency = 12000000;
 		} else if (IS_GEMINILAKE(devid)) {
 			test_set_uuid = "dd3fd789-e783-4204-8cd0-b671bbccb0cf";
-			timestamp_frequency = 19200000;
 		} else if (IS_COFFEELAKE(devid)) {
 			switch (intel_gt(devid)) {
 			case 1:
@@ -1059,7 +1079,6 @@ init_sys_info(void)
 				igt_debug("unsupported Cannonlake GT size\n");
 				return false;
 			}
-			timestamp_frequency = 12000000;
 		} else {
 			igt_debug("unsupported GT\n");
 			return false;
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-12-08 11:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08 11:39 [PATCH i-g-t v2 0/7] tests/perf: Enable i915 perf tests on CNL Lionel Landwerlin
2017-12-08 11:39 ` [PATCH i-g-t v2 1/7] tools: make sure to include embedded drm-uapi headers Lionel Landwerlin
2017-12-08 11:39 ` [PATCH i-g-t v2 2/7] include/drm-uapi: bump headers Lionel Landwerlin
2017-12-08 11:39 ` [PATCH i-g-t v2 3/7] tests/perf: drop copied i915 defines/structs Lionel Landwerlin
2017-12-08 11:39 ` [PATCH i-g-t v2 4/7] tests/perf: factorize max oa buffer size define Lionel Landwerlin
2017-12-08 13:27   ` Matthew Auld
2017-12-08 11:39 ` Lionel Landwerlin [this message]
2017-12-08 13:43   ` [PATCH i-g-t v2 5/7] tests/perf: query CS timestamp frequency if available Matthew Auld
2017-12-08 11:39 ` [PATCH i-g-t v2 6/7] tests/perf: enable testing on Coffelake GT3 Lionel Landwerlin
2017-12-08 13:47   ` Matthew Auld
2017-12-08 11:39 ` [PATCH i-g-t v2 7/7] tests/perf: add test config uuid for Cannonlake Lionel Landwerlin
2017-12-08 13:50   ` Matthew Auld
2017-12-08 13:54     ` Lionel Landwerlin
2017-12-08 14:42       ` Lionel Landwerlin
2017-12-08 13:25 ` ✗ Fi.CI.BAT: failure for tests/perf: Enable i915 perf tests on CNL (rev2) Patchwork
2017-12-08 13:38   ` Lionel Landwerlin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171208113933.26384-6-lionel.g.landwerlin@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.