Doc / output-trad


Doc / output-trad
2015-11-12 (木) 10:39:48更新
カテゴリ:未訳
原文:http://www.mplayerhq.hu/DOCS/HTML/en/output-trad.html

8.2. Video outputs for traditional video cards

8.2.1. Xv

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 driver supports adjusting brightness/contrast/hue/etc (unless you use the old, slow DirectShow DivX codec, which supports it everywhere), see the man page.

In order to make this work, be sure to check the following:

  1. You have to use XFree86 4.0.2 or newer (former versions don't have XVideo)
  2. Your card actually supports hardware acceleration (modern cards do)
  3. X loads the XVideo extension, it's something like this:
    (II) Loading extension XVideo

    in /var/log/XFree86.0.log

    Note
    This loads only the XFree86's extension. In a good install, this is always loaded, and doesn't mean that the card's XVideo support is loaded!

  4. 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:
    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...)

    It must support YUY2 packed, and YV12 planar pixel formats to be usable with MPlayer.

  5. And finally, check if MPlayer was compiled with 'xv' support. Do a mplayer -vo help | grep xv . If 'xv' support was built a line similar to this should appear:
 xv X11/Xv

8.2.1.1. 3dfx cards

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, crashes with YV12. If you experience strange effects using -vo xv, try SDL (it has XVideo, too) and see if it helps. Check the SDL section for details.

OR, try the NEW -vo tdfxfb driver! See the tdfxfb section.

8.2.1.2. S3 cards

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.

Note

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.

8.2.1.3. nVidia cards

nVidia isn't always a very good choice under Linux (according to nVidia, this is not true)... XFree86's open-source driver supports most of these cards, but for some cases, you'll have to use the binary closed-source nVidia driver, available at nVidia's web site. You'll always need this driver if you want 3D acceleration, too.

