[MPlayer-dev-eng] [PATCH] Direct3D VO better handling of uncooperative video adapter

Georgi Petrov gogothebee at gmail.com
Fri Jan 9 12:50:05 CET 2009


Hi,

After numerous tests, I concluded that it's better to handle a
uncooperative Direct3D adapter this way:

0. Don't try to reset it directly in flip_page(). MPlayers *seems* to
have timer-based handling of flip_page() and if it doesn't finish in
some time period, MPlayer decides that the frame presentation is
impossible and stops. This patch moves reinitialization code out of
flip_page(). If the video adapter becomes uncooperative, flip_page()
just sets a flag that the adapter is uncooperative, returns fast and
never draws again before the flag is cleared. This prevents MPlayer
from stop playing.

1. When the "vo_uncooperative" flag is set, draw_slice() always
returns that it has completed successfully, while skipping the actual
slice copy. This allows playback to continue even while the adapter is
uncooperative. Nothing gets copied inside it.

2. In render_d3d_frame if "vo_uncooperative" flag is set, try to reset
the adapter. If successful, clean the flag, so everything goes like
before. If the video adapter is still uncooperative, return
immediately. See the previous point why.

This is the perfect handling. MPlayer continues to play video even
when the video adapter is fully uncooperative, ignores all draw calls
when in this mode as well as returns quick from flip_page(), but tries
to reset the video adapter in each call to render_d3d_frame.

Now the computer can be put to sleep/hibernate and resumed. MPlayer
doesn't stop, but continues from where it was interrupted. It fixes
problems with 3D screensavers as well and this is another big win.

P.S. Please notice - I tried to move the reinitialize block in
render_d3d_frame inside the

    if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)

But it seems that it NEVER gets called for some reason... So I decided
to leave the reinitialization code in the beginning of the function,
so if the adapter is uncooperative, it's probt for reset in every call
to render_d3d_frame.

The patch is very small.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: better_uncooperative_handling.txt
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20090109/ef9f9328/attachment.txt>


More information about the MPlayer-dev-eng mailing list