2013-05-26, 00:23
Preface:
This howto assumes, that you are able to create a file on a linux filesystem. Furthermore it assumes, that you are able to apt-get.
Make sure to read the part about how to fix the GPU HANG by installing a kernel >= 3.18.4 kernel, as described below.
14/09/11 Overview
VPP BOB was made working in the meantime on SNB, IVB and HSW. IVB supports MADI (Motion Adaptive Deinterlacing), though there is a little bug in the driver that it produces little artifacts. On HSW even MCDI (Motion Compensation Deinterlacing) and MADI is working now. Though, you need a special driver that wsnipex is packaging in his vaapi ppa (see beneath). Ubuntu Trusty does not ship a new enough version, as a result VAAPI-BOB will produce green artifacts on HSW and MCDI and MADI will jump like hell.
Standard kodi from the team-xbmc ppa can automatically use a high quality software deinterlacer Yadif or BOB OpenGL Deinterlacer starting version 14.0 Helix. It can seamlessly use the before mentioned GPU Deinterlacing (VAAPI-BOB, VAAPI-MADI, VAAPI-MCDI). Those methods can be selected when watching a specific movie by changing the relevant options via the movie reel. VAAPI-MCDI is not available on a Baytrail as this is an IVB based chip.
The best quality of the cpu deinterlacers gives the filter called Deinterlace that is the implementation also referred to as Yadif - that costs a lot of CPU cycles (so be warned here). If you have a HSW chip you can use the VAAPI-MCDI deinterlacer which has awesome quality while keeping CPU load low. On Baytrail chips I currently suggest using the OpenGL Bob deinterlacer - cause the GPU is maxed out when using any of the VAAPI methods. I hope we can optimize this in the future when using the new EGL surface sharing API which was introduced in libva 0.3.6.
All the described features work starting with official libva-driver-intel version 1.5.0 and corresponding libva. Wsnipex provides them for Ubuntu users in his ppa. A kernel >= 3.18.4 is required to fix the GPU hang on HSW systems. Other issues are listed below, especially for IVB and BYT.
Summary:
HSW: VAAPI-MCDI
IVB: VAAPI-BOB (cause of the artifacts mentioned above)
Baytrail / SNB / In general HD2000: BOB (which is done in the renderer and costs nearly nothing, not VPP-BOB).
This ppa provides a helix version of current master. The code is in OpenELEC 5.0 - OpenELEC 4.2 is still Gotham based.
Some visual comparison:
Bob: https://dl.dropboxusercontent.com/u/5572...h1-bob.mp4
Yadif: https://dl.dropboxusercontent.com/u/5572...-yadif.mp4
Installation
-1.) Hardware Requirements / Software Requirements
SNB, IVB, HSW Intel Hardware
Ubuntu Trusty mini iso installed x64. Download link for example here: http://archive.ubuntu.com/ubuntu/dists/t...t/mini.iso
If you have a UEFI only system, you need to use the server iso as your basis, as the mini iso won't boot in UEFI mode. Server iso is 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:
Allow every user (everyone) to start X11
Create the kodi user and it add it the relevant groups. If you have created the kodi user during installation only do the usermod part.
To use the following upstart procedure you need to create /etc/init/kodi.conf to start kodi via upstart. That scripts does only wait for your HDMI device, if you want to wait for networking, you have to add that.
edit /etc/security/limits.conf and add before the end. remember kodi is the username, not the application. This will allow your user to get the audio thread a bit more priority.
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):
1.) Installation of the repository and the new packages including Kodi 14.x
3.) KODI settings
System->Settings->System->Video Settings:
Vertical Sync: Let Driver decide
System ->Video->Acceleration:
Enable HQ Scalers for scaling above: 20%
Allow hardware acceleration (VDPAU): off
Allow hardware acceleration (VAAPI): On
Use Mpeg-2 VAAPI: Yes
Use Mpeg-4 VAAPI: if you like
UseVC-1 VAAPI: off (this causes vc1 interlaced to segfault, when on)
Adjust Refreshrate to match video: On
If you experience kernel hangs (dmesg will tell), you can set Prefer VAAPI Render: Off that will force the swfilter even when progressive / VAAPI BOB is in use.
System -> Video -> Playback
Sync Playback to Display: On (* This makes no sense when you want to use passthrough - with perfect display clocks it does not harm though)
Sync Method: Video Clock (Resample Audio) (This will automatically use Drop / Dupe when passthrough is active -> best from two worlds)
Adjust display refresh rate to match video: On Start / Stop
When playing some 720p file or lower (do you get why?) open the movie icon and set Deinterlace: Auto and Deinterlace Method to: Deinterlace (if it causes too much cpu load, choose Bob (Celeron Baytrail and Celeron 847 Nucs(!)) - also set Scaling algorithm to Lanczos 3 optimized (also not for Baytrail and Celeron Nucs, only for HD3000 and faster). Save for all files.
If you are running a Baytrail NUC or a 847 Celeron NUC or comparable - choose Scaling: Bilinear and Deinterlace-Method: BOB
advancedsettings.xml in /home/kodi/.kodi/userdata/advancedsettings.xml should contain (don't create that file / directory as root - use the kodi user, e.g. mkdir -p /home/kodi/.kodi/userdata/):
Especially the RSS Reader produces high CPU load. You can disable that one under Appearance setting.
Howto update kodi
As kodi is a normal ubuntu package, installed via the ppa, it's as simple as:
Fancy Splash? (Done by forum user teeedubb
Remeber to edit /etc/default/grub and to change:
to
Don't forget to run 'sudo update-grub' after you changed that line.
We are now done. A final reboot and everything should work:
Troubleshooting
In order to get any help, please provide the following logs.
Audio
Check if you audio device is muted
You can use alsamixer -c0 or alsamixer -c1 to do it manually, or use something like:
If you want to run pulseaudio, please see the kodi wiki before: http://wiki.kodi.tv/index.php?title=PulseAudio
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:
Open Bugs, that we cannot solve:
Some Baytrails are fully freezing when entering CPU powersave mode C6 -> https://bugs.freedesktop.org/show_bug.cgi?id=88012 (Fixed in OpenELEC and wsnipex's vaapi ppa, also in libva-driver-intel master)
Intel does not fix their deinterlacing vpp for BYT and IVB -> https://bugs.freedesktop.org/show_bug.cgi?id=79765 (Fixed with custom patch in OpenELEC, upstream discussion ongoing)
[History]
14/01/05: Update to kernel 3.13-rc7
14/01/12: Update to kernel 3.13-rc8
14/01/20: Update to kernel 3.13 final
14/01/30: Update to kernel 3.13.1
14/02/06: Told howto update.
14/02/07: Update to kernel 3.13.2
14/02/14: Update to kernel 3.13.3
16/02/14: Add code to set Display to RGB Full mode
14/02/22: Update to kernel 3.13.4
14/02/24: Update to kernel 3.13.5
14/04/09: Update to Ubuntu trusty
14/04/16: Coming from Saucy? Upgrade: http://forum.xbmc.org/showthread.php?tid...pid1677121
14/06/30: SwFilter Option has been removed. If you want to force a copy to system run disable the new setting: Prefer VAAPI Render in Video -> Acceleration. This is not needed in general, cause when Deinterlace or Bob is active this is automatically bypassed.
*14/08/23: Added wsnipex vaapi ppa to the howto. This will install an experimental intel-driver that can do MCDI and MADI. Beware it will crash roughly every 30 minutes when doing deinterlacing :-)
14/08/30: The crash has been fixed and you should be able to run MCDI without crashing
14/09/11: Rewrite of the indroduction part and settings.
14/10/20: Change The server iso to point to the trusty one.
14/11/18: Added login1 permissions to the pkla file. Replace yours if you don't have suspend / power off options anymore. Thanks to wsnipex.
Update 14/12/13 concerning the GPU HANG
Chris Wilson has finally fixed the GPU HANG! Thanks very much. It is included in any kernel >= 3.18.4 official kernel. Install it as follows:
Background:
Kernel 3.18.4 mainline has the patches we need included. Starting with this kernel and obviously also with kernel 3.19+ - the gpu hang is considered fixed.
For the Baytrail people, please only install and use the following kernel, which has an issue with a full freeze with the turbo fixed. This kernel also does not harm on other intel architectures.
150108: Updated everything to kodi, including the username.
This howto assumes, that you are able to create a file on a linux filesystem. Furthermore it assumes, that you are able to apt-get.
Make sure to read the part about how to fix the GPU HANG by installing a kernel >= 3.18.4 kernel, as described below.
14/09/11 Overview
VPP BOB was made working in the meantime on SNB, IVB and HSW. IVB supports MADI (Motion Adaptive Deinterlacing), though there is a little bug in the driver that it produces little artifacts. On HSW even MCDI (Motion Compensation Deinterlacing) and MADI is working now. Though, you need a special driver that wsnipex is packaging in his vaapi ppa (see beneath). Ubuntu Trusty does not ship a new enough version, as a result VAAPI-BOB will produce green artifacts on HSW and MCDI and MADI will jump like hell.
Standard kodi from the team-xbmc ppa can automatically use a high quality software deinterlacer Yadif or BOB OpenGL Deinterlacer starting version 14.0 Helix. It can seamlessly use the before mentioned GPU Deinterlacing (VAAPI-BOB, VAAPI-MADI, VAAPI-MCDI). Those methods can be selected when watching a specific movie by changing the relevant options via the movie reel. VAAPI-MCDI is not available on a Baytrail as this is an IVB based chip.
The best quality of the cpu deinterlacers gives the filter called Deinterlace that is the implementation also referred to as Yadif - that costs a lot of CPU cycles (so be warned here). If you have a HSW chip you can use the VAAPI-MCDI deinterlacer which has awesome quality while keeping CPU load low. On Baytrail chips I currently suggest using the OpenGL Bob deinterlacer - cause the GPU is maxed out when using any of the VAAPI methods. I hope we can optimize this in the future when using the new EGL surface sharing API which was introduced in libva 0.3.6.
All the described features work starting with official libva-driver-intel version 1.5.0 and corresponding libva. Wsnipex provides them for Ubuntu users in his ppa. A kernel >= 3.18.4 is required to fix the GPU hang on HSW systems. Other issues are listed below, especially for IVB and BYT.
Summary:
HSW: VAAPI-MCDI
IVB: VAAPI-BOB (cause of the artifacts mentioned above)
Baytrail / SNB / In general HD2000: BOB (which is done in the renderer and costs nearly nothing, not VPP-BOB).
This ppa provides a helix version of current master. The code is in OpenELEC 5.0 - OpenELEC 4.2 is still Gotham based.
Some visual comparison:
Bob: https://dl.dropboxusercontent.com/u/5572...h1-bob.mp4
Yadif: https://dl.dropboxusercontent.com/u/5572...-yadif.mp4
Installation
-1.) Hardware Requirements / Software Requirements
SNB, IVB, HSW Intel Hardware
Ubuntu Trusty mini iso installed x64. Download link for example here: http://archive.ubuntu.com/ubuntu/dists/t...t/mini.iso
If you have a UEFI only system, you need to use the server iso as your basis, as the mini iso won't boot in UEFI mode. Server iso is 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:
Code:
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 libva1 vainfo libva-intel-vaapi-driver linux-firmware
sudo apt-get dist-upgrade
Allow every user (everyone) to start X11
Code:
sudo dpkg-reconfigure x11-common
Create the kodi user and it add it the relevant groups. If you have created the kodi user during installation only do the usermod part.
Code:
sudo adduser kodi
sudo usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip kodi
To use the following upstart procedure you need to create /etc/init/kodi.conf to start kodi via upstart. That scripts does only wait for your HDMI device, if you want to wait for networking, you have to add that.
Code:
# kodi-upstart
# starts KODI on startup by using xinit.
# by default runs as kodi, to change edit below.
env USER=kodi
emits kodi-started
description "KODI-barebones-upstart-script"
author "Matt Filetto"
start on (filesystem and stopped udevtrigger)
stop on runlevel [016]
# tell upstart to respawn the process if abnormal exit
respawn
respawn limit 10 5
limit nice 21 21
script
exec su -c "xinit /usr/bin/kodi --standalone -- /usr/bin/X -nolisten tcp :0" $USER
# the following two are to get an idea, if you want to user a window manager
# sudo apt-get install fluxbox and comment the above exec line
# only one exec line is allowed.
# exec su -c "xinit /usr/bin/fluxbox -- /usr/bin/X -nolisten tcp :0" $USER
end script
# remove all those to set Full rgb range make sure to change HDMI2 to match your device
# starting from the next line, including end script
# post-start script
# sleep 1
# DISPLAY=:0 xrandr --output HDMI2 --set "Broadcast RGB" Full
# end script
edit /etc/security/limits.conf and add before the end. remember kodi is the username, not the application. This will allow your user to get the audio thread a bit more priority.
Code:
kodi - 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):
Code:
[Actions for kodi user]
Identity=unix-user:kodi
Action=org.freedesktop.upower.*;org.freedesktop.consolekit.system.*;org.freedesktop.udisks.*;org.freedesktop.login1.*
ResultAny=yes
ResultInactive=yes
ResultActive=yes
[Untrusted Upgrade]
Identity=unix-user:kodi
Action=org.debian.apt.upgrade-packages;org.debian.apt.update-cache
ResultAny=yes
ResultInactive=yes
ResultActive=yes
1.) Installation of the repository and the new packages including Kodi 14.x
Code:
sudo apt-add-repository ppa:team-xbmc/ppa
sudo apt-add-repository ppa:wsnipex/vaapi (see *)
sudo apt-get update
sudo apt-get install kodi kodi-bin
sudo apt-get dist-upgrade
3.) KODI settings
System->Settings->System->Video Settings:
Vertical Sync: Let Driver decide
System ->Video->Acceleration:
Enable HQ Scalers for scaling above: 20%
Allow hardware acceleration (VDPAU): off
Allow hardware acceleration (VAAPI): On
Use Mpeg-2 VAAPI: Yes
Use Mpeg-4 VAAPI: if you like
UseVC-1 VAAPI: off (this causes vc1 interlaced to segfault, when on)
Adjust Refreshrate to match video: On
If you experience kernel hangs (dmesg will tell), you can set Prefer VAAPI Render: Off that will force the swfilter even when progressive / VAAPI BOB is in use.
System -> Video -> Playback
Sync Playback to Display: On (* This makes no sense when you want to use passthrough - with perfect display clocks it does not harm though)
Sync Method: Video Clock (Resample Audio) (This will automatically use Drop / Dupe when passthrough is active -> best from two worlds)
Adjust display refresh rate to match video: On Start / Stop
When playing some 720p file or lower (do you get why?) open the movie icon and set Deinterlace: Auto and Deinterlace Method to: Deinterlace (if it causes too much cpu load, choose Bob (Celeron Baytrail and Celeron 847 Nucs(!)) - also set Scaling algorithm to Lanczos 3 optimized (also not for Baytrail and Celeron Nucs, only for HD3000 and faster). Save for all files.
If you are running a Baytrail NUC or a 847 Celeron NUC or comparable - choose Scaling: Bilinear and Deinterlace-Method: BOB
advancedsettings.xml in /home/kodi/.kodi/userdata/advancedsettings.xml should contain (don't create that file / directory as root - use the kodi user, e.g. mkdir -p /home/kodi/.kodi/userdata/):
Code:
<advancedsettings>
<loglevel hide="false">0</loglevel>
<cputempcommand>sensors|sed -ne "s/Core 0: \+[-+]\([0-9]\+\).*/\1 C/p"</cputempcommand>
<gui>
<algorithmdirtyregions>3</algorithmdirtyregions>
<nofliptimeout>0</nofliptimeout>
</gui>
<video>
<latency>
<delay>50</delay>
<refresh>
<min>23</min>
<max>24</max>
<delay>175</delay> <!-- set to zero or adjust if audio seems out of sync with 24p movies -->
</refresh>
</latency>
</video>
</advancedsettings>
Especially the RSS Reader produces high CPU load. You can disable that one under Appearance setting.
Howto update kodi
As kodi is a normal ubuntu package, installed via the ppa, it's as simple as:
Code:
sudo apt-get update
sudo apt-get upgrade
Fancy Splash? (Done by forum user teeedubb
Code:
sudo apt-get update
sudo apt-get install plymouth-label v86d
wget https://dl.dropboxusercontent.com/u/55728161/plymouth-theme-kodi-logo.deb
sudo dpkg -i plymouth-theme-kodi-logo.deb
Code:
GRUB_CMDLINE_LINUX_DEFAULT=""
Code:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
We are now done. A final reboot and everything should work:
Code:
sudo reboot
Troubleshooting
In order to get any help, please provide the following logs.
Code:
sudo apt-get install pastebinit
dmesg | pastebinit
cat ~/.kodi/temp/kodi.log | pastebinit
cat /var/log/Xorg.0.log | pastebinit
DISPLAY=:0 vainfo | pastebinit
dpkg -l |grep mesa | pastebinit
id | pastebinit
aplay -L | pastebinit
Audio
Check if you audio device is muted
You can use alsamixer -c0 or alsamixer -c1 to do it manually, or use something like:
Code:
amixer set 'IEC958',0 unmute
If you want to run pulseaudio, please see the kodi wiki before: http://wiki.kodi.tv/index.php?title=PulseAudio
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:
Open Bugs, that we cannot solve:
Some Baytrails are fully freezing when entering CPU powersave mode C6 -> https://bugs.freedesktop.org/show_bug.cgi?id=88012 (Fixed in OpenELEC and wsnipex's vaapi ppa, also in libva-driver-intel master)
Intel does not fix their deinterlacing vpp for BYT and IVB -> https://bugs.freedesktop.org/show_bug.cgi?id=79765 (Fixed with custom patch in OpenELEC, upstream discussion ongoing)
[History]
14/01/05: Update to kernel 3.13-rc7
14/01/12: Update to kernel 3.13-rc8
14/01/20: Update to kernel 3.13 final
14/01/30: Update to kernel 3.13.1
14/02/06: Told howto update.
14/02/07: Update to kernel 3.13.2
14/02/14: Update to kernel 3.13.3
16/02/14: Add code to set Display to RGB Full mode
14/02/22: Update to kernel 3.13.4
14/02/24: Update to kernel 3.13.5
14/04/09: Update to Ubuntu trusty
14/04/16: Coming from Saucy? Upgrade: http://forum.xbmc.org/showthread.php?tid...pid1677121
14/06/30: SwFilter Option has been removed. If you want to force a copy to system run disable the new setting: Prefer VAAPI Render in Video -> Acceleration. This is not needed in general, cause when Deinterlace or Bob is active this is automatically bypassed.
*14/08/23: Added wsnipex vaapi ppa to the howto. This will install an experimental intel-driver that can do MCDI and MADI. Beware it will crash roughly every 30 minutes when doing deinterlacing :-)
14/08/30: The crash has been fixed and you should be able to run MCDI without crashing
14/09/11: Rewrite of the indroduction part and settings.
14/10/20: Change The server iso to point to the trusty one.
14/11/18: Added login1 permissions to the pkla file. Replace yours if you don't have suspend / power off options anymore. Thanks to wsnipex.
Update 14/12/13 concerning the GPU HANG
Chris Wilson has finally fixed the GPU HANG! Thanks very much. It is included in any kernel >= 3.18.4 official kernel. Install it as follows:
Code:
mkdir 3.18.4
cd 3.18.4
wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux-firmware/linux-firmware_1.143_all.deb
sudo dpkg -i *linux-firmware*deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.4-vivid/linux-headers-3.18.4-031804-generic_3.18.4-031804.201501271243_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.4-vivid/linux-headers-3.18.4-031804_3.18.4-031804.201501271243_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.4-vivid/linux-image-3.18.4-031804-generic_3.18.4-031804.201501271243_amd64.deb
sudo dpkg -i *3.18.4*deb
Background:
Kernel 3.18.4 mainline has the patches we need included. Starting with this kernel and obviously also with kernel 3.19+ - the gpu hang is considered fixed.
For the Baytrail people, please only install and use the following kernel, which has an issue with a full freeze with the turbo fixed. This kernel also does not harm on other intel architectures.
Code:
wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux-firmware/linux-firmware_1.143_all.deb
sudo dpkg -i *linux-firmware*deb
wget https://dl.dropboxusercontent.com/u/55728161/linux-headers-3.19.1-legacy-turbo%2B_3.19.1-legacy-turbo%2B-10.00.Custom_amd64.deb
wget https://dl.dropboxusercontent.com/u/55728161/linux-image-3.19.1-legacy-turbo%2B_3.19.1-legacy-turbo%2B-10.00.Custom_amd64.deb
sudo dpkg -i *3.19.1*deb