Riva128 cards don't have XVideo support with XFree86's nVidia driver :( Complain to nVidia.

However, MPlayer contains a VIDIX driver for most nVidia cards. Currently it is in beta stage, and has some drawbacks. For more information, see nVidia VIDIX section.


8.2.1.4. ATI cards

The GATOS driver (which you should use, unless you have Rage128 or Radeon) has VSYNC enabled by default. It means that decoding speed (!) is synced to the monitor's refresh rate. If playing seems to be slow, try disabling VSYNC somehow, or set refresh rate to a n*(fps of the movie) Hz.

Radeon VE - if you need X, use XFree86 4.2.0 or greater for this card. No TV out support. Of course with MPlayer you can happily get accelerated display, with or without TV output, and no libraries or X are needed. Read the VIDIX section.

8.2.1.5. NeoMagic cards

These cards can be found in many laptops. You must use XFree86 4.3.0 or above, or else use Stefan Seyfried's Xv-capable drivers . Just choose the one that applies to your version of XFree86.

XFree86 4.3.0 includes Xv support, yet Bohdan Horst sent a small patch against the XFree86 sources that speeds up framebuffer operations (so XVideo) up to four times. The patch has been included in XFree86 CVS and should be in the next release after 4.3.0.

To allow playback of DVD sized content change your XF86Config like this:

Section "Device"
   [...]
   Driver "neomagic"
   Option "OverlayMem" "829440"
   [...]
EndSection

8.2.1.6. Trident cards

If you want to use Xv with a Trident card, provided that it doesn't work with 4.1.0, install XFree 4.2.0. 4.2.0 adds support for fullscreen Xv support with the Cyberblade XP card.

Alternatively, MPlayer contains a VIDIX driver for the Cyberblade/i1 card.

8.2.1.7. Kyro/PowerVR cards

If you want to use Xv with a Kyro based card (for example Hercules Prophet 4000XT), you should download the drivers from the PowerVR site

8.2.2. DGA

PREAMBLE. This document tries to explain in some words what DGA is in general and what the DGA video output driver for MPlayer can do (and what it can't).

WHAT IS DGA. DGA is short for Direct Graphics Access and is a means for a program to bypass the X server and directly modifying the framebuffer memory. Technically spoken this happens by mapping the framebuffer memory into the memory range of your process. This is allowed by the kernel only if you have superuser privileges. You can get these either by logging in as root or by setting the SUID bit on the MPlayer executable (not recommended).

There are two versions of DGA: DGA1 is used by XFree 3.x.x and DGA2 was introduced with XFree 4.0.1.

DGA1 provides only direct framebuffer access as described above. For switching the resolution of the video signal you have to rely on the XVidMode extension.

DGA2 incorporates the features of XVidMode extension and also allows switching the depth of the display. So you may, although basically running a 32 bit depth X server, switch to a depth of 15 bits and vice versa.

However DGA has some drawbacks. It seems it is somewhat dependent on the graphics chip you use and on the implementation of the X server's video driver that controls this chip. So it does not work on every system...

INSTALLING DGA SUPPORT FOR MPLAYER. First make sure X loads the DGA extension, see in /var/log/XFree86.0.log:

(II) Loading extension XFree86-DGA

See, XFree86 4.0.x or greater is highly recommended! MPlayer's DGA driver is autodetected by ./configure, or you can force it with --enable-dga.

If the driver couldn't switch to a smaller resolution, experiment with options -vm (only with X 3.3.x), -fs, -bpp, -zoom to find a video mode that the movie fits in. There is no converter right now :(

Become root. DGA needs root access to be able to write directly video memory. If you want to run it as user, then install MPlayer SUID root:

chown root /usr/local/bin/mplayer
chmod 750 /usr/local/bin/mplayer
chmod +s /usr/local/bin/mplayer

Now it works as a simple user, too.

Security risk

This is a big security risk! Never do this on a server or on a computer that can be accessed by other people because they can gain root privileges through SUID root MPlayer.

Now use -vo dga option, and there you go! (hope so:) You should also try if the -vo sdl:driver=dga option works for you! It's much faster!

RESOLUTION SWITCHING. The DGA driver allows for switching the resolution of the output signal. This avoids the need for doing (slow) software scaling and at the same time provides a fullscreen image. Ideally it would switch to the exact resolution (except for honoring aspect ratio) of the video data, but the X server only allows switching to resolutions predefined in /etc/X11/XF86Config (/etc/X11/XF86Config-4 for XFree 4.X.X respectively). Those are defined by so-called modelines and depend on the capabilities of your video hardware. The X server scans this config file on startup and disables the modelines not suitable for your hardware. You can find out which modes survive with the X11 log file. It can be found at: /var/log/XFree86.0.log.

These entries are known to work fine with a Riva128 chip, using the nv.o X server driver module.

Section "Modes"
 Identifier "Modes[0]"
 Modeline "800x600"  40     800 840 968 1056  600 601 605 628
 Modeline "712x600"  35.0   712 740 850 900   400 410 412 425
 Modeline "640x480"  25.175 640 664 760 800   480 491 493 525
 Modeline "400x300"  20     400 416 480 528   300 301 303 314 Doublescan
 Modeline "352x288"  25.10  352 368 416 432   288 296 290 310
 Modeline "352x240"  15.750 352 368 416 432   240 244 246 262 Doublescan
 Modeline "320x240"  12.588 320 336 384 400   240 245 246 262 Doublescan
EndSection

DGA & MPLAYER. DGA is used in two places with MPlayer: The SDL driver can be made to make use of it (-vo sdl:driver=dga) and within the DGA driver (-vo dga). The above said is true for both; in the following sections I'll explain how the DGA driver for MPlayer works.

FEATURES. The DGA driver is invoked by specifying -vo dga at the command line. The default behavior is to switch to a resolution matching the original resolution of the video as close as possible. It deliberately ignores the -vm and -fs options (enabling of video mode switching and fullscreen) - it always tries to cover as much area of your screen as possible by switching the video mode, thus refraining from using additional cycles of your CPU to scale the image. If you don't like the mode it chooses you may force it to choose the mode matching closest the resolution you specify by -x and -y. By providing the -v option, the DGA driver will print, among a lot of other things, a list of all resolutions supported by your current XF86Config file. Having DGA2 you may also force it to use a certain depth by using the -bpp option. Valid depths are 15, 16, 24 and 32. It depends on your hardware whether these depths are natively supported or if a (possibly slow) conversion has to be done.

If you should be lucky enough to have enough offscreen memory left to put a whole image there, the DGA driver will use double buffering, which results in much smoother movie playback. It will tell you whether double buffering is enabled or not.

Double buffering means that the next frame of your video is being drawn in some offscreen memory while the current frame is being displayed. When the next frame is ready, the graphics chip is just told the location in memory of the new frame and simply fetches the data to be displayed from there. In the meantime the other buffer in memory will be filled again with new video data.

Double buffering may be switched on by using the option -double and may be disabled with -nodouble. Current default option is to disable double buffering. When using the DGA driver, onscreen display (OSD) only works with double buffering enabled. However, enabling double buffering may result in a big speed penalty (on my K6-II+ 525 it used an additional 20% of CPU time!) depending on the implementation of DGA for your hardware.

SPEED ISSUES. Generally spoken, DGA framebuffer access should be at least as fast as using the X11 driver with the additional benefit of getting a fullscreen image. The percentage speed values printed by MPlayer have to be interpreted with some care, as for example, with the X11 driver they do not include the time used by the X server needed for the actual drawing. Hook a terminal to a serial line of your box and start top to see what is really going on in your box.

Generally spoken, the speedup done by using DGA against 'normal' use of X11 highly depends on your graphics card and how well the X server module for it is optimized.

If you have a slow system, better use 15 or 16 bit depth since they require only half the memory bandwidth of a 32 bit display.

Using a depth of 24 bit is even a good idea if your card natively just supports 32 bit depth since it transfers 25% less data compared to the 32/32 mode.

I've seen some AVI files be played back on a Pentium MMX 266. AMD K6-2 CPUs might work at 400 MHZ and above.

KNOWN BUGS. Well, according to some developers of XFree, DGA is quite a beast. They tell you better not to use it. Its implementation is not always flawless with every chipset driver for XFree out there.

  • With XFree 4.0.3 and nv.o there is a bug resulting in strange colors.
  • ATI driver requires to switch mode back more than once after finishing using of DGA.
  • Some drivers simply fail to switch back to normal resolution (use Ctrl+Alt+Keypad + and Ctrl+Alt+Keypad - to switch back manually).
  • Some drivers simply display strange colors.
  • Some drivers lie about the amount of memory they map into the process's address space, thus vo_dga won't use double buffering (SIS?).
  • Some drivers seem to fail to report even a single valid mode. In this case the DGA driver will crash telling you about a nonsense mode of 100000x100000 or something like that.
  • OSD only works with double buffering enabled (else it flickers).

8.2.3. SDL

SDL (Simple Directmedia Layer) is basically a unified video/audio interface. Programs that use it know only about SDL, and not about what video or audio driver does SDL actually use. For example a Doom port using SDL can run on svgalib, aalib, X, fbdev, and others, you only have to specify the (for example) video driver to use with the SDL_VIDEODRIVER environment variable. Well, in theory.

With MPlayer, we used its X11 driver's software scaler ability for cards/drivers that doesn't support XVideo, until we made our own (faster, nicer) software scaler. Also we used its aalib output, but now we have ours which is more comfortable. Its DGA mode was better than ours, until recently. Get it now? :)

It also helps with some buggy drivers/cards if the video is jerky (not slow system problem), or audio is lagging.

SDL video output supports displaying subtitles under the movie, on the (if present) black bar.

There are several command line switches for SDL:

-vo sdl:driver=name
specifies SDL video driver to use (i.e. aalib, dga, x11)
-ao sdl:name
specifies SDL audio driver to use (i.e. dsp, esd, artsc)
-noxv
disables XVideo hardware acceleration
-forcexv
tries to force XVideo acceleration

Table 8.1. SDL only keys

KeyAction
ccycles available fullscreen modes
nchanges back to normal mode

Known bugs:

  • Keys pressed under sdl:driver=aalib console driver repeat forever. (use -vo aa!) It's bug in SDL, I can't change it (tested with SDL 1.2.1).
  • DO NOT USE SDL with GUI! It won't work as it should.

8.2.4. SVGAlib

8.2.5. Framebuffer output (FBdev)

8.2.6. Matrox framebuffer (mga_vid)

8.2.7. 3Dfx YUV support


8.2.8. OpenGL output

8.2.9. AAlib - text mode displaying

8.2.10. libcaca - Color ASCII Art library

8.2.11. VESA - output to VESA BIOS

8.2.12. X11


8.2.13. VIDIX

8.2.13.1. ATI cards

8.2.13.2. Matrox cards

8.2.13.3. Trident cards

8.2.13.4. 3DLabs cards


8.2.13.5. nVidia cards

8.2.13.6. SiS cards

8.2.14. DirectFB

8.2.15. DirectFB/Matrox (dfbmga)