[MPlayer-dev-eng] Re: Should I write Voodoo Banshee VIDIX driver?

Alban Bedel albeu at free.fr
Mon Mar 22 10:06:20 CET 2004

Hi Georgi Petrov,

on Sun, 21 Mar 2004 23:44:56 -0800 (PST) you wrote:

> Well... I understood everything you said.
> When using tdfxfb as well as tdfx_vid YV12 is very slow. Under Windows I
> get the same low performance with this format. Even in tdfxfb's source
> it's said that one should use -vf yuy2, I quoue:
> [***]
> Use -vf yuy2 to get yuy2 rendering, *MUCH* faster than yv12
> [***]

I know that. I hacked fdfxfb quiet a lot too.

> I just don't know why your Banshee performs faster in YV12. Even in
> DirectX's sheets Banshee is said to support only YUY2 and something like
> e.g. YUYV (the same). This makes me think that YV12 isn't native. Well,
> THE ONLY place, where YV12 is at full speed is XVideo, but again - I'm
> not sure if it doesn't first convert it by software to YUY2 and then
> pass it to video card, because every other method, which use Banshee's
> hardware YV12 -> YUY2 seems to be really slow.

I fear you misderstood me. I never said that YV12 was faster. I said that
i never saw the ridiculous (3-4fps) performance you are talking about.

> Let's forget for a moment about planar YV12 and behave like it doesn't
> exist :) Let's focus on packed YUY2 :)
> A little off-topic:
> With XFree86 4.3.0 and previous, I got an annoying flickering line (and
> with another color: green or blue) in the bottom of the video, when
> using XVideo. I used to fix it by -vf crop and giving for height -4 of
> the original size. This was really stupid, because I had to check every
> movie's coordinates and then apply -vf (Lately I made a script to do it
> for me :)
> Yesterday I installed XFree86 4.4.0 and this bug is fixed :)  

I'm still with 4.2 as 4.3 refused to work with my dual head setup :(
> New things, which I know now or want to ask:
> Is the same problem with libvo allocating only a single buffer and doing
> DR on fewer frames when -double isn't given valid for VIDIX? I mean:
> with VIDIX drivers do you have to use -double to get more frames DRed?

With VIDIX drivers (and all others that give direct access to video mem)
you can only make limited use of DR. This is bcs most modern codecs need
readable buffers and reading from video mem is SLOOOOW. Thus if the codecs
never have to read the buffer, only one is needed.

> Well, well, well, I found a bug in my driver :) Until now I was using
> the address in VIDCUROVSTART to write to. I found that it's not 4 bytes
> aligned! Now I must use LEFT/RIGHTOVBUF to set new one.
> But I have a problem again! Yesterday I tried to fix it all day long,
> without asking anyone, but I'm stuck. I understand the procedure like
> this:
> 1) Write to LEFTOVBUF the address in the video memory, from where the
> Banshee should read to update the overlay. Do you have clever way to
> find this address? And it should be just the offset from the 0 MB of
> it's memory, right? I mean - if I want to write from the 8th MB, I set
> LEFTOVBUF to 8*1024*1024. Is it so, because that's the value I pass to


> 2) Issue SWAPPENDING with value 0 (does it tells the video card, that
> only one swap should be done on the next Vsync?)
> 3) Issue SWAPBUFCMD with value 1 and on the next Vsync, Banshee is
> supposed to start reading from LEFTOVBUF (in my case - 8th MB)

It's currently done in this way for tdfx_fb. 

Hmm. IIRC i later found this was a little wrong. I found the version
where i tried to hack the 3d stuff in. It also have working
double-buffering :) That's probably gonna help us ;)

> Even after waiting sleep(1) for the Vsync, I read VIDCUROVSTART and it's
> pointing to the old value (somewhere around 13,3 MB). It should point to
> 8*1024*1024, right? I don't understand why it's not updated.
> Why is there RIGHTOVBUF - what it's used for? When you do double
> buffering to flip between LEFT/RIGHT? And how do you set your LEFT/RIGHT
> offsets? And why do you set them both, don't you need only LEFT?

It seems that only LEFTOVBUF is used. Here is the code i have to flip page:

+static int tdfx_vid_overlay_swap(unsigned long arg) {
+  tdfx_vid_swap_t swap;
+  int s = 0;
+  if(copy_from_user(&swap,(tdfx_vid_swap_t*)arg,sizeof(tdfx_vid_swap_t))) {
+    printk(KERN_DEBUG "tdfx_vid:failed copy from userspace\n");
+    return(-EFAULT); 
+  }
+  if(swap.sync) {
+    s = 1;
+    s |= (swap.sync-1)<<1;
+  }
+  banshee_make_room(3);
+  tdfx_outl(LEFTOVBUF, swap.buffer);
+  tdfx_outl(SWAPPENDING,1);
+  tdfx_outl(SWAPBUFCMD, s);
+  //banshee_wait_idle();
+  return 0;

> Oh, yes - I check wheter something is 4 bytes aligned this way:
> if ((something & ~0x3) != something) it's not 4 bytes aligned

Yes (if something contain the address).


Everything is controlled by a small evil group
to which, unfortunately, no one we know belongs.

More information about the MPlayer-dev-eng mailing list