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

+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Kodi 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 AMD Zacate (Fusion) platform (/showthread.php?tid=99154)



- fritsch - 2011-09-29 18:02

I have the same problem.

I filed two bugs, which tell the "two last" problems for me with the Zacate platform:

http://trac.xbmc.org/ticket/11862 (hang in menu, etc.)
http://trac.xbmc.org/ticket/12015 (problems using newer ffmpeg, which should fix the stop in video and sound issues)

My system crashes very hard if this is happening, process gets defunc and not killable anymore


- merol - 2011-09-30 11:39

Hello y follow this tutorial http://forum.xbmc.org/showthread.php?tid=106898, and all works fine except for two things:
  • The remote control, Philips rc197 don't work well. When push down sometime seem to have pressed several times. I use the in kernel driver as the tutorial say.
  • Appears the system mouse button in the center of the screen, and I have to close and reopen xbmc to remove. This happens when the system is on but without interaction for a long time. I thinking the cause was the program of automatic updates of ubuntu I've removed, but still the same problem
Any ideas?


Thank you


- bizz - 2011-09-30 15:04

Great! Finally got VAAPI for my Radeon 4830!

Here's how I did it if it helps anyone:

- installed Ubuntu 11.04 and all updates.
- added user to audio & video groups from Step1 from first post here (not sure if required)
- did a complete Step 2 from first post here
- downloaded and installed latest catalyst (11.9)
- installed xbmc from lars-op den kamp's repo:[url=https://launchpad.net/~lars-opdenkamp/+archive/xbmc-pvr] https://launchpad.net/~lars-opdenkamp/+archive/xbmc-pvr[/url]

Additionally in xbmc settings turned off VDPAU and set to Always vsync (because of tearing). And that's all.


- Redsandro - 2011-10-02 01:41

Is anyone trying this on Fedora? I prefer Fedora over Ubuntu. They seem to make some better choices lately.


- djselbeck - 2011-10-02 23:47

Yeah I tried it under fedora and it works. But I've now installed archlinux because I want a lightweight distribution for my HTPC


- Redsandro - 2011-10-03 11:00

djselbeck Wrote:Yeah I tried it under fedora and it works. But I've now installed archlinux because I want a lightweight distribution for my HTPC

I have yet to see if Fedora runs acceptably on my AMD Fusion board. I hope so, Gnome 3 is nice even though I don't need it. Otherwise I was thinking about Debian with LXDE.

Anyway, every piece of advice in these threads link to precompiled XBMC's in .deb packages, or drivers from SplitttedDesktop, which are also .deb packages.

Do you have a resource for the drivers and patched builds in Fedora?


- Robotica - 2011-10-03 13:35

fritsch Wrote:I have the same problem.

I filed two bugs, which tell the "two last" problems for me with the Zacate platform:

http://trac.xbmc.org/ticket/11862 (hang in menu, etc.)
http://trac.xbmc.org/ticket/12015 (problems using newer ffmpeg, which should fix the stop in video and sound issues)

My system crashes very hard if this is happening, process gets defunc and not killable anymore

Thnx for testing and reporting those bugs...


- Redsandro - 2011-10-08 16:41

How can you check if the proper patches were compiled with? I found this ppa for Oneiric 11.10, dunno if it's suitable for VAAPI.

https://launchpad.net/~michael.nelson/+archive/xbmc


- Redsandro - 2011-10-09 20:48

Easy XBMC-VAAPI installation

This is awesome Big Grin

I got an easy way of getting VAAPI to work with XBMC on my AMD Fusion A50M chipset (Zotac Fusion mainboard)

1. Install Ubuntu 11.10 Beta 2

Download the image and use unetbootin to create a bootable USB stick. Install from there.

2. Fixes

