Commit 4fee36ef authored by Lionel Landwerlin's avatar Lionel Landwerlin

tests/perf: query CS timestamp frequency if available

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).

v2: Skip the tests when timestamp frequency cannot be read on CNL+ (Lionel)
Signed-off-by: Lionel Landwerlin's avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matthew Auld's avatarMatthew Auld <matthew.auld@intel.com>
parent 2389c6f5
...@@ -969,6 +969,29 @@ gen8_sanity_check_test_oa_reports(uint32_t *oa_report0, uint32_t *oa_report1, ...@@ -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_skip("Kernel with PARAM_CS_TIMESTAMP_FREQUENCY support required\n");
}
static bool static bool
init_sys_info(void) init_sys_info(void)
{ {
...@@ -979,7 +1002,8 @@ init_sys_info(void) ...@@ -979,7 +1002,8 @@ init_sys_info(void)
igt_assert_neq(card, -1); igt_assert_neq(card, -1);
igt_assert_neq(devid, 0); igt_assert_neq(devid, 0);
timestamp_frequency = 12500000; timestamp_frequency = get_cs_timestamp_frequency();
igt_assert_neq(timestamp_frequency, 0);
if (IS_HASWELL(devid)) { if (IS_HASWELL(devid)) {
/* We don't have a TestOa metric set for Haswell so use /* We don't have a TestOa metric set for Haswell so use
...@@ -1030,10 +1054,8 @@ init_sys_info(void) ...@@ -1030,10 +1054,8 @@ init_sys_info(void)
igt_debug("unsupported Skylake GT size\n"); igt_debug("unsupported Skylake GT size\n");
return false; return false;
} }
timestamp_frequency = 12000000;
} else if (IS_BROXTON(devid)) { } else if (IS_BROXTON(devid)) {
test_set_uuid = "5ee72f5c-092f-421e-8b70-225f7c3e9612"; test_set_uuid = "5ee72f5c-092f-421e-8b70-225f7c3e9612";
timestamp_frequency = 19200000;
} else if (IS_KABYLAKE(devid)) { } else if (IS_KABYLAKE(devid)) {
switch (intel_gt(devid)) { switch (intel_gt(devid)) {
case 1: case 1:
...@@ -1046,10 +1068,8 @@ init_sys_info(void) ...@@ -1046,10 +1068,8 @@ init_sys_info(void)
igt_debug("unsupported Kabylake GT size\n"); igt_debug("unsupported Kabylake GT size\n");
return false; return false;
} }
timestamp_frequency = 12000000;
} else if (IS_GEMINILAKE(devid)) { } else if (IS_GEMINILAKE(devid)) {
test_set_uuid = "dd3fd789-e783-4204-8cd0-b671bbccb0cf"; test_set_uuid = "dd3fd789-e783-4204-8cd0-b671bbccb0cf";
timestamp_frequency = 19200000;
} else if (IS_COFFEELAKE(devid)) { } else if (IS_COFFEELAKE(devid)) {
switch (intel_gt(devid)) { switch (intel_gt(devid)) {
case 1: case 1:
...@@ -1059,7 +1079,6 @@ init_sys_info(void) ...@@ -1059,7 +1079,6 @@ init_sys_info(void)
igt_debug("unsupported Cannonlake GT size\n"); igt_debug("unsupported Cannonlake GT size\n");
return false; return false;
} }
timestamp_frequency = 12000000;
} else { } else {
igt_debug("unsupported GT\n"); igt_debug("unsupported GT\n");
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment