Kodi Community Forum

Full Version: [LINUX] HOW-TO use VAAPI HW Acceleration in Intel Core i3 / i5 / i7 integrated GPU
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
alanwww1 Wrote:Please check that it is also only coming out at vaapi decoded files. Also please check that this comes up on every vaapi decoded files or just some with a certain refcount (eg. the files which were played with stutter before my pacth)

Hey Alan,
I can confirm it is with all files, not just with a particular refcount.
For some reason it's as if VAAPI has trouble purging a buffer or cache. I'm sure that makes no sense, but that's how it feels Smile You skip forward, but it's still hung up on what it was previously doing. If I stop playback, wait a couple of seconds and start it's usually ok, if I immediately play something else after stopping (other file or same) the issue persists. It is with everything I throw at it, overclocked GPU or not. It seems to scale with movie quality - Full bluray (20+GB file) is affected more than a HD TV series is. Both same behaviour but smaller file is quicker to "catch up".

It's not network or XBMC as I had my ION on the same network drop/version without issue.

By the way; if you need me to test in any way let me know.
igjunk Wrote:First of, great job alanwww1! I really appreciate the time and effort you are putting into this.

Can you please elaborate on this statement. Can the intel VA-API driver output the proper 23.976hz rate out via HDMI, or is it only limited to 24hz?

I am not 100% percent sure, but playback is perfectly smooth without any stutter.
One more issue to add; you know how some HD TV episodes have a popup bar to advertise other shows, or state "presented in HD" or something like that?

The moment that's displayed, the TV switches resolution causing video playback to stall and go completely out of sync with audio/subs. Totally unusable.
If I enable a 6-10 second delay upon resolution switch it's ok.
Obviously that's a workaround and not a solution, and one with a very low WAF at that Smile
Rude-Dog Wrote:One more issue to add; you know how some HD TV episodes have a popup bar to advertise other shows, or state "presented in HD" or something like that?

The moment that's displayed, the TV switches resolution causing video playback to stall and go completely out of sync with audio/subs. Totally unusable.
If I enable a 6-10 second delay upon resolution switch it's ok.
Obviously that's a workaround and not a solution, and one with a very low WAF at that Smile

Are you sure it is only a problem with VAAPI ?
alanwww1 Wrote:Are you sure it is only a problem with VAAPI ?

Yes. It's treated just like a search operation that is causing problems like I posted earlier. The issue is not the resolution switch itself it seems.
Rude-Dog Wrote:Yes. It's treated just like a search operation that is causing problems like I posted earlier. The issue is not the resolution switch itself it seems.

And the cause of the stutter is coming from low or fluctuating framerate like we have for video starting and ff/rw ?
Hi alanwww1, first of all thank you very much for your guide it has helped me a lot to install XBMC with VAAPI support in my hptc ( i3 530 - Ubuntu 10.10 64bits).

