On Tue, 2009-06-30 at 09:18 -0700, Jesse Barnes wrote:
> That depends...  If you're getting hit by scheduling latency (i.e. your
> app doesn't actually get scheduled on the CPU until several ms after
> the vblank interrupt fires), then there's no easy way to fix it.  You
> could try realtime scheduling and configuring things just right so that
> your waiting apps always get scheduled in time, but that's going to be
> difficult in a general purpose environment.
> 
> If the interrupt is arriving too late, you could try one of the other
> hardware mechanisms (fire an interrupt at a scanline near the bottom of
> the screen instead, to give you some extra time or something).

Without looking at the demo source code, I suspect the problem might be
something else. The implementation of sgi_video_sync in Mesa simply
waits for the vblank interval and does nothing else.

So, if I:

 - Do a bunch of rendering
 - Wait for vblank
 - glXSwapBuffers

Then my command buffers will not be flushed to the video card until
after vblank. If the command buffers take time to execute, then the
swap buffers is delayed and you get a tear. So, you need to glFlush()
before waiting for vblank.

There's a more subtle reason why you want to actually glFinish() rather
than glFlush() - if your rendering takes long enough so that you can't
keep up with the refresh rate:

- Do a bunch of rendering
- glFlush
- Wait for vblank
- glXSwapBuffers
 
Will cause the glXSwapBuffers to happen in the middle of a frame, while

- Do a bunch of rendering
- glFinish
- Wait for vblank
- glXSwapBuffers

Will cause it to properly happen at the *second* vblank.

- Owen

> Jesse
> 
> On Tue, 30 Jun 2009 15:49:19 +0000 (GMT)
> Nicolas Cadio <nicolas.ca...@ymail.com> wrote:
> 
> > Hi 
> > 
> > Thank for your help,
> > 
> > I have an other question. When I use this demo with the option "-s
> > s" (sgi_video_sync), the vertical sync is not correct, it arrives a
> > little late. So I have a strip of the image on the top of the screen
> > which is not synchronized with the rest of the image. Is this normal.
> > Can i resolve this problem ?
> > 
> > Thank, and sorry for my english, I am french...



------------------------------------------------------------------------------
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to