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)



- peterk2005 - 2011-06-18

dafrog Wrote:p.s.
I have some picture "offsets" - looking like a line separating the movie in two parts ... above the line "old frame" (1/4) below "new frame"(3/4). This line appears on top(1/4) or bottom (1/4). I hope I described it coherent...
Any solution?

I think you are talking about tearing. Set vertical synchronization ON (or always) in system/video output settings.


- Rapoza - 2011-06-19

gaspo100 Wrote:@Rapoza

When I forgot to set 'export DEVICE=:0' and run vainfo I got got the same weird messages. Once the DEVICE was set I got vainfo,fglrxinfo messages as WytRaven.

I done the export at the time, but no effect.
I don't understand why I always get those vainfo and fglrxinfo results any time I do a install on natty.

I followed the instructions of WytRaven to the word, And the fact is that I don't have sound and crash every time I start playing a movie. Same message on the xbmc crash log.
But I'm still not using spdif nor havent disabled analog audio (I'm using it)
Done the mixer thing thou.

@WytRaven
Perhaps the installed packages on upgrade where:
libdrm-nouveau1a libdrm-radeon1 libpixman-1-0


- Rapoza - 2011-06-19

@dafrog

Men! I think would send you a pack of beers:
Quote:xbmc@HTPC:~$ vainfo
libva: libva version 0.32.0
Xlib: extension "XFree86-DRI" missing on display ":0.0".
libva: va_getDriverName() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit
xbmc@HTPC:~$ export LIBVA_DRIVERS_PATH=/usr/lib/dri
xbmc@HTPC:~$ export LIBVA_DRIVER_NAME=fglrx
xbmc@HTPC:~$ export DISPLAY=:0
xbmc@HTPC:~$ fglrxinfo
display: :0 screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: AMD Radeon HD 6300 series Graphics
OpenGL version string: 4.1.10834 Compatibility Profile Context

xbmc@HTPC:~$ vainfo
libva: libva version 0.32.0
libva: User requested driver 'fglrx'
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.7.8
vainfo: Supported profile and entrypoints
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD

Now I'll check if this runs. Laugh


- WytRaven - 2011-06-19

dafrog Wrote:p.s.
I have some picture "offsets" - looking like a line separating the movie in two parts ... above the line "old frame" (1/4) below "new frame"(3/4). This line appears on top(1/4) or bottom (1/4). I hope I described it coherent...
Any solution?

Good to hear you are up and running. The problem you seem to be describing is screen tearing which is caused by a mismatch between the rate the TV is refreshing the screen and the rate xbmc is updating the screen.

There are settings in xbmc under both video/playback and system/video that deal with syncing to vertical blank but this is where the problem with 24Hz and syncing, discussed earlier, come about.


- WytRaven - 2011-06-19

jbo87 Wrote:@WytRaven: I think you should install the ATI driver before you unmute w/ alsamixer because otherwise the HDMI output is not detected. At least for me.

Apparently this wan't a problem for me but as you have experienced it I have moved the alsa config part down to after installing fglrx and before installing xbmc in the instructions txt file.


- WytRaven - 2011-06-19

BTW just for reference. I mentioned earlier the 24p-isn't-really-24p thing. Here's what I was referring to. It may not actually be relevant to the 24p vsync issues but it's food for thought anyway.

http://danielsteinberg.net/2010/07/24p/


- WytRaven - 2011-06-19

And now just for shits and giggles it would seem, without changing any system files or configurations at all, VA API is consistently crashing xbmc again every single time I select a video to play. This issue is persisting between reboots.

EDIT: Ok so I found the issue. I switched from SLiM to nodm as a display manager. I don't know why but xbmc/vaapi doesn't like nodm apparently...or I misconfigured it somehow :/


- Rapoza - 2011-06-19

Good morning boys.
Setting the driver variables fixed the crash problem. So I included them in the envorinment file:
Quote:echo "" >> /etc/environment
echo "LIBVA_DRIVERS_PATH=/usr/lib/dri" >> /etc/environment
echo "LIBVA_DRIVER_NAME=fglrx" >> /etc/environment

I also managed to mount the network shared drive. That wasn't trivial as they are both samba and cifs involved and some bug there.

