Do hwsync of slave PCM on dmix

Call hwsync of slave PCM on snd_pcm_hwsync() over dmix.
This reduces ocasional output noises, typically seen in xmms and bmp with
multi-threading on SMP/HT systems.

Disabled slowptr of default dmix definition again.
This commit is contained in:
Takashi Iwai 2005-03-29 14:10:16 +00:00
parent 5e325ea18b
commit 6a6a70ffe7
2 changed files with 10 additions and 4 deletions

View file

@ -27,7 +27,6 @@ pcm.!dmix {
type dmix type dmix
ipc_key 5678293 ipc_key 5678293
ipc_key_add_uid yes ipc_key_add_uid yes
slowptr yes
slave { slave {
pcm { pcm {
type hw type hw

View file

@ -243,7 +243,7 @@ static void snd_pcm_dmix_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t size)
/* /*
* synchronize hardware pointer (hw_ptr) with ours * synchronize hardware pointer (hw_ptr) with ours
*/ */
static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm) static int _snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm, int do_slave_sync)
{ {
snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_direct_t *dmix = pcm->private_data;
snd_pcm_uframes_t slave_hw_ptr, old_slave_hw_ptr, avail; snd_pcm_uframes_t slave_hw_ptr, old_slave_hw_ptr, avail;
@ -256,7 +256,7 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
default: default:
break; break;
} }
if (dmix->slowptr) if (do_slave_sync)
snd_pcm_hwsync(dmix->spcm); snd_pcm_hwsync(dmix->spcm);
old_slave_hw_ptr = dmix->slave_hw_ptr; old_slave_hw_ptr = dmix->slave_hw_ptr;
slave_hw_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr; slave_hw_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
@ -285,6 +285,12 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
return 0; return 0;
} }
static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
{
snd_pcm_direct_t *dmix = pcm->private_data;
return _snd_pcm_dmix_sync_ptr(pcm, dmix->slowptr);
}
/* /*
* plugin implementation * plugin implementation
*/ */
@ -369,7 +375,8 @@ static int snd_pcm_dmix_hwsync(snd_pcm_t *pcm)
switch(dmix->state) { switch(dmix->state) {
case SNDRV_PCM_STATE_DRAINING: case SNDRV_PCM_STATE_DRAINING:
case SNDRV_PCM_STATE_RUNNING: case SNDRV_PCM_STATE_RUNNING:
return snd_pcm_dmix_sync_ptr(pcm); /* sync slave PCM */
return _snd_pcm_dmix_sync_ptr(pcm, 1);
case SNDRV_PCM_STATE_PREPARED: case SNDRV_PCM_STATE_PREPARED:
case SNDRV_PCM_STATE_SUSPENDED: case SNDRV_PCM_STATE_SUSPENDED:
case STATE_RUN_PENDING: case STATE_RUN_PENDING: