Module: Mesa Branch: master Commit: b65093c0cfbc614e88bb333fd99e4f578ddccdb7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b65093c0cfbc614e88bb333fd99e4f578ddccdb7
Author: Erik Faye-Lund <[email protected]> Date: Wed Feb 10 18:50:32 2021 +0100 zink: correctly handle 64 valid timestamp bits We can't shift up 1ull by more than 63 without triggering undefined behavior here. But in that case, doing nothing is perfectly fine. While we're at it, remove some needless parens. This fixes the spec@ext_timer_query@time-elapsed piglit test on top of Lavapipe. Reviewed-by: Hoe Hao Cheng <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8977> --- src/gallium/drivers/zink/zink_query.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c index 89ec037be9c..f4652432428 100644 --- a/src/gallium/drivers/zink/zink_query.c +++ b/src/gallium/drivers/zink/zink_query.c @@ -49,7 +49,9 @@ timestamp_to_nanoseconds(struct zink_screen *screen, uint64_t *timestamp) * the VkQueueFamilyProperties::timestampValidBits property of the queue on which the timestamp is written. * - 17.5. Timestamp Queries */ - *timestamp &= ((1ull << screen->timestamp_valid_bits) - 1); + if (screen->timestamp_valid_bits < 64) + *timestamp &= (1ull << screen->timestamp_valid_bits) - 1; + /* The number of nanoseconds it takes for a timestamp value to be incremented by 1 * can be obtained from VkPhysicalDeviceLimits::timestampPeriod * - 17.5. Timestamp Queries _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
