Module: Mesa Branch: master Commit: bb603352b68f1a58f020e9cd7fa15040742c00d5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb603352b68f1a58f020e9cd7fa15040742c00d5
Author: Mike Blumenkrantz <[email protected]> Date: Fri Jul 10 14:46:18 2020 -0400 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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6923> --- src/gallium/drivers/zink/zink_query.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c index 5bf8f69c48c..0d1e8117cbc 100644 --- a/src/gallium/drivers/zink/zink_query.c +++ b/src/gallium/drivers/zink/zink_query.c @@ -477,6 +477,20 @@ zink_render_condition(struct pipe_context *pctx, 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, ×tamp, &deviation); + timestamp_to_nanoseconds(screen, ×tamp); + return timestamp; +} + void zink_context_query_init(struct pipe_context *pctx) { @@ -490,4 +504,5 @@ zink_context_query_init(struct pipe_context *pctx) 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; } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
