<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Video - MPlayer - The Movie Player for Linux</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="../default.css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<H3><A NAME="video">2.3.1 Video output devices</A></H3>
<H4><A NAME="mtrr">2.3.1.1 Setting up MTRR</A></H4>
<P>It is VERY recommended to check if the MTRR registers are set up properly,
because they can give a big performance boost.</P>
<P>Do a '<CODE>cat /proc/mtrr</CODE>':</P>
<P><CODE>
--($:~)-- cat /proc/mtrr<BR>
reg00: base=0xe4000000 (3648MB), size= 16MB: write-combining, count=9<BR>
reg01: base=0xd8000000 (3456MB), size= 128MB: write-combining, count=1</CODE></P>
<P>It's right, shows my Matrox G400 with 16MB memory. I did this from
XFree 4.x.x , which sets up MTRR registers automatically.</P>
<P>If nothing worked, you have to do it manually. First, you have to find the
base address. You have 3 ways to find it:</P>
<UL>
<LI>from X11 startup messages, for example:
<P><CODE>(--) SVGA: PCI: Matrox MGA G400 AGP rev 4, Memory @ 0xd8000000, 0xd4000000<BR>
(--) SVGA: Linear framebuffer at 0xD8000000</CODE></P></LI>
<LI>from /proc/pci (use lspci -v command):
<P>
<CODE>01:00.0 VGA compatible controller: Matrox Graphics, Inc.: Unknown device 0525</CODE>
<CODE>Memory at d8000000 (32-bit, prefetchable)</CODE>
</P></LI>
<LI>from mga_vid kernel driver messages (use <CODE>dmesg</CODE>):
<P><CODE>mga_mem_base = d8000000</CODE></P></LI>
</UL>
<P>Then let's find the memory size. This is very easy, just convert video ram
size to hexadecimal, or use this table:</P>
<TABLE BORDER=0>
<TR><TD> </TD><TD>1 MB</TD><TD WIDTH="10%"></TD><TD>0x100000</TD></TR>
<TR><TD></TD><TD>2 MB</TD><TD></TD><TD>0x200000</TD></TR>
<TR><TD></TD><TD>4 MB</TD><TD></TD><TD>0x400000</TD></TR>
<TR><TD></TD><TD>8 MB</TD><TD></TD><TD>0x800000</TD></TR>
<TR><TD></TD><TD>16 MB</TD><TD></TD><TD>0x1000000</TD></TR>
<TR><TD></TD><TD>32 MB</TD><TD></TD><TD>0x2000000</TD></TR>
</TABLE>
<P>You know base address and memory size, let's setup MTRR registers!
For example, for the Matrox card above (base=0xd8000000) with 32MB
ram (size=0x2000000) just execute:</P>
<P><CODE> echo "base=0xd8000000 size=0x2000000 type=write-combining" >| /proc/mtrr</CODE></P>
<P>Not all CPUs support MTRRs. For example older K6-2's [around 266MHz,
stepping 0] doesn't support MTRR, but stepping 12's do ('<CODE>cat
/proc/cpuinfo</CODE>' to check it').</P>
<H4><A NAME="normal">2.3.1.2 Video outputs for traditional video cards</A></H4>
<H4><A NAME="xv">2.3.1.2.1 Xv</A></H4>
<P>Under XFree86 4.0.2 or newer, you can use your card's hardware YUV routines
using the XVideo extension. This is what the option '-vo xv' uses. Also,
this is driver supports adjusting brightness/contrast/hue/etc (unless you use
the old, slow DirectShow DivX codec, which supports it everywhere), see the
man page.</P>
<P>In order to make this work, be sure to check the following:</P>
<UL>
<LI>You have to use XFree86 4.0.2 or newer (former versions don't have
XVideo)</LI>
<LI>Your card actually supports hardware acceleration (modern cards do)</LI>
<LI>X loads the XVideo extension, it's something like this:
<P><CODE> (II) Loading extension XVideo</CODE></P>
<P>in /var/log/XFree86.0.log</P>
<P>NOTE: this loads only the XFree86's extension. In a good install, this
is always loaded, and doesn't mean that the <B>card's</B> XVideo support is
loaded!</P>
</LI>
<LI>Your card has Xv support under Linux. To check, try 'xvinfo', it is the
part of the XFree86 distribution. It should display a long text, similar
to this:
<PRE>
X-Video Extension version 2.2
screen #0
Adaptor #0: "Savage Streams Engine"
number of ports: 1
port base: 43
operations supported: PutImage
supported visuals:
depth 16, visualID 0x22
depth 16, visualID 0x23
number of attributes: 5
(...)
Number of image formats: 7
id: 0x32595559 (YUY2)
guid: 59555932-0000-0010-8000-00aa00389b71
bits per pixel: 16
number of planes: 1
type: YUV (packed)
id: 0x32315659 (YV12)
guid: 59563132-0000-0010-8000-00aa00389b71
bits per pixel: 12
number of planes: 3
type: YUV (planar)
(...etc...)
</PRE>
<P>It must support YUY2 packed, and YV12 planar pixel formats to be
usable with MPlayer.</P>
</LI>
<LI>And finally, check if MPlayer was compiled with 'xv' support.
./configure prints this.</LI>
</UL>
<H4><A NAME="xv_3dfx">2.3.1.2.1.1 3dfx cards</A></H4>
<P>Older 3dfx drivers were known to have problems with XVideo acceleration, it
didn't support either YUY2 or YV12, and so. Verify that you have XFree86
version 4.2.0 or greater, it works OK with YV12 and YUY2. Previous versions,
including 4.1.0, <B>crash with YV12</B>. If you experience strange effects
using -vo xv, try SDL (it has XVideo too) and see if it helps. Check the
<A HREF="#sdl">SDL section</A> for details.</P>
<P><B>OR</B>, try the NEW -vo tdfxfb driver! See the
<A HREF="#tdfxfb">tdfxfb</A> section.</P>
<H4><A NAME="xv_s3">2.3.1.2.1.2 S3 cards</A></H4>
<P>S3 Savage3D's should work fine, but for Savage4, use XFree86 version 4.0.3
or greater (in case of image problems, try 16bpp). As for S3 Virge.. there is
xv support, but the card itself is very slow, so you better sell it.</P>
<P><B>NOTE</B>: it's currently unclear which Savage models lack YV12 support,
and convert by driver (slow). If you suspect your card, get a newer driver,
or ask politely on the mplayer-users mailing list for an MMX/3DNow enabled
driver.</P>
<H4><A NAME="xv_nvidia">2.3.1.2.1.3 nVidia cards</A></H4>
<P>nVidia isn't a very good choice under Linux (according to nVidia, this is
<A HREF="users_against_developers.html#nvidia">not true</A>).. You'll have to
use the binary closed-source nVidia driver, available at nVidia's web site.
The standard XFree86 driver doesn't support XVideo for these cards, due to
nVidia's closed sources/specifications.</P>
<P>As far as I know the latest XFree86 driver contains XVideo support for
GeForce 2 and 3.</P>
<P>Riva128 cards don't have XVideo support even with the nVidia driver :(
Complain to nVidia.</P
|