vlc causing complete system hangups explaination and recommendation

Christophe Massiot massiot at via.ecp.fr
Thu Nov 22 11:40:57 CET 2001


On Thu, Nov 22, 2001, Peter Surda wrote:

> The point is, the "transfer data" part is implemented as a memcpy. However,
> e.g. on r128 which I have, this memcpy ALONE eats about 30% CPU time on DVD
> playback. Faster CPU doesn't help, because it is the card that's slowing it
> down. You can see it sometimes if you run "top" while playing videos, X eats
> lots of time, while it acually isn't doing anything besides this memcpy.

I have rage128 pro and I have exactly the same problem.

> So, a couple of months ago, together with DRI/XFree86 developer Michel Dänzer,
> we modified the r128 driver to use DMA (BlitTexture function from DRI
> actually) when available. This indeed solved the problem, CPU load caused by
> XvShmPutImage is negligible and DVD playback only eats like 15% on my
> Duron650.
> 
> All the players I tried (aviplay, mplayer, xine) can cope with this
> flawlessly, however vlc causes frequent hangups. The reason is obvious: while
> killing a memcpy can at worst cause display corruption, killing a DMA transfer
> often causes a complete system hangup because the card is blocked unless it
> gets the promised amount of data, which it can't.
> 
> This *PutImage modification is already in CVS XFree86, and more drivers are
> expected to implement this as well. Therefore at least when 4.2.0 comes out,
> you can expect a lot of angry vlc users with machines hanging up.

I use XFree86 CVS and I didn't see any performance improvement lately.
How can I know if I can use DMA ? BTW what you did is _really_
interesting.

> As stated previously, I tried to avoid XvShmPutImage interruptions by using a
> mutex in appropriate places of the xvideo vout plugin, but obviously my
> knowledge of vlc is lacking because I was only able to make the hangups less
> frequent, they still happen.
> 
> My recommendation is that whoever has enough knowledge of the xvideo vout
> module, to implement the mutexes properly (i.e. when killing something, vlc
> waits until the XvShmPutImage function returns), before more people complain.
> Until then, I am unable to use vlc for DVD playback (or more precisely for any
> playback) because I need my machine running 24/7.

I'm not an Xlib specialist (far from it), but since Xlib is asynchronous,
I think the only thing we can do is add XSync() in critical places. For
instance could you try adding XSync(p_vout->p_sys->p_display, False)
just before XVideoDestroyWindow (vout_xvideo.c:604) ? Since you said it
crashed in XVideoDestroyWindow, I think it may fix your problem.

Good luck,

-- 
Christophe Massiot.




More information about the vlc-devel mailing list