[PATCH] winevulkan: Implement VK_EXT_calibrated_timestamps

Paul Gofman pgofman at codeweavers.com
Sat Jul 18 01:35:13 CDT 2020

>> Digging into dlls/ntdll/unix/sync.c:monotonic_counter we see the following code that I'd expect is the common-path for us to hit on Linux platforms (ie: having clock_gettime()):
>>>  98 #ifdef CLOCK_MONOTONIC_RAW
>>>  99     if (!clock_gettime( CLOCK_MONOTONIC_RAW, &ts ))
>>> 100         return ts.tv_sec * (ULONGLONG)TICKSPERSEC + ts.tv_nsec / 100;
>>> 101 #endif
>>> 102     if (!clock_gettime( CLOCK_MONOTONIC, &ts ))
>>> 103         return ts.tv_sec * (ULONGLONG)TICKSPERSEC + ts.tv_nsec / 100;
>>> 104 #endif
>> So I think to report accurate values winevulkan will need to make a similar conversion here. Perhaps it would be good to refactor things a bit such that this conversion lives in an area which is accessible both by ntdll as well as winevulkan, but I'm not sure what the general feeling is around that kind of thing in WINE since I've almost exclusively stuck to winevulkan.

I guess QueryPerformanceCounter units can be established by QueryPerformanceFrequency. IIRC whenever I tested these functions on Windows I saw ‘rdtsc’ (base cpu) frequency as PerformanceFrequency (while Wine has this Tickspersec constant). I did not spot an application yet which would obviously depend on this difference, yet but maybe we would want to change the constant to the real frequency at some point.

More information about the wine-devel mailing list