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

Jose Fonseca jfonseca at vmware.com
Mon Dec 3 09:29:54 PST 2012



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

Merged and commited. Thanks!

I think you're right about CLOCK_MONOTONIC. Not sure how to detect CLOCK_MONOTONIC_RAW run/compile time. So let's do that in a follow on change.

I think that it is unnecessary to have two implementations of os_time_get_nano/os_time_get. os_time_get should be re-defined in term of os_time_get_nano, since it is more general.

Jose


More information about the mesa-dev mailing list