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

Dave Airlie airlied at gmail.com
Mon Dec 3 01:33:27 PST 2012


> 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.

Dave.


More information about the mesa-dev mailing list