X: 25 years and still lacking vsync'ed double buffering
X: 25 years and still lacking vsync'ed double buffering
Posted Sep 28, 2009 11:20 UTC (Mon) by dion (guest, #2764)Parent article: LPC: 25 years of X
Way back when I started dabbling in graphics with DOS and VGA the learning curve was something like this:
1) Switch to graphics mode (int 0x13)
2) Putpixel (mess about in memory around 0xA0000)
3) Set pallette (port 0x3C8 & 0x3C9)
4) Draw in an off screen buffer to make the animation look good.
5) Sync to vtrace before copying the buffer to screen to avoid tearing.
6) Start doing useful work.
Now, true color displays has dispensed with #3, but #5 is still impossible to do with X and it's really sad because that's the main reason video and animations SUCK on X.
I realize that something like this DOS code would never fly on a multitasking system:
void vsync() {
/* wait until any previous retrace has ended */
do { } while (inportb(0x3DA) & 8);
/* wait until a new retrace has just begun */
do { } while (!(inportb(0x3DA) & 8));
}
... but come on! It has to be possible to do smooth full screen graphics, even with the added complexities of multitasking.
No application should ever run any other framerate than the 60-80 FPS that the display runs at, because if it does then it looks like ass, even if you do get to do proper double or tripple buffering that's synchronized to vsync.
I'm guessing the difficulty is that to know if the display is ready for a new frame you need support for the retrace interrupt and as nobody who writes drivers for X or X developers seem to care about tearing and smooth animations that little thing never gets implemented.
