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 Krypton v17 based on Ubuntu 16.04 server - fritsch - 2017-08-21

No, that is wrong: https://github.com/xbmc/xbmc/blob/Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp#L563 v17 does not support HEVC-10 bit.


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - ((( atom ))) - 2017-08-21

OK, compiling kodi-git now...


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - ((( atom ))) - 2017-08-22

So, kodi-git compiled overnight and it plays HEVC 10 just fine! - Great, all formats welcome, now! Smile

While being at it I ran my 25fps test file and played around with the audio-offset while watching the debug-log. When reaching 750 ms (ahead, delaying the picture), I got
09:04:50.624 T:140097194288896 WARNING: CRenderManager::WaitForBuffer - timeout waiting for buffer.
When decreasing the value it disappeared again. Voila!

I guess the value depends on other factors, since I can never use above 700 as a fixed value. I am stuck at fivehundredsomething.

Here is the entire log: https://pastebin.com/NRf1awx1

I wrote to Achim Turan, he answered. I will write back.. Wink


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - fritsch - 2017-08-22

Make sure your sink returns proper Delay values if it does AE can adjust, else it's always a hack.


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - ((( atom ))) - 2017-08-22

Do you mean my alsa-to-jack bridge? I wouldn't know about any Delay values, hmm. Anyway what kodi gets to see is alsa. The alsa-jack-plugin is passing the sound through to jack and jack has a network portion that sends it to another machine running jack again which is passing the sound through to bruteFIR, which does the processing and introduces the delay. In other words the machine kodi is running on cannot know the actual delay being introduces, so it would at best report a tiny delay, let's say 5 ms.

The setup might sound complicated, but actually it is rather straightforward and working for maybe 5 years now untouched, processing all audio I'm listening to.


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - fritsch - 2017-08-23

Print out the delay values please by modifying aesinkalsa, it's one line. Btw implementing a real jack sink for Kodi is not that hard at all.

Edit: AE measures it's own delay as it knows what data it gave you. If sinks delay returned does not match AE will take action... often, always.


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - ((( atom ))) - 2017-08-23

Funny you'd say that. I have been asking around for the possibility of kodi outputting directly to jack and I was always told, that would be quite a bit of work and I should use the alsa-bridge. OK, that was a while ago, maybe things have changed to the better..

Quickly looked through the code of aesinkalsa. I can see that from line 895 it gets and deals with the delay, so I will have to see how to get this best into the debugging-output. I am not a C-coder, but I should find out..

I will also set up and try the delay-issue on a kodi-system with direct alsa-output, so I will have another hint if my bridge is causing the issue or if it is a general problem.


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - fritsch - 2017-08-23

There are basically three things AE wants from the sink:

Proper GetDelay
Proper blocking AddPackets
Sane GetTotalCache

That's it


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - ((( atom ))) - 2017-08-25

So I set up a second kodi on a second arch linux PC, audio going to HDMI via alsa and I get the exact same behaviour when I raise the audio-delay above 725 ms:
The picture starts to stutter and the log says: WARNING: CRenderManager::WaitForBuffer - timeout waiting for buffer.

I suppose this to happen on any given machine. Could someone please check that out quickly?


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - ((( atom ))) - 2017-08-29

Could anyone please quickly raise the audio-delay above 700 ms (slider to the right) and report if it gets choppy?


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - Soli - 2017-08-29

it doesn't


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - ((( atom ))) - 2017-08-30

Thx for checking out, very interesting result! Why do I have that on two systems, one of them ordinarily outputting audio through alsa?


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - qp9013625 - 2017-09-03

(2015-07-12, 20:06)fritsch Wrote: 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):
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 --exit

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.

@ fritsch:

In another thread you wrote:

(2017-06-15, 19:58)fritsch Wrote: You can configure that _before_ you start wayland / weston whatever. A starting point is the proptest of libdrm. Example for my HDMI port:
Code:
proptest -M i915 -D /dev/dri/card0 61 connector 54 1
In my setup I used weston and kodi from the GSOC project.

When I try the proptest command on Ubuntu, it is not being recognized and not offered to be installed.

Can you possibly explain some more how to do it? And maybe that way we could set BroadcastRGB=Full even before X starts?


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - Axman - 2017-09-14

Hey guys, frisch especially:

Again, thanks for all the great work bringing modern codec support and hw acceleration to kodi!

My pursuit for flawless 24p playback with DTS* passthrough and hw decoding has been long and continues to this day.

My setup:
Hardware
Kaby Lake i5 CPU
8GB memory
Content is on RAID5 disk array
2016 model Samsung curved LED
4 year old Yamaha AV receiver
5.1 audio setup

Software
Ubuntu Zesty 17.04
Built Kodi-agile from source (master, last time a week ago)
Followed this guide to the letter
Used padoka-ppa to get latest Mesa drivers (17.3)

I've achieved:
Proper DTS pass-through audio
hw decoding of 4k content
hw decoding of HEVC

But, I have yet to achieve 100% flawless playback. I still see some irregular stuttering, especially in panning scenes. During playback with debugging on, I see frame rate fluctuating between 22.4-25.4 fps. Content is 23.96fps I think. TV changes refresh rate to 24 on playback start.
I have the Plex HT app installed on my TV, and when I play back same material on it, its 100% smooth - no stuttering at all. However, with this app pass-through audio does not work so its not a satisfactory option.

I'm trying both 1080p and 2160p content, some playback hiccups always occur. I have settings as per page 1 of this guide, including advancedsettings.xml and "Motion adaptive" deinterlacing.

Logs:
dpkg -l | grep mesa
~/.kodi/temp/kodi.log
dmesg
id
amixer

I've done all I can so far. I see no problems in the Kodi debug logs.
Any advice on how to achieve this holy grail of HTPC experience is greatly appreciated!


RE: Intel VAAPI howto with Krypton v17 based on Ubuntu 16.04 server - qp9013625 - 2017-09-15

(2017-09-03, 23:46)qp9013625 Wrote:
(2015-07-12, 20:06)fritsch Wrote: 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):
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 --exit

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.

@ fritsch:

In another thread you wrote:

(2017-06-15, 19:58)fritsch Wrote: You can configure that _before_ you start wayland / weston whatever. A starting point is the proptest of libdrm. Example for my HDMI port:
Code:
proptest -M i915 -D /dev/dri/card0 61 connector 54 1
In my setup I used weston and kodi from the GSOC project.

When I try the proptest command on Ubuntu, it is not being recognized and not offered to be installed.

Can you possibly explain some more how to do it? And maybe that way we could set BroadcastRGB=Full even before X starts?

Just came across this:

https://www.brad-x.com/2017/08/07/quick-tip-setting-the-color-space-value-in-wayland/

Wink