mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-22 18:30:31 +01:00
anv: Reduce ifdefs in anv_GetCalibratedTimestampsEXT()
Add anv_get_default_cpu_clock_id() to return the default cpu clock id to be used in the begin and end time captures of anv_GetCalibratedTimestampsEXT(). Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24591>
This commit is contained in:
parent
ae0df368a8
commit
01aafa14d4
1 changed files with 12 additions and 10 deletions
|
|
@ -4804,6 +4804,16 @@ VkResult anv_GetPhysicalDeviceCalibrateableTimeDomainsEXT(
|
|||
return vk_outarray_status(&out);
|
||||
}
|
||||
|
||||
static inline clockid_t
|
||||
anv_get_default_cpu_clock_id(void)
|
||||
{
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
return CLOCK_MONOTONIC_RAW;
|
||||
#else
|
||||
return CLOCK_MONOTONIC;
|
||||
#endif
|
||||
}
|
||||
|
||||
VkResult anv_GetCalibratedTimestampsEXT(
|
||||
VkDevice _device,
|
||||
uint32_t timestampCount,
|
||||
|
|
@ -4817,11 +4827,7 @@ VkResult anv_GetCalibratedTimestampsEXT(
|
|||
uint64_t begin, end;
|
||||
uint64_t max_clock_period = 0;
|
||||
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
begin = vk_clock_gettime(CLOCK_MONOTONIC_RAW);
|
||||
#else
|
||||
begin = vk_clock_gettime(CLOCK_MONOTONIC);
|
||||
#endif
|
||||
begin = vk_clock_gettime(anv_get_default_cpu_clock_id());
|
||||
|
||||
for (d = 0; d < timestampCount; d++) {
|
||||
switch (pTimestampInfos[d].timeDomain) {
|
||||
|
|
@ -4851,11 +4857,7 @@ VkResult anv_GetCalibratedTimestampsEXT(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
end = vk_clock_gettime(CLOCK_MONOTONIC_RAW);
|
||||
#else
|
||||
end = vk_clock_gettime(CLOCK_MONOTONIC);
|
||||
#endif
|
||||
end = vk_clock_gettime(anv_get_default_cpu_clock_id());
|
||||
|
||||
*pMaxDeviation = vk_time_max_deviation(begin, end, max_clock_period);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue