XBMC Community Forum

Full Version: Radeon OSS with vdpau (howto)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Warning: This Howto assumes you know how to use ssh and howto create a file on a linux system. Furthermore you need to know what sudo is - if one is unknown to you - this is not the howto you want to follow

After AMD proprietary department did not care for XvBA for more than 2 years now and no AMD driver since 12.10 was really usable, we got into contact with the AMD OSS devs. Within just 2 weeks, we got more working than we ever hoped with the oss radeon vdpau in comparison to fglrx binary blob xvba implementation. As it now made a whole lot of fun working with AMD hardware, we have dropped XvBA completely (it is parked in fernetmentas xvba branch).

What you get
- Bitstream Audio (including DTS-HD, TrueHD, LPCM 7.1)
- max resolution: 2048 x 1152
- mpeg2, mpeg4, h264, vc1 advanced accleration
- Bob and Temporal deinterlacing via vdpau
- 110% speed as with the fglrx implementation

Known issues for now
- xbmc will segfault when you press stop - this will be fixed when ubuntu updates their mesa package (See the workaround below)

-1.) Hardware Requirements / Software Requirements
UVD 2.2 or higher See here: http://en.wikipedia.org/wiki/Unified_Vid...abled_GPUs
Ubuntu Trusty mini or server iso installed x64.

You can download the mini.iso here: http://archive.ubuntu.com/ubuntu/dists/t...t/mini.iso

UEFI: If you need an UEFI installation, please use the server iso instead, but make sure you boot the Computer in UEFI mode, you can download the server iso from here: http://cdimage.ubuntu.com/ubuntu-server/...-amd64.iso

0.) Basic Installation and script tuning
After the mini iso is installed, continue with the following steps:

sudo apt-get update
sudo apt-get install ssh python-software-properties software-properties-common udisks upower xorg alsa-utils mesa-utils git-core librtmp0 lirc libmad0 lm-sensors libmpeg2-4 avahi-daemon libnfs1 consolekit pm-utils vdpauinfo linux-firmware mesa-vdpau-drivers
sudo apt-get dist-upgrade

Allow every user (everyone) to start X11
sudo dpkg-reconfigure x11-common

Create the xbmc user and it add it the relevant groups. If you have created the xbmc user during installation only do the usermod part.
sudo adduser xbmc
sudo usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip xbmc

To use the following upstart procedure you need to create /etc/init/xbmc.conf to start xbmc via upstart. That scripts does only wait for your HDMI device, if you want to wait for networking, you have to add that.
# xbmc-upstart
# starts XBMC on startup by using xinit.
# by default runs as xbmc, to change edit below.
env USER=xbmc

description     "XBMC-barebones-upstart-script"
author          "Matt Filetto"

# if you use mysql you need to wait for your network device
# that means you should add 'and net-device-up IFACE!=lo' behind the udevtrigger

start on (filesystem and stopped udevtrigger)
stop on runlevel [016]

# tell upstart to respawn the process if abnormal exit
respawn limit 10 5
limit nice 21 21

exec su -c "xinit /usr/bin/xbmc --standalone -- /usr/bin/X -bs -nolisten tcp :0" $USER
# the following two are to get an idea, if you want to user a window manager
#   exec su -c "xinit /usr/bin/startfluxbox --  /usr/bin/X -bs -nolisten tcp :0" $USER
end script

edit /etc/security/limits.conf and add before the end. remember xbmc is the username, not the application. This will allow your user to get the audio thread a bit more priority.
xbmc             -       nice            -1

Last thing is missing some permissions to shutdown, suspend the computer, therefore create the file /etc/polkit-1/localauthority/50-local.d/custom-actions.pkla with the following content (don't introduce line breaks, especially the Action= line must be exactly one line (especially no linebreaks or auto ".." in freedesktop.udisks.*), verify this):
[Actions for xbmc user]

[Untrusted Upgrade]

1a) Installation of the Fernetmenta version of xbmc with hevc, ffmpeg 2.2.x)
sudo apt-add-repository ppa:wsnipex/xbmc-fernetmenta-master
sudo apt-get update
sudo apt-get install xbmc xbmc-bin

This option 1a includes the following changes:
- multimonitor support (SDL is removed)
- ffmpeg 2.2.x with HEVC (aka H265) support
- VC1 interlaced playback support
- SWFilter for VAAPI installations for advanced deinterlacing (not relevant for AMD users)
- It is based on xbmc master therefore will likely get unstable after gotham is out.

XOR You only need one of those

1b) Installation of the team xbmc repository with gotham final mainline builds
sudo apt-add-repository ppa:team-xbmc/ppa
sudo apt-get update
sudo apt-get install xbmc xbmc-bin
Reboot of the system
We are done now with installing. We will reboot now, remember to make the following settings within xbmc in step 2. It could also be good to disable the RSS Reader to save some processing power.
sudo reboot

If you loose keyboard with the option 1a, please use 1b instead ... SDL won't survive it ...

2.) XBMC settings
(Set xbmc to Advanced or Expert before doing this - settings hierarchies, see in the middle of confluence)
System->Settings->System->Video output
Vertical blank sync: Let Driver choose

System ->Video->Acceleration:
Prefer VDPAU Mixer: ON
VAAPI: off

System -> Video -> Playback:
Adjust Refreshrate to match video: On
Sync Playback to Display: On
Sync Method: Video Clock (Drop/Dupe)

advancedsettings.xml in /home/xbmc/.xbmc/userdata/advancedsettings.xml should contain (don't create that file / directory as root - use the xbmc user):
   <loglevel hide="false">0</loglevel>
  <useddsfanart>true</useddsfanart> <!-- Do not use on Apple TV2/iOS/RPi/many Android systems -->
  <cputempcommand>sensors|sed -ne "s/Core 0: \+[-+]\([0-9]\+\).*/\1 C/p"</cputempcommand>
  <gputempcommand>sensors|sed -ne "s/temp1: \+[-+]\([0-9]\+\).*/\1 C/p"</gputempcommand>
      <delay>175</delay> <!-- set to zero or adjust if audio seems out of sync with 24p movies -->

Fancy Splash?
sudo apt-get update
sudo apt-get install plymouth-label v86d
wget http://excyle.nl/plymouth-theme-xbmc-logo.deb
sudo dpkg -i plymouth-theme-xbmc-logo.deb

Here we need to workaround a segfault bug, when stopping videos (this will hopefully be fixed with final trusty released):
sudo apt-add-repository ppa:wsnipex/mesa
sudo apt-get update
sudo apt-get dist-upgrade

Final reboot and we are done:
sudo reboot

Installation is now finished - you can start to enjoy your xbmc installation

In case something should not work as you expected it, please follow the Troubleshooting steps.

We need full debug logs that show the issue. We don't look at cut out logfiles, as most of the time, the important part is missing. Additionally get us the output of dmesg, Xorg.0.log and vdpauinfo. Don't post the logs inline, don't use google drive or something, just post links to known pastebins. Set xbmc into debugging mode, redo what is causing errors and afterwards do:

sudo apt-get install pastebinit
dmesg | pastebinit
cat ~/.xbmc/temp/xbmc.log | pastebinit
cat /var/log/Xorg.0.log | pastebinit
DISPLAY=:0 vdpauinfo | pastebinit
dpkg -l |grep mesa | pastebinit

Mpeg-2 Crashes
If you have bad luck, you got an AMD card that does mpeg-2 decoding in shaders, which segfaults when done multithreaded. Switch Confluence to Expert and disable Mpeg-2 under Video Acceleration.

Relevant output from qvdpauinfo:
Quote:qvdpautest 0.5.2
AMD E-350 Processor
Unknown GPU

VDPAU API version : 1
VDPAU implementation : G3DVL VDPAU Driver Shared Library version 1.0

FATAL: get_bits failed : No backend implementation could be loaded.!!
MPEG DECODING (1920x1080): 59 frames/s
MPEG DECODING (1280x720): 92 frames/s
H264 DECODING (1920x1080): 38 frames/s
H264 DECODING (1280x720): 70 frames/s
VC1 DECODING (1440x1080): 85 frames/s
MPEG4 DECODING (1920x1080): 54 frames/s
MIXER WEAVE (1920x1080): 275 frames/s
MIXER BOB (1920x1080): 439 fields/s

Audio trouble shooting

Check if you audio device is muted
You can use alsamixer -c0 or alsamixer -c1 to do it manually, or use something like:
amixer set 'IEC958',0 unmute

If DTS-HD / TrueHD does not work or your kernel complains about broken edid, consider the following:

Download: https://dl.dropboxusercontent.com/u/5572...arantz.bin and save it to /lib/firmware/edid
You have to create the /lib/firmware/edid directory. Make 100% sure, the file has exact 256 Byte after download, if not redownload it.

afterwards edit /etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="drm_kms_helper.edid_firmware=HDMI-A-1:edid/marantz.bin radeon.audio=1 radeon.dpm=1 quiet splash"
This will overwrite EDID and ELD info.

Other EDID workarounds: http://forum.xbmc.org/showthread.php?tid...pid1685301

Bitstream audio still not working
Some receivers deny Bitstream Audio for everything not 60hz. In that case disable Adjust Refreshrate to match Video and also set the Sync Playback to Display to Audio Clock.

IRC Channel
Out of historical reasons, you can join #xbmc-xvba for discussing this howto. The channel name shall make us remember forever, that best hardware is worth nothing, if there are no drivers for it :-)

Happy penguin:
[Image: amd-dolby-truehd-320.jpg]
2013/10/05: Updated kernel to 3.11.4
2013/10/14: wsnipex has built a fixed mesa version with all relevant patches in a special mesa ppa. Use this one, if you want an always working version. You can still run oibaf, where this version (+ the compile fix) was copied from.
2013/10/19: Changed howto to use 3.12-rc5 it includes the bitstream audio patch and the pll clock change, as well as lipsync preparation. (2.1)
2013/10/19: I picked a patch, which enables Audio by default, when radeon.audio=1 is passed to the command line, details see above thread (2.2)
2013/10/19: Updated to kernel 3.12-rc6 with the usual patches.
2013/10/20: Added the hpet timer to the grub/default config - let's see who investigates a difference ;-)
2013/10/21: Uploaded 3.12-rc6 0.2 kernel. The faulty PLL clock patch on machines > E450 has been reverted.
2013/10/22: Missed some groups in the original howto (dip, dialout) sudo adduser xbmc dip && sudo adduser xbmc dialout && sudo reboot can fix that
2013/10/22: Audio Clock finally working (Kernel 3.12-rc6 0.3) - see above.
2013/10/24: Added some audio trouble shooting (unmute + bitstream audio known workarounds)
2013/10/27: Updated to 3.12-rc6+ which contains a lot of the other patches. Added one clock multiplier patch for Evergreen to use the same values as fglrx.
2013/10/28: Update to 3.12-rc7+ and changed howto to disable Adjust Refresh Rate to match video - it seems 23.976 mode causes drops with passthrough audio.
2013/11/04: Update to 3.12.0 final - all patches can be found on my github (howto branch of linux)
2013/11/05: Howto now uses Ubuntu Saucy 64 bit as installation medium. Thanks for wsnipex for providing updated mesa packages with the advanced deinterlacing packages.
2013/11/05: 24p and 24.0 hz is working fine again, therefore they can be enabled again
2013/11/06: There is now a howto for OpenSuse: http://forum.xbmc.org/showthread.php?tid...pid1546145 (thx to Tomtomme).
2013/11/08: Thanks to Grigori (zgreg) we als have temporal deinterlacing included. This was fixed for HD7xxx+ in version v8
2013/11/11: If your Saucy installation hangs without keyboard input possible, use this workaround: http://forum.xbmc.org/showthread.php?tid...pid1547981 (thanks to gWr71Tv)
2013/11/18: Updated 3.12 kernel with dropping a fractional div patch. It did not help us. Now all patches are in 3.13.
2013/11/26: Updated advancedsettings.xml to actually read CPU and GPU temperature, thx to Strangenoises.
2013/11/27: It could very well be, that your specific model needs other advancedsettings, e.g. here: http://pastebin.com/9TbQ0nZb or here: http://forum.xbmc.org/showthread.php?tid...pid1563088 (thx to Redeemer and menthos)
2013/12/15: Updated the upstart script to honor nice level, so that we really get what we want. upstart does not read the /etc/security/limits.conf things: limit nice 21 21
2013/12/19: Finally Artifacts on Richland are fixed. Nice christmas present from the AMD guys - it does for sure not hurt, to ask them, if there is a amazon wishlist or something. Though they are being paied by AMD, they are investing a whole lot of their free time to help us, are directly available in their irc channel and so on. Was a good year for AMD and their OSS support. Patches can be found in my drm-fixes-3.13 branch on github.com/fritsch
2013/12/30: I changed the upstart script to start /usr/bin/xbmc --standalone directly. Many users were confused and not able to also create a startxbmc.sh in the correct location.
2013/12/30: Updated howto to use 3.13-rc6 kernel from ubuntu mainline - all patches are now upstream.
2014/01/05: Updated howto to use 3.13-rc7. We now also have all the Radeon SI performance patches in mainline.
2014/01/10: Removed all patches as they are all upstream now and included in the mainline builds.
2014/01/12: Updated Kernel to 3.13-rc8
2014/01/20: We are stable now. Kernel was updated to 3.13 final.
2014/01/26: Removed the hpet - did not do anything.
2014/01/30: Updated to kernel 3.13.1
2014/02/07: Updated to kernel 3.13.2
2014/02/14: Updated to kernel 3.13.3
2014/02/22: Updated to kernel 3.13.4
2014/02/24: Updated to kernel 3.13.5 this adds two important fixes for HD 7xxx and Kabini
2014/03/01: Changed the settings descriptions as settings.xml was changed upstream. New Video Settings: Acceleration
2014/04/08: Updated the howto to Ubuntu Trusty 14.04
2014/04/14: Some users noted, that after upgrade from saucy to trusty there was a 100% load on home screen. If that happens to you, please start from a fresh profile by e.g. removing your .xbmc directory.
2014/04/26: Note for upgraders from saucy. Make sure to run: sudo ppa-purge ppa:wsnipex/mesa and ppa-purge ppa:wsnipex/xbmc-fernetmenta-master prior to running sudo do-release-upgrade - If you have missed those steps, you need to readd the saucy line of the mesa ppa, run sudo apt-get update and purge afterwards.
2014/05/03: ckoenig of AMD has found the skip issue which was driving us nuts the last year. It was a kernel fault and will hopefully be fixed in 3.15 kernel - for the time in between, you can use these images:
2014/05/23: The above change are now in Kernel 3.15, you can install version 3.15-rc6 via:
2014/05/23: With the update of libSDL to 1.2.15-8ubuntu1.1 disabling the backing store is not needed anymore. Make sure you run that version, when you remove the -bs from the above xbmc.onf
2014/06/30: deadite66 build 3.15.2 kernels with one offending commit reverted. This commit made the Temporal Deinterlacer drop and skip. I suggest the kernels here:
2014/07/01: The last patch was added to 3.15 kernel. No additional patches are needed anymore.
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.15.3-utopic/linux-headers-3.15.3-031503-generic_3.15.3-031503.201407010040_amd64.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.15.3-utopic/linux-headers-3.15.3-031503_3.15.3-031503.201407010040_all.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.15.3-utopic/linux-image-3.15.3-031503-generic_3.15.3-031503.201407010040_amd64.deb
sudo dpkg -i *3.15.3*deb
2014/07/11: Don't forget the UMA size:
[Image: umasize512.jpg]
2014/07/11: Kernel 3.15.5 is released - you can download / install it via the usual location -> http://kernel.ubuntu.com/~kernel-ppa/mai....5-utopic/
Finally we can get HD sound in linux...Big Grin

Installed and working now.

qvdpautest output

qvdpautest 0.5.2
AMD A6-3500 APU with Radeon™ HD Graphics
Unknown GPU

VDPAU API version : 1
VDPAU implementation : G3DVL VDPAU Driver Shared Library version 1.0

FATAL: get_bits failed : No backend implementation could be loaded.!!

MPEG DECODING (1920x1080): 75 frames/s
MPEG DECODING (1280x720): 113 frames/s
H264 DECODING (1920x1080): 47 frames/s
H264 DECODING (1280x720): 86 frames/s
VC1 DECODING (1440x1080): 101 frames/s
MPEG4 DECODING (1920x1080): 66 frames/s

MIXER WEAVE (1920x1080): 625 frames/s
MIXER BOB (1920x1080): 1023 fields/s
MIXER TEMPORAL (1920x1080): 1087 fields/s
MIXER TEMPORAL + IVTC (1920x1080): 1087 fields/s
MIXER TEMPORAL + SKIP_CHROMA (1920x1080): 1088 fields/s
MIXER TEMPORAL_SPATIAL (1920x1080): 1087 fields/s
MIXER TEMPORAL_SPATIAL + IVTC (1920x1080): 1087 fields/s
MIXER TEMPORAL_SPATIAL + SKIP_CHROMA (1920x1080): 1088 fields/s
MIXER TEMPORAL_SPATIAL (720x576 video to 1920x1080 display): 1162 fields/s

MULTITHREADED MPEG DECODING (1920x1080): 70 frames/s
MULTITHREADED MIXER TEMPORAL (1920x1080): 1118 fields/s
fritsch, please highlith this thread (and possibly remove the attention from the old one)
Could you point out what the performance is vs xvba? Is the limitation in fps noticeble? Should people move away from xvba towards a solution with the OSS driver?
Performance is fine on my a6-3500 as you see above..

And it supports HD audio Smile so well worth to change into.
does this mean oibaf has glinterop in mesa again?
i just get a whole lot of tearing...

here's my debug log -- http://pastebin.com/EBqDiDZ5

fresh install.

i tried the generic Mesa drivers. better.. no tearing, but not a very image.
am I missing something? or is my Radeon GPU not supported yet? HD 6000 series

since i don't have any other X sessions, i can't run the other commands to get the info. is there another way through ssh terminal to get what you need?


FYI: videos play fine.. great quality. just the XBMC interface... just lots of tearing.
Do you have any knowledge on how to use this on arch linux ?

Kind Regards
@locomot1f: Please provide all the logfiles that are mentioned above. Turn on debug logging before

sudo apt-get install pastebinit
dmesg | pastebinit
cat ~/.xbmc/temp/xbmc.log | pastebinit
cat /var/log/Xorg.0.log | pastebinit
DISPLAY=:0 vdpauinfo | pastebinit

@BenvanDamme: It is not difficult. Use your standard arch way of installing packages and just add the relevant patches to your aur build source.

I get some errors after the dist-upgrade

That's what I did:
sudo apt-add-repository ppa:oibaf/graphics-drivers
sudo apt-get update
sudo apt-get dist-upgrade

Then I got these unresolved dependencies
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.      
Statusinformationen werden eingelesen.... Fertig
Probieren Sie »apt-get -f install«, um dies zu korrigieren.
Die folgenden Pakete haben unerfüllte Abhängigkeiten:
libegl1-mesa : Hängt ab von: libwayland-client0 (>= 1.2.1) ist aber nicht installiert
                Hängt ab von: libwayland-server0 (>= 1.2.1) ist aber nicht installiert
libegl1-mesa-drivers : Hängt ab von: libwayland-client0 (>= 1.2.1) ist aber nicht installiert
                        Hängt ab von: libwayland-server0 (>= 1.2.1) ist aber nicht installiert
libgbm1 : Hängt ab von: libwayland-client0 (>= 1.2.1) ist aber nicht installiert
           Hängt ab von: libwayland-server0 (>= 1.2.1) ist aber nicht installiert
libgtk-3-0 : Hängt ab von: libwayland-client0 (>= 1.0.2) ist aber nicht installiert
              Hängt ab von: libwayland-cursor0 (>= 1.0.2) ist aber nicht installiert
E: Unerfüllte Abhängigkeiten. Versuchen Sie, -f zu benutzen.

Then I tried with
sudo apt-get -f install
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.      
Statusinformationen werden eingelesen.... Fertig
Abhängigkeiten werden korrigiert ... Fertig
Die folgenden Pakete wurden automatisch installiert und werden nicht mehr benötigt:
  libllvm3.2 libwayland0
Verwenden Sie »apt-get autoremove«, um sie zu entfernen.
Die folgenden zusätzlichen Pakete werden installiert:
  libwayland-client0 libwayland-cursor0 libwayland-server0
Die folgenden NEUEN Pakete werden installiert:
  libwayland-client0 libwayland-cursor0 libwayland-server0
0 aktualisiert, 3 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
35 nicht vollständig installiert oder entfernt.
Es müssen noch 0 B von 65,9 kB an Archiven heruntergeladen werden.
Nach dieser Operation werden 257 kB Plattenplatz zusätzlich benutzt.
Möchten Sie fortfahren [J/n]?
(Lese Datenbank ... 230711 Dateien und Verzeichnisse sind derzeit installiert.)
Entpacken von libwayland-client0:amd64 (aus .../libwayland-client0_1.2.1-1~r~gd_amd64.deb) ...
dpkg: Fehler beim Bearbeiten von /var/cache/apt/archives/libwayland-client0_1.2.1-1~r~gd_amd64.deb (--unpack):
Versuch, »/usr/lib/x86_64-linux-gnu/libwayland-client.so.0.1.0« zu überschreiben, welches auch in Paket libwayland0:amd64 1.0.5-0ubuntu1 ist
Es wurde kein Apport-Bericht verfasst, da das Limit MaxReports bereits erreicht ist.
                                                                                    Entpacken von libwayland-server0:amd64 (aus .../libwayland-server0_1.2.1-1~r~gd_amd64.deb) ...
dpkg: Fehler beim Bearbeiten von /var/cache/apt/archives/libwayland-server0_1.2.1-1~r~gd_amd64.deb (--unpack):
Versuch, »/usr/lib/x86_64-linux-gnu/libwayland-server.so.0« zu überschreiben, welches auch in Paket libwayland0:amd64 1.0.5-0ubuntu1 ist
Es wurde kein Apport-Bericht verfasst, da das Limit MaxReports bereits erreicht ist.
                                                                                    Entpacken von libwayland-cursor0:amd64 (aus .../libwayland-cursor0_1.2.1-1~r~gd_amd64.deb) ...
dpkg: Fehler beim Bearbeiten von /var/cache/apt/archives/libwayland-cursor0_1.2.1-1~r~gd_amd64.deb (--unpack):
Versuch, »/usr/lib/x86_64-linux-gnu/libwayland-cursor.so.0.0.0« zu überschreiben, welches auch in Paket libwayland0:amd64 1.0.5-0ubuntu1 ist
Es wurde kein Apport-Bericht verfasst, da das Limit MaxReports bereits erreicht ist.
                                                                                    Fehler traten auf beim Bearbeiten von:
E: Sub-process /usr/bin/dpkg returned an error code (1)

What can I do to solve the problem?
Following command is a one liner:
sudo dpkg -i --force-all /var/cache/apt/archives/libwayland-client0_1.2.1-1~r~gd_amd64.deb /var/cache/apt/archives/libwayland-server0_1.2.1-1~r~gd_amd64.deb /var/cache/apt/archives/libwayland-cursor0_1.2.1-1~r~gd_amd64.deb

sudo apt-get -f install
sudo apt-get update
sudo apt-get dist-upgrade

PS: That error was expected.
Thank you for your help
Thank you very much for your fast reply.
That fixed it.
Reference URL's