On Thu, 05 Jun 2003 16:51:27 -0600
Brian Paul <[EMAIL PROTECTED]> wrote:

> Felix Kühling wrote:
> > Hi,
> > 
> > even with LIBGL_SYNC_REFRESH I get bad tearing with quake2. I looked
> > into the source a bit and now I'm scratching my head about this
> > question: Does waiting for a vblank do anything useful if you havn't
> > flushed the 3D hardware graphics pipeline before? I believe the driver
> > should call something equivalent to glFinish before driWaitForVBlank if
> > LIBGL_SYNC_REFRESH is set.
> > 
> > Further in case of a non-zero swap interval you will throttle the frame
> > rate but there is no guarantee that the swap will occur during a retrace
> > if the application or the driver havn't called glFinish. I guess
> > applications explicitly using swap intervals are aware of that. But
> > LIBGL_SYNC_REFRESH is supposed to work for applications that don't even
> > know they are waiting for a vblank. So the driver should call glFinish
> > for them.
> > 
> > I hope I'm not completely off with my theories ;-)
> 
> When glXSwapBuffers is called, the rendering context currently bound 
> to the window (if any) is flushed (ala glFinish) automatically.  Then, 
> glXSwapBuffers should wait for the end of the screen refresh before 
> swapping.

>From the glXSwapBuffers manpage:

       glXSwapBuffers  performs an implicit glFlush before it returns.  Subse-
       quent OpenGL commands may be issued immediately after calling  glXSwap-
       Buffers, but are not executed until the buffer exchange is completed.

glFlush is not the same as glFinish. The radeon and r200 drivers can
have up to one frame in the hardware rendering pipeline when the
pageflip or buffer copying commands are sent to the hardware (they are
pipelined as well). The frame throttling code in
radeonWaitForFrameCompletion makes sure that it doesn't get more than
one frame as that would introduce too much latency in interactive
applications.

> 
> That said, I don't know why you're seeing tearing.

I added this to radeon_ioctl.c in radeonPageFlip just before the call to
driWaitForVBlank:

   if ((rmesa->vblank_flags & VBLANK_FLAG_SYNC))
       radeonFinish (rmesa->glCtx);

Now the tearing is gone.

> 
> -Brian

Felix

------------    __\|/__    ___     ___       -------------------------
 Felix       ___\_e -_/___/ __\___/ __\_____   You can do anything,
   Kühling  (_____\Ä/____/ /_____/ /________)  just not everything
 [EMAIL PROTECTED]       \___/   \___/   U        at the same time.


-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to