Kodi Community Forum
Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - 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: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server (/showthread.php?tid=231955)



RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - Rumpelstiltskin - 2020-03-08

Guys,

I would like to update this post because like me maybe he has the latest NUC model and he's gone crazy.
So I've solved it using a couple of "tricks" that I don't like but that work

I hope that the user (and that I thank him again with all my heart for his infinite patience and goodness) @fritsch does not want to shoot me and that if maybe I'm saying crap to correct me and I try to summarise the steps I have taken (I hope to remember them in the correct order):


Installation
-1.) Hardware and software :
       - NUC10i7FNH
       - OS Ubuntu Server 19.10
       - Kernel : 5.5.8-050508-generic

0.) Basic Installation and script tuning
Quote:sudo apt-get install ssh software-properties-common xorg xserver-xorg-legacy alsa-utils mesa-utils git-core librtmp1 libmad0 lm-sensors libmpeg2-4 avahi-daemon libnfs12 libva2 vainfo  intel-media-va-driver-non-free linux-firmware dbus-x11 udisks2 openbox pastebinit udisks2 xserver-xorg-video-intel  xserver-xorg-video-intel
sudo apt-get dist-upgrade 

This is really very important for my system otherwise the hardware acceleration doesn't work.
sudo sh -c "echo 'LIBVA_DRIVER_NAME=iHD' >> /etc/environment"

