aboutsummaryrefslogtreecommitdiff
path: root/sound/firewire
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-05-11 17:50:49 +0200
committerTakashi Iwai <tiwai@suse.de>2012-05-11 19:05:12 +0200
commit0910c216f78d1097a4ac6dcc83b38809dea94160 (patch)
tree906b3beea4baea0c31062ff2ebc1714fedc48a62 /sound/firewire
parentb2522f9262539fc328b4b9344f8a2f7ef2cb18d5 (diff)
ALSA: pcm - Optimize the call of snd_pcm_update_hw_ptr() in read/write loop
In the PCM read/write loop, the driver calls snd_pcm_update_hw_ptr() at each time at the beginning of the loop. Russell King reported that this hogs CPU significantly. The current code assumes that the pointer callback is very fast and cheap, also not too much fine grained. It's not true in all cases. When the pointer advances short samples while the read/write copy has been performed, the driver updates the hw_ptr and gets avail > 0 again. Then it tries to read/write these small chunks. This repeats until the avail really gets to zero. For avoiding this situation, a simple workaround is to call snd_pcm_update_hw_ptr() only once at starting the loop, assuming that the read/write copy is performed fast enough. If the available count becomes short, it goes to snd_pcm_wait_avail() anyway, and this processes right. Tested-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
0 files changed, 0 insertions, 0 deletions