All EGL code was merged into Krypton - you can savely use kodi v17 based builds!
Reporting issues:
It is mandatory to always provide a full Debug Log that shows the issue. You can restart kodi before hand, reproduce and then post the logfile, by using pastebinit (sudo apt-get install pastebinit) - the following commands need to be run as the user running kodi (kodi if you followed the howto):
Issue reports without those logfiles are ignored or the posts deleted as they waste everybody's time.
Introduction
This is a new era for VAAPI. We worked together with the intel mesa people in order to get rid of the vaPutSurface method, that was the only way, besides some cpu intensive copying, to get the decoded surfaces via a texture from pixmap method to display. This always needed twice the amount of surfaces, as all the decoded surfaces needed to be copied and transfered to a texture again. Besides the additional gpu memory, this copy used too much performance and therefore high quality content like 3840x2160 with 60 frames (60p) were not really watchable even on highly performant hardware.
Besides the performance issue, this putSurface method always scaled the limited color range of the original files to FULL RGB. Introducing Banding or even worse it was scaled twice, e.g. back to limited, by the driver itself. All this won't happen anymore, cause the new zero copy approach allows us to directly render the decoded NV12 surface with our own shader. So all color conversions are in our hands now. You can savely use "Prefer VAAPI Render Method" set to on again and don't need to waste CPU cycles with bypassing this Method. All colors will be fine. If you have a Limited Range TV - you need to set "Use Limited Range" to On additionally. Also make sure that your GPU itself is running at full range, which this howto and also all OpenELEC images will do by default.
Furthermore we got implemented a feature called dithering, which will add random noise to the color scaled image when it is output on a FULL RGB monitor / lcd. So even perfect full range without any banding is now possible for VAAPI decoded material.
This thread is for guiding and testing this new approach, mainly implemented by - whom else - fernetmenta. The dithering algorithm realization in the shader was done by laurim. Wsnipex has done the packaging for the Ubuntu ppa for ease of use.
While we are trying to get this code tested and merged into kodi v17 - the daily builds and updates might get rough from time to time, whenever big changes appear in kodi. This code won't go into kodi v15 as development started right now. Also v16 does not have this code.
To use hevc-vaapi a Braswell or newer architecture is needed. Haswell and Broadwell and older arches will use the CPU for decoding.
So in short: Whatever is possible on linux nowadays on Intel hardware we have here in this build.
This thread is a follow up of: http://forum.kodi.tv/showthread.php?tid=165707