sudo chmod -R 777 /dev/dri
sudo chmod -R 777 /dev/dri/*

sudo nano etc/modprobe.d/i915.conf
Quote:options i915 enable_guc=2 enable_psr=0

sudo apt remove gdm3
sudo apt remove pulseaudio

Allow "everyone" to start the Xserver
Quote:sudo dpkg-reconfigure xserver-xorg-legacy ->everyone
sudo nano /etc/X11/Xwrapper.config -> needs_root_rights=yes

cat /etc/X11/xorg.conf.d/20intel.conf
Quote:Section "Device"
  Identifier  "Device0"
  Driver      "intel"
  VendorName  "INTEL Corporation"
  Option "AccelMethod" "sna"
  Option "TripleBuffer" "false"
  Option "TearFree" "false"
  Option "DRI" "3"
EndSection
Section "Extensions"
  Option "Composite" "Disable"
EndSection

sudo adduser kodi
sudo usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,disk kodi

sudo nano /etc/polkit-1/localauthority/50-local.d/custom-actions.pkla
Quote:[Actions for kodi user]
Identity=unix-user:kodi
Action=org.freedesktop.login1.*;org.freedesktop.udisks2.*
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
 
sudo nano /etc/systemd/system/kodi.service
Quote:[Unit]
Description = kodi-standalone using xinit
Requires = dbus.service
After = systemd-user-sessions.service 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.target
 
sudo nano /etc/security/limits.conf
Quote:kodi             -       nice            -1


1.) Now we install the kodi in nightly version:
Quote:sudo add-apt-repository ppa:team-xbmc/xbmc-nightly
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install kodi kodi-x11
As we use openbox as our display manager, we need to auto start kodi, therefore create:
Quote:sudo mkdir -p /home/kodi/.config/openbox
sudo touch /home/kodi/.config/openbox/autostart
sudo chown kodi:kodi /home/kodi/.config -R

cat /home/kodi/.config/openbox/autostart
Quote:OUTPUT=`xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q'`
xrandr -display :0 --output $OUTPUT --set "Broadcast RGB" "Full"
xsetroot #000000
xset s off -dpms
/usr/bin/kodi --standalone
while [ $? -ne 0 ]; do
/usr/bin/kodi --standalone
done
openbox --exit

And in my system I also had to update the graphics drivers
Quote:sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt update
sudo apt upgrade


@fritsch if I said nonsense or if the installation history is not correct, feel free to intervene and fix Smile

thank you all

inxi :
 
Quote:System:    Host: kodi Kernel: 5.5.8-050508-generic x86_64 bits: 64 compiler: gcc v: 9.2.1 Console: tty 0
           Distro: Ubuntu 19.10 (Eoan Ermine)
Machine:   Type: Mini-pc System: Intel Client Systems product: NUC10i7FNH v: K61081-302 serial: <root required>
           Mobo: Intel model: NUC10i7FNB v: K61360-302 serial: <root required> UEFI: Intel v: FNCML357.0038.2020.0131.1422
           date: 01/31/2020
CPU:       Topology: 6-Core model: Intel Core i7-10710U bits: 64 type: MT MCP arch: N/A L2 cache: 12.0 MiB
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 38399
           Speed: 3464 MHz min/max: 400/4700 MHz Core speeds (MHz): 1: 3585 2: 3593 3: 3501 4: 3598 5: 3500 6: 3560 7: 3576
           8: 3554 9: 3567 10: 3530 11: 3501 12: 3525
Graphics:  Device-1: Intel driver: i915 v: kernel bus ID: 00:02.0
           Display: server: X.org 1.20.7 driver: intel tty: 229x40
           Message: Advanced graphics data unavailable in console. Try -G --display
Audio:     Device-1: Intel driver: snd_hda_intel v: kernel bus ID: 00:1f.3
           Sound Server: ALSA v: k5.5.8-050508-generic
Network:   Device-1: Intel Wireless-AC 9462 driver: iwlwifi v: kernel port: 3000 bus ID: 00:14.3
           IF: wlp0s20f3 state: down mac: xx:xx:xx:xx:xx:xx
           Device-2: Intel Ethernet I219-V driver: e1000e v: 3.2.6-k port: efa0 bus ID: 00:1f.6
           IF: eno1 state: up speed: 1000 Mbps duplex: full mac: xx:xx:xx:xx:xx:xx
           IF-ID-1: tun0 state: unknown speed: 10 Mbps duplex: full mac: N/A
Drives:    Local Storage: total: 18.65 TiB used: 8.65 TiB (46.4%)
           ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 970 EVO Plus 1TB size: 931.51 GiB
           ID-2: /dev/sda vendor: Samsung model: SSD 850 EVO 500GB size: 465.76 GiB
           ID-3: /dev/sdb type: USB vendor: Western Digital model: WD Elements 10A8 size: 931.48 GiB
           ID-4: /dev/sdc type: USB vendor: Seagate model: ST4000LM024-2AN17V size: 3.64 TiB
           ID-5: /dev/sdd type: USB vendor: Seagate model: ST4000LM024-2AN17V size: 3.64 TiB
           ID-6: /dev/sde type: USB vendor: Western Digital model: WD My Passport 2627 size: 4.55 TiB
           ID-7: /dev/sdf type: USB vendor: Western Digital model: WD My Passport 2627 size: 4.55 TiB
Partition: ID-1: / size: 107.08 GiB used: 31.80 GiB (29.7%) fs: ext4 dev: /dev/sda2
Sensors:   System Temperatures: cpu: 47.0 C mobo: 27.8 C
           Fan Speeds (RPM): N/A
Info:      Processes: 366 Uptime: 16h 21m Memory: 31.20 GiB used: 12.90 GiB (41.3%) Init: systemd runlevel: 5 Compilers:
           gcc: 9.2.1 Shell: bash v: 5.0.3 inxi: 3.0.36


dpkg -l |grep mesa | pastebinit
DISPLAY=:0 vainfo | pastebinit Note that I had to make a direcotry and copy this file "iHD_drv_video.so" into it...
cat ~/.kodi/temp/kodi.log | pastebinit
dmesg | pastebinit
id | pastebinit
amixer | pastebinit
cat /var/log/Xorg.0.log | pastebinit


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - teriyaki - 2020-03-15

(2020-03-08, 12:22)Rumpelstiltskin Wrote: This is really very important for my system otherwise the hardware acceleration doesn't work.
sudo sh -c "echo 'LIBVA_DRIVER_NAME=iHD' >> /etc/environment"

sudo chmod -R 777 /dev/dri
sudo chmod -R 777 /dev/dri/*
Instead of altering the permissions you should just add your user to the "render" group.


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - fritsch - 2020-03-15

video group should be enough, render should only be there for the D128 device which kodi does not need.


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - teriyaki - 2020-03-15

(2020-03-15, 17:53)fritsch Wrote: video group should be enough, render should only be there for the D128 device which kodi does not need.

VAAPI was failing to initialize in Kodi with just the video group. Altering the permissions to 777 like he's doing, or adding the user to the "render" group fixes it.


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - fritsch - 2020-03-15

Highly wondering, as it looks like this:

Quote:drwxr-xr-x  2 root root         80 Mär 11 22:15 by-path
crw-rw----+ 1 root video  226,   0 Mär 11 22:15 card0
crw-rw----+ 1 root render 226, 128 Mär 11 22:15 renderD128

kodi does not need the renderD128 device. Might be that for iHD is it needed:

Quote:media_driver/linux/common/ddi/media_libva_util.h:#define DEVICE_NAME "/dev/dri/renderD128"

Yes, that's the case. adding the user to render group therefore is the right thing to do


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - Rumpelstiltskin - 2020-03-16

@teriyaki @fritsch 

Thanks, guys,

in fact I've been kicking ass in the rendering group and it's all working fine without having to do the permit trick...
Sorry, I'll take advantage of it: I have problems with the EAC3 audio, basically while I watch the movie the audio is skipping every now and then.

What could it be?
I'll leave you the logs.

kodi.log
Xorg.0.log


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - raptorq - 2020-05-25

Hey @fritsch 

Hi man, just reinstalled my Linux HTPC Box a few days ago, but actually have been wondering for a while about my black/grey levels in video content. Your tutorial basically works just fine for me. But I always had the impression, that video played from my HTPC (through a Denon AVC 8500h to a LG 65B6D, Denon is NOT doing any Video processing, just passthrough) seemed darker compared to content from my sattelite receiver, fire tv (both also through Denon AVR) or direct playback on the LG Oled using apps there (e.g. Prime Video, Netflix). 
Now I took the time, reading through the Wiki and found the page about Video levels & Color Spaces:

https://kodi.wiki/view/Video_levels_and_color_space#Summary_of_Results

After testing with the recommended AVSHD709 patterns, especially the Basic Tests Black Clipping Test Pattern. My settings brightness/black level Settings on the TV are very good. I can see the bars 17+ flashing. With Kodi, and your recommended setup, I can just see the last 3 or so Bars in that test. So it seems way too dark, thus loosing detail in dark scenes.

Again, back to the Kodi Wiki ... in the result summary, I see that with your recommendation, you'd need the Display (in my Case OLED TV) also set to FULL Color Space:

Full, Full, Full -- Video Level CORRECT : WtW & BtW Clipped, Single scaling

But I am not sure I'd want that, since other sources also hit the TV through the same HDMI Uplink from my AVR, as mentioned, sattelite receiver etc.

Wouldn't it be easier to recommend and use this configuration from the Wiki:

Limited, Full, Limited -- Video Level CORRECT : WtW & BtB preserved, Zero scaling

Which seems to be better anyway, since there is no scaling involved. 

I went ahead and set Kodi back to "Use limited color space" to match the latter configuration recommendation from the Wiki and Voila, I got the same black levels in the Pattern Test as with my other sources mentioned above. Pattern test is showing the desired black level details from Bar 17 upwards.

Just curious, was your setup focused on PC Monitors which normally offer Full color space? What would be the reason to use that for TVs anyway, since from what I understand, also from the Wiki, most or all Video content offers Limited Color Space information anyways ....

Thanks,

raptor


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - tutu - 2020-07-22

Anybody else have this issue on upgrading from 19.10 to 20.04? using kodi stable and a solution please?
Quote:The following packages have unmet dependencies.
 kodi-x11 : Depends: libnfs13 (>= 1.9.7) but it is not installable
            Depends: libpython2.7 (>= 2.7) but it is not going to be installed
            Depends: libsmbclient (>= 2:4.0.3+dfsg1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.



RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - keoma - 2020-07-26

A little bit of topic, feel free to delete if too much so. I've always used this guide to setup my kodi-boxes. Bought a NUC (Gemini Lake) a year ago and it's been working great. Recently started labbing a bit with emulators and such and wanted to try vulkan. But I can't get it to work on my kodi-box. vulkaninfo gives an error instead of posting results. Works fine on my laptop which is using vanilla ubuntu desktop. I saw that this configuration casues xorg to be launched as root instead of user. And sudo vulkaninfo works.. Can anyone else using this configuration run vulkaninfo?


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - Wintermute0110 - 2020-07-27

(2020-07-26, 23:44)keoma Wrote: A little bit of topic, feel free to delete if too much so. I've always used this guide to setup my kodi-boxes. Bought a NUC (Gemini Lake) a year ago and it's been working great. Recently started labbing a bit with emulators and such and wanted to try vulkan. But I can't get it to work on my kodi-box. vulkaninfo gives an error instead of posting results. Works fine on my laptop which is using vanilla ubuntu desktop. I saw that this configuration casues xorg to be launched as root instead of user. And sudo vulkaninfo works.. Can anyone else using this configuration run vulkaninfo?

Here you have a upgraded version of the guide which targets Intel NUC and covers emulation. vulkan works OK with the installation steps in the guide and Ubuntu Focal Fossa. My guide is still WIP so any comment you may have please write in the thread I linked.


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - NoH0w - 2020-10-01

Hi everybody...
    I hope some of you could throw some light to an issue that I have with kodi latest stable running over Ubuntu 20.04 (Celeron J1800 Baytrail). HW acceleration was working previously with Ubuntu 16.04 following the original guide of this thread, but after doing a dist upgrade to 20.04 and re-checking all the steps in this new version of the procedure, I'm unable to make it work again, running ffmpeg in SW mode inside kodi. Curiously Jellyfin VAAPI acceleration works properly in this same machine. I attached my logs here in case someone knows what could be happening:


Thank you in advance

dpkg -l |grep mesa | pastebinit
https://paste.ubuntu.com/p/m2jC3YbJtT/
DISPLAY=:0 vainfo | pastebinit
https://paste.ubuntu.com/p/ykTWnhCKpd/
cat ~/.kodi/temp/kodi.log | pastebinit
https://paste.ubuntu.com/p/5vyZgcVsxv/
dmesg | pastebinit
https://paste.ubuntu.com/p/dzNvWzqtCZ/
id | pastebinit
https://paste.ubuntu.com/p/3fqTSGmXRx/
amixer | pastebinit
https://paste.ubuntu.com/p/QQH9VNW6hm/
cat /var/log/Xorg.0.log | pastebinit
https://paste.ubuntu.com/p/g3mrYPq84Y/


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - fritsch - 2020-10-01

dpkg -l |grep kodi

please - from the log you have a nice mixture between ubuntu and kodi ppa.


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - NoH0w - 2020-10-25

(2020-10-01, 19:15)fritsch Wrote: dpkg -l |grep kodi

please - from the log you have a nice mixture between ubuntu and kodi ppa.

Apologize me for not answering, didn't see your replay before. Effectivily you were right, kodi packages installed were tied to ubuntu Xenial version and not upgraded to Focal during the process. Once done, VAAPI is now working properly!. Thank you very much for yor support Fritsch!!.


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - ezechiel1917 - 2020-12-25

Hello, using this guide
with old VGA (1920x1080) I had console login screen (tty) displayed on monitor after stopping Kodi  (sudo systemctl stop kodi).
with new VGA (3840x2160) i have no singal on monitor when exiting Kodi. I can't display tty unless Kodi is running

any help appreciated.

edit: looks like a bug with newer vga drivers (same behaviour for old VGA)


RE: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - Glandos - 2021-04-08

Hi everyone,

Just to mark a short notice that, starting with Kodi 19 Matrix, I tried to modify the systemd unit using:
ini:
ExecStart=/usr/bin/kodi-standalone --windowing=gbm

This was a great success. A little faster startup, no more sound hiccup on screen off (due to xrandr?), and a little bit faster decoding.

If I understood correctly, GBM is a technique to use the display driver directly, without any X11 or Wayland. The main drawback is that… only Kodi can run, no other graphical application, even launched within Kodi.