zink: Do the timestamp-to-ns math in a double to have better precision.
authorEmma Anholt <emma@anholt.net>
Mon, 11 Jul 2022 22:50:50 +0000 (15:50 -0700)
committerMarge Bot <emma+marge@anholt.net>
Tue, 12 Jul 2022 16:58:10 +0000 (16:58 +0000)
Fixes arb_timer_query-timestamp-get on my radv system, where the GPU has
been on for many days and the timestamp would only increment every once in
a while.

Part of fixing #6808

Fixes: 7a40b734ee2b ("zink: handle timestamp queries")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17477>

src/gallium/drivers/zink/zink_query.c

index 2c560b1..dbe4444 100644 (file)
@@ -273,7 +273,7 @@ timestamp_to_nanoseconds(struct zink_screen *screen, uint64_t *timestamp)
     * can be obtained from VkPhysicalDeviceLimits::timestampPeriod
     * - 17.5. Timestamp Queries
     */
-   *timestamp *= screen->info.props.limits.timestampPeriod;
+   *timestamp *= (double)screen->info.props.limits.timestampPeriod;
 }
 
 static VkQueryType