Commit graph

146 commits

Author SHA1 Message Date
Takashi Iwai
0e15e6a97a Fix compile warnings
Fix compile warnings about cast signedness.
2006-01-10 11:03:02 +00:00
Clemens Ladisch
45f63a8735 dmix: add S24_3LE support
Add to the dmix plugin support for the S24_3LE sample format which is
used by 24-bit USB devices.

The optimized assembler version uses only 23 bits for sample data so
that the lowest bit can be used for synchronization because there is no
24-bit cmpxchg instruction.
2005-12-19 07:39:03 +00:00
Jaroslav Kysela
bdfbbed5ca pcm dump() routines update: use spaces to indent texts 2005-12-11 08:24:13 +00:00
Jaroslav Kysela
8b908f233d direct plugins - fixed ipc_gid initialization when gid specified as number 2005-12-04 09:19:11 +00:00
Takashi Iwai
8495f42feb abort snd_pcm_dmix_drain when state is SND_PCM_STATE_XRU
From: Sascha Sommer <saschasommer@freenet.de>

this is a fix for bug 0001559.
Unlike my first guesses the real problem is not in the kernel driver but in
alsa-lib. Whenever the current dmix status is xrun and snd_pcm_dmix_drain
gets called the process will hang forever in the poll function. The reason is
that poll gets called even though the timer already stopped.
As described in the bugtracking system this bug was not noticable with alsa
versions that used the old IOCTLS because the SNDRV_TIMER_IOCTL_STOP ioctl
never reached the timer kernel module.

Attached patch fixes this problem for alsa-lib 1.0.10 by simply calling
snd_pcm_dmix_drop when snd_pcm_dmix_drain gets called in the state
SND_PCM_STATE_XRUN.
2005-11-21 10:47:42 +00:00
Takashi Iwai
5bf3b31cf1 Fix endianess with dmix plugin
Allow different endianess with the generic dmix code, mainly for
big-endian architectures.
2005-09-19 12:37:08 +00:00
Takashi Iwai
ea77e08cc6 Misc fixes
Fixes of spots found via valgrind

- non-freed chunks after snd_config_get_ascii()
- zero-fill records (to make valgrind happy)
- compile warning fixes
2005-08-17 17:27:16 +00:00
Jaroslav Kysela
bac9a7de83 direct plugins (dmix) - suspend/resume fixes
- this patch adds support for suspend & result for dmix and other
  direct plugins
- the timer detection / initialization (TREAD support) was redesigned and
  the check for proper driver version was moved to the timer_hw.c
2005-08-16 12:19:15 +00:00
Takashi Iwai
e80f80866f Fix direct plugins running on 32bit emulation with 64bit arch
Fix the problems of dmix/dsnoop/dshare plugins running on 32bit mode with
64bit biarch.
2005-08-12 15:53:02 +00:00
Takashi Iwai
6c7f60f7a9 Fix boundary overlap
Fixed the possible bug with boundary overlap in dmix code.
2005-06-16 14:03:15 +00:00
Takashi Iwai
b69ab56881 Fix bugs in the last change of ipc_gid option
- Fix semaphore gid control
- Do semaphore discard for all semaphores (although currently defined as 1)
- Fix the wrong check of return value from shmctl
2005-05-30 17:56:12 +00:00
Jaroslav Kysela
4b7e3cff81 added ipc_gid for direct plugins 2005-05-30 10:13:54 +00:00
Takashi Iwai
087184b0f9 Fix doxygen documents
Fix the warnings of doxygen parsing.
Add some missing documentation.
2005-05-24 14:14:28 +00:00
Takashi Iwai
dd37bb20ee Move poll_* callbacks to fast_ops
Moved poll_* callbacks to fast_ops.
These callbacks may be called frequently indeed.
2005-05-23 09:03:16 +00:00
Takashi Iwai
a3ae02d884 Fix semaphore deadlocks
- Fixed unbalanced semaphores (which may cause deadlock)
- Do semaphore-up before blocking calls for communication with the server
- Don't discard semaphores on the client side
- Open slave PCMs always in non-blocking mode to avoid blocking by semaphore
  with the secondary open
