aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2009-05-28 05:31:20 -0400
committerTakashi Iwai <tiwai@suse.de>2009-05-29 05:47:38 -0400
commit13f040f9e55d41e92e485389123654971e03b819 (patch)
treea1a10bff0ab5fb7f8ab265edba72897f1b90bd07 /sound
parentc62a01ad6e746fae9c93f51ea67e0abfd8d94b58 (diff)
ALSA: PCM midlevel: Do not update hw_ptr_jiffies when hw_ptr is not changed
Some hardware might have bigger FIFOs and DMA pointer value will be updated in large chunks. Do not update hw_ptr_jiffies and position timestamp when hw_ptr value was not changed. Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_lib.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 25cb36710ef..0f299a5ad6d 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -138,6 +138,10 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
138 138
139static void xrun(struct snd_pcm_substream *substream) 139static void xrun(struct snd_pcm_substream *substream)
140{ 140{
141 struct snd_pcm_runtime *runtime = substream->runtime;
142
143 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE)
144 snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp);
141 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); 145 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
142 if (xrun_debug(substream, 1)) { 146 if (xrun_debug(substream, 1)) {
143 snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", 147 snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n",
@@ -154,8 +158,6 @@ snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream,
154{ 158{
155 snd_pcm_uframes_t pos; 159 snd_pcm_uframes_t pos;
156 160
157 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE)
158 snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp);
159 pos = substream->ops->pointer(substream); 161 pos = substream->ops->pointer(substream);
160 if (pos == SNDRV_PCM_POS_XRUN) 162 if (pos == SNDRV_PCM_POS_XRUN)
161 return pos; /* XRUN */ 163 return pos; /* XRUN */
@@ -298,10 +300,15 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)
298 runtime->silence_size > 0) 300 runtime->silence_size > 0)
299 snd_pcm_playback_silence(substream, new_hw_ptr); 301 snd_pcm_playback_silence(substream, new_hw_ptr);
300 302
303 if (runtime->status->hw_ptr == new_hw_ptr)
304 return 0;
305
301 runtime->hw_ptr_base = hw_base; 306 runtime->hw_ptr_base = hw_base;
302 runtime->status->hw_ptr = new_hw_ptr; 307 runtime->status->hw_ptr = new_hw_ptr;
303 runtime->hw_ptr_jiffies = jiffies; 308 runtime->hw_ptr_jiffies = jiffies;
304 runtime->hw_ptr_interrupt = hw_ptr_interrupt; 309 runtime->hw_ptr_interrupt = hw_ptr_interrupt;
310 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE)
311 snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp);
305 312
306 return snd_pcm_update_hw_ptr_post(substream, runtime); 313 return snd_pcm_update_hw_ptr_post(substream, runtime);
307} 314}
@@ -356,9 +363,14 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
356 runtime->silence_size > 0) 363 runtime->silence_size > 0)
357 snd_pcm_playback_silence(substream, new_hw_ptr); 364 snd_pcm_playback_silence(substream, new_hw_ptr);
358 365
366 if (runtime->status->hw_ptr != new_hw_ptr)
367 return 0;
368
359 runtime->hw_ptr_base = hw_base; 369 runtime->hw_ptr_base = hw_base;
360 runtime->status->hw_ptr = new_hw_ptr; 370 runtime->status->hw_ptr = new_hw_ptr;
361 runtime->hw_ptr_jiffies = jiffies; 371 runtime->hw_ptr_jiffies = jiffies;
372 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE)
373 snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp);
362 374
363 return snd_pcm_update_hw_ptr_post(substream, runtime); 375 return snd_pcm_update_hw_ptr_post(substream, runtime);
364} 376}