]> git.alsa-project.org Git - alsa-lib.git/commit
pcm: dmix: make lockless operation optional
authorTakashi Iwai <tiwai@suse.de>
Fri, 19 Jun 2020 16:57:05 +0000 (18:57 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 7 Jul 2020 09:56:41 +0000 (11:56 +0200)
commit4759865c861c708ce4a68fc08060fc820628ccaf
tree4e95f35c41cef1f75929810e07d56875816d039a
parent877bdf95fdfdac840a7a664362ec69b85c59ecb0
pcm: dmix: make lockless operation optional

The recently reported (but a long-standing) bug about the
unconditional semaphore usage in the dmix implies that basically we've
had no problem with the locking in the practical usages over years.
Although the lockless operation has a clear merit, it's a much higher
CPU usage (especially on some uncached pages), and it might lead to a
potential deadlock in theory (which is hard to reproduce at will,
though).

This patch introduces a new configure option "--enable-lockless-dmix"
or "--disable-lockless-dmix" to let user choose the default dmix
operation mode.  The usage of the lockless mixing has been already
conditionally enabled via asoundrc and card config
"direct_memory_access", so we just need to set the default value based
on it.

In this patch, the default is set off to the lockless mixing, i.e. the
generic mixing is chosen.  It makes more sense from the performance
POV.  For any users who still require the lockless operation, it can
be enabled either via configure option or the asoundrc.

The magic number used in the shmem is also changed depending on the
operation mode.  It's just for safety, not to conflict both operation
modes with each other.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
configure.ac
src/pcm/pcm_direct.c