I got rid of the Tearing adjusting the options related to vsync in xbmc. Adjust screen freq to video=on and Vsync always on.

Now playing with 15%/10% cpu load.

But I still have two issues:
No audio. Xbmc says cannot access to audio card, check settings. I searching for the command to choose audio adapter from cl. Anyone remembers?

Other thing is I'm surprised that xbmc doesn't load automatically at start after "xinit xbmc-standalone" as my other installations. WytRaven, is something due to any command in your instructions.
And I have some underscan... or over. Don't know. The fact is that I always have the black frame around. Perhaps "aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0" wasn't needed for my screen? If so, How this can be disabled?

Tomorow will post some captures and the contents of xorg.conf

Regards
Sergio.


- WytRaven - 2011-06-19

Rapoza Wrote:And I have some underscan... or over. Don't know. The fact is that I always have the black frame around. Perhaps "aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0" wasn't needed for my screen? If so, How this can be disabled?

You have underscan so that would suggest that the above command has had no effect on your system for whatever reason. I used that command to set max overscan on my TV then used xbmc's video calibration to bring it back in to an exact fit.


- gaspo100 - 2011-06-19

Thanks Rapoza, this worked for me too:
Quote:echo "" >> /etc/environment
echo "LIBVA_DRIVERS_PATH=/usr/lib/dri" >> /etc/environment
echo "LIBVA_DRIVER_NAME=fglrx" >> /etc/environment
echo "DISPLAY=:0" >> /etc/environment

To get rid off tearing in Settings>System>Video Output I set 'Vertical blank sync' to 'Always On'. I didn't have to change any other settings. My audio device is set to 'hdmi (ALSA)' for playback and passthrough.

All is working fine, bluray rips play with 10-15% cpu.
The only thing I have noticed is that when trying to play mkv HD TV shows (SG Universe, Bing Bang Theory, etc.) it takes about 5-10 seconds before audio starts playing and syncs with video.

How do you configure system for the XBMC shutdown options to work properly? I mean, when I select shutdown or reboot, I get command prompt login or sometimes just black screen with cursor blinking.


- SDM2011 - 2011-06-19

Quote:No audio. Xbmc says cannot access to audio card, check settings. I searching for the command to choose audio adapter from cl. Anyone remembers?

I just installed pulseaudio and set it to output to all devices simultaneously (include "module-combine" in the pulse config, add yourself to the pulse groups). Works great for me. The only thing that doesn't work is that xbmc itself doesn't output to this sound sink, it just uses the analog output, regardless of the audio settings. There's a manual setting I have to tweak somewhere, I just haven't gotten around to it.

Quote:How do you configure system for the XBMC shutdown options to work properly? I mean, when I select shutdown or reboot, I get command prompt login or sometimes just black screen with cursor blinking.

I just partially solved this issue myself:

  1. Follow the wiki guide: http://wiki.xbmc.org/index.php?title=Ubuntu_Suspend_/_Wake
  2. Change the command you use to launch xbmc, to launch via ck-launch-session:
    Code:
    ck-launch-session xbmc --standalone
This allows shutdown for me, though not suspend or hibernate. If anyone can shed light on the latter two, that would be much appreciated.


- craigdabbs - 2011-06-19

thanks dafrog,

i had spent hours and hours of reinstalling ubuntu trying to get vaapi working. Seems it was all to do with the missing variables.
Also thanks to wytraven, very nice guide Smile.

I now have it running 1080p perfect with surround sound through a receiver and xbmc starting up automatically.
I have only just started using linux so its been a bit of a learning curve.

I stayed with the default kernel and unpatched ati driver, seems to work fine btw.

Thanks for this thread and everyones input without it i would of been stuffed.

dont forget for menu sounds create ~/.asoundrc file with
Code:
pcm.!default {
   type plug
   slave {
       pcm "hw:0,3"
       rate 48000
   }
}
find your device with aplay -l

Craig

MP3 playback needed a extra library installed
apt-get install libmad0


- htpcero - 2011-06-19

Rapoza Wrote:Good morning boys.
Setting the driver variables fixed the crash problem. So I included them in the envorinment file:


I also managed to mount the network shared drive. That wasn't trivial as they are both samba and cifs involved and some bug there.