My experience so far:
I had a previous installation of Ubuntu 10.10 with vaapi packages from gbauchesne page ( http://www.splitted-desktop.com/~gbeauchesne/libva/ ) and mplayer-vaapi compiled following exactly the same instructions that you gave. That installation of mplayer worked with vaapi without problems.

After discovering your tutorial I decided to test xbmc with vaapi and created a new partition with a fresh install of Ubuntu Maverick. I followed your tutorial and xbmc works flawlessly with vaapi, I am really happy with the setup, I had never used Xbmc and I am really impressed with it so far.

The part that didn't work so well for me was the vaapi enabled mplayer. Following exactly your guide if I try to play a file with -vo vaapi it complains abaut the video output driver vaapi. The output of :
Code:
mplayer -vo help
doesn't list vaapi as an option.

I checked my other Maverick partition and there that option works....

so I suspect that there is some kind of incompatibility between vaapi implementation in Xorg-Edgers and the one in gbeauchesne page (from where I downloaded the vaapi enabled mplayer).

Reviewing the compilation logs reveals the problem with the build:
config.log in the failed version (with xorg-edgers repo):

Code:
============ Checking for VA-API ============

#include <va/va_x11.h>
int main(void) { (void) vaGetDisplay(0); return 0; }

cc /tmp/mplayer-configure--[b]19592[/b]/tmp.c -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -I.  -D_REENTRANT -I/usr/include/directfb -I/usr/include/     -D_REENTRANT     -ffast-math   -lncurses -lrt -lsmbclient -lpng -lz -ljpeg -lungif -lasound -ldl -lpthread  -ldirectfb  -lXext -lX11 -lpthread -lXrender -lXv -lXinerama -lXxf86vm -lXxf86dga -laa -L/usr/lib -lcaca -lvga -lSDL -lGL -ldl -lGLU -lesd   -laudio -lXt -lpulse   -ljack -lopenal  -o /tmp/mplayer-configure--[b]19592[/b]/tmp -lva-x11
/usr/lib/libva-x11.so: undefined reference to `vaDisplayIsValid'
collect2: ld returned 1 exit status



#include <va_x11.h>
int main(void) { (void) vaGetDisplay(0); return 0; }

cc /tmp/mplayer-configure--[b]19592[/b]/tmp.c -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -I.  -D_REENTRANT -I/usr/include/directfb -I/usr/include/     -D_REENTRANT     -ffast-math   -lncurses -lrt -lsmbclient -lpng -lz -ljpeg -lungif -lasound -ldl -lpthread  -ldirectfb  -lXext -lX11 -lpthread [b]-lXrender[/b] -lXv -lXinerama -lXxf86vm -lXxf86dga -laa -L/usr/lib -lcaca -lvga -lSDL -lGL -ldl -lGLU -lesd   -laudio -lXt -lpulse   -ljack -lopenal  -o /tmp/mplayer-configure--[b]19592[/b]/tmp -lva
/tmp/mplayer-configure--[b]19592[/b]/tmp.c:1: fatal error: va_x11.h: No such file or directory
compilation terminated.


Result is: no
##########################################

Config Log in the sucessful build:

Code:
##########################################

============ Checking for VA-API ============

#include <va/va_x11.h>
int main(void) { (void) vaGetDisplay(0); return 0; }

cc /tmp/mplayer-configure--[b]29746[/b]/tmp.c -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -I.  -D_REENTRANT -I/usr/include/directfb -I/usr/include/     -D_REENTRANT     -ffast-math   -lncurses -lrt -lsmbclient -lpng -lz -ljpeg -lungif -lasound -ldl -lpthread  -ldirectfb  -lXext -lX11 -lpthread -lXv -lXinerama -lXxf86vm -lXxf86dga -laa -L/usr/lib -lcaca -lvga -lSDL -lGL -ldl -lGLU -lesd   -laudio -lXt -lpulse   -ljack -lopenal  -o /tmp/mplayer-configure--[b]29746[/b]/tmp -lva-x11


Result is: yes
##########################################

============ Checking for VA-API (with GLX support) ============

#include <va/va_glx.h>
int main(void) { (void) vaGetDisplayGLX(0); return 0; }

cc /tmp/mplayer-configure--[b]29746[/b]/tmp.c -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -I.  -D_REENTRANT -I/usr/include/directfb -I/usr/include/     -D_REENTRANT     -ffast-math   -lncurses -lrt -lsmbclient -lpng -lz -ljpeg -lungif -lasound -ldl -lpthread  -ldirectfb  -lXext -lX11 -lpthread -lXv -lXinerama -lXxf86vm -lXxf86dga -laa -L/usr/lib -lcaca -lvga -lSDL -lGL -ldl -lGLU -lesd   -laudio -lXt -lpulse   -ljack -lopenal -lva-x11  -lva -o /tmp/mplayer-configure--[b]29746[/b]/tmp -lva-glx


Result is: yes
##########################################

I have checked va.h in /usr/include/va/ and there is an entry for vaDisplayIsValid and there is maybe the souce of the problems, but my programming skills are close to null and don't know how to proceed to install mplayer with vaapi support.

It seems some members have the same problem I have:
http://forum.xbmc.org/showpost.php?p=658...stcount=20


... I forgot to mention, I had a lot of problems trying to output AC3 and DTS to my receiver (old one) via spdif from xbmc but found the solution in this thread: http://forum.xbmc.org/showthread.php?p=691448



Has anyone any idea how could I continue researching the problem.
Thanks,
alanwww1 Wrote:And the cause of the stutter is coming from low or fluctuating framerate like we have for video starting and ff/rw ?

Yes sir, that's exactly right. Anything that introduces a fluctuation in framerate completely screws up playback, usually to a point where it does not catch up/correct itself unless the feed is paused for at least 5 seconds.
Any content without frame rate switches, or watched from beginning to end without touching it plays just fine (except, of course, Interlaced VC1).
Rude-Dog Wrote:Yes sir, that's exactly right. Anything that introduces a fluctuation in framerate completely screws up playback, usually to a point where it does not catch up/correct itself unless the feed is paused for at least 5 seconds.
Any content without frame rate switches, or watched from beginning to end without touching it plays just fine (except, of course, Interlaced VC1).

Thanks for the info. I will try to investigate. But that won't be easy. Any help from anyone with c++ debugging skills is welcome. What is suspect is that renderer drops one frame which does not have time to be decoded until the next screen refresh, but somehow, the decoding of the next frame does not start at this moment, only after the previous frame decode is finished. It will be a tough one to fix.
Not sure if this bug is specific to the smoothvideo patch in this thread, but I cant seem to disable smoothvideo in the settings. At least, it still says +0.1% speedup etc when it is disabled.

Ive also experimented a bit with the low-fps bug. It seems to only happen on start of playing a new file for me, never from skipping. Only thing I could see was that CPU was much higher than when it works, 25% on 2 cores versus about 10% when a movie is playing stably. FPS around 10. Just stopping and resuming seems to work well for me.

I'm not sure how scaling is done (btw not sure what scaling I even use) but for some movies smoothvideo misses synchs reliably if I scale at all it seems. I guess this pushes the GPU slightly too much to be able to decode properly.

This bug is acceptable for me anyway, as long as I dont need to scale its superfine. Checked out some long panning scenes, just perfect. Ive been playing 60hz exclusively before, and this is waaay better.
alanwww1 Wrote:Thanks for the info. I will try to investigate. But that won't be easy. Any help from anyone with c++ debugging skills is welcome. What is suspect is that renderer drops one frame which does not have time to be decoded until the next screen refresh, but somehow, the decoding of the next frame does not start at this moment, only after the previous frame decode is finished. It will be a tough one to fix.

I had the time to do some more testing. If I disable "Adjust display refresh rate to match video" the file plays fine as obviously the refresh rate change is avoided. If I enable a BIG pause after refresh switch the problem is avoided too.

I don't understand why it would only try to do that resolution switch after 15+ seconds into playback anyways - that seems to be the reason it screws up. To me normal behaviour would be to do the refresh rate switch immediately upon starting the playback, at that point there are not much frames rendered yet so there's no problem.
Hello

Just want to share...

I'm using an Asrock 100HT with 10.10, 64 bit version. Installed latest intel drivers from X-team and XBMC and libva from https://launchpad.net/~lars-opdenkamp/+a...r=maverick

I'm running tvheadend and XBMC is Dharma with PVR added but I don't use the "Live-TV" function since it crashes all the time. I can live with that since it's a non released version.

The HTPC is connected to a Samsung TV via HDMI

My main problems are:

1) Can't use VAAPI, due to the stuttering problem. It's ok to run HD videos at least up to 8-10 Mbit/s with just the CPU. Can't find any (test videos) with higher bitrate on the net..Solved with own compilation and patch ?

2) After suspend, the graphic is crap. Need to reboot. Similar problem like:
http://askubuntu.com/questions/16902/gra...or-suspend

3) After boot the audio sometime is gone. In some cases it seems to be muted in ubuntu. In other cases I can't find the problem. Reboot needed..

I see it like a "test" system and hope that next release of ubuntu will solve at least some of the problems...Wink
bema Wrote:I see it like a "test" system and hope that next release of ubuntu will solve at least some of the problems...Wink

We have to wait for Intel and Xorg devs to solve the problems. Most of the problems will be solved in Natty final, but we have to see later.
Another bug with vaapi: some files are very extremely out of synch. And this is SD movies. I suspect it could be that the audio has some odd samplerate.
bema Wrote:3) After boot the audio sometime is gone. In some cases it seems to be muted in ubuntu. In other cases I can't find the problem. Reboot needed..

Are you sure that's not related to Pulseaudio in Ubuntu taking exclusive control over the same audio device you're trying to use for XBMC output?
I had similar problems, and setting pulseaudio to the analog outputs in Ubuntu, thus freeing up optical output for XBMC did the trick.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19