git: kernel - Hack pcm audio for firefox issue
Matthew Dillon
dillon at crater.dragonflybsd.org
Mon Jul 20 21:09:55 PDT 2015
commit 8f4c1ac15448601b857fa353d97a99423d2a6033
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Mon Jul 20 21:01:52 2015 -0700
kernel - Hack pcm audio for firefox issue
* Observed that the firefox thread handling sound output winds up being
in a cpu-bound loop calling poll() on two descriptors, one being the
/dev/dsp descriptor. With some debugging, determined that this call
occurs with the sound buffer ~slightly less than half full.
The sound is generated via the dports/audio/alsa-plugins (oss) library,
but the poll() appears to come from the snd_pcm_ioplug subsystem. It
appears that this subsystem has a bug in it when pacing sound output,
it still polls and live-loops on the sound output descriptor even when
it has no new data to send to the decriptor.
* There could be something else going on here with assumptions made by
linux sound client code vs our implementation, but I don't know what
they might be.
* This is probably not the correct fix, but we hack in a change to not
generate POLLWR events until the sound buffer is at least half empty.
This matches up with observed behavior from the above subsystem and
prevents the cpu loop.
It should be harmless to other code using kqueue/select/poll.
Appears to fix firefox's live looping in poll() during sound and
video (w/sound) playback.
Summary of changes:
sys/dev/sound/pcm/channel.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/8f4c1ac15448601b857fa353d97a99423d2a6033
--
DragonFly BSD source repository
More information about the Commits
mailing list