From: Bas Nieuwenhuizen <ba...@chromium.org>

Per spec:

"timestampPeriod is the number of nanoseconds required for a timestamp query to 
be
incremented by 1."

So:

period = nanoseconds/cycle and difference = cycles
difference * period = nanoseconds
difference * period / 1000000 = milliseconds
difference / (1000000 / period) = milliseconds

therefore freq = 1000000 / period, since we compute elapsed ms from this.

Fixes func.query.timestamp on radv.
---

This likely breaks the test for anv, so I would appreciate it if someone would 
either
look at anv or prove my commit wrong.

 src/tests/func/query/timestamp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tests/func/query/timestamp.c b/src/tests/func/query/timestamp.c
index ea7f683..aef007d 100644
--- a/src/tests/func/query/timestamp.c
+++ b/src/tests/func/query/timestamp.c
@@ -66,7 +66,7 @@ test_timestamp(void)
     t_assert(poll(NULL, 0, 100) == 0);
     b = get_timestamp();
 
-    freq = 1 / (t_physical_dev_props->limits.timestampPeriod * 1000);
+    freq = 1000000 / t_physical_dev_props->limits.timestampPeriod;
     elapsed_ms = (b - a) / freq;
     printf("difference: %" PRIu64 " - %" PRIu64 " = %" PRIu64 "\n", b / freq, 
a / freq, elapsed_ms);
     if (elapsed_ms < 90 || elapsed_ms > 110)
-- 
2.16.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to