XBMC Community Forum
[LINUX] HOW-TO use VAAPI HW Acceleration on AMD Zacate (Fusion) platform - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: XBMC General Help and Support (/forumdisplay.php?fid=111)
+---- Forum: Linux and Live support (/forumdisplay.php?fid=52)
+---- Thread: [LINUX] HOW-TO use VAAPI HW Acceleration on AMD Zacate (Fusion) platform (/showthread.php?tid=99154)



- chemical - 2011-12-07 15:59

fritsch Wrote:It hangs in fglrx, i suppose during swapBuffers call or similar.... too much GL in xvba-driver which can interfere. But let`s see your log.

First idea (some month ago) was to fix xvba-driver, cause you do only get this kind of hangs hang after having watched a movie with vaapi over xvba-driver. But we decided differently, to implement raw xvba.

But! we need to get this fixed. No solution if vaapi crashes for all AMD folks outside when eden is released.

You use the latest Catalyst btw.? 11.11?

Yes, I do. Thanks for the background.

I'll see what I can provide ;-)

Btw, I'm using Opdenkamp git at this commit https://github.com/opdenkamp/xbmc/commit/2e00d86e7b2cb4fd001d7798ff576447ee02b90d and with this patch:

Code:
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
@@ -358,7 +358,9 @@ bool CDecoder::EnsureContext(AVCodecContext *avctx)
     else
       m_refs = 2;
   }
-  return EnsureSurfaces(avctx, m_refs + 3);
+  // number of reference + 3 renderbuffers + Holder
+  // an extra one should not harm
+  return EnsureSurfaces(avctx, m_refs + 5);
}

bool CDecoder::EnsureSurfaces(AVCodecContext *avctx, unsigned n_surfaces_count)

Maybe this is part of the problem.


- Redsandro - 2011-12-07 16:33

I replaced stable with nathan-renniewaldock/xbmc-nightly yesterday, let's see if I still have the issue.

BTW, the post-releases driver cannot install for some reason, so I installed the non-post-release driver from jockey in Ubuntu which is Catalyst 11.8 for Ubuntu 11.10.

@chemical For me the crash left the frozen image on the screen, even after XBMC was killed or desktop manager restarted. Replugging cables or picking a different port has no effect, that's why I must reboot at that time. Everything else keeps working though, so if I don't need to do mediacentering, I can just leave it running as file server and other headless tasks. AMD Fusion A50M here.

-edit-

@chemical I also used the opdenkamp repo previously, without patches, and had the freezes I described. I don't think that patch is the cause.


- chemical - 2011-12-08 01:09

fritsch Wrote:It hangs in fglrx, i suppose during swapBuffers call or similar.... too much GL in xvba-driver which can interfere. But let`s see your log.

First idea (some month ago) was to fix xvba-driver, cause you do only get this kind of hangs hang after having watched a movie with vaapi over xvba-driver. But we decided differently, to implement raw xvba.

But! we need to get this fixed. No solution if vaapi crashes for all AMD folks outside when eden is released.

You use the latest Catalyst btw.? 11.11?

Within the debugger, I noticed this is different. Sometime after skipping in movies, stopping them and jumping to live tv, I found that xbmc.bin froze (not even logging anything).

However, I wasn't able to Strg+C in gdb back to the prompt.

last messages in xbmc.log:
Code:
23:56:38 T:140736583833344    INFO: CDVDPlayerVideo - Stillframe left, switching to normal playback
23:56:38 T:140736583833344   DEBUG: VAAPI - attempting to open codec 28 with profile 77 at level 40 with 2 reference frames
23:56:38 T:140736676964096  NOTICE: Opening teletext stream: 4 source: 256
23:56:38 T:140736676964096  NOTICE: Creating teletext data thread
23:56:38 T:140736676964096  NOTICE: Opening audio stream: 2 source: 256
23:56:38 T:140736676964096  NOTICE: Finding audio codec for: 86016
23:56:38 T:140736676964096   DEBUG: FactoryCodec - Audio: libmad - Opening
23:56:38 T:140736676964096   DEBUG: SECTION:LoadDLL(libmad.so.0)
23:56:38 T:140736751122176   DEBUG: Thread CDVDTeletextData start, auto delete: 0
23:56:38 T:140736751122176  NOTICE: running thread: CDVDTeletextData
23:56:38 T:140736676964096   DEBUG: Loading: libmad.so.0
23:56:38 T:140736583833344   DEBUG: VAAPI - initialize version 0.32
23:56:38 T:140736583833344   DEBUG: VAAPI - attrib 5 (get/---) min 1 max 1 value 0x1
23:56:38 T:140736583833344   DEBUG: VAAPI - attrib 4 (get/set) min 0 max 16777215 value 0xffffff
23:56:38 T:140736583833344   DEBUG: VAAPI - attrib 0 (get/set) min -100 max 100 value 0x0
23:56:38 T:140736583833344   DEBUG: VAAPI - attrib 1 (get/set) min -100 max 100 value 0x0
23:56:38 T:140736583833344   DEBUG: VAAPI - attrib 2 (get/set) min -100 max 100 value 0x0
23:56:38 T:140736583833344   DEBUG: VAAPI - attrib 3 (get/set) min -100 max 100 value 0x0
23:56:38 T:140736583833344   DEBUG: VAAPI - profile 7
23:56:38 T:140736583833344   DEBUG: VAAPI - profile 10
23:56:38 T:140736583833344   DEBUG: VAAPI - making sure 7 surfaces are allocated for given 2 references

