[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
|
|
Subscribe / Log in / New account

VA API slowly -- but surely -- making progress

July 1, 2009

This article was contributed by Nathan Willis

For years, video acceleration on Linux and Unix-like systems has been possible only through the X Video Motion Compensation (XvMC) API. A new, more modern replacement is in the works: the Video Acceleration API (VA API). XvMC offered a way for applications to partially offload decoding of MPEG-2-encoded video directly to the video card's graphics processing unit (GPU), which provided more speed and a smoother display when compared to processing on the system CPU. VA API will add more video formats to the accelerated decoding pipeline, as well as video encoding and post-processing.

Applications can use XvMC to save CPU cycles and reduce power consumption, but the API is extremely limited: it only supports MPEG-2 video, and only offloads the motion compensation calculations. On the other hand, XvMC is supported by a wide range of video hardware from different manufacturers, current and legacy. X developers talked about extending XvMC to support other formats and to add more steps in the video decoding process — such as the costly inverse discrete cosine transform (iDCT), but eventually decided to write a new API from the ground up.

A new specification

The VA API project was launched in December of 2006, spearheaded by Jonathan Bian from Intel. Initially, the API only attempted to cover video decoding, adding support for the VC-1 codec, and adding iDCT and variable-length decoding (VLD or "slice-level acceleration") to the techniques offloaded to the GPU. The specification subsequently added MPEG-4 ASP/H.263 and MPEG-4 AVC/H.264 to the list of supported codecs, and acceleration hooks for deblocking and inverse zigzag ordering (IZZ). VA API has also been designed to handle color space conversion, gamma correction, scaling, and other video processing techniques traditionally handled by the X video extension (Xv) rather than XvMC itself.

The most recent revision of the specification is 0.30, released in March of 2009, more than a year after the release of 0.29. 0.30 introduces a major new feature to the API: hardware acceleration for video encoding. The encoding support supports multiple codecs; currently H.263, H.264, and generic MPEG-4 are specified.

In addition to the specification, the project produces libVA, an implementation library targeting Linux systems. Using libVA requires supported hardware and a supported video driver, however, which has historically been the sticking point. VA API is maintained by a team at Intel: Bian, Austin Yuan, and Waldo Bastian. Despite calls for input and outside participation, the competing GPU manufacturers have not contributed, each preferring to put effort into its own hardware video acceleration project. NVIDIA has the Video Decode and Presentation API for Unix (VDPAU), and ATI has X-Video Bitstream Acceleration (XvBA). Thus, the only Linux video driver that natively supports VA API is Intel's own (closed source) psb-video, for its Poulsbo chipset, which is aimed at low-power devices like netbooks and features the GMA500 GPU.

Beyond Intel: participation and driver support

The single-vendor problem began to turn around in late 2008, when embedded systems vendor Splitted-Desktop Systems (SDS) decided to adopt VA API for some of its Linux-based low-power boxes. SDS's Gwenole Beauchesne developed bridge code to use VDPAU and XvBA as back-ends for VA API, bringing support for the API to NVIDIA and ATI card owners. Neither VDPAU nor XvBA support the entire product range from either manufacturer, of course, and both vendor APIs are limited in scope — neither supports encoding acceleration, and VDPAU does not support MPEG-4 ASP/H.263.

Taking advantage of this work requires a VDPAU- or XvBA-supported video card, a VDPAU- or XvBA-enabled driver, and a patched version of libVA. Beauchesne's patches to libVA add fields to VA API's control structures to pass parameters down to the VDPAU and XvBA back-ends. He publicly maintains a patch set at SDS in addition to patched libVA packages while the changes await upstream integration.

To use Beauchesne's bridge work for an NVIDA card a user would need to install his patched libVA library, the vdpau-video package that links VA API calls to VDPAU API calls, and a video driver that implements VDPAU. Thus far, only the binary nvidia driver from NVIDIA implements VDPAU, not the free nv driver from X.org. Similarly, an ATI user would need the patched libVA, the xvba-video bridging package, and a Radeon driver that implements XvBA — currently only the closed source fglrx.

In February of 2009, S3 Graphics released its first VA API-compatible driver, for the Chrome 400 and Chrome 500.

Application support

Regardless of the chipset or driver used, it is impossible to see the benefits of VA API if the application does not support it. Fortunately, open source video projects are beginning to take a look. "Official" support is currently limited; RealPlayer for Mobile Devices is designed for Poulsbo-based hardware, and thus to take advantage of VA API through libVA and the psb-video driver. Likewise, closed source codec vendor Fluendo makes specialized builds of its GStreamer codecs for Poulsbo devices that will use VA API. Users with NVIDIA or ATI GPUs would not gain hardware acceleration with either product because neither uses the patched version of libVA compatible with the VDPAU and XvBA back-ends.

Fortunately, Beauchesne provides patched versions of MPlayer and FFmpeg, making this the simplest way to experience hardware acceleration on desktop Linux systems. Build notes are included. The VA API-accelerated MPlayer will work with any back-end: VDPAU for NVIDIA, XvBA for ATI, or native Poulsbo drivers for Intel. Beauchesne has sent his patches upstream, but it is not yet clear when MPlayer or FFmpeg will include VA API in official releases.

VLC has added VA API support in its development branch, and a patch is available through the developers' mailing list that adds support to current releases. MythTV can be patched to support VDPAU, but thus far there has been no work on supporting VA API. It is possible, however, to set up MythTV to use MPlayer as a video playback engine, so it would be possible to leverage Beauchesne's patched version of MPlayer that way.

Benchmarks comparing VA API-accelerated decoding to CPU-based decoding are available from several sources. Beauchesne has run multiple comparisons on different systems: Opteron, Phenom, and Atom processors, and NVIDIA, ATI, and Intel GPUs, all using MPlayer. Jean-Baptiste Kempf has run real-world tests on the VA API-enabled version of VLC. The difference in CPU utilization can be dramatic; the CPU has little to do other than pass the compressed bits to the GPU. Beauchesne's numbers report CPU utilization between 66.3 and 98.4 percent for unaccelerated video playback, and as low as 0.6 percent with VA API acceleration.

Beauchesne said he hopes to see more applications take an interest in VA API, noting that the average desktop user only benefits from it when the players adopt it. He added that he had tried to add VA API support to the open source Flash decoder Gnash, but eventually abandoned the effort because the peculiarities of the Flash format (such as requiring all pixels to be converted to RGB24) sapped away most of the gains of hardware acceleration.

Future work

On the specification side, Bian echoed Beauchesne's sentiment, hoping that more developers would take an interest in contributing to the work. "Many aspects of the API could benefit from video application developer inputs ... as the app developers are ultimately the consumers of the API." Beauchesne's patches are an example of that, he said. Yuan added that moving the libVA code to Freedesktop.org's public Git repository should streamline the process for integrating contributions from outside Intel.

Video encoding is new to the specification, but has not been tested in the wild; that is expected to happen when Intel releases its Moorestown mobile platform late in 2009. Bian indicated that more video post-processing filters may make it into the next revision, and Beauchesne added that he would like VA API to support rendering directly to an OpenGL texture, as this would allow it to work with Clutter.

The bigger news is that Intel plans to launch a VA API-supporting driver for additional graphics chips. According to Bian and Yuan, the G45 chipset is next. G45 is a Core 2 chipset introduced in 2008, and already found in a variety of products, including desktop motherboards.

Still, at the moment the only "native" VA API video drivers are Intel's Poulsbo driver and S3's Chrome driver, neither of which is open source. Although Beauchesne's bridge code for VDPAU and XvBA is open source, both rely on the binaries drivers provided by NVIDIA and ATI to implement VDPAU and XvBA, respectively.

The open source RadeonHD and Nouveau drivers are not pursuing hardware video acceleration, through VDPAU, XvBA, or VA API. Gallium3D is another possibility for purely open source drivers, although developer Younes Manton said that VDPAU was the current focus of his attention.

Searching through the mailing lists, IRC logs, and discussion forums of Linux video applications reveals that a "wait and see" attitude was taken by most projects during the first year or so of VA API development. Some of that is, no doubt, caution that would be taken towards any entirely new API; perhaps some of it is attributable to the perception that VA API was an Intel-only project or at best fated to duke it out against VDPAU and XvBA until one of them becomes dominant. VA API is the only hardware video acceleration standard open to all vendors and with the advent of bridging code for NVIDIA and ATI it is finally possible to see its effects on desktop systems. Hopefully that bodes well for its continued development as a standard.


Index entries for this article
GuestArticlesWillis, Nathan


to post comments

VA API slowly -- but surely -- making progress

Posted Jul 2, 2009 4:00 UTC (Thu) by pabs (subscriber, #43278) [Link]

I wonder how OpenMAX fits in with all this:

http://www.khronos.org/openmax/

There is a FLOSS implementation here:

http://omxil.sourceforge.net/

Motivation

Posted Jul 2, 2009 4:49 UTC (Thu) by ncm (guest, #165) [Link] (1 responses)

I guess this work is important mainly so underpowered CPUs can be used in players for hi-def video?

Motivation

Posted Jul 2, 2009 18:25 UTC (Thu) by Thalience (subscriber, #4217) [Link]

Keep in mind that, for "real HD" content, all but the most beefy of desktop CPUs are underpowered.

VA API slowly -- but surely -- making progress

Posted Jul 2, 2009 9:48 UTC (Thu) by nim-nim (subscriber, #34454) [Link] (2 responses)

I'm a bit surprised to see something that only "works" with closed drivers, only targets patented video formats, and was only merged in permissive software stacks, to get such proeminent lwn.net coverage

Is there any reason to think it won't dead-end like previous attempts to add hardware acceleration without trying seriously to engage FLOSS actors (Via acceleration patches that never acquired any traction any come to mind)?

VA API slowly -- but surely -- making progress

Posted Jul 2, 2009 17:21 UTC (Thu) by drag (guest, #31333) [Link] (1 responses)

> I'm a bit surprised to see something that only "works" with closed drivers, only targets patented video formats, and was only merged in permissive software stacks, to get such proeminent lwn.net coverage

The nice thing about VA-API is that once your application targets it then it can take take advantage of all the different sorts of video acceleration out there. Well, that's the idea eventually anyways. So if regardless of what acceleration API you want to use... Gallium3D, OpenCL, VDPAU, XvBA, etc then you can get your acceleration.

If somebody creates any sort of hardware that accelerates what Theora uses then I am sure it could be extended to support that also.

And don't forget that although H.264 is patented, Mythtv, ffmpeg, mplayer, and all that stuff is open source and those codecs are used by pretty much every Linux user in existence that want's to watch any sort of common video format.

VA API slowly -- but surely -- making progress

Posted Jul 5, 2009 4:58 UTC (Sun) by pflugstad (subscriber, #224) [Link]

Also, w.r.t. patented algorithms, any commercial chip that implements the encoding/decoding that is patented would already have paid the patent licensing fees. So this actually seems like a way to work around that particular problem by offloading the patent encumbered process from legally questionable software (in the US anyway) that may be patent infringing to hardware that has already paid the licensing feed.

Or maybe I don't understand this very well.

Note: I'm not advocating software/math patents at all (which is what any patent on an encoding/decoding algorithm inevitably is), but simply providing another P.O.V. that a commercial entity might be interested in.

VA API slowly -- but surely -- making progress

Posted Jul 2, 2009 12:47 UTC (Thu) by phillemann (guest, #49231) [Link] (1 responses)

Sadly, VDPAU only works for Geforce 8xxx cards and newer. :/

VA API slowly -- but surely -- making progress

Posted Jul 2, 2009 18:38 UTC (Thu) by epb205 (guest, #50182) [Link]

Well, there are still some cheap cards that should work. Just found this 9400 GT on newegg for $40. It should support VDPAU

VA API slowly -- but surely -- making progress

Posted Jul 23, 2009 18:13 UTC (Thu) by gswoods (subscriber, #37) [Link]

The only way to really promote interest in VA API is if it provides a way to get the hardware acceleration without using the proprietary drivers. If I have to use NVIDIA's proprietary driver anyway in order to get VDPAU, what is the additional benefit of VA API? And since NVIDIA and ATI unfortunately have a vast majority of the desktop market, until the developers of the free drivers for these cards take an interest in supporting hardware acceleration, those of us using (or developing) things like MythTV are stuck with the proprietary drivers anyway for HD and aren't likely to be interested in VA API.

Gnash h264 accelerated with VA API

Posted Sep 28, 2009 19:49 UTC (Mon) by Velmont (guest, #46433) [Link]

So, he did it anyway. Or maybe this is something else, as it pushes h264-video to the GPU.

http://www.splitted-desktop.com/~gbeauchesne/gnash-vaapi/

Nice anyway. I'm looking forward to when radeonhd or some other free driver supports VA API. :D


Copyright © 2009, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds