[MPlayer-G2-dev] Limitations in vo2 api :(

D Richard Felker III dalias at aerifal.cx
Fri Dec 19 09:44:48 CET 2003


Hey, Arpi. Libvo2 is your baby, so I need some help overcoming
limitations in libvo2 so that I can write the vp wrapper for it. The
problem is that the vo driver just exports an array of buffers without
any information about which ones are in use internally and expects the
wrapper to manage that information. This is _somewhat_ possible,
except that the wrapper doesn't have enough info to go on.

For example, vo_mga with triple buffering has three buffer states:
unused, displayed, and pending-display. Since a maximum of only four
buffers are available (and currently only 3 are allowed!!), we need to
make sure we make very good use of them! I believe it's possible to
tell from the hardware (dunno whether mga_vid module implements this
tho) whether the pending-display buffer has actually been displayed
yet. Knowing this is important since it means we can reuse the
previously displayed buffer.

Without this knowledge, we're either forced to give up direct
rendering (and maybe slices too), or else we run the risk of _tearing_
and out-of-order display if the cpu is too fast! Consider the
following example:

A: displayed
B: pending-display
C: free

The codec decodes a P-frame, slice-rendering it into buffer C, then
needs to decode a B-frame to display before it. Provided the cpu isn't
too fast and buffer B has already been displayed, we can put the
B-frame in buffer A. But if buffer A is still visible, very bad things
will happen!

There are even worse things that can happen if the movie fps is
greater than the video refresh rate, but anyone running the player in
that situation is stupid to begin with...

The above example can be solved by having the wrapper layer remember
the last 2 buffers it showed, and refusing to use those. However, this
will disable direct rendering of B-frames unless you have 4 buffers
available.

So, what kind of solution would I like??

I'm not really sure. :(

I tend to think that the vp layer should call the vo layer's
get_buffer and release_buffer every time it wants to use buffers,
rather than just getting them all at the beginning. This way, the vo
driver would be free to decide when it can or can't give you buffers.
But right now, the vo drivers are NOT written to support that sort of
use. For example, the x11 driver allocates an image when you call
get_buffer, and frees it when you call release_buffer -- very
inefficient!

Please comment on what you'd like to do. IMO this isn't a fundamental
design issue, but it will probably require changes to the vp/vo
wrapper interface to be made at some point.


Rich







More information about the MPlayer-G2-dev mailing list