[MPlayer-dev-eng] [PATCH] reduce flashing on resize with VDPAU

Dan Oscarsson Dan.Oscarsson at tietoenator.com
Sun Mar 15 12:47:45 CET 2009


On 2009-03-14 at 18:15 +0100 Reimar Döffinger wrote:
> On Sat, Mar 14, 2009 at 05:44:31PM +0100, Dan Oscarsson wrote:
> > In resize:
> >   - width and height are set to screen width and height.
> >     This results in no resizing of output surfaces are done but once.
> >     I suspect that destroying the active visible surface results in
> >     flashing - this avoids that.
> 
> That change does not really fix anything, it just hides the issue by
> making it less likely.

The attached code creates or recreates on size change, the surface to
draw on, when needed. The routine get_output_surface should be used when
an output surface to draw on is needed.

> 
> >   - Only update output when in pause. When not paused it will be updated
> >     at next picture frame.
> 
> I don't mind much, but ideally it would work nicely for e.g. 1 fps
> slideshows, which is the reason it is done always currently.

I have tested by running speed at 0.01 of normal and even then you gets
a lot of jumping around. 1 fps is just 1 second before right size shows
up.

> 
> > In win_x11_init_vdpau_flip_queue:
> >   - set background colour to black for parts outside a surface.
> >     Without this I get yellowish flashing during resize. Black
> >     works better.
> 
> I heavily suggest that NVidia should change their code to set the
> background to bacl by default, making every application set that
> manually for no good reason just seems silly.
> Unless of course this is also the "overlay" colour as it was used for
> Xv, in that case this change might have weird effects like writing on a
> Window placed on top of MPlayer becoming transparent...

In the new code I have added code from nvidia's original patches that
limits area presented by presentation queue. This reduces the flashing
of yellow a lot.
I still get one flash in yellow when larger surface is allocated. If we
want to get rid of this I think we have to use the set background colour
call. I have not included this in this patch, but it is easy to add
again.

> 
> > In check_events:
> >   - removed the code that requeues the current visible output surface
> >     when paused. vdpau does redisplay the visible output surface by
> >     itself.
> 
> Are you sure this is true if the blit backend is used? I can't really
> see how, but of course NVidia might have found a clever trick I have not
> thought of.

I tested with blitting and unfortunately the answer is no.

The code now requeues as before. And just like before, this is only done
when paused.

This code includes my reworked code for reducing audio-video out of sync
in a way where that is done in flip_page just like in your code example.
There are now, apart from the osd surface, three surfaces, one for
drawing, one in queue and one visible. If audio gets more than one frame
out of sync frames will be dropped to catch up (cannot show them more
quickly as only one frame will be shown per vsync (if non blitting
mode).

Unfortunately the blitting bug nvidia have in old drivers (I do not know
if it works in the newest prerelease/beta version) results in surfaces
not being shown unless you wait for a surface to be idle.
In the code you have to set blitting_bug to 1 if you want to run under
the blitting interface, and to 0 to run under non-blitting interface.
If we are going to support the nvidia drivers with this bug we have to
add this as a command line option.

   Dan




-------------- next part --------------
A non-text attachment was scrubbed...
Name: vdpaunoflash2.diff
Type: text/x-patch
Size: 15785 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20090315/e3b8bdb7/attachment.bin>


More information about the MPlayer-dev-eng mailing list