[MPlayer-dev-eng] vo_gl PBO patch ..

Sven Gothel sgothel at jausoft.com
Wed Apr 30 22:05:57 CEST 2008


On Wednesday 30 April 2008 12:29:13 Reimar Döffinger wrote:
> On Tue, Apr 29, 2008 at 01:44:32PM -0600, Sven Gothel wrote:
> > version 4 .. reflecting Reimar's suggestions.
> 
> I still have some problems understanding the need for most of those
> changes.
> While it is really ugly for several reasons and I will have to clean it up
> once I have a bit more time,
Well, we have a different idea what is more complicated and what is not,
that's for sure :)
But maybe exactly this will help us to do better.

My patch just adds a little PBO helper tool,
to ease the PBO usage, utilizing a bit OO style,
so we don't have to bother with all the floating around variables.

In the end, it all boils down to a little extension of the UpdateTex function,
no more no less.

The new feature adds a ways to enable DMA xfers.
The first DMA is video -> PBO buffer, utilizing memcpy.
The 2nd is the GPU's DMA xfer using the PBO for glTexSubImage2D.

Why this is usefull for some GPU drivers is very well explained in my initial post.
E.g. Nvidia does such a DMA xfer implicit, where AMD doesn't.
So this code makes sure DMA is being used.

The impact is a performance benefit especially for HD content,
from around 80% -> 20%, factor 4, on AMD drivers.

> could you please use attached patch and 
> tell me what it misses in functionality compared to yours?

I do.

As far I understand your patch,
you perform a memcpy, ie DMA xfer, to shape the mp_image_t, 
so you get rid of the GL_UNPACK_ROW_LENGTH trouble.
But this should be redundant, since this PBO case hits if you 
are already in charge of the texture and video buffer, ie. get_image.

Your patch would still use slow PIO in glTexSubImage,
because of the lack of direct PBO in get_image.
(see below)

> One "issue" I know is that you may have to use -noslices to make it have
> an effect.

Nope, I never ran into the case, where get_image was capable to use 
the direct PBO fast path.

That's why my patch just uses 2 guaranteed DMA xfers, 
instead of one probable slow PIO texture update.

You are right, it would be best, if get_image would allow PBO's ..,
but all the exceptions checked there hit ..
MP_IMGFLAG_READABLE and MP_IMGTYPE_IP were set.

> Another thing is probably the GL_UNPACK_ROW_LENGTH support you said ATI drivers
> are lacking, if this still causes a problems with this patch I'd need a bit
> more information on this.

Well, it seems it is simply a bug in the current ATI driver,
which enforces us to use multiple memcpy, ie. shape the PBO memory
so no NPOT stride happen - even though the driver claims to support NPOT.

> The usage would be something like
> mplayer -vo gl:yuv=2:force-pbo -noslices file.avi
> 
> Greetings,
> Reimar Döffinger
> 



-- 
health & wealth
mailto:sgothel at jausoft.com ; www  : http://www.jausoft.ca ; pgp: http://www.jausoft.com/gpg/
land : +1 (780) 637 3842 ; cell: +1 (780) 952 4481
Timezone MST: EST-2, UTC-7, CET-8 ; MDT: EDT-2, UTC-6, CEDT-8



More information about the MPlayer-dev-eng mailing list