summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm/feeder_rate.c
diff options
context:
space:
mode:
authorariff <ariff@FreeBSD.org>2007-06-16 03:37:28 +0000
committerariff <ariff@FreeBSD.org>2007-06-16 03:37:28 +0000
commit98cd3abe8b02f0ae3d389eb9e6ecbf4bf39032f6 (patch)
treeee24d563e820c63a513c58c01e33792788d64cfd /sys/dev/sound/pcm/feeder_rate.c
parenta2d7081fdfd21f76333ba013ab76221e98217db8 (diff)
downloadFreeBSD-src-98cd3abe8b02f0ae3d389eb9e6ecbf4bf39032f6.zip
FreeBSD-src-98cd3abe8b02f0ae3d389eb9e6ecbf4bf39032f6.tar.gz
Last (again ?!?) major commit for RELENG_7, featuring total Giant
eradication in/from userland path, countless locking fixes, etc. - General sleep call through msleep(9) has been converted to condvar(9) with better consistencies. - Heavily guard every possible "slow path" entries (open(), close(), few ioctl()s, sysctls), but once it entering "fast path" (io, interrupt started), they are free to fly on their own. - Rearrange locking sequences, resulting better concurrency and serialization. Large part doesn't even need locking at all, and will be removed in future. Less clutter, except in few places due to lock ordering. - Anonymous mixer object creation/deletion to simplify mixer handling beyond typical mixer ioctls. Submitted by: chibis (with modifications) - Add few mix_[get|set|..] functions to avoid calling mixer_ioctl() directly using cryptic arguments. - Locking fixes to avoid possible deadlock with (still under Giant) USB. - Better simplex/duplex device handling. - Recover mmap() functionality for recording, which has been lost since 2.2.x - 3.x (the introduction of newpcm). Full-duplex mmap still doesn't work (due to VM/page design), but people still can mmap both by opening each direction separately. mmaped playback is guarantee to work either way. - New sysctl: "hw.snd.compat_linux_mmap" to allow PROT_EXEC page mapping, due to recent changes in linux compatibility layer which require it. All linux applications that using sound + mmap() (mostly games) require this to be enabled. Disabled by default. - Other goodies.. too many, that will increase releng7 shareholder value and make users of releng6 (and below) cry ;) * This commit should be atomic. If anything goes wrong (not counting problem originated from elsewhere), I will not hesitate to revert everything back within 12 hours. This substantial changes itself not a rocket science and the process has begun for almost 2 years, and lots of incremental changes are already in place during that period of time. * Some issues does occur in snd_emu10kx (note the 'x') due to various internal locking issues and it is currently being worked on by chibis. Tested by: chibis (Yuriy Tsibizov), joel, Alexandre Vieira, many innocent souls...
Diffstat (limited to 'sys/dev/sound/pcm/feeder_rate.c')
-rw-r--r--sys/dev/sound/pcm/feeder_rate.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/sound/pcm/feeder_rate.c b/sys/dev/sound/pcm/feeder_rate.c
index 79f06f1..cf9d7c1 100644
--- a/sys/dev/sound/pcm/feeder_rate.c
+++ b/sys/dev/sound/pcm/feeder_rate.c
@@ -320,7 +320,7 @@ feed_rate_setup(struct pcm_feeder *f)
if (!(RATE_FACTOR_SAFE(info->gx) && RATE_FACTOR_SAFE(info->gy)))
return (-1);
- for (i = 0; i < sizeof(convtbl) / sizeof(*convtbl); i++) {
+ for (i = 0; i < sizeof(convtbl) / sizeof(convtbl[0]); i++) {
if (convtbl[i].format == 0)
return (-1);
if ((f->desc->out & ~AFMT_STEREO) == convtbl[i].format) {
@@ -404,8 +404,8 @@ feed_rate_init(struct pcm_feeder *f)
* bufsz = sample from last cycle + conversion space
*/
info->bufsz_init = 8 + feeder_buffersize;
- info->buffer = malloc(sizeof(*info->buffer) * info->bufsz_init,
- M_RATEFEEDER, M_NOWAIT | M_ZERO);
+ info->buffer = malloc(info->bufsz_init, M_RATEFEEDER,
+ M_NOWAIT | M_ZERO);
if (info->buffer == NULL) {
free(info, M_RATEFEEDER);
return (ENOMEM);
@@ -480,7 +480,7 @@ feed_rate(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
* beginning of buffer.
*/
bcopy(info->buffer + info->pos - smpsz, info->buffer,
- sizeof(*info->buffer) * (smpsz << 1));
+ smpsz << 1);
info->pos = smpsz;
info->bpos = smpsz << 1;
}
@@ -574,7 +574,7 @@ feed_rate(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
info->stray));
#endif
bcopy(info->buffer + info->pos - smpsz, info->buffer,
- sizeof(*info->buffer) * smpsz);
+ smpsz);
info->bpos = smpsz;
info->pos = smpsz;
}
OpenPOWER on IntegriCloud