From: Adrian M. <ad...@mc...> - 2002-10-18 20:11:29
|
This patch should allow the aica module to be loaded with an option 'sleeps' parameter. With sleeps > 0 the module will sleep even for high sample sounds - so lessening the load. This may improve performance in some high stress environments. The default behaviour (the only behaviour available when the code is built into the kernel) is for the code not to sleep, but to spin. This shoul guarantee high quality sound playback at the price of eating through cpu clock cycles. The long term solution to this problem/choice may be for HZ to be set to a higher value (as proposed for 2.5 and optionally backported for 2.4) - ie to give the kernel a time granularity an order of magnitude smaller than now. I imagine a 200 MIPS machine like the DC should be able to handle that - any comemnts? --- main.c Fri Oct 18 21:05:18 2002 +++ linux-sh-dc/drivers/sound/aica/main.c Fri Oct 18 21:02:40 2002 @@ -68,6 +68,10 @@ static int currentpoint; static struct semaphore dsp_mutex; +static int sleeps = 0; /* default is not to sleep for hi-sample rate sounds */ + +MODULE_PARAM(sleeps, "i"); + typedef struct { uint32_t cmd; /* Command ID */ uint32_t pos; /* Sample position */ @@ -341,7 +345,7 @@ for (i = 0; i < (HZ * 2); i++) { - if (chanh->freq < 23000) + if ((chanh->freq < 23000)||(sleeps > 0)) interruptible_sleep_on_timeout(& (devc-> open_wait), @@ -421,7 +425,7 @@ { int playpoint; do { - if (chanh->freq < 23000) + if (chanh->freq < 23000) interruptible_sleep_on_timeout(&(devc->open_wait), 1); spu_write_wait(); @@ -432,7 +436,7 @@ if ((currentpoint + total_count) > 0x8000) { currentpoint = 0; do { - if (chanh->freq < 23000) + if ((chanh->freq < 23000)||(sleeps > 0)) interruptible_sleep_on_timeout(& (devc-> open_wait), |