Mesa (staging/22.1): zink: Do the timestamp-to-ns math in a double to have better precision.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 12 17:20:16 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 6ddbd56174bd8eab4711be59ccb2ccd392b57b2f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ddbd56174bd8eab4711be59ccb2ccd392b57b2f

Author: Emma Anholt <emma at anholt.net>
Date:   Mon Jul 11 15:50:50 2022 -0700

zink: Do the timestamp-to-ns math in a double to have better precision.

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 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17477>
(cherry picked from commit 0feedec9e6b630f930605d9681911fe9e2b705ce)

---

 .pick_status.json                     | 2 +-
 src/gallium/drivers/zink/zink_query.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index cba00123a1b..e589acbe872 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
         "description": "zink: Do the timestamp-to-ns math in a double to have better precision.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "7a40b734ee2ba7da7975ac858022b6f175ddcb5a"
     },
diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c
index 34ba0b9a36f..0a5d33dce1a 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -262,7 +262,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



More information about the mesa-commit mailing list