Playing 3840x2160 60p with lanczos3 (down)scaling on a 1080p display at 60hz.
Installation
-1.) Hardware Requirements / Software Requirements
SNB, IVB, HSW, BSW, BDW Intel Hardware
This installation is based upon the server iso for Ubuntu 16.04 64 bit: http://cdimage.ubuntu.com/ubuntu-server/...-amd64.iso (Until 16.04 is released, this links to the daily server iso images).
0.) Basic Installation and script tuning
First install the server iso as you would normally do, don't select any additional packages besides perhaps ssh. Also make sure to not use "encrypted home directory" cause this render the simple systemd service unusable. After installation continue with the following steps:
Allow "everyone" to start the Xserver
Now edit /etc/X11/Xwrapper.config and add the following into a new line at the end of the file:
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.
Now we give the permission 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.login1.*), verify this):
We need a simple systemd service file (this one actively waits on network connection, see: network-online.target remove that if you don't need to wait)
Create the following file and put the listing into it: /etc/systemd/system/kodi.service
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.
Fake display-manager.service to not make plymouth or something else complain.
1.) Now we install the final Krypton v17 version:
As libva / libva-driver-intel version 1.7.0 of Xenial has a color issue ( see: https://bugs.freedesktop.org/show_bug.cgi?id=94845 ), we use the wsnipex vaapi ppa to use 1.7.3
As we use openbox as our display manager, we need to auto start kodi, therefore create:
now we write the following into the created /home/kodi/.config/openbox/autostart file, this will automatically switch your TV to full range (please copy the lines, don't try to type the '` and so on, this code only works for one (1) connected TV, if you have multiple devices extend it to a loop):
Now, we can start kodi:
The usual kodi configuration is done as follows:
2.) KODI settings
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: on
Prefer VAAPI Render Method: on <- This version has the banding fixed, so enable that setting to save CPU cycles with 100% quality.
Adjust Refreshrate to match video: On
System -> Video -> Playback
Sync Playback to Display: On if you don't use passthrough and Off if passthrough enabled (* This makes no sense when you want to use passthrough, why? Read: http://forum.kodi.tv/showthread.php?tid=...pid2107461). In current versions (Jarvis) passthrough is disabled by us if users wants to Sync Playback to Display to care for people that refuse to read.
Adjust display refresh rate to match video: On Start / Stop
While watching a SD(!) video, that is accelerated by VAAPI, e.g. mpeg-2 or h264, click the film role and choose: Deinterlace: Auto (Never set this to ON it will harm for everything that is not interlaced) Deinterlacing-Method: VAAPI-MCDI or VAAPI-MADI (Sandybridge) and VAAPI-BOB (BYT), Scaling Method: Lanczos3 Optimized and choose save for all files. Remember to do this only in combination with the above "scaling above" for 20%. This Lanczos3 Optimized filter is too heavy for BYTs, here you might - depending on the file - choose Bilinear.
It is obviously clear, that you won't see the VAAPI-MCDI settings when you play a video that is software accelerated only.
You might need to create and advancedsettings.xml file as follows if you have special needs:
3. Color Management
If your TV is limited range. Go to System -> Video Output and choose "Use Limited Range", disable Dithering.
If your TV is full range. Go to System -> Video Output and unselect "Use Limited Range" and enable Dithering with 8 bits.
If your projector is of low quality, use a dithering setting of 6 or 7 bits.
Remember the above settings only make sense, when you output in Full Range (or in the special Video Range 16:235, that I provide in my custom kernels). With the default xrandr setting of Limited 16:235 - those settings are totally counter productive.
4.) Reporting issues
It is mandatory to always provide a full Debug Log that shows the issue. You can restart kodi before hand, reproduce and then post the logfile, by using pastebinit (sudo apt-get install pastebinit) - the following commands need to be run as the user running kodi (kodi if you followed the howto):
Issue reports without those logfiles are ignored.
Reporting issues:
It is mandatory to always provide a full Debug Log that shows the issue. You can restart kodi before hand, reproduce and then post the logfile, by using pastebinit (sudo apt-get install pastebinit) - the following commands need to be run as the user running kodi (kodi if you followed the howto):
Code:
dpkg -l |grep mesa | pastebinit
DISPLAY=:0 vainfo | pastebinit
cat ~/.kodi/temp/kodi.log | pastebinit
dmesg | pastebinit
id | pastebinit
amixer | pastebinitIssue reports without those logfiles are ignored or the posts deleted as they waste everybody's time.
Introduction
This is a new era for VAAPI. We worked together with the intel mesa people in order to get rid of the vaPutSurface method, that was the only way, besides some cpu intensive copying, to get the decoded surfaces via a texture from pixmap method to display. This always needed twice the amount of surfaces, as all the decoded surfaces needed to be copied and transfered to a texture again. Besides the additional gpu memory, this copy used too much performance and therefore high quality content like 3840x2160 with 60 frames (60p) were not really watchable even on highly performant hardware.
Besides the performance issue, this putSurface method always scaled the limited color range of the original files to FULL RGB. Introducing Banding or even worse it was scaled twice, e.g. back to limited, by the driver itself. All this won't happen anymore, cause the new zero copy approach allows us to directly render the decoded NV12 surface with our own shader. So all color conversions are in our hands now. You can savely use "Prefer VAAPI Render Method" set to on again and don't need to waste CPU cycles with bypassing this Method. All colors will be fine. If you have a Limited Range TV - you need to set "Use Limited Range" to On additionally. Also make sure that your GPU itself is running at full range, which this howto and also all OpenELEC images will do by default.
Furthermore we got implemented a feature called dithering, which will add random noise to the color scaled image when it is output on a FULL RGB monitor / lcd. So even perfect full range without any banding is now possible for VAAPI decoded material.
This thread is for guiding and testing this new approach, mainly implemented by - whom else - fernetmenta. The dithering algorithm realization in the shader was done by laurim. Wsnipex has done the packaging for the Ubuntu ppa for ease of use.
While we are trying to get this code tested and merged into kodi v17 - the daily builds and updates might get rough from time to time, whenever big changes appear in kodi. This code won't go into kodi v15 as development started right now. Also v16 does not have this code.
To use hevc-vaapi a Braswell or newer architecture is needed. Haswell and Broadwell and older arches will use the CPU for decoding.
So in short: Whatever is possible on linux nowadays on Intel hardware we have here in this build.
This thread is a follow up of: http://forum.kodi.tv/showthread.php?tid=165707

Playing 3840x2160 60p with lanczos3 (down)scaling on a 1080p display at 60hz.
Installation
-1.) Hardware Requirements / Software Requirements
SNB, IVB, HSW, BSW, BDW Intel Hardware
This installation is based upon the server iso for Ubuntu 16.04 64 bit: http://cdimage.ubuntu.com/ubuntu-server/...-amd64.iso (Until 16.04 is released, this links to the daily server iso images).
0.) Basic Installation and script tuning
First install the server iso as you would normally do, don't select any additional packages besides perhaps ssh. Also make sure to not use "encrypted home directory" cause this render the simple systemd service unusable. After installation continue with the following steps:
Code:
sudo apt-get update
sudo apt-get install ssh python-software-properties software-properties-common xorg xserver-xorg-legacy alsa-utils mesa-utils git-core librtmp1 lirc libmad0 lm-sensors libmpeg2-4 avahi-daemon libnfs8 libva1 vainfo i965-va-driver linux-firmware dbus-x11 udisks2 openbox pastebinit udevil
sudo apt-get dist-upgradeAllow "everyone" to start the Xserver
Code:
sudo dpkg-reconfigure xserver-xorg-legacyNow edit /etc/X11/Xwrapper.config and add the following into a new line at the end of the file:
Code:
needs_root_rights=yesCreate 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,input kodiNow we give the permission 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.login1.*), verify this):
Code:
[Actions for kodi user]
Identity=unix-user:kodi
Action=org.freedesktop.login1.*;org.freedesktop.udisks.*
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=yesWe need a simple systemd service file (this one actively waits on network connection, see: network-online.target remove that if you don't need to wait)
Create the following file and put the listing into it: /etc/systemd/system/kodi.service
Code:
[Unit]
Description = kodi-standalone using xinit
Requires = dbus.service
After = systemd-user-sessions.service network.target sound.target network-online.target
[Service]
User = kodi
Group = kodi
Type = simple
PAMName=login
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/openbox-session -- :0 -nolisten tcp vt7
Restart = on-abort
[Install]
WantedBy = multi-user.targetedit /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 -1Fake display-manager.service to not make plymouth or something else complain.
Code:
sudo ln -s /etc/systemd/system/kodi.service /etc/systemd/system/display-manager.service1.) Now we install the final Krypton v17 version:
Code:
sudo apt-add-repository ppa:team-xbmc/ppa
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install kodi kodi-binAs libva / libva-driver-intel version 1.7.0 of Xenial has a color issue ( see: https://bugs.freedesktop.org/show_bug.cgi?id=94845 ), we use the wsnipex vaapi ppa to use 1.7.3
Code:
sudo apt-add-repository ppa:wsnipex/vaapi
sudo apt-get update
sudo apt-get dist-upgradeAs we use openbox as our display manager, we need to auto start kodi, therefore create:
Code:
sudo mkdir -p /home/kodi/.config/openbox
sudo touch /home/kodi/.config/openbox/autostart
sudo chown kodi:kodi /home/kodi/.config -Rnow we write the following into the created /home/kodi/.config/openbox/autostart file, this will automatically switch your TV to full range (please copy the lines, don't try to type the '` and so on, this code only works for one (1) connected TV, if you have multiple devices extend it to a loop):
Code:
OUTPUT=`xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q'`
xrandr -display :0 --output $OUTPUT --set "Broadcast RGB" "Full"
xsetroot #000000
xset -dpms
devmon &
MALLOC_MMAP_THRESHOLD_=131072 /usr/bin/kodi --standalone
while [ $? -ne 0 ]; do
MALLOC_MMAP_THRESHOLD_=131072 /usr/bin/kodi --standalone
done
openbox --exitNow, we can start kodi:
Code:
sudo systemctl start kodiThe usual kodi configuration is done as follows:
2.) KODI settings
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: on
Prefer VAAPI Render Method: on <- This version has the banding fixed, so enable that setting to save CPU cycles with 100% quality.
Adjust Refreshrate to match video: On
System -> Video -> Playback
Sync Playback to Display: On if you don't use passthrough and Off if passthrough enabled (* This makes no sense when you want to use passthrough, why? Read: http://forum.kodi.tv/showthread.php?tid=...pid2107461). In current versions (Jarvis) passthrough is disabled by us if users wants to Sync Playback to Display to care for people that refuse to read.
Adjust display refresh rate to match video: On Start / Stop
While watching a SD(!) video, that is accelerated by VAAPI, e.g. mpeg-2 or h264, click the film role and choose: Deinterlace: Auto (Never set this to ON it will harm for everything that is not interlaced) Deinterlacing-Method: VAAPI-MCDI or VAAPI-MADI (Sandybridge) and VAAPI-BOB (BYT), Scaling Method: Lanczos3 Optimized and choose save for all files. Remember to do this only in combination with the above "scaling above" for 20%. This Lanczos3 Optimized filter is too heavy for BYTs, here you might - depending on the file - choose Bilinear.
It is obviously clear, that you won't see the VAAPI-MCDI settings when you play a video that is software accelerated only.
You might need to create and advancedsettings.xml file as follows if you have special needs:
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>3. Color Management
If your TV is limited range. Go to System -> Video Output and choose "Use Limited Range", disable Dithering.
If your TV is full range. Go to System -> Video Output and unselect "Use Limited Range" and enable Dithering with 8 bits.
If your projector is of low quality, use a dithering setting of 6 or 7 bits.
Remember the above settings only make sense, when you output in Full Range (or in the special Video Range 16:235, that I provide in my custom kernels). With the default xrandr setting of Limited 16:235 - those settings are totally counter productive.
4.) Reporting issues
It is mandatory to always provide a full Debug Log that shows the issue. You can restart kodi before hand, reproduce and then post the logfile, by using pastebinit (sudo apt-get install pastebinit) - the following commands need to be run as the user running kodi (kodi if you followed the howto):
Code:
dpkg -l |grep mesa | pastebinit
DISPLAY=:0 vainfo | pastebinit
cat ~/.kodi/temp/kodi.log | pastebinit
dmesg | pastebinit
id | pastebinit
amixer | pastebinitIssue reports without those logfiles are ignored.