2005-05-23 08:56:48 +00:00
Takashi Iwai
1661759351 Minor clean up of dmix codes
Minor clean up of dmix codes.
2005-05-23 08:49:58 +00:00
Takashi Iwai
4c6809bf30 Fix poll after XRUN with dmix
Fix the behavior of poll after XRUN with dmix plugin.
Poll should return immediately with an XRUN stream.
2005-05-23 08:48:46 +00:00
Takashi Iwai
4e1723f9a5 More strict permission for IPC shm and sem
Use more strict permission for IPC shm and sem, too.
The permission follows to the value of ipc_perm config option, as
default 0600.
2005-05-19 14:36:04 +00:00
Takashi Iwai
13c7364997 Revert the shmget permission
Oops, a part of another patch was merged accidentally.  Reverted.
2005-05-19 14:20:07 +00:00
Takashi Iwai
5227c7e170 Fix possible noises and optimization with dmix
dmix transfers data in asynchronously so that it doesn't write on the
last active period.  This will allow the arbitrary buffer size in
future, too.

The hwsync call to slave is removed from commit and hwsync callbacks.
This hack was added to fix the noisy output (typically on xmms/bmp)
but it doesn't happen any more.  Now the hwsync behavior is as same as
on 1.0.8 (i.e. hwsync is called only when slowptr option is set).
2005-05-19 14:14:04 +00:00
Takashi Iwai
a6d3b9e4e0 Remove poll_ask callback
Removed poll_ask callbacks.
poll_ask function is merged to poll_descriptors callbacks.
2005-05-18 10:50:09 +00:00
Takashi Iwai
cf4f4bc9c4 Fix drain of dmix without data
Fixed the drain of dmix plugin without any data.
It should return immediately.
2005-05-17 15:36:18 +00:00
Takashi Iwai
51313cb2dd Remove pause and fix timer initialization in prepare
- Removed broken pause implementations.
- Fixed the timer initialization in prepare callback so that poll
  works again after prepare.
2005-05-17 09:28:29 +00:00
Takashi Iwai
467d69c5bc Fix CPU hog with combination of rate plugin
Fix CPU hog with some apps (e.g. artsd) when rate plugin is used
together with dmix (or possible hw).
2005-04-22 16:36:13 +00:00
Takashi Iwai
0f0fea7450 Fix ATTRIBUTE_UNUSED
Remove invalid ATTRIBUTE_UNUSED and add it to necessary places.
2005-04-20 14:30:45 +00:00
Takashi Iwai
72ad0e9ae7 Fix more CPU hang-up bugs in dmix
- Fix CPU hang-up during snd_pcm_drain()
  A new internal function snd_pcm_wait_nocheck() to force to call poll().

- Clean up, fix status() callback of dmix
2005-04-11 10:03:28 +00:00
Takashi Iwai
aa89f27de4 More fixes for 100% CPU hang with dmix
More fixes for 100% CPU hang-up problem with dmix.

- Clear timer queues properly when XRUN happens.
- Don't check XRUN when the stream isn't really running.
- Do hwsync properly for the delayed start state.
2005-04-05 15:50:15 +00:00
Takashi Iwai
a0a440dcf4 Stop timer at XRUN
Stop PCM timer at XRUN.
2005-03-31 15:23:20 +00:00
Takashi Iwai
9207804912 Generic architecture support
Support dmix on generic architectures without atomic operations but
using a semaphore to avoid concurrent accesses.  This is less effective
than atomic operations but should work on every system.
2005-03-29 14:13:04 +00:00
Takashi Iwai
6a6a70ffe7 Do hwsync of slave PCM on dmix
Call hwsync of slave PCM on snd_pcm_hwsync() over dmix.
This reduces ocasional output noises, typically seen in xmms and bmp with
multi-threading on SMP/HT systems.

Disabled slowptr of default dmix definition again.
2005-03-29 14:10:16 +00:00
Takashi Iwai
5e325ea18b Delayed start for dmix
Introducing a private state for the delayed start of PCM stream.
This problem occurs when the rate plugin doesn't feed the data
properly before triggering START.  This results in weird problems,
e.g. an inifinte loop of artsd eating 100% CPU time.