This is beta-software (next week the full version comes out, maybe you don't need this anymore.)

Code:
$ sudo apt-get update
$ sudo apt-get upgrade

2b. Optional fixes

Code:
$ sudo apt-get install gnome-shell
$ sudo apt-get remove overlay-scrollbar
$ sudo apt-get remove liboverlay-scrollbar-0.2-0

Please note:
MaZZly Wrote:I tried your guide and could get it to work only if i started xbmc from terminal, when starting it normally it crashes when i was about to start a video. (..) then i tried your optional fix to install gnome shell, and when inlogged into gnome shell it works flawlessly.

so maybe make that step non-optional? =D

3. Install VAAPI driver from Splitted-Desktop

New URL
Code:
$ wget http://www.splitted-desktop.com/static/libva/xvba-video/xvba-video_0.8.0-1_amd64.deb
sudo dpkg -i xvba-video_0.8.0-1_amd64.deb

4. Install Catalyst 11.8 drivers.
Run jockey-gtk and install the ATI/AMD proprietary FGLRX graphics driver. The (post-release updates) version doesn't work. Yet. Maybe it works when the final version of Ubuntu Oneiric comes out.

5. Install patched XBMC from lars-opdenkamp PPA

Create /etc/apt/sources.list.d/xbmc-opdenkamp.list with following contents:
Code:
# RED 2011-10-08
# XBMC VAAPI patched natty repo

deb http://ppa.launchpad.net/lars-opdenkamp/xbmc-pvr/ubuntu natty main
deb-src http://ppa.launchpad.net/lars-opdenkamp/xbmc-pvr/ubuntu natty main

Code:
$ apt-get update
The PPA will complain about missing key. Take the last 8 characters from the key ID and insert like so:
Code:
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8NUMHERE
Replace 8NUMHERE with the actual key ID that the complaining apt-get update provides.

Code:
$ apt-get update
$ apt-get install xbmc

5b. (optional) Check non-VAAPI playback
Movies already play back faster in XBMC due to the catalyst driver, but 1080 will probably not play back smooth yet. You can check this to make you extra happy when VAAPI works.

6. Verify correct installation of drivers

Code:
$ vainfo
libva: libva version 0.32.0
Xlib:  extension "XFree86-DRI" missing on display ":0.0".
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/fglrx_drv_video.so
libva: va_openDriver() returns -1
Error! Make a symbolic link like Robotica proposed:

Code:
$ sudo ln -s /usr/lib/va/drivers/fglrx_drv_video.so /usr/lib/dri/

Code:
$ vainfo
libva: libva version 0.32.0
Xlib:  extension "XFree86-DRI" missing on display ":0.0".
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/fglrx_drv_video.so
libva: va_openDriver() returns 0
vainfo: VA API version: 0.32
vainfo: Driver version: Splitted-Desktop Systems XvBA backend for VA-API - 0.8.0
vainfo: Supported profile and entrypoints
      VAProfileH264High               :    VAEntrypointVLD
      VAProfileVC1Advanced            :    VAEntrypointVLD
Correct!

Code:
$ fglrxinfo
display: :0.0  screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: AMD Radeon HD 6300 series Graphics
OpenGL version string: 4.1.11005 Compatibility Profile Context
Correct!

7. Start XBMC and enable VAAPI, disable VDPAU

Robotica provided a nice screenshot:
http://gaspo.dyndns.org/files/xbmc-settings-videos-playback.png

8. Start XBMC, ready for action!
Restart XBMC, and play your 1080p movie.

Big GrinBig GrinBig GrinBig Grin


Now, if only someone knew a trick to make Adobe Flash play fluent fullscreen in the browser..

-edit- Concerning Flash playback

Quote:Now, if only someone knew a trick to make Adobe Flash play fluent fullscreen in the browser..
Gnash / Lightspark support vaapi accelerated playback. They are far from perfect Flash-replacements, but if one could get them to work, it would at least enable us to watch youtube-like video's on this platform.

Installation is easy
Code:
$ sudo apt-get install lightspark browser-plugin-lightspark
Go to Firefox -> Add-Ons -> Plugins
Disable the Adobe Flash plugin, enable the Lightspark plugin.

But

For me, vaapi does not work. It should though, because gbeauchesne from Splitted-Desktop donated the code to those projects upstream himself.


- Redsandro - 2011-10-11 02:57

Concerning mplayer

Robotica Wrote:
Code:
wget http://www.splitted-desktop.com/~gbeauchesne/mplayer-vaapi/mplayer-vaapi-latest-FULL.tar.bz2
sudo apt-get build-dep mplayer
tar -xpvf mplayer-vaapi-latest-FULL.tar.bz2
cd mplayer-vaapi-20100713/
./checkout-patch-build.sh
cd mplayer-vaapi
sudo make install

You can check a film with:
Code:
mplayer -vo vaapi -va vaapi -lavdopts threads=N moviename.mkv
where N is the number of threads you want to use.

If Mplayer plays the file fine then it is time for some log files: Xorg.0.log, aticonfig, glxinfo, xbmc.log & dmesg. Check this out for decent bug-reporting.

For me, XBMC plays fine, but I cannot get mplayer to work.

Code:
# wget http://www.splitted-desktop.com/static/libva/mplayer-vaapi/mplayer-vaapi-20110127-FULL.tar.bz2
# tar -xjvf mplayer-vaapi-20110127-FULL.tar.bz2
# cd mplayer-vaapi-20110127
# ./checkout-patch-build.sh
(...) #a whole lot of blahblah that takes very long on my htpc
# cd mplayer-vaapi/
# make install
install -d /usr/local/bin /usr/local/etc/mplayer /usr/local/lib
install -m 755 -s mencoder /usr/local/bin
install -d /usr/local/share/man/man1
install -m 644 DOCS/man/en/mplayer.1 /usr/local/share/man/man1/
cd /usr/local/share/man/man1 && ln -sf mplayer.1 mencoder.1
install -m 755 -s mplayer /usr/local/bin
#

Test:
Code:
$ mplayer -fs -vo vaapi -va vaapi -lavdopts threads=2 /home/sander/redserv.fs/red/media/films/Avatar.mkv
mplayer: Symbol `ff_codec_bmp_tags' has different size in shared object, consider re-linking
Unknown option on the command line: -va
Error parsing option on the command line: -va
MPlayer SVN-r33713-4.6.1 (C) 2000-2011 MPlayer Team
^ Does not work. Without -va, it sais:
Code:
Error opening/initializing the selected video_out (-vo) device.
Video: no video
This is the date I did make install, so I got the correct version.
Code:
$ ll `which mplayer`
-rwxr-xr-x 1 root root 11M 2011-10-11 02:23 /usr/local/bin/mplayer*
Doublecheck
Code:
# pwd
/root/vaapi/mplayer/mplayer-vaapi-20110127/mplayer-vaapi
# ./mplayer -vo help
MPlayer SVN-r32819-4.6.1 (C) 2000-2011 MPlayer Team
Available video output drivers:
    fbdev    Framebuffer Device
    fbdev2    Framebuffer Device
    v4l2    V4L2 MPEG Video Decoder Output
    cvidix    console VIDIX
    null    Null video output
    mpegpes    MPEG-PES to DVB card
    yuv4mpeg    yuv4mpeg output for mjpegtools
    png    PNG file
    tga    Targa output
    pnm    PPM/PGM/PGMYUV file
    md5sum    md5sum of each frame
^No VAAPI

Tried various remixes of parameters and paths, just no ball. Did I miss a step to enable vaapi?

-update-

Somewhere during the blahblah (checkout make) I saw this.

I think there is way to many no. Arent Jack/Alsa/Xv and a whole lot of others supposed to say 'yes' for mplayer?

Anyway I colorized the ones relevant to not playing vaapi.

Quote:(...)
Checking for Xrender ... no
Checking for Xv ... no
Checking for XvMC ... no
Checking for VDPAU ... no
Checking for Xinerama ... no
(...)
Checking for GIF support ... no
Checking for VESA support ... no
Checking for SDL ... no
Checking for OpenGL ... no
Checking for OpenGL utilities (GLU) ... no
Checking for MatrixView ... no
Checking for DXR2 ... no
Checking for DXR3/H+ ... no
Checking for IVTV TV-Out (pre linux-2.6.24) ... no
Checking for V4L2 MPEG Decoder ... yes
Checking for OSS Audio ... yes
Checking for aRts ... no
Checking for EsounD ... no
Checking for NAS ... no
Checking for pulse ... no
Checking for ... no
Checking for OpenAL ... no
Checking for ALSA audio ... no
Checking for Sun audio ... no
[COLOR="red"]Checking for VA-API ... no
Checking for VA-API (with GLX support) ... no
[/COLOR]

Checking for VCD support ... yes
(...)
even though
Quote:$ vainfo
libva: libva version 0.32.0
Xlib: extension "XFree86-DRI" missing on display ":0.0".
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/fglrx_drv_video.so
libva: va_openDriver() returns 0
vainfo: VA API version: 0.32
vainfo: Driver version: Splitted-Desktop Systems XvBA backend for VA-API - 0.8.0
vainfo: Supported profile and entrypoints
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
And I do have those headers installed otherwise it wouldn't build at all.

BTW, a note on VLC, it works out of the box if you enable hardware acceleration if you have the vaapi driver installed.
I have this impossible h264 1080p and VLC went from like 0.2 frames to 4 frames per second. But XBMC plays it fluently! Big Grin

Either the XBMC implementation is kick-ass, or the VLC one kinda sucks. Or both.


- MaZZly - 2011-10-12 08:26

Redsandro Wrote:Easy XBMC-VAAPI installation

This is awesome Big Grin

I got an easy way of getting VAAPI to work with XBMC on my AMD Fusion A50M chipset (Zotac Fusion mainboard)

1. Install Ubuntu 11.10 Beta 2

Download the image and use unetbootin to create a bootable USB stick. Install from there.

2. Fixes

This is beta-software (next week the full version comes out, maybe you don't need this anymore.)

Code:
$ sudo apt-get update
$ sudo apt-get upgrade

2b. Optional fixes

Code:
$ sudo apt-get install gnome-shell
$ sudo apt-get remove overlay-scrollbar
$ sudo apt-get remove liboverlay-scrollbar-0.2-0

3. Install VAAPI driver from Splitted-Desktop

New URL
Code:
$ wget http://www.splitted-desktop.com/static/libva/xvba-video/xvba-video_0.8.0-1_amd64.deb
sudo dpkg -i xvba-video_0.8.0-1_amd64.deb

4. Install Catalyst 11.8 drivers.
Run jockey-gtk and install the ATI/AMD proprietary FGLRX graphics driver. The (post-release updates) version doesn't work. Yet. Maybe it works when the final version of Ubuntu Oneiric comes out.

5. Install patched XBMC from lars-opdenkamp PPA

Create /etc/apt/sources.list.d/xbmc-opdenkamp.list with following contents:
Code:
# RED 2011-10-08
# XBMC VAAPI patched natty repo

deb http://ppa.launchpad.net/lars-opdenkamp/xbmc-pvr/ubuntu natty main
deb-src http://ppa.launchpad.net/lars-opdenkamp/xbmc-pvr/ubuntu natty main

Code:
$ apt-get update
The PPA will complain about missing key. Take the last 8 characters from the key ID and insert like so:
Code:
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8NUMHERE
Replace 8NUMHERE with the actual key ID that the complaining apt-get update provides.

Code:
$ apt-get update
$ apt-get install xbmc

5b. (optional) Check non-VAAPI playback
Movies already play back faster in XBMC due to the catalyst driver, but 1080 will probably not play back smooth yet. You can check this to make you extra happy when VAAPI works.

6. Verify correct installation of drivers

Code:
$ vainfo
libva: libva version 0.32.0
Xlib:  extension "XFree86-DRI" missing on display ":0.0".
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/fglrx_drv_video.so
libva: va_openDriver() returns -1
Error! Make a symbolic link like Robotica proposed:

Code:
$ sudo ln -s /usr/lib/va/drivers/fglrx_drv_video.so /usr/lib/dri/

Code:
$ vainfo
libva: libva version 0.32.0
Xlib:  extension "XFree86-DRI" missing on display ":0.0".
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/fglrx_drv_video.so
libva: va_openDriver() returns 0
vainfo: VA API version: 0.32
vainfo: Driver version: Splitted-Desktop Systems XvBA backend for VA-API - 0.8.0
vainfo: Supported profile and entrypoints
      VAProfileH264High               :    VAEntrypointVLD
      VAProfileVC1Advanced            :    VAEntrypointVLD
Correct!

Code:
$ fglrxinfo
display: :0.0  screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: AMD Radeon HD 6300 series Graphics
OpenGL version string: 4.1.11005 Compatibility Profile Context
Correct!

7. Start XBMC and enable VAAPI, disable VDPAU

Robotica provided a nice screenshot:
http://gaspo.dyndns.org/files/xbmc-settings-videos-playback.png

8. Start XBMC, ready for action!
Restart XBMC, and play your 1080p movie.

Big GrinBig GrinBig GrinBig Grin


Now, if only someone knew a trick to make Adobe Flash play fluent fullscreen in the browser..

I tried your guide and could get it to work only if i started xbmc from terminal, when starting it normally it crashes when i was about to start a video..
also when i started it the startup logo was weird.

BUT
then i tried your optional fix to install gnome shell, and when inlogged into gnome shell it works flawlessly..

so maybe make that step non-optional? =D

thnx m8

now my 170€ htpc works fine.. love it how spdif works out of the box also =)


- Robotica - 2011-10-12 14:23

fritsch Wrote:I have the same problem.

I filed two bugs, which tell the "two last" problems for me with the Zacate platform:

http://trac.xbmc.org/ticket/11862 (hang in menu, etc.)
http://trac.xbmc.org/ticket/12015 (problems using newer ffmpeg, which should fix the stop in video and sound issues)

My system crashes very hard if this is happening, process gets defunc and not killable anymore

There is a patch for compiling against newer FFMPEG: http://trac.xbmc.org/ticket/11689
And for this ticket, it is best to cc Fernetmenta/bobo1on1 in the ticket: http://trac.xbmc.org/ticket/11862

Together with Fernetmenta patches for the 24p bug, audio out of sync after pause/seek issue, the catylist driver 11.8 which solved the Suspend Problems and the the great bugreport from fritsch, it looks like all known problems will be soon solved. Oh, only the big pixel issue could be handled better by XBMC.

Make sure to have your settings set to rendermethod is VAAPI, set Always vsync= enabled, sync audio to video = disabled & "Adjust display refresh rate to match video". If you have the "Adjust display refresh rate to match video" setting enabled XBMC will adjust the refresh rate to 24Hz, 25Hz, or whatever the video frame rate is when you play the video. The ATI control center helpfully sets the screen scaling separately for each refresh rate, so the screen scaling will vary depending on what video you play.


Last things: I am running without a GUI and with aticonfig cli-based, it is possible to activate the "tearfree option" setting.

Answer:
Code:
$ amdxdg-su -c amdcccle

or

$ sudo amdcccle

And I've read someone was using a leightweight windows manager (replacement for X). Maybe something like twm-kiosk, wayland, enlightment, fluxbox or windowmaker? Any more info on this? And I would love to test some even more minimal distro's? anyone idea's?


- Redsandro - 2011-10-12 18:24

MaZZly Wrote:I tried your guide and could get it to work only if i
thnx m8

Thanks MaZZly, I added your suggestion to the optional step. Smile
Honestly, I didn't try it without the optional step, because without it Ubuntu is more like EwwBuntu to me. Frown But I know some people like it the way it is, so I made the step optional not to offend anynoe. Big Grin

btw you shouldn't quote such a lengthy post in it's entirety. :o

@Robotica: Could you give some pointers on getting mplayer-vaapi and/or gstreamer-vaapi to work with vaapi?

Using the information both provided by Splitted-Desktop and by your second post, I just couldn't get them to work.

These little Fusion machines are worth so much more within Linux if we could get some desktop player to play video like a boss also.


- Robotica - 2011-10-13 10:41

Doesn't this work:
Code:
cd /usr/src
wget http://www.splitted-desktop.com/static/libva/mplayer-vaapi/
tar xvfj mplayer-vaapi-latest.tar.bz2  (or: tar -xpvf mplayer-vaapi-latest-FULL.tar.bz2 )
cd mplayer-vaapi-20110127/
./checkout-patch-build.sh
cd mplayer-vaapi
(sudo)make install
ldconfig

(I just used the build instructions: http://www.splitted-desktop.com/static/libva/mplayer-vaapi/)

Then play with
./mplayer -vo vaapi -va vaapi filename


- Redsandro - 2011-10-13 14:46

That is so weird, I must be missing something.

I tried it again, I just keep getting
Error opening/initializing the selected video_out (-vo) device.
There is no vaapi.

Build:
Quote:# tar -xjpf mplayer-vaapi-20110127-FULL.tar.bz2
# cd mplayer-vaapi-20110127
# ./checkout-patch-build.sh
patching file Makefile
(...)
Checking for VA-API ... no
Checking for VA-API (with GLX support) ... no
(...)
Config files successfully generated by ./configure --enable-vaapi --disable-vdpau !
# cd mplayer-vaapi/
# make install
install -d /usr/local/bin /usr/local/etc/mplayer /usr/local/lib
install -m 755 -s mencoder /usr/local/bin
install -d /usr/local/share/man/man1
install -m 644 DOCS/man/en/mplayer.1 /usr/local/share/man/man1/
cd /usr/local/share/man/man1 && ln -sf mplayer.1 mencoder.1
install -m 755 -s mplayer /usr/local/bin
# ldconfig

Play:
Quote:# ./mplayer -vo vaapi -va vaapi /home/sample.mkv
MPlayer SVN-r32819-4.6.1 © 2000-2011 MPlayer Team
/home/sample.mkv
Playing /home/sample.mkv.
libavformat file format detected.
[matroska,webm @ 0x2d3a880] Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (dca), -aid 0, -alang eng
VIDEO: [H264] 1280x720 0bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
Load subtitles in /home/
Error opening/initializing the selected video_out (-vo) device.
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 1536.0 kbit/100.00% (ratio: 192000->192000)
Selected audio codec: [ffdca] afm: ffmpeg (FFmpeg DTS)
==========================================================================
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
DVB card number must be between 1 and 4
AO: [null] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...

Code:
# [b]./mplayer -vo help[/b]
MPlayer SVN-r32819-4.6.1 (C) 2000-2011 MPlayer Team
Available video output drivers:
    fbdev    Framebuffer Device
    fbdev2    Framebuffer Device
    v4l2    V4L2 MPEG Video Decoder Output
    cvidix    console VIDIX
    null    Null video output
    mpegpes    MPEG-PES to DVB card
    yuv4mpeg    yuv4mpeg output for mjpegtools
    png    PNG file
    tga    Targa output
    pnm    PPM/PGM/PGMYUV file
    md5sum    md5sum of each frame