-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jan Gukelberger wrote:

> I'm trying to port an application that presents visual stimuli for
> experiments in neuroscience from DirectFBGL to X/DRI. A main requirement
> is reliable timing of the drawing code, i.e. on every VSYNC a new frame
> must be ready in the back buffer so that the buffers can be swapped.
> 
> For this purpose I start a graphics thread with SCHED_FIFO scheduler
> that does basically this:
> 
> while( !Stopped() )
> {
>       glXGetVideoSyncSGI( &count1 );
>       time1 = GetTime( CLOCK_REALTIME );
>       glXWaitVideoSyncSGI( 2, ( count1 + 1 ) % 2, &count2 );
>       time2 = GetTime( CLOCK_REALTIME );
>       glXGetVideoSyncSGI( &count3 );
> 
>       if( count3 != prevCount + 1 ) 
>               Print( "Lost %i frames.", count3 - prevCount - 1 );
>       Print( "Draw time: %f ms. Wait time: %f ms.", 
>               time1 - prevTime, time2 - time1 );
>       prevCount = count3;
>       prevTime = time2;
> 
>       glFlush();
>       glXSwapBuffers( dpy, win );
>       DrawFrame();
> }

This is not the right way to do this.  You want to use either
GLX_MESA_swap_control, GLX_SGI_swap_control, or GLX_OML_sync_control.
Each of these provides a way for the application to tell the driver the
maximum buffer swap frequency.

GLX_MESA_swap_control is the flavor supported by most of the open source
drivers.  To achieve the result you want, you'd call glXSwapIntervalMESA
with a value of 1.  For that extension, the default value is 0, which
means the driver should swap as fast as it can.

If you want to get some statistics about the swapping, you can use
GLX_MESA_swap_frame_usage.  That will tell you how fast your swaps are
actually happening.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFE8z7QX1gOwKyEAw8RAoy8AJ9y4Rmp/9mzKrMHmJj2IMlKZmRpgQCghCrV
VHzq/ajSHLK/il2DmIok+Aw=
=nqhc
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to