[Nouveau] [PATCH v2] drm/nouveau: Add getparam for current PTIMER time.

Ben Skeggs skeggsb at gmail.com
Mon May 24 16:25:52 PDT 2010


On Mon, 2010-05-24 at 07:50 +0000, Marcin Kościelnicki wrote:
> > On Sun, 2010-05-23 at 11:36 +0000, Marcin Kościelnicki wrote:
> > > This will be useful for computing GPU-CPU latency, including
> > > GL_ARB_timer_query extension.
> >
> > Looks fine, just a quick question as to whether this is necessary?  I
> > seem to recall that on nv40, the QUERY methods actually return
> > timestamps in the "notifier" that one would assume are from PTIMER.
> >
> > Is there some way to do this on G80+ also?
> 
> There is. Notifiers and QUERYs and PFIFO FENCEs all return PTIMER time. But 
> that's not the point - all of these commands execute on GPU inside the GPU 
> command stream, and we want a CPU version. See the GL_ARB_timer_query 
> extension for details... generic idea:
> 
> 1. Submit lots of commands 
> 2. Add a GPU timestamp query at the end
> 3. Fire
> 4. Get current GPU time at the moment of firing [via the above getparam]
> 5. Do something else for some time, like rendering another frame
> 6. Substract results from 2. and 4. to measure how far ahead the CPU is at the 
> end of a frame [CPU-GPU latency]
> 
> Using another query at the beginning of the command buffer won't do the trick, 
> since GPU could still be busy rendering previous frame.  Unless you glFinish, 
> but this results in pipeline stalls.
Sure it will, since {EXT,ARB}_timer_query actually says that it measures
the time it takes for the commands between a BeginQuery() and and
EndQuery() to be processed, not the time before all commands before the
BeginQuery() right up until the EndQuery() have completed.

A snippet from ARB_timer_query:

    The timer is started or stopped when the effects from all
    previous commands on the GL client and server state and the framebuffer
    have been fully realized.

Which, to me, seem like using the GPU methods to write timestamps into buffers
at BeginQuery() and EndQuery() time will work just fine.  Or am I missing
something?

Ben.

> 
> Marcin Kościelnicki




More information about the Nouveau mailing list