diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2012-05-13 13:07:22 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-05-14 04:43:43 -0400 |
commit | 92b862c7d685f5971a954e6ded51891d4adc412b (patch) | |
tree | 2843d2093df1ad58fac3274e67b208b2827546cd /sound/firewire/amdtp.c | |
parent | e9148dddc3c7b6121300319c3e31f9380d459be8 (diff) |
ALSA: firewire-lib: optimize packet flushing
Trying to flush completed packets is pointless when the pointer
callback was called from the packet completion callback; avoid it.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/amdtp.c')
-rw-r--r-- | sound/firewire/amdtp.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c index c2685fbd7366..ea995af6d049 100644 --- a/sound/firewire/amdtp.c +++ b/sound/firewire/amdtp.c | |||
@@ -178,6 +178,7 @@ void amdtp_out_stream_pcm_prepare(struct amdtp_out_stream *s) | |||
178 | tasklet_kill(&s->period_tasklet); | 178 | tasklet_kill(&s->period_tasklet); |
179 | s->pcm_buffer_pointer = 0; | 179 | s->pcm_buffer_pointer = 0; |
180 | s->pcm_period_pointer = 0; | 180 | s->pcm_period_pointer = 0; |
181 | s->pointer_flush = true; | ||
181 | } | 182 | } |
182 | EXPORT_SYMBOL(amdtp_out_stream_pcm_prepare); | 183 | EXPORT_SYMBOL(amdtp_out_stream_pcm_prepare); |
183 | 184 | ||
@@ -393,6 +394,7 @@ static void queue_out_packet(struct amdtp_out_stream *s, unsigned int cycle) | |||
393 | s->pcm_period_pointer += data_blocks; | 394 | s->pcm_period_pointer += data_blocks; |
394 | if (s->pcm_period_pointer >= pcm->runtime->period_size) { | 395 | if (s->pcm_period_pointer >= pcm->runtime->period_size) { |
395 | s->pcm_period_pointer -= pcm->runtime->period_size; | 396 | s->pcm_period_pointer -= pcm->runtime->period_size; |
397 | s->pointer_flush = false; | ||
396 | tasklet_hi_schedule(&s->period_tasklet); | 398 | tasklet_hi_schedule(&s->period_tasklet); |
397 | } | 399 | } |
398 | } | 400 | } |
@@ -539,7 +541,11 @@ EXPORT_SYMBOL(amdtp_out_stream_start); | |||
539 | */ | 541 | */ |
540 | unsigned long amdtp_out_stream_pcm_pointer(struct amdtp_out_stream *s) | 542 | unsigned long amdtp_out_stream_pcm_pointer(struct amdtp_out_stream *s) |
541 | { | 543 | { |
542 | fw_iso_context_flush_completions(s->context); | 544 | /* this optimization is allowed to be racy */ |
545 | if (s->pointer_flush) | ||
546 | fw_iso_context_flush_completions(s->context); | ||
547 | else | ||
548 | s->pointer_flush = true; | ||
543 | 549 | ||
544 | return ACCESS_ONCE(s->pcm_buffer_pointer); | 550 | return ACCESS_ONCE(s->pcm_buffer_pointer); |
545 | } | 551 | } |