Checking with top, I found that xbmc.bin loaded both cpus. Stracing the process xbmc.bin: Permission denied.

Last output of gdb:
Code:
[Thread 0x7fffcfa32700 (LWP 3221) exited]
[New Thread 0x7fffcfa32700 (LWP 3222)]
[New Thread 0x7fffc9960700 (LWP 3227)]
[New Thread 0x7fffdec60700 (LWP 3228)]
[New Thread 0x7fffca161700 (LWP 3229)]
libva: VA-API version 0.32.0
libva: User requested driver 'xvba'
libva: Trying to open /usr/lib/va/drivers/xvba_drv_video.so
[New Thread 0x7fffd40eb700 (LWP 3230)]
libva: va_openDriver() returns 0
[New Thread 0x7fffd38ea700 (LWP 3231)]
^C
^C^C^C^C^C^C

The last thread fork was pid 3231 - that one is still running and gdb was waiting for it (indefinitely - 3065 is "gdb /usr/lib/xbmc/xbmc.bin"):

Code:
xbmc@xbmc:~/.xbmc/temp$ sudo strace -p 3065
Process 3065 attached - interrupt to quit
wait4(3231,

Don't know how to go on here, the only way to help is kill -9 gdb - no bt possible ;-(

EDIT: Without debugger, xbmc.bin is traceable. Freezing in "futex(0x7fc068000020, FUTEX_WAIT_PRIVATE, 2, NULL"


- chemical - 2011-12-08 01:37

Was able to catch a (different) crash.

Last lines in xbmc.log
http://paste.kde.org/156356/

Thread apply all bt:
http://paste.kde.org/156368/


- fritsch - 2011-12-08 09:14

I am afraid this looks not like anything I expected. Could you file an issue with opdenkamps git tree?

For a really first look, it seems like a race condition between different threads (waiting forever) - but I am not really sure - too many threads invoked I do not know of (vdr stuff) and how they interact.

Btw. you could run xbmc without gdb, when it hangs you can use gdb to attach to this pid. gdb must be run as superuser, eg sudo gdb xbmc.bin

set logging on lala.txt
attach $PID
thread apply all bt

For a first look it does not seem to be vaapi related in anyway. I am looking again in some hours - have to go to work :-)


- chemical - 2011-12-08 12:13

fritsch Wrote:I am afraid this looks not like anything I expected. Could you file an issue with opdenkamps git tree?

For a really first look, it seems like a race condition between different threads (waiting forever) - but I am not really sure - too many threads invoked I do not know of (vdr stuff) and how they interact.

Btw. you could run xbmc without gdb, when it hangs you can use gdb to attach to this pid. gdb must be run as superuser, eg sudo gdb xbmc.bin

set logging on lala.txt
attach $PID
thread apply all bt

For a first look it does not seem to be vaapi related in anyway. I am looking again in some hours - have to go to work :-)

Ok, maybe this is related to the epg crashes I have with the Nov 20 pvr-ppa git - wasn't the problem before.

If I can attach to a "freezing" xbmc.bin life is easier for me. I just placed a hook for this - my gf will call me the next time this happens. ;-)

I placed the logs/traces here, looks similar: https://github.com/opdenkamp/xbmc/issues/344


- Redsandro - 2011-12-09 04:34

It happened again. A freeze. But not during any menu drawing, in the middle of a video. The audio continued playing, but input (remote, keyboard) didn't work anymore. Reboot is the only clean way out. (login via ssh, reboot now)

This was using the nightly from nathan-renniewaldock/xbmc-nightly. How did I do that special magic again that is any use to the devs? Was enabling debug mode enough, or did I need a special debug build?
And can I enable the debug logging without that annoying overlay? I mean I have to continue my daily htpc-life until it happens again, who knows how long that takes. Tongue


- fritsch - 2011-12-09 10:13

@chemical:
As I thought this is a locking problem in pvr, nothing to do with this patch concerning 24p playback. Btw. from reading the bugreport there are patches on their way.

@Redsandro:
It would be interesting to get an xbmc.log with debugging turned on and additionally a gdb backtrace as described some threads above. Thank you in advance.


- Infinitatus - 2011-12-09 11:43

BTW What is currently the most stable versión: The opdenkamp ppa or the nathan-renniewaldock ppa?


- Redsandro - 2011-12-09 14:59

@fritsch I am guessing you reply to the email notification and did not see my edit so excuse me for asking again, but can I enable the debug logging without that 3 line text overlay? I have to continue my daily htpc-life until another freeze, who knows how long that takes. Big Grin

@Infinitatus nathan has both a stable and a nightly branch. Stable is more recent than opdenkamp. I have not noticed a difference between the three from an ignorant consumer point of view, so bugwise that is neat. I would go for the newest stable, nathan that is.