I got rid of the Tearing adjusting the options related to vsync in xbmc. Adjust screen freq to video=on and Vsync always on.

Now playing with 15%/10% cpu load.

But I still have two issues:
No audio. Xbmc says cannot access to audio card, check settings. I searching for the command to choose audio adapter from cl. Anyone remembers?

Other thing is I'm surprised that xbmc doesn't load automatically at start after "xinit xbmc-standalone" as my other installations. WytRaven, is something due to any command in your instructions.
And I have some underscan... or over. Don't know. The fact is that I always have the black frame around. Perhaps "aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0" wasn't needed for my screen? If so, How this can be disabled?

Tomorow will post some captures and the contents of xorg.conf

Regards
Sergio.


This fixed the VAAPI crash in my htpc too!! I am running Natty/AMD64, on AMD Fusion (ASUS E35MI-1 Deluxe), XBMC-PVR from Lars' PPA; and for the first time I have VAAPI working (zero drops when playing MPEG4/H264 content, 14% CPU; before, I had hundreds and hundreds of frame drops and 95% CPU)

In my case, the third line (DISPLAY) above was not needed.

The below may help you or give you pointers with regards to the issues you see.

The only outstanding issue I currently have is on the LIRC side of things: Suspend works fine, and resume works as well however after resume, my mce-remote dies (the IR receiver's LED stays on continously after the box wakes up); the system log shows a kernel exception related to lirc. There is a bug opened on launchpad.



Audio (I use SPDIF)
Code:
Enable SPDIF output

run “alsamixer”

In alsamixer unmute the spdif devices. Then we store this setting.

alsamixer
sudo alsactl store

Then in XBMC, select:

        Audio Output = Optical/Coax
        Dolby Digital Capable Receiver = ON
        DTS Capable Receiver = ON
        Audio Output Device = HDA ATI SB iec958 (ALSA)
        Passthrough Output Device = HDA ATI SB iec958 (ALSA)


Passthrough confirmed to work OK (Dolby & DTS) on this setup with my receiver


Automatically execute XBMC on boot (and automatically relaunch it if it crashes, using Ubuntu's upstart):

Code:
Autostart XBMC on boot (properly - using upstart)

The following  will create a “/usr/bin/runXBMC” script, and a new upstart job (/etc/init/xbmc.conf)

sudo wget http://paste.kde.org/7158/raw/ -O /etc/init/xbmc.conf
sudo ln -s /lib/init/upstart-job /etc/init.d/xbmc
sudo wget http://paste.kde.org/7022/raw/ -O /usr/bin/runXBMC
sudo chmod a+x /usr/bin/runXBMC

in /usr/bin/runXBMC, change the path to reflect the location of the executable in your system:

    /usr/lib/xbmc/xbmc.bin  --standalone


To avoid grub from overiding the “kernel selection timeout counter” after a hard reboot or crash (otherwise, a keyboard would be needed to select the kernel to boot after a hard reboot)

       # the following will have grub to always auto-select the default kernel after the timeout period elapses

        sudo grub-editenv /boot/grub/grubenv set recordfail=0


Underscan issue:

To fix the underscan issue, I added the following to my xbmc launch script:

Code:
aticonfig --set-dispattrib=dfp1,positionX:0
aticonfig --set-dispattrib=dfp1,positionY:0
aticonfig --set-dispattrib=dfp1,sizeX:1920
aticonfig --set-dispattrib=dfp1,sizeX:1920

The "dfp1" string (works like a screen name) may differ in your system; see the following links for reference:

Code:
http://ubuntuforums.org/showthread.php?t=1409508
http://forum.xbmc.org/showthread.php?p=782438



- craigdabbs - 2011-06-19

@ rapoza

selecting the right audio device in xbmc is a bit hit and miss, you can add it manually using the custom option

In terminal do aplay -l

find the soundcard you want to use, look for card: X device: X
then just add hw:0,3 to the custom field in xbmc on both. replace 0,3 with your card,device.

Also make sure you have added the user running xbmc to the audio and video group
sudo adduser "user" audio


- jbo87 - 2011-06-19

So wakeup from STR works for you under linux? I guess ur not using the AsRock E350M1 then...