To solve this problem, the state is marked as "pending" when no
data appears at the trigger, and the stream is started later at
the mmap commit.
2005-03-29 14:06:00 +00:00
Takashi Iwai
248d0b285c Fix compilation with gcc-4.0
Fixed compilation with gcc-4.0
2005-03-22 18:49:07 +00:00
Takashi Iwai
dab2b58e0e Fix resume of dmix, dsnoop and dshare plugins
Fix the resume of dmix, dsnoop and dshare plugins.

[This replaces the timer mode with TREAD mode, and may trigger Oops
 with the older kernel...]
2005-03-15 11:39:51 +00:00
Takashi Iwai
8003e03b50 Small code clean up
Small code clean up for readability.
2005-03-09 12:00:37 +00:00
Takashi Iwai
22846c486f Split arch-dependent codes of dmix
Split arch-dependent codes of dmix to separate files.
2005-02-08 20:28:29 +00:00
Clemens Ladisch
c92969845d start pcm when draining in prepared state
For consistency with hw pcms, dmix/dshare pcms are started
when draining in the prepared state with a non-empty buffer.
2005-02-07 09:13:58 +00:00
Takashi Iwai
680a60a688 Use snd_config_get_bool()
Cleanup using snd_config_get_bool() in possible places.
2005-01-21 19:37:00 +00:00
Jaroslav Kysela
836987aa99 improved stream linking and plugin code cleanups
- added link/unlink/link_fd fast_ops callbacks
- moved code from snd_pcm_link to pcm_hw.c
- moved "empty" routines pointing to slave to pcm_generic.c
- introduced snd_pcm_generic_t
2005-01-20 15:07:51 +00:00
Takashi Iwai
c83e9d7451 Fix handling of DISCONNECT state
Fixed the handling of DISCONNECT state in dmix (not to set bogus error
values to state).
2005-01-11 17:42:49 +00:00
Jaroslav Kysela
b7e8f57314 Try to fix period_time/period_size problems for direct plugin slaves 2004-10-29 10:56:13 +00:00
Stas Sergeev
6f515096d9 [ALSA-LIB] dmix: dont forget to return -EINVAL on errors
snd_pcm_dmix_open() returns success if the open fails attempting
to open not the HW plugin (dmix seems to be limited to use only
the HW plugin right now). This leads to memory corruptions and
eventually a SIGSEGV. The attached patch fixes the omission.

Signed-off-by: Stas Sergeev <stsp@aknet.ru>
2004-09-15 18:44:24 +00:00
Jaroslav Kysela
eafb492512 - added SYNC_PTR ioctl support for pcm_hw plugin 2004-05-22 10:14:32 +00:00
Clemens Ladisch
ef11ba77ed document all PCM plugin parameters 2004-04-26 07:40:12 +00:00
Jaroslav Kysela
7c201b510a - added poll_ask callback to mangle avail_min (rate_plugin as example)
- added mangling of avail_min to rate_plugin
- added poll_fd_count variable
- FIXME: move poll_revents callback to fast_ops
2004-03-17 11:48:14 +00:00
Jaroslav Kysela
5337e682f6 rewind returns error code rather than doing wrong operation 2004-02-18 20:15:49 +00:00
Jaroslav Kysela
a6ad2629e3 The format condition was wrong (dmix<->dsnoop) 2004-02-03 14:44:48 +00:00
Jaroslav Kysela
b798d89c0f <atlka@pg.gda.pl>
- shm memory patch
- optimized a bit sample mixing routines in c and x_86 asm
2004-01-24 16:34:35 +00:00
Jaroslav Kysela
819a85fb2c Added sync_ptr callback 2004-01-23 13:04:43 +00:00
Jaroslav Kysela
c508b496b4 Fixed poll() behaviour for direct plugins, also added snd_pcm_hwsync() call to start callback 2004-01-21 19:21:11 +00:00
Jaroslav Kysela
eeb5d6f0ac Added slowptr options to direct plugins 2004-01-20 15:29:39 +00:00