Cartoon drawing of a man with a grey beard and glasses.

coofdy.com

Martin Kenny's blog

The Vertical Retrace Problem

The essential problem of trying to play a video stream correctly on TV in a tear-free and jump-free way is to synchronize the delivery of new frames with the vertical retrace period; the time around the vertical sync pulse when the monitor is moving the beam from the bottom back to the top of the screen.

So far my attempt at achieving this has been to hack my video card’s X11 XVideo driver to sit in a polling loop until the bit in the video controller registers indicates that retrace is in progress. While this works, it sucks up a lot of CPU time in a busy-waiting loop; time that could have been better spent decoding video and audio streams.

What’s needed is to take advantage of the video controller’s ability to interrupt on vertical retrace. That way other processes can use the time profitably. Possible ways to do this are:

Tags: