[Mesa-dev] [PATCH] llvmpipe: Implement PIPE_QUERY_TIMESTAMP and PIPE_QUERY_TIME_ELAPSED.

Dave Airlie airlied at gmail.com
Mon Dec 3 02:08:10 PST 2012


On Mon, Dec 3, 2012 at 7:33 PM, Dave Airlie <airlied at gmail.com> wrote:
>> diff --git a/src/gallium/auxiliary/os/os_time.c b/src/gallium/auxiliary/os/os_time.c
>> index 3e9d50a..4055125 100644
>> --- a/src/gallium/auxiliary/os/os_time.c
>> +++ b/src/gallium/auxiliary/os/os_time.c
>> @@ -36,6 +36,7 @@
>>  #include "pipe/p_config.h"
>>
>>  #if defined(PIPE_OS_UNIX)
>> +#  include <time.h> /* timeval */
>>  #  include <sys/time.h> /* timeval */
>>  #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
>>  #  include <windows.h>
>> @@ -68,6 +69,20 @@ os_time_get(void)
>>  }
>>
>>
>> +uint64_t
>> +os_time_get_nano(void)
>> +{
>> +#if defined(PIPE_OS_UNIX)
>> +   struct timespec tv;
>> +   clock_gettime(CLOCK_REALTIME, &tv);
>> +   return tv.tv_nsec + tv.tv_sec * 1000000000LL;
>> +
>> +#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
>> +   return os_time_get() * 1000;
>> +#endif
>> +}
>
> I wonder if we should be using CLOCK_MONOTONIC_RAW (on new Linux) or
> CLOCK_MONOTONIC here, but I also wonder if we should do the same for
> os_time_get so they are the same clock.
>
> I ran some piglits on this, and it found it doesn't provide the
> screen->get_timestamp callback, but that looks like a trivial
> addition, though with that it still fails a test, I'll see if I can
> spot the problem.
>

Okay the attached patch fixes up the piglit fails I see with this patch.

feel free to merge it in.

Dave.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-llvmpipe-fix-up-piglits-for-timers.patch
Type: application/octet-stream
Size: 2017 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121203/9fc2301a/attachment.obj>


More information about the mesa-dev mailing list