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

Georgi Petrov gogothebee at yahoo.com
Sat Mar 20 10:20:04 CET 2004


I'm amazed how fast I get responce, that's really great!

Tobias, thank you too for trying to help!

I begin...

I saw colorspace.txt and I blame myself for asking too many questions, which
can be found there. Actually long time ago I red this file and everything I
(don't) know was based on memories for what's written inside :)

Things I figured out from your previous posts (can be wrong):

1) pitch=stride >= width * bpp

Is here bpp like this:
YV12 -> 12 bits -> bpp=12 bits=1,5 bytes
YUY2 -> 16 bits -> bpp=16 bits=2 bytes

2) for YV12 planar I have this layout in memory: YUV YUV YUV YUV..., where
Y plane :w*h*8 bits
U plane :(w/2)*(h/2)*8 bits
V plane :(w/2)*(h/2)*8 bits

(I can be wrong about YUVYUVYUV memory layout!!!)

3) for YUY2 packed I have YU YV YU YV..., where
Y plane :w*h*8 bits
U plane :(w/2)*h*8 bits
V plane :(w/2)*h*8 bits

But I suppose it's not so, because colorspaces.txt says:

*****
- Planar mode means: you have 3 separated image, one for each component,
each image 8 bits/pixel. To get the real colored pixel, you have to
mix the components from all planes. The resolution of planes may differ!
- Packed mode means: you have all components mixed/interleaved together,
so you have small "packs" of components in a single, big image.
*****

What does it mean "you have to mix the components from all planes"
and "you have all components mixed/interleaved together, ..."

I mean - is there any difference from the way they are positioned in memory. I
must know it in order to give VIDIX the right parameters. I figured out that
without EXACT knowledge about everything in memory, I can't do much.
 
4) The Banshee can't use YV12 natively, but it has hardware YV12 -> YUY2
converter. This converter is supposed to be faster than software (that's its
purpose), but on my system as well as on others it isn't. On my system I get
way better performance by giving Banshee YUY2 format.

On the other side this can be wrong, because XVideo accepts YV12 and the
Banshee runs at full speed with it. Can it be because XVideo actually takes
YV12, converts it to YUY2 by software and doesn't use Banshee's (slow???)
hardware converter?

Under Windows when I use YV12, I get the same low speed (really 3-4 fps).
Ideas?

>You are running a celeron, i was running a k6 it might be the difference.

Can this in ANY way be related to the fact that my Celeron has no L2 cache???

5) XVideo is bloated/slow and movies can play faster :)))

6) I understood DR.

7) I didn't understand why when double buffering in XVideo is turned off, only
1 frame on 3 uses DR.




Now let's see my questions:


>Sadly it's not that simple :( The overlay setup is a bit hairy. I succeded
>only bcs i had the xv driver source as reference. The specs. sheet are
>sadly very obscure on the subject.
>To setup the overlay you need to set qiet a few register see in tdfx_vid.c
>how it's done. To set the buffer addresse you must set you addresse in
>the LEFTOVBUF and RIGHTOVBUF registers and then issue SWAP commands.
>You can't directly write the address you want to VIDCUROVRSTART.

Yes, I also use XVideo sources as well as yours. Otherwise I have NO CHANCE!
Now excuse my inexperience here, but correct me if I'm wrong. I'll tell you how
I understand the whole playing with the video card:

When dealing with the video card, I allocate 2 separate memory ranges from it:

1) MMIO, which is used to set/read registers and as a whole change video card's
configuration.
2) Video card's video memory.

>From now on I have 2 pointers to these memory locations.

Then in order to get/set registers I look at the manual and see their offsets.
I can do this correctly. When I want to play video, I setup an overlay. I write
the needed info into needed registers, giving:

1) coordinates
2) size
3) format (eg. YUY2)
4) stride
5) H/V scaling, ... etc

6) memory, where the frame is located.

Here only 6 bother me.

I understand it that way: I set LEFTOVBUF to point to some memory of the video
card's memory (for example it's 10th MB) and then the Banshee reads from this
address to update the overlay frame after frame. 

If you want to do double buffering, you set RIGHTOVBUF too and then swap them
frame by frame. This turned out to be wrong, because regardless of what I point
LEFTOVBUF to, overlay sits empty. So after 4 days 8 hours/day TRYING to find
something useful, just got VIDCUROVRSTART's value and decided to write there.
Suprisely it turned out to be exactly the start of the memory that Banshee uses
to update the overlay. Am I wrong somewhere? What must I set LEFT/RIGHTOVBUF to
point to?

One more question: I must deal always with video card's memory, right? I mean -
I have no work to do with computer's RAM and all those registers must point to
the video card's RAM???

Then I don't understand this:

VIDIX wants these things:

1) video memory destination to write to. I give it VIDCUROVSTART's value
2) video format. I always reject YV12 and tell it to give me YUY2
3) alignment of Y,U,V in bytes. Should it be 4???
4) frame size. How can I compute it? h*w*2 for YUY2 (2 comes from 2 bytes=16
bits)
5) Y,U,V planes offsets within frame. It's only for planar formats, for packed
only Y value is used (because it's packed and there are no Y,U,V???). Does this
mean that for YUY2 I have to give only Y plane and should it's offset be 0, eg.
the start of the overlay memory? Ideas?
6) stride. stride=w*2 for YUY2

As you can see, there are some things, which need to be set. When I get this 6
points right AND I've set the overlay itself right, the video will
automagically appear on the screen :) Right now something moves, but...
				  
Well, that's for now. Let's see if you can answer some of my questions :)

Georgi


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html




More information about the MPlayer-dev-eng mailing list