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) Pages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
|
Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - fritsch - 2015-07-12 For AMD Users and VAAPI: You need to upgrade Ubuntu 18.04's Mesa to at least 18.0.1 - also for hw acceleration to work with VAAPI for your devices you need to use kodi 18. For Intel users with Generation 10, don't install the intel xorg driver and please start with Ubuntu 20.04. 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 Installation -1.) Hardware Requirements / Software Requirements SNB, IVB, HSW, BSW, BDW, BXT, and newer Intel Hardware This installation is based upon the server iso for Ubuntu 18.04.1 64 bit: http://cdimage.ubuntu.com/releases/18.04.1/release/ubuntu-18.04.1-server-amd64.iso 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 For AMD-Users: If you are running on modern AMD hardware, please also install mesa-va-drivers and the corresponding xorg-drivers matching your hardware xserver-xorg-video-radeon or xserver-xorg-video-amdgpu - we don't support amdgpu-pro. Code: sudo apt-get install [b]xserver-xorg-video-radeon xserver-xorg-video-amdgpu mesa-va-drivers[/b] Allow "everyone" to start the Xserver Code: sudo dpkg-reconfigure xserver-xorg-legacy Now edit /etc/X11/Xwrapper.config and add the following into a new line at the end of the file: Code: needs_root_rights=yes Make sure we use the intel xorg driver (This is only needed on version newer than 16.04, 16.04 uses intel driver by default), but NOT supported for very modern intel GPUs NUC 10 and beyond, for these, skip the next step. Additionally make sure to use Ubuntu 19.10 or better 20.04: Code: sudo mkdir -p /etc/X11/xorg.conf.d 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 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) - btw. udisks2 will start to work the very moment the PR adding udisks2 support gets merged: Code: [Actions for kodi user] 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 Code: [Unit] 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 Fake 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.service 1.) Now we install the final Krypton v18 stable version: Code: sudo apt-add-repository ppa:team-xbmc/ppa As we use openbox as our display manager, we need to auto start kodi, therefore create: Code: sudo mkdir -p /home/kodi/.config/openbox 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'` Now, we can start kodi: Code: sudo systemctl start kodi The usual kodi configuration is done as follows: 2.) KODI settings System ->Player->Processing: Enable HQ Scalers for scaling above: 20% Allow hardware acceleration - VAAPI: on Use Mpeg-2 VAAPI: Yes Use Mpeg-4 VAAPI: if you like UseVC-1 VAAPI: on Use VP8 VAAPI: on (if your device supports it) Use VP9 VAAPI: on (if your device supports it) Use HEVC VAAPI: on (if your device supports it) System -> Player -> Playback Adjust Refreshrate to match video: On start / stop 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=231955&pid=2107461#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: 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. (Hint the Deinterlace: Auto setting was removed some years ago - we can now properly detect interlace / non interlaced content). 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> 3. Color Management (only correct with above xrandr forced to FULL) 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. With the default xrandr setting of Limited 16:235 - those settings would be totally wrong. 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 Issue reports without those logfiles are ignored Update 230512: Seems some people still follow this howto blindly ;-). If you use the iHD driver, make sure your user is member of the render group: adduser kodi render else you cannot properly access /dev/dri/renderD128 RE: New Era: VAAPI with EGL interoperation - fritsch - 2015-07-12 Want to boot with AVR / TV powered off? Have a look here: http://forum.kodi.tv/showthread.php?tid=231955&pid=2148505#pid2148505 for Ubuntu and here: http://wiki.openelec.tv/index.php/Configuring_a_Custom_xorg.conf#tab=Intel for OpenELEC. This is considered an advanced task. Upgrading from 15.10 Code: sudo do-release-upgrade -d after it is run through succesfully readd the ppas and now the crucial part: Install the legacy xserver package and configure it to allow anybody to start the xserver Code: sudo apt-get install xserver-xorg-legacy Now edit: /etc/X11/Xwrapper.config and append the line: Code: needs_root_rights=yes After you updated / readded or enable the ppas (Only the kodi ppas are needed, vaapi not as 16.04 ships 1.7.0 already): Code: sudo apt-get update I want to use fritsch's home build kernel with the Video 16:235 mode and I understand what it does Download the latest kernel / headers from here: http://fritsch.fruehberger.net/kernel/ and install these with sudo dpkg -i. Afterwards alter the autostart such that it ooks like (see the two xrandr commands, switching to full and then switching to fritsch's Video Range, which is not available on non patched kernels): Code: OUTPUT=`xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q'` FernetMenta's master: https://github.com/FernetMenta/xbmc/commits/master (ppa) Known Issues 160626: Colorspace averaging issue libva-driver-intel version 1.7.0 of Xenial has a color filter issue ( see: https://bugs.freedesktop.org/show_bug.cgi?id=94845 ), we use the wsnipex vaapi ppa to use 1.7.1 Code: sudo apt-add-repository ppa:wsnipex/vaapi 170813 - Add dpms setting Through to changes in kodi concering the screensaver inhibitation kodi does not stop the screensaver when it is running on normal menus - which is fully correct. Some people expect other behaviour though, but don't want to change the relevant systemwide settings. Therefore I added xset -dpms to the openbox startup command. 171022 - Change systemd startup file Added dependency on dbus.service - this is needed since Ubuntu 17.10 180521 - Adjust to 18.04 Changed some packages, made a notice for AMD users. 180527 - AMD users AMD users that want to use kodi v18 with vaapi (Take care: v17 won't work), you need to install mesa 18.0.1 or later. You can do this via Paulo's ppa: Code: sudo add-apt-repository ppa:paulo-miguel-dias/pkppa 180601 - v17 users: If usb mounting does not work, please install udevil. For v18 and later udisks2 is properly working. 180929: Changed iso to match 18.04.1 server iso (thx @tutu ) 190130: Changed the ppa link to 18 stable. We are live now. 190620: Added Information for AMD users to properly install mesa-va-drivers and amdgpu / radeon drivers. 200209: Added information about very modern intel gpus which are not supported by the intel-xorg driver anymore nor by ubuntu 18.04.[/b] 230512: If you are using the iHD drivers for vaapi, make sure to add the kodi user to the render group: adduser kodi render RE: New Era: VAAPI with EGL interoperation - john321 - 2015-07-12 Wow, that was a quick :-). A new thread before I could even reply to the last one ! Yes very clear. !! Only Q. still in my mind is that on a j1900 VAAPI-MCDI is available and seems to work. Is it deprecated due to artifacts/skips rather than unsuported ? RE: New Era: VAAPI with EGL interoperation - Ney - 2015-07-12 I am running Openelec testbuild on a Zbox CI-320 (baytrail). full RGB output works wonders and colors are fantastic. MAADI works great for 1080i50 content. Lancoz 3, however seems to be too much (maybe someone with baytrails with dual-chan memory might have better luck), on anything but 720p25 content 4k30 decodes fine with billinear downscaling to 1080p, 4k60 has very few skips when the overlay is on, seems not to happen when the overlay is off, and the testsample at least is very watchable, but this seems to be the limit of the small baytrail. @fritch, maybe add the autostart.sh fix for full RGB output for openelec to the second post? RE: New Era: VAAPI with EGL interoperation - fritsch - 2015-07-12 (2015-07-12, 21:45)john321 Wrote: Wow, that was a quick :-). A new thread before I could even reply to the last one ! It should work as it got fixed after the old howto, but it's obviously only useful for interlaced content. Gwenole, the intel dev, that has designed all those algorithms doubt that BYT would be fast enough for MCDI - therefore I suggest MADI on those platforms. Deinterlacing only makes sense for Interlaced content - so never set this to "On" but always use Auto. Btw: As you see in Ney's reply: the scaling algorithm is very crucial on BYTs, so whenever something stutters, check Scaling Method first. You might need to set it to "Bilinear". RE: New Era: VAAPI with EGL interoperation - fritsch - 2015-07-12 (2015-07-12, 21:49)Ney Wrote: @fritsch, maybe add the autostart.sh fix for full RGB output for openelec to the second post? Will add a note. Thanks for feedback. RE: New Era: VAAPI with EGL interoperation - wsnipex - 2015-07-13 DISPLAY=:0 xrandr --output HDMI1 --set "Broadcast RGB" "Full" >> /usr/local/bin/kodi --standalone should be /usr/bin/kodi --standalone its also not needed to use sudo for the openbox stuff. RE: New Era: VAAPI with EGL interoperation - fritsch - 2015-07-13 The sudo was intended, when the installation user was not the kodi users - so that we get the permissions correct in any case. Will fix the first one. RE: New Era: VAAPI with EGL interoperation - DaVu - 2015-07-13 Great work...use it since yesterday and it looks very nice. I'll follow this thread and will test as much as I can to give usefull feedback Cheers RE: New Era: VAAPI with EGL interoperation - masinad - 2015-07-13 Does in work also in latest kodibuntu? RE: New Era: VAAPI with EGL interoperation - fritsch - 2015-07-13 Upgrading from a 14.04 LTS is not supported within this thread. It might work, though - but you are on your own. RE: New Era: VAAPI with EGL interoperation - neox387 - 2015-07-13 is it normal that w fps: jumps from & back to 23.41-24.39 and not at stable 23.976 ? Adjust display refresh rate to match video: On Start / Stop is on. tv reports 24p. Intel haswell nuc allso confused about 0.175 audio delay this is normal i guess for 24p ? RE: New Era: VAAPI with EGL interoperation - fritsch - 2015-07-13 fps will be gone in the next rebuild :-) cause of exactly your question. This fps value never was anywhere accurate it is my shoesize + some nails + x. Therefore it will be removed in kodi v15 completely. Smoothness you can see at the skip / drop values. The 175ms delay we measured some years ago while asking several 100 people about the delay AVRs add when processing 24p content, therefore we add this by default via advancedsettings.xml RE: New Era: VAAPI with EGL interoperation - neox387 - 2015-07-13 Ok, thanks for the quick reply RE: New Era: VAAPI with EGL interoperation - rob77 - 2015-07-13 I have updated to your latest openelec build fritsch and it works perfect. Thanks so much for your hard work! In a movie when I bring up the menu and audio settings mine says Audio Offset 0.000s and I haven't changed it. Is it meant to say 0.175s? By the way I have no sync issues with my Denon Amp. Cheers |