X: 25 years and still lacking vsync'ed double buffering
Posted Oct 7, 2009 4:47 UTC (Wed) by pphaneuf
In reply to: X: 25 years and still lacking vsync'ed double buffering
Parent article: LPC: 25 years of X
I think the reason why there's no good vsync support in X is that you
can't hook interrupts from user-space, and they didn't want to poll,
because it would have made everything else suck.
Note that there's nothing in the X11 API that precludes using vsync to
avoid tearing without exposing it in the API. What you need is just for a
drawing command not to be in effect while the retrace is over the affected
X could implement its drawing so that this doesn't happen in the
middle of one of its drawing commands, and you wouldn't get tearing.
Now, you might not want a partially drawn image, even if it does so without
any tearing. In that case, you can just do the double buffering yourself, by
drawing into a pixmap instead of directly in the window, and XCopyArea
the pixmap to the window when you're done (which is a single operation,
so could be done without tearing).
The only thing that would need an extension for is throttling, so that
you don't draw more than one image to your pixmap when only one copy
can be made to the window. What you'd want is a XCopyArea that would
send an event back to the client when it has been done. That can even
support two displays with different update rates, you'd just get the event
for different copies at a different rate, depending on where you put it.
to post comments)