Difference between revisions of "XvMC"
(Extensive cleanup of XvMC information including some updates for 0.21)
|Line 78:||Line 78:|
Option "NVAGP" "1" (some users report 2 works better, may not be applicable to newer driver versions)
Option "NVAGP" "1" (some users report 2 works better, may not be applicable to newer driver versions)
Revision as of 16:42, 11 April 2008
- 1 Introduction
- 2 Drivers
- 3 Enabling XvMC
- 4 MythTV XvMC Support
- 5 Hardware acceleration processes not yet supported by XvMC
- 6 Alternatives
- 7 External Links
X-Video Motion Compensation, or XvMC, is a part of The X Window System which allows video programs to offload motion compensation and iDCT (Inverse Discrete Cosine Transform) portions of MPEG-2 decoding to the GPU hardware. XvMC can greatly reduce CPU utilization when playing back MPEG-2 video. In theory it should also reduce bus bandwidth requirements. Savings will be most dramatic with slow CPUs or when playing HDTV. SDTV will benefit as well, but most modern CPUs can already play back SDTV without XvMC. MythTV can be compiled to use XvMC for native playback. External players such as Xine and Mplayer can also be compiled to support XvMC.
Currently, only MPEG-2 is supported. This is usually a hardware limitation, but can also in some chips case be a device driver limitation. As an exception, one of the newer VIA Unichrome chips is capable of XvMC accelerated MPEG-4 playback, but it is not supported by the official UniChrome driver at the time of writing this, instead you have to turn to the openChrome project drivers (which has an updated forked version of libxvmc).
A new video acceleration API is being developed, in an effort lead by Intel. This new API supports more complete offload (VLD) as well as iDCT+MC, and can support acceleration of MPEG-4 ASP (H.263), MPEG-4 AVC (H.264), VC-1/VMW3, as well as MPEG-2. The website for this effort is located at: http://www.freedesktop.org/wiki/Software/vaapi
Some users have also provided a chart of example CPU savings
Each hardware video card capable of XvMC video acceleration requires a software driver to enable these features. Below is a list of the recommended software drivers and driver versions for each supported hardware type.
|NVIDIA||Yes||www.nvidia.com||Any recent version of the driver is acceptable. See the Nvidia page for more details||nvidia|
|NVIDIA||No||Included with Xorg distribution||Included version||nv|
|Unichrome||Yes||Included in Xorg 6.9 and above distributions||Included version||openchrome|
|Intel||Yes||Included in Xorg distribution||Included version||i810 or intel|
||No||At this time, there is no XvMC support for ATI cards in Linux drivers||N/A||N/A|
Installing the drivers
In order for MythTV to utilize the XvMC feature of your video chipset, you need to install the appropriate driver for your distribution. This process will vary by chipset and distribution but some general recommendations can be made.
For nvidia chipsets, go to www.nvidia.com and download the binary driver installer package from their website. Follow the instructions there for executing the package and installing the modules. Also, the ATRPMS site packages nvidia drivers for installation on new Fedora distributions and the Livna site has packages for some older distributions as well as newer.
For other chipsets, the driver should already be included in your Xorg installation.
Configuring chipset drivers
Each chipset driver may have specific configuration options that work better with XvMC
Use the 'nvidia-settings' control panel to disable Video Texture Adapter and/or Video Blitter Adapter "Sync to VBlank" checkboxes (on the "X Server XVideo Settings" page)
These xorg.conf options can also affect usage or performance
Section "Driver" Option "UseEvents" "true" Option "XvmcUsesTextures" "false" Option "NVAGP" "1" (some users report 2 works better, may not be applicable to newer driver versions) End Section
This option is appear to be required for XvMC use with nvidia chipsets, especially when using the Chromakey OSD
Section "Extensions" Option "Composite" "Disabled" End Section
Installing the XvMC libraries
For many distributions, a separate XvMC library package needs to be installed. This is the library that MythTV will use to hook into the XvMC support in the driver. It provides a common interface for application wishing to use XvMC.
yum install libXvMC
is probably appropriate for most. This may already be installed by your distribution
Enabling the chipset library
Each chipset provides an interface between the XvMC library and the actual driver. This is usually handled by what is called the XvMC wrapper library. A text configuration file directs the XvMC library to the driver interface.
The wrapper configuration script is usually found at /etc/X11/XvMCConfig
It contains a single line of the driver library name
libXvMCVIA or libXvMCVIAPro (depending on the chipset)
These will change with different driver chipsets. If you find a new one, please add it here. If you used a package (atrpms, livna) based driver installation, you might also be able to find the library name by doing
rpm -ql <driver-package> | grep -i xvmc
and look for library names that include the XvMC text.
MythTV XvMC Support
Packages and Distributions
Most package and distributions of MythTV should have XvMC enabled by default. You can check your version by doing
and looking for
Options compiled in: linux release using_oss using_alsa using_jack using_backend using_dbox2 using_dvb using_firewire using_frontend using_hdhomerun using_iptv using_ivtv using_joystick_menu using_lirc using_v4l using_x11 using_xrandr using_xv using_xvmc using_xvmcw using_xvmc_vld using_bindings_perl using_bindings_python using_opengl using_ffmpeg_threads using_libavc_5_3 using_live
If you see options like
using_xvmcw then your Myth system is prepared for XvMC.
Compiling from source
When you run configure, if you have the proper XvMC development files installed (libXvMC-devel, libXvMCW-devel) , you should see this type of output from the configure script:
# Video Output Support x11 support yes xrandr support yes xv support yes XvMC support yes XvMC VLD support yes XvMC pro support yes XvMC OpenGL sup. no XvMC libs -lXvMCW
The last libs line will tell you which libraries that MythTV is compiling against. In this case, it is the XvMC wrapper mentioned above. For some, it may be the nvidia libraries. But regardless, you need to see yes before building MythTV.
If installing MythTV on Gentoo Linux, make sure VIDEO_CARDS is properly configured in /etc/make.conf to include, "i810", "nvidia" or "via". The "xvmc" USE flag is also required. These flags can usually be set on a per package basis in /etc/portage/package.use, for example:
$ cat /etc/portage/package.use media-tv/mythtv xvmc
Or globally for all packages in /etc/make.conf via USE="xvmc"
XvMC usage is controlled using the Playback profiles feature of MythTV as of version 0.21. In previous versions, you simply set the Preferred MPEG-2 Decoder to one of the XvMC methods appropriate for your chipset. With 0.21, this is a more flexible configuration allowing for different decoders depending on the content. For XvMC, the Bob deinterlacer provides the best deinterlacing but with some performance penalty.
Sometimes the OpenGL VSync feature can affect XvMC use and performance. This can be enabled or disabled in the frontend configuration if compiled into your MythTV system.
If your on screen display is greyscale, then XvMC is working and you are using the softblend OSD. If you are experiencing performance issues related to the OSD (on screen display), disabling the OSD fade will improve this greatly. You can also try using the Chromakey OSD
The chromakey OSD will provide a color OSD and for many chipsets, this also uses far less CPU resources, making playback smoother.
Using other applications
If you use other applications for playback in MythVideo such as mplayer or xine, each has its own configuration options for using XvMC
MPlayer includes an XvMC output plugin. To use it, try this:
mplayer -vo xvmc -vc ffmpeg12mc
(assuming you are running mplayer with XvMC support compiled in)
- Note - unichrome support in mplayer requires a patch.
Xine's has two plugins for XvMC support, the first is named xvmc as you would expect, however to take advantage of XvMC acceleration on nVidia graphics cards using the nVidia binary drivers they have a seperate plugin named xxmc (xx instead of xv).
To use Xine with XvMC support for most graphics cards use:
xine -V xvmc
To use Xine with XvMC support for nVidia graphics cards use:
xine -V xxmc
(assuming, of course, that xine has been compiled with XvMC support.)
Hardware acceleration processes not yet supported by XvMC
XvMC does have the potential for more than it currently features it supports today. Modern graphic processors (since the DirectX 9 generation and newer) support more than just accelerating motion compensation and iDCT, and they can support more video formats than only MPEG-2 as XvMC does today. NVIDIA's PureVideo Technology and ATI's AVIVO Technology support hardware accelerated video decoding for MPEG-2, MPEG-4 AVC (H.264), and WMV3 (often referred to as WMV9 because Microsoft released it as the same time as Windows Media Player 9). Unfortunate, neither NVIDIA or ATI have yet to open up those technologies to Linux nor the API documentations to the open source community, and no publicly known attempt to reverse engineer access to those APIs have been made.
As a temporary (or permanent) solution to this, shaders in and/or Cg code could be written for these processes and added to the XvMC library to gain some of the additional advantages that GPU assisted video decoding brings and Shader Model 3.0 based GPUs can support today. (Best would be if FFmpeg was used as a reference codec and player/utility). Both NVIDIA and ATI have extensive tools for creating and maintaining the process of developing shaders easier than it has been in the past.
Processes that can be accelerated for most video formats
- Motion compensation (mo comp)
- Inverse Discrete Cosine Transform (iDCT)
- Inverse Telecine 3:2 and 2:2 pull-down correction
- Inverse modified discrete cosine transform (iMDCT)
- in-loop deblocking
- intra-frame prediction
- inverse quantization (IQ)
- Variable Length Decoding (VLD)
- More commonly known as slice level acceleration
- Spatial-Temporal De-Interlacing
- Plus automatic interlace/progressive source detection
- Bitstream processing (CAVLC/CABAC)
There are alternative methods for hardware assisted MPEG-2 playback of standard definition video: