View Single Post
Old 10-26-10, 09:53 AM   #11
bearoso
Registered User
 
Join Date: Sep 2003
Posts: 57
Default Re: Why does it take 6 steps to get nvidia + compiz running smooth, fast, not torn ?

Quote:
Originally Posted by Dragoran View Post
Not when using triple buffering ... also playing games that look like crap due to tearing is "bad" either.
Triple buffering can cause an extra frame's worth of latency, which is VERY bad in terms of responsiveness. Imagine moving a window with a compositor on, and the window lagging several frames behind the mouse cursor.

The cause of the tearing everyone's getting even with vsync is a client-side wait in compiz (via GLX_SGI_video_sync). It uses a dirty-rectangles approach most of the time, preventing page-flipping and making display susceptible to scheduler interference. So most of the time the output frame is drawn partially during scan-out.

This can be fixed by using a buffer swap with only driver-side vsync every time. A page flip is completed very quickly by the video card and there's no tearing. There's two problems with this:

1. Buffer swaps on the video card occur asynchronously with respect to compiz. So compiz continues running and picks up input and graphics data for the next frame in advance--accumulating an additional frame of input-lag. This can be eliminated by waiting until the current framebuffer is complete by using glFinish or glXWaitGL immediately after the swap-buffers call.

2. Redrawing the whole screen is more expensive than only redrawing parts. Arguably, this is a moot point because all the graphic content is in video memory and framebuffer->framebuffer writes are so fast. It is, however, the main reason people mention for not doing it.
bearoso is offline   Reply With Quote