{{Warning box|XvMC has been deemed unnecessary for playback of any content it supports, and detrimental to future graphical enhancements to MythTV. It has been removed from MythTV as of 0.25, and superseded by [[VDPAU]], [[VAAPI]], and [[Broadcom_Crystal_HD|Crystal HD]].}}

+

{{Wikipedia}}

+

== Introduction ==

== Introduction ==

( Current as of May 1, 2008)

( Current as of May 1, 2008)

−

{{Wikipedia}}

+

'''X-Video Motion Compensation''', or '''XvMC''', is a standardized API in [[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, through the use of XvMC enabled drivers. 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.

'''X-Video Motion Compensation''', or '''XvMC''', is a standardized API in [[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, through the use of XvMC enabled drivers. 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.

−

{{HelpUs}}

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 [http://sourceforge.net/projects/unichrome/ official UniChrome] driver at the time of writing this, instead you have to turn to the [http://www.openchrome.org openChrome project] drivers (which has an updated forked version of libxvmc).

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 [http://sourceforge.net/projects/unichrome/ official UniChrome] driver at the time of writing this, instead you have to turn to the [http://www.openchrome.org openChrome project] drivers (which has an updated forked version of libxvmc).

Line 27:

Line 29:

| nvidia

| nvidia

! style="background-color: lightgreen" | Yes

! style="background-color: lightgreen" | Yes

−

| Any recent version of the driver is acceptable. See the Nvidia page for more details. Be careful though: some nVidia cards do not support XvMC: the only cards that support XvMC are those that support nVidia "PureVideo", which is not the case for most motherboard GPUs such as the [http://www.nvidia.com/object/mcp_intel_page.html GeForce 7 series]. Geforce 8 and later do not support XvMC: driver limitation.<br><br>

+

| Any recent version of the driver is acceptable. See the Nvidia page for more details. Be careful though: some nVidia cards do not support XvMC: the only cards that support XvMC are those that support nVidia "PureVideo", which is not the case for most motherboard GPUs such as the [http://www.nvidia.com/object/mcp_intel_page.html GeForce 7 series]. Geforce 8 and later do not support XvMC. This is a hardware and driver limitation. Use VDPAU instead. The latest NVidia driver packages support XvMC on hardware which supports XvMC instead of VDPAU.<br><br>

''"The 173.14.09 release includes support for the XVideo Motion Compensation (XvMC) version 1.0 API on GeForce 5 series, GeForce 6 series and GeForce 7 series addin cards, as well as motherboard chipsets with integrated graphics that have PureVideo support."'' [http://us.download.nvidia.com/XFree86/Linux-x86/173.14.09/README/appendix-g.html]

''"The 173.14.09 release includes support for the XVideo Motion Compensation (XvMC) version 1.0 API on GeForce 5 series, GeForce 6 series and GeForce 7 series addin cards, as well as motherboard chipsets with integrated graphics that have PureVideo support."'' [http://us.download.nvidia.com/XFree86/Linux-x86/173.14.09/README/appendix-g.html]

| [http://www.nvidia.com www.nvidia.com]

| [http://www.nvidia.com www.nvidia.com]

Line 41:

Line 43:

! style="background-color: lightgreen" | Yes

! style="background-color: lightgreen" | Yes

| Included version

| Included version

−

| Included in Xorg 6.9 and above distributions

+

| Included in Xorg 6.9 and above distributions.

|-

|-

! style="background-color: lightyellow" | '''Intel'''

! style="background-color: lightyellow" | '''Intel'''

Line 66:

Line 68:

=== Available drivers ===

=== Available drivers ===

−

In order for MythTV to utilize the XvMC feature of your video chipset, you need to install the appropriate XvMC-enabled driver for your distribution. Drivers are presently available for NVidia, Via Unichrome and Intel video chipsets. There are presently (May, 2008) no XvMC enabledd ATI drivers. The installation process will vary by chipset and distribution but some general recommendations can be made.

+

In order for MythTV to utilize the XvMC feature of your video chipset, you need to install the appropriate XvMC-enabled driver for your distribution. Drivers are presently available for NVidia, Via Unichrome and Intel video chipsets. There are presently (May, 2008) no XvMC enabledd ATI drivers. ATI has been releasing upgraded drivers for Radeon 8500 or so chipsets and as of November 2008, version 8.10 appears to have an unannounced XvMC capability. See the wiki [http://www.mythtv.org/wiki/ATI_Proprietary_Driver here] and ATI's site [http://ati.amd.com/support/driver.html here].

−

There are main three steps: installing the driver (including compiling in some cases), revising xorg.conf and XvMCConfig to enable XvMC, and, finally, setting the playback profile in Mythtv (see the [http://www.mythtv.org/wiki/index.php/Playback_profiles#Default_profiles Playback_profiles] page.

+

The installation process will vary by chipset and distribution but some general recommendations can be made. There are main three steps: installing the driver (including compiling in some cases), revising xorg.conf and XvMCConfig to enable XvMC, and, finally, setting the playback profile in Mythtv (see the [http://www.mythtv.org/wiki/index.php/Playback_profiles#Default_profiles Playback_profiles] page.

=== XvMCW libraries ===

=== XvMCW libraries ===

Line 84:

Line 86:

===== In Fedora =====

===== In Fedora =====

−

The [http://www.atrpms.net ATRPMS] site packages nvidia drivers for installation on new Fedora distributions and the [http://rpm.livna.org Livna] site has packages for some older distributions as well as newer.

+

The [http://www.atrpms.net ATRPMS] site packages nvidia drivers for installation on new Fedora distributions and the [http://www.rpmfusion.org RPMFusion] site has packages for some older distributions as well as newer.

===== In Ubuntu =====

===== In Ubuntu =====

Line 93:

Line 95:

For via unichrome chipsets, go to [http://www.openchrome.org Openchrome.org] to download the source code or for links to binary driver packages. Note that not all features of the unichrome chipsets, especially TV-out, are presently working, but XvMC appears to be working on all chipsets using video-out (VGA/DVI).

For via unichrome chipsets, go to [http://www.openchrome.org Openchrome.org] to download the source code or for links to binary driver packages. Note that not all features of the unichrome chipsets, especially TV-out, are presently working, but XvMC appears to be working on all chipsets using video-out (VGA/DVI).

+

+

This thread throws some light on many issues people have been facing with recent distributions; MythDora5 works out of the box with Via SP13000 MB which has a CN400 chipset however MythBuntu 810 & 904 do not work. A patch has been provided in this thread which may be of help to Intrepid 8.10 users - http://ubuntuforums.org/showpost.php?p=6269306&postcount=14. There are similar patches from the same provider for various other distributions.

=== Intel Chipsets ===

=== Intel Chipsets ===

+

(Revised January 1, 2010)

+

+

Intel chipsets are often considered 'low-powered' but in fact the drivers have been deficient in enabling the capabilities of the hardware. XvMC has had a chequered history. As of May 1, 2008, the intel driver which was included in most distributions did NOT enable XvMC, except on i810 and i815 chipsets. XvMC was then made available through the xf86-video-intel driver as of version 2.3.0 on all Intel chipsets. XvMC capability was later disabled in the 2.6.0 and subsequent driver versions due to problems.

−

Intel chipsets are often considered 'low-powered' but in fact the drivers have been deficient in enabling the capabilities of the hardware. For Intel chipsets, as of May 1, 2008, the intel driver which is included in most distributions does NOT enable XvMC, except on i810 and i815 chipsets. XvMC is now available through the xf86-video-intel driver as of version 2.3.0 on all Intel chipsets and is presently available as a source tar from:

+

XVMC has now been re-enabled in driver version 2.9.0 for all chipsets. A frame size limitation of 720x576 pixel frames was also removed so that XvMC is available for 1920x1080 frame sizes.

+

+

Ubuntu 9.04 (Jaunty) and Fedora 11 as distributed, has XvMC disabled. Driver version 2.9.0 was released September 29, 2009 and has been included in Ubuntu Karmic (9.10) and Fedora 12 together with the required X server version 1.6. XvMC can be enabled with the correct options in xorg.conf.

As of September 19, 2008, the latest driver version is 2.4.2. This version requires a very recent xorg server, which is available here:

−

<pre> http://xorg.freedesktop.org/archive/individual/xserver/ </pre>. The latest stable version is a release candidate for version 1.5 which is also available. Installation requires the usual steps, except that you must use 'configure --prefix=/usr' to put the libraries and drivers in the correct places. Installation creates new drivers in /usr/lib/xorg/modules/drivers and libraries (libI810XvMC and libIntelXvMC) in /usr/lib.

−

−

NOTE: XvMC is only available for Standard Definition frame sizes (max 720x576) and the OSD is unavailable.

== Compiling/Installing the driver ==

== Compiling/Installing the driver ==

Line 113:

Line 119:

<pre> id:3:initdefault: </pre>

<pre> id:3:initdefault: </pre>

and reboot. (Reverse the edit after the installation).

and reboot. (Reverse the edit after the installation).

−

The installer binary will install the driver in /usr/lib/xorg/modules/drivers and the accompanying libraries in /usr/lib.

+

The installer binary will install the driver in /usr/lib/xorg/modules/drivers and the accompanying libraries in /usr/lib.

−

+

+

NOTE: DO not attempt to use the experimental vdpau drivers (180 series). The vdpau driver setup installs non-standard header files in addition to the driver files. Other chipsets will fail to operate if the non-standard headers are installed. The installation is not reversed by the uninstall script provided. It is also not clear whether non-vdpau capable nvidia hardware will operate properly with the vdpau enabled driver. Possibly but without xvmc.

+

==== VIA Unichrome ====

==== VIA Unichrome ====

Line 125:

Line 133:

==== Intel ====

==== Intel ====

−

1. Requirements for Compilation:

+

Requirements for Compilation:

−

+

−

(Revised May 9, 2008)

+

−

(Further revised August 25, 2008: It appears that xvmc only works for frames less than 720x568 in size. For larger frames, xvmc appears to work, but the picture is a bright monochrome green, like night vision goggles.)

+

−

+

−

Note: if you obtain the driver and the xserver tars from http://xorg.freedesktop.org/archive/individual/ you do NOT need to do any of the steps given below. Just doing 'configure --prefix=/usr' && make && make install' on the xserver as root, then jump down to subheading 2. below. (You might want to backup the existing drivers in the folders mentioned above.)

+

−

+

−

The [http://www.intellinuxgraphics.org/install.html INTEL_GRAPHICS] site lists some requirements for building from the tarball or from the git source. The site is a good reference!

+

−

What is not explained is that you will require a quite recent git build of drm and mesa, from x.org, as even libdrm-2.4.0-0.3.fc9 is not be sufficiently new enough.

+

−

You will likely have to build drm and mesa from git sources, and install new (testing) versions of other programs. Note that if you are on Fedora, it appears that Fedora 9 will have the new programs and libraries. You may be able to avoid building drm and mesa by using packages from the Fedora 9 Preview [http://mirros.kernel.org/fedora/releases/test/9-Preview/Fedora/i386/os/Packages Fedora 9 Preview Packages]. Due to an apparent regression in the git version of the intel driver, I strongly suggest that you try to build from the tarball version 2.3.0. Note that you may still have the problem referred to in section 5.b) and you will have to revise the drm.h file.

+

−

+

−

From the Intel Linux Graphics Page:

+

−

<pre>In order to test or use the latest Intel X driver, you typically don't need to upgrade other components of

+

−

the graphics stack, like Mesa or the DRM drivers. In order to build the driver, you'll need several development

+

−

packages installed (list taken from the Fedora build requirements for the driver):

+

−

- autoconf

+

−

- automake

+

−

- libtool

+

−

- hwdata (for PCI IDs)

+

−

- xorg-x11-server-Xorg >= 1.3.0.0-6

+

−

- xorg-x11-server-sdk >= 1.3.0.0-6

+

−

- libXvMC-devel

+

−

- mesa-libGL-devel >= 6.5-9

+

−

- libdrm-devel >= 2.0-1

+

−

</pre>

+

−

+

−

Packages meeting these requirements are available for Fedora in the 'Everything' repository and can be installed with yum. The first 4 are likely already installed if you are running Mythtv. You will also need git which is available from the usual places. Note that the first sentence of the quoted section is not true.

+

−

+

−

In addition you will need to find and install at least

+

−

+

−

xorg-x11-proto-devel-7.3-12.fc9

+

−

+

−

which can be found, at present, at [http://mirros.kernel.org/fedora/releases/test/9-Preview/Fedora/i386/os/Packages Fedora 9 Preview Packages]

+

−

+

−

If you have any of the problems described below, check out the wiki at [http://www.x.org/wiki/Development/git Xorg Development] which describes a

+

−

smooth set of steps to building drm and mesa using the git sources.

+

−

+

−

In Fedora, to get the 'Everything' repo change line 4 in your /etc/yum.repos.d/fedora.repo file to read:

+

−

....fedora/linux/releases/$releasever/Everything/$basearch.....

+

(seriously revised January 1, 2010)

−

In Ubuntu, the equivalent files may require that the 'universe' or 'multiverse' repositories have to be enabled.

+

Since driver version 2.9.0 or 2.9.1 is now available in mainstream repositories there is no real need to compile from source. The following is retained for reference purposes only.

+

Note: if you obtain the driver and the xserver tars from http://xorg.freedesktop.org/archive/individual/ a

+

'configure --prefix=/usr' && make && make install' on the xserver as root should suffice to build the driver.

−

2. Getting the Driver Source: (Revised August 31,2008: Stable version is now 2.4.1 and release candidates, 2.4.99x for 2.5.0 are now available.)

Then you are missing the xorg-x11-proto-devel file (in Fedora) or the xorg-server-devel or source files, in other distributions. If you are sure you followed the instructions given above, you can run 'ldconfig', or if necessary, attempt to re-install the rpms, as these files should be there.

+

−

+

−

If you cannot otherwise fix the problem, you can avoid the error, by a workaround. You will need to open 'configure' with your favourite editor, find (note the line number!) and comment out the following lines:

+

−

<pre>

+

−

# Checks for extensions

+

−

#XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)

+

−

#XORG_DRIVER_CHECK_EXT(RANDR, randrproto)

+

−

#XORG_DRIVER_CHECK_EXT(RENDER, renderproto)

+

−

#XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)

+

−

#XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)

+

−

</pre>

+

−

Those lines should not throw an error if you have the full xorg sources properly installed. And sometimes, things do not quite go right!

+

−

+

−

4. Saving Your Old Drivers:

+

−

+

−

To save your old drivers in case of problems (since we all know that you will *not* have problems if you do this: problems only arise when you cannot reverse out of the trouble!).

By default configure wants to build (and install) in /usr/local/, but we want everything in /usr so that xorg works as usual. So re-run configure as follows, whichever version you are building.

By default configure wants to build (and install) in /usr/local/, but we want everything in /usr so that xorg works as usual. So re-run configure as follows, whichever version you are building.

Line 226:

Line 163:

$ sudo make install

$ sudo make install

</pre>

</pre>

−

−

a) If configure fails with an error 'No package Xorg-server found', you need to install the requirements listed in Section 1, above.

−

−

b) If make fails with an error like:

−

"In file included from /usr/local/include/xf86drm.h:39,

−

from intel_xvmc.h:42,

−

from intel_xvmc.c:27:

−

/usr/include/drm/drm.h:650: error: expected specifier-qualifier-list

−

before ‘uint64_t’"

−

−

then there is a problem with libdrm. You will need to add a line "#include <inttypes.h>" to the /usr/include/drm/drm.h file. *Even the latest git-clone of drm seems to require this fix.* I made this change, then updated to a git source build and the error reappeared.

−

−

c) If make fails with an error like:

−

"i830_driver.c: In function ‘I830LeaveVT’:

−

i830_driver.c:3194: error: ‘DRM_BO_MEM_TT’ undeclared (first use in this

−

function)

−

i830_driver.c:3194: error: (Each undeclared identifier is reported only once

−

i830_driver.c:3194: error: for each function it appears in.)

−

i830_driver.c: In function ‘I830EnterVT’:

−

i830_driver.c:3231: error: ‘DRM_BO_MEM_TT’ undeclared (first use in this

−

function)

−

i830_driver.c: In function ‘I830CloseScreen’:

−

i830_driver.c:3359: error: ‘DRM_BO_MEM_TT’ undeclared (first use in this

−

function)

−

make[4]: *** [i830_driver.lo] Error 1"

−

−

then the problem is that the version of libdrm on your system is too old. You can try a re-install/update of libdrm and libdrm-devel, then ldconfig. If that does not work, you can try installing even newer versions from the Fedora 9 Preview repository referred to above. If all else fails go to [http://www.x.org/wiki/Development/git Xorg Development] and download the latest drm source, and build it following the straightforward and clear instructions given on that page. If you get an error message referring to dri2proto, your xorg-x11-proto-devel version is too old and you will need to find a more recent version on the Fedora 9 Preview repo.

The 'make install' step will install the intel_drv.so driver in /usr/lib/xorg/modules/drivers and the libIntelXvMC.so.1.0.0 library in /usr/lib. The libI810XvMC.so driver will be installed in the same place or may be replaced by a symlink to the libIntelXvMC library.

The 'make install' step will install the intel_drv.so driver in /usr/lib/xorg/modules/drivers and the libIntelXvMC.so.1.0.0 library in /usr/lib. The libI810XvMC.so driver will be installed in the same place or may be replaced by a symlink to the libIntelXvMC library.

Line 262:

Line 172:

Run ldconfig one last time, to tell the kernel about the new driver.

Run ldconfig one last time, to tell the kernel about the new driver.

−

(If you haven't figured it by now, having read the above, the real answer is to avoid using the git sources, and just download the driver tarball from http://xorg.freedesktop.org/archive/individual/driver/ and if necessary, the server from ...individual/xserver, and use those. I had near endless problems with getting the git sources to compile cleanly, but the tarballs built without effort.)

+

The easy answer to getting XvMC working on an Intel chipset is to upgrade your installation to Fedora 12, Ubuntu 9.10 or the equivalent which have everything already built. You can download the driver tarball from http://xorg.freedesktop.org/archive/individual/driver/ and if necessary, the server from ...individual/xserver, and use those. They require compilation but rarely give problems. Using the git sources ranks much lower compared to the other options.

Note that since driver version 100.14.11 there is a bug for users of AGP cards in the nvidia driver that requires the NVAGP option set to 0 (turning off agpgart support). See [http://www.nvnews.net/vbulletin/showthread.php?t=118738 this nvidia forums post] for more info.

The following option appears to be required for XvMC use with nvidia chipsets, especially when using the Chromakey OSD. This turns off the 'Compiz eye-candy'. (The 'Extensions' option is a part of xorg.conf, and is a replacement for SubSections which were used to pass Options to a specific module. Since modules are now 'automagically' loaded through extmod, the "Modules" section has disappeared. The 'Extensions' section is the replacement for that capability.)

The following option appears to be required for XvMC use with nvidia chipsets, especially when using the Chromakey OSD. This turns off the 'Compiz eye-candy'. (The 'Extensions' option is a part of xorg.conf, and is a replacement for SubSections which were used to pass Options to a specific module. Since modules are now 'automagically' loaded through extmod, the "Modules" section has disappeared. The 'Extensions' section is the replacement for that capability.)

Line 339:

Line 250:

==== INTEL ====

==== INTEL ====

−

The 'intel' man page which was installed with the driver contains a full listing of the switches now available. Revise /etc/X11/xorg.conf as follows:

+

The 'intel' man page which should be installed with the driver contains a full listing of the switches now available. Revise /etc/X11/xorg.conf as follows:

<pre>

<pre>

Section "Device"

Section "Device"

Line 350:

Line 261:

Option "UseEvents" "true"

Option "UseEvents" "true"

## The following 2 options should be used together, and may or may not make a difference to CPU load

## The following 2 options should be used together, and may or may not make a difference to CPU load

−

Option "AccelMethod" "XAA" # The default is "EXA"

+

Option "AccelMethod" "UXA" # "XAA and "EXA" have been removed from the latest driver

Option "CacheLines" "xxxx" # Allows the user to change the amount of graphics

Option "CacheLines" "xxxx" # Allows the user to change the amount of graphics

# memory used for 2D acceleration and video when

# memory used for 2D acceleration and video when

Line 369:

Line 280:

== Enabling the chipset library ==

== 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 XvMCW wrapper library. The XVMCW library looks to a text configuration file in order to find the correct XvMC library. The wrapper configuration file is usually found at /etc/X11/XvMCConfig and you may have to create this file yourself as it is sometimes not pre-installed even though it is needed.

+

Each chipset provides an interface between the XvMC library and the actual driver. This is usually handled by what is called the XvMCW wrapper library. The XVMCW library looks to a text configuration file in order to find the correct XvMC library. XvMC will not be enabled if the XvMCConfig file refers to the XvMCW library. The wrapper configuration file is found at /etc/X11/XvMCConfig and you either may have to create this file yourself as it is sometimes not pre-installed even though it is needed, or edit it to remove the libXvMCW.so reference and replace it with the proper reference.

This file contains a single line consisting of the driver library name:

This file contains a single line consisting of the driver library name:

Line 392:

Line 303:

You will have to reboot. To check if XvMC is properly enabled, run:

You will have to reboot. To check if XvMC is properly enabled, run:

−

<pre>

+

$ cat /var/log/Xorg.0.log | grep Motion

−

$ cat /var/log/Xorg.0.log | grep Motion

+

−

</pre>

+

and you should see:

and you should see:

−

<pre>

+

(II) Loading extension XVideo-MotionCompensation

−

(II) Loading extension XVideo-MotionCompensation

+

−

</pre>

+

−

If you try: cat /var/log/Xorg.0.log | grep XvMC

+

+

If you try: '''cat /var/log/Xorg.0.log | grep -i XvMC'''

your driver might also report loading the options such as:

your driver might also report loading the options such as:

−

(**) NVIDIA(0): Option "XvMCUsesTextures" "True"

+

(**) NVIDIA(0): Option "XvMCUsesTextures" "True"

+

+

with VIA SP13000 this will be:

+

+

(II) CHROME(0): [XvMC] Registering chromeXvMCPro.

+

(II) CHROME(0): [XvMC] Initialized XvMC extension.

Success!

Success!

Line 423:

Line 336:

#include <stdlib.h>

#include <stdlib.h>

#include <stdio.h>

#include <stdio.h>

+

#include <string.h>

#include <X11/Xlib.h>

#include <X11/Xlib.h>

Line 520:

Line 434:

" flags:\n"

" flags:\n"

" %s%s%s%s\n\n",

" %s%s%s%s\n\n",

−

isurf,

+

isurf,

xvmc_info[isurf].max_width,

xvmc_info[isurf].max_width,

xvmc_info[isurf].max_height,

xvmc_info[isurf].max_height,

Line 526:

Line 440:

xvmc_info[isurf].subpicture_max_height,

xvmc_info[isurf].subpicture_max_height,

/* chroma_format */

/* chroma_format */

−

chroma[xvmc_info[isurf].chroma_format && 0xf],

+

chroma[xvmc_info[isurf].chroma_format & 0xf],

/* mc_type */

/* mc_type */

−

codec[xvmc_info[isurf].mc_type && 0xf],

+

codec[xvmc_info[isurf].mc_type & 0xf],

−

/* XVMC_MOCOMP is zero! */

+

−

xvmc_info[isurf].mc_type & XVMC_MOCOMP ? "motion compensation " : "",

+

xvmc_info[isurf].mc_type & XVMC_IDCT ? "IDCT " : "MOCOMP ",

xvmc_info[isurf].mc_type & XVMC_IDCT ? "IDCT " : "MOCOMP ",

/* flags */

/* flags */

Line 581:

Line 493:

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.

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 [http://www.gentoo.org/doc/en/xorg-config.xml#doc_chap2 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:

+

If installing MythTV on Gentoo Linux, make sure [http://www.gentoo.org/doc/en/xorg-config.xml#doc_chap2 video card] 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

$ cat /etc/portage/package.use

media-tv/mythtv xvmc

media-tv/mythtv xvmc

Line 652:

Line 564:

** Plus automatic interlace/progressive source detection

** Plus automatic interlace/progressive source detection

* Bitstream processing (CAVLC/CABAC)

* Bitstream processing (CAVLC/CABAC)

−

−

== Alternatives ==

−

There are alternative methods for hardware assisted [[MPEG-2]] playback of standard definition video:

Revision as of 17:23, 18 January 2011

Warning: XvMC has been deemed unnecessary for playback of any content it supports, and detrimental to future graphical enhancements to MythTV. It has been removed from MythTV as of 0.25, and superseded by VDPAU, VAAPI, and Crystal HD.

Introduction

( Current as of May 1, 2008)

X-Video Motion Compensation, or XvMC, is a standardized API in 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, through the use of XvMC enabled drivers. 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. XvMC-vld is also available on Via Unichrome-Pro chipsets, through the openchrome driver.

Drivers

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.

Chipset

Driver

XvMC?

Version

Source

NVIDIA

nvidia

Yes

Any recent version of the driver is acceptable. See the Nvidia page for more details. Be careful though: some nVidia cards do not support XvMC: the only cards that support XvMC are those that support nVidia "PureVideo", which is not the case for most motherboard GPUs such as the GeForce 7 series. Geforce 8 and later do not support XvMC. This is a hardware and driver limitation. Use VDPAU instead. The latest NVidia driver packages support XvMC on hardware which supports XvMC instead of VDPAU.

"The 173.14.09 release includes support for the XVideo Motion Compensation (XvMC) version 1.0 API on GeForce 5 series, GeForce 6 series and GeForce 7 series addin cards, as well as motherboard chipsets with integrated graphics that have PureVideo support."[1]

Obtaining XvMC capable drivers for your chipset

Available drivers

In order for MythTV to utilize the XvMC feature of your video chipset, you need to install the appropriate XvMC-enabled driver for your distribution. Drivers are presently available for NVidia, Via Unichrome and Intel video chipsets. There are presently (May, 2008) no XvMC enabledd ATI drivers. ATI has been releasing upgraded drivers for Radeon 8500 or so chipsets and as of November 2008, version 8.10 appears to have an unannounced XvMC capability. See the wiki here and ATI's site here.

The installation process will vary by chipset and distribution but some general recommendations can be made. There are main three steps: installing the driver (including compiling in some cases), revising xorg.conf and XvMCConfig to enable XvMC, and, finally, setting the playback profile in Mythtv (see the Playback_profiles page.

XvMCW libraries

For many distributions, a separate XvMCW (Wrapper) library package can 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 applications wishing to use XvMC.

yum install libXvMCW

or the equivalent will do the trick. This may already be installed by your distribution.

NVIDIA Chipsets

For NVIDIA chipsets, the open source nv driver is provided in all distributions. The nv driver does not enable XvMC. NVidia provides a closed source binary driver installer package on their website which gives an XvMC enabled driver. Clicking on the 'Archive' link, below the first listed driver will disclose not only the older "legacy" drivers, but also other more recent drivers. Download and follow the instructions there for executing the package and installing the modules.

In Fedora

The ATRPMS site packages nvidia drivers for installation on new Fedora distributions and the RPMFusion site has packages for some older distributions as well as newer.

In Ubuntu

The Envy project provides binary packages for Ubuntu and Debian to quickly install and configure nvidia drivers and XvMC support. It also will install the binary ATI drivers which do not, however, support XvMC.

VIA Unichrome Chipsets

For via unichrome chipsets, go to Openchrome.org to download the source code or for links to binary driver packages. Note that not all features of the unichrome chipsets, especially TV-out, are presently working, but XvMC appears to be working on all chipsets using video-out (VGA/DVI).

This thread throws some light on many issues people have been facing with recent distributions; MythDora5 works out of the box with Via SP13000 MB which has a CN400 chipset however MythBuntu 810 & 904 do not work. A patch has been provided in this thread which may be of help to Intrepid 8.10 users - http://ubuntuforums.org/showpost.php?p=6269306&postcount=14. There are similar patches from the same provider for various other distributions.

Intel Chipsets

(Revised January 1, 2010)

Intel chipsets are often considered 'low-powered' but in fact the drivers have been deficient in enabling the capabilities of the hardware. XvMC has had a chequered history. As of May 1, 2008, the intel driver which was included in most distributions did NOT enable XvMC, except on i810 and i815 chipsets. XvMC was then made available through the xf86-video-intel driver as of version 2.3.0 on all Intel chipsets. XvMC capability was later disabled in the 2.6.0 and subsequent driver versions due to problems.

XVMC has now been re-enabled in driver version 2.9.0 for all chipsets. A frame size limitation of 720x576 pixel frames was also removed so that XvMC is available for 1920x1080 frame sizes.

Ubuntu 9.04 (Jaunty) and Fedora 11 as distributed, has XvMC disabled. Driver version 2.9.0 was released September 29, 2009 and has been included in Ubuntu Karmic (9.10) and Fedora 12 together with the required X server version 1.6. XvMC can be enabled with the correct options in xorg.conf.

Compiling/Installing the driver

NVIDIA

The nvidia installer binary runs from runlevel 3. Edit the first uncommented line in /etc/inittab to read:

id:3:initdefault:

and reboot. (Reverse the edit after the installation).
The installer binary will install the driver in /usr/lib/xorg/modules/drivers and the accompanying libraries in /usr/lib.

NOTE: DO not attempt to use the experimental vdpau drivers (180 series). The vdpau driver setup installs non-standard header files in addition to the driver files. Other chipsets will fail to operate if the non-standard headers are installed. The installation is not reversed by the uninstall script provided. It is also not clear whether non-vdpau capable nvidia hardware will operate properly with the vdpau enabled driver. Possibly but without xvmc.

VIA Unichrome

To get the latest code using anonymous subversion, cd to a scratch space and use:

svn co http://svn.openchrome.org/svn/trunk openchrome

'cd' into the newly created openchrome sub-directory, and do the 'configure && make && make install' cycle. The openchrome.org website has some good documentation. The openchrome users list is a good resource as well.

Intel

Requirements for Compilation:

(seriously revised January 1, 2010)

Since driver version 2.9.0 or 2.9.1 is now available in mainstream repositories there is no real need to compile from source. The following is retained for reference purposes only.

Unpack the tarball (if required) and 'cd' into the xf86-video-intel directory which has been created.
If you downloaded the tarball, run ./configure --prefix=/usr.

If you downloaded with git, run './autogen.sh'
Autogen.sh creates and then runs 'configure'

Compile Time:

By default configure wants to build (and install) in /usr/local/, but we want everything in /usr so that xorg works as usual. So re-run configure as follows, whichever version you are building.

$ ./configure --prefix=/usr
$ make
$ sudo make install

The 'make install' step will install the intel_drv.so driver in /usr/lib/xorg/modules/drivers and the libIntelXvMC.so.1.0.0 library in /usr/lib. The libI810XvMC.so driver will be installed in the same place or may be replaced by a symlink to the libIntelXvMC library.

Check that the driver was put into the correct place. If you are unsure, check in /usr/local/lib/xorg/modules/drivers. If the new driver is there, you forgot to (re-)run configure with --prefix=/usr since it should be in /usr/lib/xorg/modules/drivers/

Check that (or revise as necessary to put) '/usr/lib/xorg/modules/drivers' and '/usr/lib/xorg/extensions are listed in /etc/ld.so.conf.

Run ldconfig one last time, to tell the kernel about the new driver.

The easy answer to getting XvMC working on an Intel chipset is to upgrade your installation to Fedora 12, Ubuntu 9.10 or the equivalent which have everything already built. You can download the driver tarball from http://xorg.freedesktop.org/archive/individual/driver/ and if necessary, the server from ...individual/xserver, and use those. They require compilation but rarely give problems. Using the git sources ranks much lower compared to the other options.

Configuring xorg.conf

Each chipset driver has specific configuration options to enable XvMC.

Note that since driver version 100.14.11 there is a bug for users of AGP cards in the nvidia driver that requires the NVAGP option set to 0 (turning off agpgart support). See this nvidia forums post for more info.

The following option appears to be required for XvMC use with nvidia chipsets, especially when using the Chromakey OSD. This turns off the 'Compiz eye-candy'. (The 'Extensions' option is a part of xorg.conf, and is a replacement for SubSections which were used to pass Options to a specific module. Since modules are now 'automagically' loaded through extmod, the "Modules" section has disappeared. The 'Extensions' section is the replacement for that capability.)

Section "Extensions"
Option "Composite" "Disabled"
EndSection

Enabling the UseEvents option can sometimes bring out an issue with the nvidia driver resulting in a blue line around the screen. To fix this simply run the following somewhere during your Xorg startup:

VIA Unichrome

Many Via based motherboards and especially the EPIA motherboards have video *and* TV outputs. The TV output can be sent directly to a standard NTSC or PAL (CRT-style) TV. These motherboards have a setting in the BIOS which must be set to enable the dual outputs. In addition, the dual outputs must be enabled in xorg.conf. XvMC is enabled by default on chipsets which support it, but depends upon certain extensions, especially 'dri'. Revise xorg.conf as follows:

INTEL

The 'intel' man page which should be installed with the driver contains a full listing of the switches now available. Revise /etc/X11/xorg.conf as follows:

Section "Device"
Identifier "Videocard0"
Driver "intel"
Option "XvMCSurfaces" "7" # for i810/i815 chipsets only, otherwise
# XvMC is disabled
Option "XvMC" "true" # enable XvMC chipsets after i815
# default is disabled
Option "UseEvents" "true"
## The following 2 options should be used together, and may or may not make a difference to CPU load
Option "AccelMethod" "UXA" # "XAA and "EXA" have been removed from the latest driver
Option "CacheLines" "xxxx" # Allows the user to change the amount of graphics
# memory used for 2D acceleration and video when
# XAA acceleration is enabled.
# Decreasing leaves more for 3D textures. Increasing
# can improve 2D performance at the expense of 3D.
# xxxx=8192/16384/32768 etc.
# Note AccelMethod XAA does not appear to work with Xvmc enabled. Testing required.
EndSection

Note that the intel driver, like the latest nvidia driver loads all the required extensions by default and does not require a 'Module' section in xorg.conf. The Intel linux graphics page states that xorg.conf requires

Section "DRI"
Mode 0666
EndSection

Due to the fact that all extensions are loaded by default, without a "Modules" section, this Section is not required (DRI is enabled without it), but it actually may do something....

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 XvMCW wrapper library. The XVMCW library looks to a text configuration file in order to find the correct XvMC library. XvMC will not be enabled if the XvMCConfig file refers to the XvMCW library. The wrapper configuration file is found at /etc/X11/XvMCConfig and you either may have to create this file yourself as it is sometimes not pre-installed even though it is needed, or edit it to remove the libXvMCW.so reference and replace it with the proper reference.

This file contains a single line consisting of the driver library name:

NVIDIA

libXvMCNVIDIA_dynamic.so.1

unichrome

libXvMCVIA.so or libXvMCVIAPro.so (depending on the chipset)

intel

/usr/lib/libIntelXvMC.so

Note that the Intel driver requires the absolute pathname of the library.
If you used a package (atrpms, livna) based driver installation, you might also be able to find the library name by doing

If you are having problems, or are just unsure whether your setup is correct, you can compile this small program and run it. If it will not build, then you probably do not have the pre-requisites and no wonder your xvmc will not work! I do not know who gave this program to me, but Michal Podsiadlik <michal (et) gov.one.pl and Ken Harris deserve the credit for writing it.

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 card 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"

Configuring MythTV

Note: When running mythfrontend for the first time to test XvMC, try running it from a command window so you can see the output from mythfrontend. If mythfrontend cannot load the XvMC library, you will see a line in the logs about this when starting playback and you will see log entries about xvmc not being available

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.

Warning: Do not configure your Playback profile for more than one CPU when using XvMC. This will crash the frontend when attempting to playback recordings.

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.

OSD

softblend

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

Chromakey

The chromakey OSD will provide a color OSD and for many chipsets, this also uses far less CPU resources, making playback smoother.

Note: Chromakey OSD is not supported on newer Nvidia cards of the 6000 series and above

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

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.