venus: Fix dEQP-VK.pipeline.timestamp.calibrated.host_domain_test failure

The current implementation is getting its clock value from the host
and this value is not guaranteed to be the same as the VM guest.

This commit implements the CLOCK_MONOTONIC[_RAW] natively.

Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18281>
This commit is contained in:
Igor Torrente 2022-08-26 11:22:55 -03:00 committed by Marge Bot
parent a0b08e2858
commit 1ebfa00bc5
2 changed files with 48 additions and 4 deletions

View file

@ -13,4 +13,3 @@ dEQP-VK.pipeline.extended_dynamic_state.before_draw.enable_raster,Fail
dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.enable_raster,Fail
dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.enable_raster,Fail
dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.enable_raster,Fail
dEQP-VK.pipeline.timestamp.calibrated.host_domain_test,Fail

View file

@ -547,8 +547,53 @@ vn_GetCalibratedTimestampsEXT(
uint64_t *pMaxDeviation)
{
struct vn_device *dev = vn_device_from_handle(device);
uint64_t begin, end, max_clock_period = 0;
VkResult ret;
int domain;
return vn_call_vkGetCalibratedTimestampsEXT(
dev->instance, device, timestampCount, pTimestampInfos, pTimestamps,
pMaxDeviation);
#ifdef CLOCK_MONOTONIC_RAW
begin = vk_clock_gettime(CLOCK_MONOTONIC_RAW);
#else
begin = vk_clock_gettime(CLOCK_MONOTONIC);
#endif
for (domain = 0; domain < timestampCount; domain++) {
switch (pTimestampInfos[domain].timeDomain) {
case VK_TIME_DOMAIN_DEVICE_EXT: {
uint64_t device_max_deviation = 0;
ret = vn_call_vkGetCalibratedTimestampsEXT(
dev->instance, device, 1, &pTimestampInfos[domain],
&pTimestamps[domain], &device_max_deviation);
if (ret != VK_SUCCESS)
return vn_error(dev->instance, ret);
max_clock_period = MAX2(max_clock_period, device_max_deviation);
break;
}
case VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT:
pTimestamps[domain] = vk_clock_gettime(CLOCK_MONOTONIC);
max_clock_period = MAX2(max_clock_period, 1);
break;
#ifdef CLOCK_MONOTONIC_RAW
case VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT:
pTimestamps[domain] = begin;
break;
#endif
default:
pTimestamps[domain] = 0;
break;
}
}
#ifdef CLOCK_MONOTONIC_RAW
end = vk_clock_gettime(CLOCK_MONOTONIC_RAW);
#else
end = vk_clock_gettime(CLOCK_MONOTONIC);
#endif
*pMaxDeviation = vk_time_max_deviation(begin, end, max_clock_period);
return VK_SUCCESS;
}