Re: [AD] Alsa driver hogs CPU

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On December 21, 2003 10:04 am, Elias Pschernig wrote:
> On Sun, 2003-12-21 at 17:37, Thomas Fjellstrom wrote:
> > I currently don't have any sound problems besides the rather low quality
> > of my via82xx chip's output ;) I did however notice some odd problems
> > when using ALSA ~1.0 (be it a beta release or recent 0.9.* release...), I
> > ended up downgrading to ALSA 0.9.4 to rid my self of some problems when
> > in conjunction with MythTV... (audio stuttering, etc...) Mind you 1.0 rc2
> > seems to be "ok" on my main machine...
> >
> > Do any alsa programs work? Do any show the same problems? Maybe I missed
> > something in the ALSA non-manual. (there isn't one really... pita) Or
> > they changed the api since I wrote the driver (AGAIN).
>
> No, other ALSA programs work (and use <1% CPU while playing music). Also
> Allegro sound works, just it uses so much CPU. I believe, the problem is
> somehow in how the background thread and alsa_update work together.
> Probably we should wait until someone shows up who knows how this part
> of Allegro is supposed to work.

Good to know...

> I've looked a bit at the code, and it seems like background functions
> (like alsa_update) are called 100 times / second:
>
> at least, src/unix/uthreads.c bg_man_pthreads_threadfunc contains:
> delay.tv_sec = 0;
> delay.tv_usec = 10000;
> select(0, NULL, NULL, NULL, &delay);
>
> And the callbacks should then return as fast as possible I guess. But I
> didn't look very long. What are the fragments and the loop inside
> alsa_update for? And I believe the sleep(1) in there better not get
> executed - since it blocks other background callbacks?

Hmm.. the fragments thing is probably legacy stuff from the 0.5 driver, its in 
there, and is a config option... Its not rerally needed from what I see, the 
ALSA code I wrote/collected for another project seems to be ok, and doesn't 
have the extra loop. But it also includes/uses that scary xrun_recovery 
function. 

If you can, try removing that for loop, and see how it performs...

> --
> Elias Pschernig <elias@xxxxxxxxxx>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
> Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click

-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx
http://strangesoft.net





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/