[MPlayer-dev-eng] [PATCH] Direct3D libvo driver
Uoti Urpala
uoti.urpala at pp1.inet.fi
Tue Nov 18 16:41:56 CET 2008
On Tue, 2008-11-18 at 16:52 +0200, Georgi Petrov wrote:
> You are right. However, I never really understood one thing:
>
> 1. We have a draw_slices() libvo callback, which as you said updates
> the screen with the rendered content every 16 lines. I thought it's on
> every line though. I never realized that StretchRect is called so
> often. This is huge overkill. BUT - it's overkill for for every 16
> lines (even if it copies only them) as well!!!
>
> 2. We have a VOCTRL_DRAW_IMAGE in "control", which passes mpi
> structure with whole frame already rendered.
>
> This is stupid. Or it seems so. This way we have two "paths" for
> rendering. I never really understood when is VOCTRL_DRAW_IMAGE used
> for the whole frame and when draw_slices() for a 16 by 16 lines... On
> my test images, draw_slices() never called directly.
>
> Please somebody explain to me WHY are there those two draw paths and
> exactly when is the first and when the second one used? As far as I
> understand, this question is valid only for planar modes. In packed
> mode, only VOCTRL_DRAW_IMAGE is used, right?
There are three possible ways how the image can be drawn:
1) Decoder draws the image in its own buffer, then VOCTRL_DRAW_IMAGE is
called and the decoder copies the image.
2) Decoder draws the image a bit at a time and calls draw_slice after
each one. This can at least in theory improve performance in some cases
due to cache locality. Also if the decoder does not need to keep the
frame for reference then it's possible to save memory by decoding the
next slice over the previous one (so only the VO side will buffer the
whole image).
3) Direct rendering where the decoder gets a buffer address from the VO
and then draws the image into that buffer instead of using its own.
VOCTRL_DRAW_IMAGE is always called when the whole frame is complete. So
you should check whether it was already drawn in slices and do different
things depending on that.
> StretchRect is expensive. I don't want to call it each 16 lines even
> if I update only 16 lines on the destination (with RECT given as a
> parameter to StretchRect). I would want to delay StretchRect until
> Present and call it in flip_page() then...
You should call it from the VOCTRL_DRAW_IMAGE callback instead. All
possible processing should be done before flip_page() so the final timed
frame display is as fast as possible.
More information about the MPlayer-dev-eng
mailing list