Re: [Mesa-dev] [PATCH 4/7] mesa: implement glGet(GL_TIMESTAMP)

2012-06-27 Thread Eric Anholt
Does the hardware you care about not have a reg to read out the current timestamp? Ours does, and it seems like a way better way to go about it than hoping that the two clocks don't drift relative to each other. pgpOwy0UJAI9h.pgp Description: PGP signature ___

Re: [Mesa-dev] [PATCH 4/7] mesa: implement glGet(GL_TIMESTAMP)

2012-06-27 Thread Adam Jackson
On Wed, 2012-06-27 at 17:16 +0200, Marek Olšák wrote: > I am working in nanoseconds and precision is quite important. I don't > think I can use CLOCK_MONOTONIC_COARSE. CLOCK_MONOTONIC might be fine. My mistake, read the math the wrong way around. - ajax signature.asc Description: This is a dig

Re: [Mesa-dev] [PATCH 4/7] mesa: implement glGet(GL_TIMESTAMP)

2012-06-27 Thread Marek Olšák
On Wed, Jun 27, 2012 at 4:42 PM, Adam Jackson wrote: > On Wed, 2012-06-27 at 09:29 +0200, Michel Dänzer wrote: >> On Mit, 2012-06-27 at 03:49 +0200, Marek Olšák wrote: >> > >> > +GLuint64 >> > +_mesa_get_cpu_timestamp(void) >> > +{ >> > +#ifndef _WIN32 >> > +   struct timeval tv; >> > + >> > +   g

Re: [Mesa-dev] [PATCH 4/7] mesa: implement glGet(GL_TIMESTAMP)

2012-06-27 Thread Adam Jackson
On Wed, 2012-06-27 at 09:29 +0200, Michel Dänzer wrote: > On Mit, 2012-06-27 at 03:49 +0200, Marek Olšák wrote: > > > > +GLuint64 > > +_mesa_get_cpu_timestamp(void) > > +{ > > +#ifndef _WIN32 > > + struct timeval tv; > > + > > + gettimeofday(&tv, 0); > > + return (GLuint64)tv.tv_sec * 1

Re: [Mesa-dev] [PATCH 4/7] mesa: implement glGet(GL_TIMESTAMP)

2012-06-27 Thread Brian Paul
On 06/26/2012 07:49 PM, Marek Olšák wrote: --- src/mesa/main/get.c | 10 src/mesa/main/mtypes.h |1 + src/mesa/main/queryobj.c | 61 ++ src/mesa/main/queryobj.h |5 4 files changed, 77 insertions(+) diff --git a/s

Re: [Mesa-dev] [PATCH 4/7] mesa: implement glGet(GL_TIMESTAMP)

2012-06-27 Thread Michel Dänzer
On Mit, 2012-06-27 at 03:49 +0200, Marek Olšák wrote: > > +GLuint64 > +_mesa_get_cpu_timestamp(void) > +{ > +#ifndef _WIN32 > + struct timeval tv; > + > + gettimeofday(&tv, 0); > + return (GLuint64)tv.tv_sec * 10ull + (GLuint64)tv.tv_usec * 1000; As in a recent discussion about DRM

[Mesa-dev] [PATCH 4/7] mesa: implement glGet(GL_TIMESTAMP)

2012-06-26 Thread Marek Olšák
--- src/mesa/main/get.c | 10 src/mesa/main/mtypes.h |1 + src/mesa/main/queryobj.c | 61 ++ src/mesa/main/queryobj.h |5 4 files changed, 77 insertions(+) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 677