Kodi Community Forum
[LINUX] HOW-TO use VAAPI HW Acceleration on AMD Zacate (Fusion) platform - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: [LINUX] HOW-TO use VAAPI HW Acceleration on AMD Zacate (Fusion) platform (/showthread.php?tid=99154)



- wsnipex - 2011-09-04

hmm I never tried openelec, maybe they have hacked in an option to change the refresh to a fixed value. Normal XBMC does not have it. I just set xorg to 60HZ and then use auto adjust framerate.


- ErikB - 2011-09-05

Hi!

I've been working every night for a week to get this working, but I just can't.
I have a Asrock E350M1 motherboard.

I've managed to get the VAAPI running correctly with the OpenElec daily build for fusion x86 (found here: http://www.mediafire.com/openelec#d5pmbbb0ay9at,1 )

However I want to run a LAMP server and a SAMBA server parallel to XBMC, so I would really need to get xbmc with VAAPI working in an environment controlled by me (which OpenElec just isn't).

Anyway, when following the OP:s step-by-step guide, I quite early run into trouble. Performing the following code:

Robotica Wrote:This topic is a follow-up to this topic: AMD Fusion based hardware for a HTPC?

.....

Upgrade to 3.0??? kernel from ppa:xorg-edgers/ppa and reboot with the new kernel.

Code:
sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get install linux-headers-3.0??? linux-headers-3.0???-generic linux-image-3.0???-generic --fix-missing
sudo reboot

Verify that you are using kernel 3.0???
Code:
uname -r


It seems to work with linux-headers-3.0??? but cannot find package for linux-headers-3.0???-generic or any of the other.

When I check with uname -r kernel is still the old, 2.6. something.

Anybody else with this problem? What to do?


- wsnipex - 2011-09-05

because the exact name of the package is not linux-headers-3.0Huh
The "?" is just a placeholder for some version numbers.
If you really need kernel 3.0 look up the exact name first:

apt-cache search linux-headers-3

anyway, I doubt kernel 3 is really needed.


- ErikB - 2011-09-05

wsnipex Wrote:because the exact name of the package is not linux-headers-3.0Huh
The "?" is just a placeholder for some version numbers.
If you really need kernel 3.0 look up the exact name first:

apt-cache search linux-headers-3

anyway, I doubt kernel 3 is really needed.

Sweet, I will try this tonight. Hopefully this helps the rest of the process to work out better as well...


- hipp0 - 2011-09-05

ErikB Wrote:Hi!

I've been working every night for a week to get this working, but I just can't.
I have a Asrock E350M1 motherboard.

I've managed to get the VAAPI running correctly with the OpenElec daily build for fusion x86 (found here: http://www.mediafire.com/openelec#d5pmbbb0ay9at,1 )

However I want to run a LAMP server and a SAMBA server parallel to XBMC, so I would really need to get xbmc with VAAPI working in an environment controlled by me (which OpenElec just isn't).

Anyway, when following the OPConfused step-by-step guide, I quite early run into trouble. Performing the following code:

Exactly my Problem to.

I have running it with natty quite well. Try to skip the Kernel update. It is not necessary in my opinion (but the openelec guys running a 3.* kernell). The easiest way is to start with a ubuntu natty desktop. Do step 2 and 3 from the first page and then add a ppa. For me VAAPI is not working with the unstable ppa but with the pvr ppa.

Unfortunately I have some other problems. Some Videos have big pixels and some are stuttering. I don't know why they are stuttering because my xbmc does not drop any frames.

I also tried to build the vaapi forke from FernetMenta but it crashes. It would be perfect if there was a github for the openelc xbmc version for fusion. Sadly this does not exist.

Does someebody have the FernetMenta github working under Natty and can give me some short steps to go there?

@wsnipex: I also tried to patch the FernetMenta patches against the xbmc mainline. But I gives me some errors when patching. I am sorry I do not have the exact command line output. Have you tried to enable the patches?


- ErikB - 2011-09-05

hipp0 Wrote:Exactly my Problem to.

@wsnipex: I also tried to patch the FernetMenta patches against the xbmc mainline. But I gives me some errors when patching. I am sorry I do not have the exact command line output. Have you tried to enable the patches?


If you go to the URLs provided, e.g. https://github.com/FernetMenta/xbmc/commit/d25fbc8248be3cc0b208614faca394c56157cf1a.patch - you will notice that the first is some email subject / details..

My guess is that you are to run only the "code" part of the files..
E.G. only run this:
Code:
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
@@ -205,6 +205,7 @@ int CDecoder::GetBuffer(AVCodecContext *avctx, AVFrame *pic)
   pic->linesize[1]    = 0;
   pic->linesize[2]    = 0;
   pic->linesize[3]    = 0;
+  pic->reordered_opaque= avctx->reordered_opaque;
   return 0;
}



- hipp0 - 2011-09-05

ErikB Wrote:If you go to the URLs provided, e.g. https://github.com/FernetMenta/xbmc/commit/d25fbc8248be3cc0b208614faca394c56157cf1a.patch - you will notice that the first is some email subject / details..
[/CODE]

Ah. Okay i thought that these lines get ignored by the patch tools. Have you already tried to build the mainline with these patches? I think I will try to do it, when I am at home.

Somebody know what is best choice for the ati driver? 11.7 oder 11.8 ?


- wsnipex - 2011-09-05

If you do as I described above it will patch the source. A "patch file" essentially is a diff which the patch command interprets to make the changes.

btw, I run mainline (GIT from 2nd September) with those 4 patches, and it works fine. A difference might be, that I do not have a fusion APU(which has an ATI 6300 series GPU), but an ATI 4250(onboard GFX), although I doubt it makes a big difference. Those details are handled driver internally and the vaapi interface remains the same.

Anyway, are you sure the patches were applied?
Can you post your commands?


- hipp0 - 2011-09-05

wsnipex Wrote:Anyway, are you sure the patches were applied?
Can you post your commands?
Code:
$ git clone git://github.com/xbmc/xbmc.git
$ cd xbmc/
$ git checkout master
Already on 'master'
$ wget https://github.com/FernetMenta/xbmc/commit/d25fbc8248be3cc0b208614faca394c56157cf1a.patch
$ patch -p1 < d25fbc8248be3cc0b208614faca394c56157cf1a.patch
patching file xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
Reversed (or previously applied) patch detected!  Assume -R? [n] ^C

As you can see it says that that the patch is already applied. patch --help says me that -N forces the patch to be applied. I compared some part of the sources and only some lines of the patch seems to be applied. So perhaps -N is the way to go? Or this deletes some important lines and I get serious problems Smile


- wsnipex - 2011-09-05

just skip the one if it says already applied, the other 3 should not give this error


- spocky184 - 2011-09-05

Hi,
following this great guide and the guide on http://wiki.cchtml.com/index.php/Ubuntu_Natty_Installation_Guide i`ve got vaapi hardware accelaration running (it`s a FOXCONN NT-A3500 Netbox Fusion E350 with a AMD HD 6310) with Opdenkamps latest xbmc-pvr build (11.0-pvr+p8~git20110829.4e9f5b7-0ubuntu1~stable48~natty), on Ubuntu Natty 11.04 desktop amd64. Latest ATI Catalyst 11.8 on Kernel 2.6.38-11-generic.

So here is exactly what i did (even if i repeat some steps mentioned in this post):

Install Dependencies:
Code:
sudo apt-get install -y --force-yes build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 dkms libqtgui4 wget execstack libelfg0 dh-modaliases
if you are running amd64:
Code:
sudo apt-get install -y --force-yes ia32-libs
Uninstall radeon driver:
Code:
sudo apt-get remove -y --force-yes --purge xserver-xorg-video-radeon
Download and install my precompiled ATI Catalyst 11.8 driver:
Code:
wget http://downloads.ztreambox.org/ztreamboxlive/ati-fglrx/catalyst11.8-natty/fglrx_8.881-0ubuntu1_amd64.deb
wget http://downloads.ztreambox.org/ztreamboxlive/ati-fglrx/catalyst11.8-natty/fglrx-dev_8.881-0ubuntu1_amd64.deb
wget http://downloads.ztreambox.org/ztreamboxlive/ati-fglrx/catalyst11.8-natty/fglrx-amdcccle_8.881-0ubuntu1_amd64.deb
wget http://downloads.ztreambox.org/ztreamboxlive/ati-fglrx/catalyst11.8-natty/fglrx-installer_8.881-0ubuntu1_amd64.changes
sudo dpkg -i fglrx*.deb
or do it yourself:
Code:
cd ~/; mkdir catalyst11.8; cd catalyst11.8/
wget http://www2.ati.com/drivers/linux/ati-driver-installer-11-8-x86.x86_64.run
sh ./ati-driver-installer-11-8-x86.x86_64.run --buildpkg Ubuntu/natty
sudo dpkg -i fglrx*.deb
Install HW-Accelaration related files:
Code:
sudo apt-get install -y --force-yes libva-dev libva1 libkms1 libdrm-dev vainfo
Install and configure xvba:
Code:
wget http://www.splitted-desktop.com/~gbeauchesne/xvba-video/xvba-video-latest.amd64.deb
sudo dpkg -i xvba-video-latest.amd64.deb
cd /usr/lib/dri
sudo ln -s /usr/lib/va/drivers/fglrx_drv_video.so fglrx_drv_video.so
sudo sh -c "echo LIBVA_DRIVER_NAME=xvba >> /etc/environment"
sudo sh -c "echo LIBVA_DRIVERS_PATH=/usr/lib/va/drivers >> /etc/environment"
Generate Base xorg.conf:
Code:
sudo aticonfig --initial -f
sudo aticonfig --input=/etc/X11/xorg.conf --tls=1
Controll if you have also these two sections in /etc/X11/xorg.conf:
Code:
Section "Extensions"
Option        "Composite"        "Disable"
EndSection

Section "ServerFlags"
Option  "AIGLX" "off"
EndSection
Reboot
Now start playing a 1080p HD Video in XBMC, press o and look if you see (on the second line): dc:ff-vc1-vaapi or dc:ff-h264-vaapi

There you go.
Hope it`s usefull and thank you again for this great guide.

Spocky184

PS: The 11.8 Catalyst resolved my Suspend Problems on the AMD E350 !


- SteelWolf - 2011-09-05

No matter what I do when following these guides I end up with XBMC unable to start because it failed to connect to the X server (startx alone fails as well). I think I'm going to try starting with Ubuntu desktop instead of minimal, it seems like many of you in the thread have had success with that.


- ErikB - 2011-09-05

I also got it to work today, using ubuntu desktop, amd 64..
Cred goes out to this thread and to that thread: http://forum.xbmc.org/showthread.php?p=853855#post853855
(and of course to Lars-opdenkamp and other rep makers!)

Code:
(clean install: Desktop x64. Perform all upgrade [sudo su;apt-get update;apt-get upgrade])

sudo apt-get install -y build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 dkms libqtgui4 wget execstack libelfg0 dh-modaliases ia32-libs

cd ~; mkdir catalyst11.8; cd catalyst11.8
apt-get install axel
axel http://www2.ati.com/drivers/linux/ati-driver-installer-11-8-x86.x86_64.run
chmod +x ati-driver-installer-11-8-x86.x86_64.run

sudo sh ./ati-driver-installer-11-8-x86.x86_64.run --buildpkg Ubuntu/natty

sudo dpkg -i fglrx*.deb

sudo aticonfig --initial -f
sudo aticonfig --input=/etc/X11/xorg.conf --tls=1

sudo reboot




sudo apt-get install -y libkms1 libdrm-dev pkg-config vainfo

cd ~
mkdir vaapi; cd vaapi
wget http://www.splitted-desktop.com/~gbeauchesne/xvba-video/xvba-video_0.8.0-1_amd64.deb
sudo dpkg -i xvba-video_0.8.0-1_amd64.deb

cd /usr/lib/dri; sudo ln -s /usr/lib/va/drivers/fglrx_drv_video.so fglrx_drv_video.so


sudo nano /etc/environment

insert:
LIBVA_DRIVER_NAME=xvba
LIBVA_DRIVERS_PATH=/usr/lib/va/drivers


sudo reboot





sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo add-apt-repository ppa:lars-opdenkamp/xbmc-pvr

sudo apt-get -y update
sudo apt-get -y install gparted chromium-browser ubuntu-restricted-extras gnome-mplayer vlc nfs-kernel-server ssh grub-customizer grub2-splashimages xbmc tvheadend

(Lots of extras that probably are unnecessary here...)

reboot

Plays well on VAAPI with 12% load on my ASROCK E350M1

Problems remaining:
1) Seems a bit heavy to run with ubuntu desktop, would be nice to try with ubuntu minimal
2) I am having "big pixel" issues with some 1080p videos. For instance the killa-sample mkv is just big pixels. Anybody resolved this?

I'm getting close to great satisfaction!


- ErikB - 2011-09-06

ErikB Wrote:...
Plays well on VAAPI with 12% load on my ASROCK E350M1

Problems remaining:
1) Seems a bit heavy to run with ubuntu desktop, would be nice to try with ubuntu minimal
2) I am having "big pixel" issues with some 1080p videos. For instance the killa-sample mkv is just big pixels. Anybody resolved this?

I'm getting close to great satisfaction!


What I mean with big pixels is shown in this image.
http://i.imgur.com/w1lar.jpg


- FernetMenta - 2011-09-06

The "big pixels" are probably because killa-sample and other videos showing this are encoded with h.264 level > 4.1. The xvba backend driver reduces the number of references needed by h.264 in this case. There might be a better way of dealing with level > 4.1. vdpau does not support level > 4.1 either but plays killa-sample fine.