zink: add pipe_context::get_timestamp hook

this uses VK_EXT_calibrated_timestamps to read a timestamp immediately from
the device without using a batch, which is what the gallium api expects

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6923>
diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c
index 5bf8f69..0d1e811 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -477,6 +477,20 @@
    pipe_resource_reference(&pres, NULL);
 }
 
+static uint64_t
+zink_get_timestamp(struct pipe_context *pctx)
+{
+   struct zink_screen *screen = zink_screen(pctx->screen);
+   uint64_t timestamp, deviation;
+   assert(screen->info.have_EXT_calibrated_timestamps);
+   VkCalibratedTimestampInfoEXT cti = {};
+   cti.sType = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT;
+   cti.timeDomain = VK_TIME_DOMAIN_DEVICE_EXT;
+   screen->vk_GetCalibratedTimestampsEXT(screen->dev, 1, &cti, &timestamp, &deviation);
+   timestamp_to_nanoseconds(screen, &timestamp);
+   return timestamp;
+}
+
 void
 zink_context_query_init(struct pipe_context *pctx)
 {
@@ -490,4 +504,5 @@
    pctx->get_query_result = zink_get_query_result;
    pctx->set_active_query_state = zink_set_active_query_state;
    pctx->render_condition = zink_render_condition;
+   pctx->get_timestamp = zink_get_timestamp;
 }