XBMC Community Forum
[LINUX] HOW-TO use VAAPI HW Acceleration on new Intel Sandy Bridge platform - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: XBMC General Help and Support (/forumdisplay.php?fid=111)
+---- Forum: Linux and Live support (/forumdisplay.php?fid=52)
+---- Thread: [LINUX] HOW-TO use VAAPI HW Acceleration on new Intel Sandy Bridge platform (/showthread.php?tid=96669)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16


- HarryRosen - 2011-04-25 02:54

Can I use this guide on a non sandy bridge? like say for a H55 chipset>?


- waha - 2011-04-30 06:23

Just wish to say thanks for this guide. I had been pulling my hair out trying to get 1080p24 output working on my Gigabyte H67M-UD2H-B3.

Had to use a slightly different modeline to get my Sony KDL40EX720 TV to accept the 1080p24 signal:
Code:
Modeline "1920x1080@24p" 74.16 1920 2558 2602 2750 1080 1084 1089 1125 +HSync +VSync



- tstack77 - 2011-05-03 06:46

Got hung-up trying to compile xbmc:

Code:
~/Builds/xbmc$ make -j4
make: *** No targets specified and no makefile found.  Stop.

I ran the tutorial to the letter, obviously I overlooked something (probably obvious :o


- alanwww1 - 2011-05-03 21:44

tstack77 Wrote:Got hung-up trying to compile xbmc:

Code:
~/Builds/xbmc$ make -j4
make: *** No targets specified and no makefile found.  Stop.

I ran the tutorial to the letter, obviously I overlooked something (probably obvious :o

Probably missing this:

./configure --prefix=/usr


- waha - 2011-05-03 23:02

I replaced my Debian system with Arch Linux to get a few more bleeding edge packages (Newer kernel, newer xorg-server) and rebuilt XBMC from git and 'lo and behold the ReferenceClockHang patch is no longer needed. In fact, with that patch XBMC breaks horribly when you try to exit it. Guessing either the newer kernel, or the newer xorg-server fixed it.


- sprawl - 2011-05-11 22:10

@alanwww1, I have the same problem with you with problem with autodetect of the audio capabilities over HDMI. I saw a post from you where you said:

"Manually triggering the settings make the unavailable sound modes work.", how do you manually trigger the settings and have you found any other work around?

Thanks for the nice how to!

/sprawl


- alanwww1 - 2011-05-12 09:16

sprawl Wrote:@alanwww1, I have the same problem with you with problem with autodetect of the audio capabilities over HDMI. I saw a post from you where you said:

"Manually triggering the settings make the unavailable sound modes work.", how do you manually trigger the settings and have you found any other work around?

Thanks for the nice how to!

/sprawl

Sorry i had no time to update the guide but here are the lines that triggers the available soundmodes. Just insert this into the /etc/init/xbmc.conf upstart script at the end of the "pre-start script" section.

Code:
echo sad0_rates 0x1ee0  > /proc/asound/card0/eld#3.0
    echo speakers 0x4f  > /proc/asound/card0/eld#3.0
    echo sad0_channels 8  > /proc/asound/card0/eld#3.0
    echo sad0_bits 0xe0000  > /proc/asound/card0/eld#3.0

You can verify the modes before and after with

Code:
cat /proc/asound/card0/eld#3.0

I will add this to the guide whan i have time.


Results in trying to get VAAPI running without compiling - gven - 2011-05-16 05:50

As the machine I am using is used for other purposes, I am not able to compile and install stuff so I have been trying these things out as new updates arrive that are close to what people have done here. If anyone has some insights on why things are not working yet, please do let me know.

The system is a i7-2600k running OpenSuse 11.4 64 bit

Kernel: 2.6.37
xbmc: 10.1-2.13
Mesa: 7.10.2

xbmc has the enable vaapi acceleration option in video playback settings. So I assume it is compiled to provide VAAPI acceleration.

output of vainfo
Quote:libva: libva version 0.32.0
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib64/dri/i965_drv_video.so
libva: va_openDriver() returns 0vainfo: VA API version: 0.32
vainfo: Driver version: i965 Driver 0.1
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Baseline : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD

With VAAPI tuned off in XBMC everything plays fine with no problems.

When I turned on VAAPI, xbmc tries to start the video and then it stops with a blank screen. The left hand corner has the timer which stays at 0:00 played.

At this point it is possible to use the menus to exit XBMC. But if I try running a video again, XBMC hangs in a deadlock (looks like the video thread is in a deadlock because of the previous attempt) and so it cannot exit and has to be killed.

When I look at xbmc.log for with and without the VAAPI tuned on, there is no difference in the output until it stops trying to play. With VAAPI turned on, it hangs before it gets to the following line and there is no further output:

Quote:20:06:33 T:140514050787072 M:5018001408 NOTICE: fps: 30.000000, pwidth: 480, pheight: 360, dwidth: 480, dheight: 360

Before that there are a bunch of lines like
Quote:20:06:33 T:140514050787072 M:5019779072 WARNING: Decode - avcodec_decode_video didn't consume the full packet. size: 1305, consumed: 298

that are common to both cases (with or without VAAPI).

Looks to me like all of the required libraries are up to the versions compiled in this thread from the standard repositories, so I am not sure what I am missing still.

Any enlightenment or insight would be appreciated. If there is some data I can provide that is needed for the context, please do ask.

Thanks

Edited to add: I tried if VAAPI works with VLC player on this system. Not sure but there is some change when I enable it in VLC and it plays with and without. VLC has two switches - one for direct rendering which gives the maximum benefits in reducing CPU time - otherwise both Xorg and VLC take a lot of CPU. The second switch is labeled experimental for hardware decoding support. I am assuming that this is VAAPI support. When I turn it on, the CPU usage for VLC actually increases (but still much less than what XBMC uses for the same video). VLC uses the hardware decoding and gets it back to do post-processing, so that may explain the increase in CPU time. I still have no idea if it is really doing hardware decoding although its CPU consumption is several times smaller than XBMC for the same video. I noticed from the output of VLC that it calls vainfo when hardware decoding is enabled, so clearly it is trying to use it. Just additional info for what it is worth to determine if the problem is with XBMC or with the graphics stack.


- arnoo - 2011-05-29 21:03

just did a clean ubuntu 11.04 mini install (on i3 2100T & ASUS P8H67-I) and this howto worked well, but i had to install some additional packages to get everything worked without errors:

libva
Code:
sudo apt-get install libpciaccess-dev libpciaccess0

mesa
Code:
sudo apt-get install libxt-dev

xbmc
Code:
apt-get install python-all-dev



Partial success - gven - 2011-05-30 23:28

gven Wrote:As the machine I am using is used for other purposes, I am not able to compile and install stuff so I have been trying these things out as new updates arrive that are close to what people have done here. If anyone has some insights on why things are not working yet, please do let me know.

The system is a i7-2600k running OpenSuse 11.4 64 bit

Kernel: 2.6.37
xbmc: 10.1-2.13
Mesa: 7.10.2

xbmc has the enable vaapi acceleration option in video playback settings. So I assume it is compiled to provide VAAPI acceleration.

The good news is that the rolling updates in current distros (at least OpenSuse) has caught up with the latest video rendering and driver libraries so it is no longer necessary to compile your own or use third-party libva, etc. I was able to cleanly compile the latest git clone for xbmc 11 and run it with HW VAAPI with stock updated software from the distro for everything else.

I am not able to compile xbmc 10 cleanly to try it (the configure script doesn't work for opensuse and has been changed for the 11 configure) but the packman repo xbmc 10.1 with VAAPI enabled doesn't work (dark screen lockup).

xbmc 11 is not stable enough for me in other things and so I am not able to play with it much (crashes with projectM enabled as well) but I am glad to see that VAAPI HW acceleration on the SandyBridge has become a reality without having to hack a lot of stuff.

Side note:People who want to try 11 out should be aware that if they are using a mysql database for the library, the 11 use of the db is not backward compatible with 10 because of the version table update, so xbmc 10 will not be able to use the mysqldb without some hacking/restore after you have tried 11. Just remove the mysql settings from advancedsettings.xml for trying out 11.

When xbmc 11 is released, there should be no issues (at least for the common need of playing a 720P or 1080P video source with HW decoding). Getting audio right through HDMI, etc., isn't a problem and in any case, the issues are not anything specific to SNB CPUs. The same issues exist for NVIDIA graphics as well and requires similar configurations

Unless one is into gaming, there should be no reason to get a discrete graphics card with the SandyBridge cpus especially if media consumption is the primary use. This makes it easier for slimmer and quieter HTPC builds when Atom or Fusion based systems are not enough for your needs.

Cheers to the XBMC team and good luck on the progress with 11.