<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/dev/sound/pcm/buffer.c, branch release/7.0.0_cvs</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>This commit was manufactured by cvs2svn to create tag</title>
<updated>2008-02-24T05:45:17+00:00</updated>
<author>
<name>cvs2svn</name>
<email>cvs2svn@FreeBSD.org</email>
</author>
<published>2008-02-24T05:45:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a9c219fa3cec18ef9f30edec6fa106bf0e2d423d'/>
<id>a9c219fa3cec18ef9f30edec6fa106bf0e2d423d</id>
<content type='text'>
'RELENG_7_0_0_RELEASE'.

This commit was manufactured to restore the state of the 7.0-RELEASE image.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
'RELENG_7_0_0_RELEASE'.

This commit was manufactured to restore the state of the 7.0-RELEASE image.
</pre>
</div>
</content>
</entry>
<entry>
<title>Last (again ?!?) major commit for RELENG_7, featuring total Giant</title>
<updated>2007-06-16T03:37:28+00:00</updated>
<author>
<name>Ariff Abdullah</name>
<email>ariff@FreeBSD.org</email>
</author>
<published>2007-06-16T03:37:28+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e4e61333ffa4e90360de2dd1e4e0146f7cbf0afb'/>
<id>e4e61333ffa4e90360de2dd1e4e0146f7cbf0afb</id>
<content type='text'>
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...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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...
</pre>
</div>
</content>
</entry>
<entry>
<title>Buffer optimization and locking cleanup. Don't resize/malloc</title>
<updated>2007-06-14T11:15:51+00:00</updated>
<author>
<name>Ariff Abdullah</name>
<email>ariff@FreeBSD.org</email>
</author>
<published>2007-06-14T11:15:51+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=504e00af6baedb9f73a3c67ca6dd5151ed93af9f'/>
<id>504e00af6baedb9f73a3c67ca6dd5151ed93af9f</id>
<content type='text'>
unless it is really necessary to ease down unlock/lock sequence.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
unless it is really necessary to ease down unlock/lock sequence.
</pre>
</div>
</content>
</entry>
<entry>
<title>Last major commit and updates for RELENG_7:</title>
<updated>2007-05-31T18:43:33+00:00</updated>
<author>
<name>Ariff Abdullah</name>
<email>ariff@FreeBSD.org</email>
</author>
<published>2007-05-31T18:43:33+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=bba4862c6482ae036365342c54e10864922f4c74'/>
<id>bba4862c6482ae036365342c54e10864922f4c74</id>
<content type='text'>
- Rework the entire pcm_channel structure:
  * Remove rarely used link placeholder, instead, make each pcm_channel
    as head/link of each own/each other. Unlock - Lock sequence due to
    sleep malloc has been reduced.
  * Implement "busy" queue which will contain list of busy/active
    channels. This greatly reduce locking contention for example while
    servicing interrupt for hardware with many channels or when virtual
    channels reach its 256 peak channels.

- So I heard you like v chan ... O RLY?
  Welcome to Virtual **Record** Channels (vrec, rec vchans, vchans for
  recording, Rec-Chan, you decide), the ultimate solutions for your
  nagging O_RDWR full-duplex wannabe (note: flash plugins) monopolizing
  single record channel causing EBUSY.  Vrec works exactly like Vchans
  (or, should I rename it to "Vplay" :) , except that it operates on the
  opposite direction (recording). Up to 256 vrecs (like vchans) are
  possible.

  Notes:
   * Relocate dev.pcm.%d.{vchans,vchanformat,vchanrate} to each of its
     respective node/direction:
       dev.pcm.%d.play.* for "play"   (cdev = dsp%d.vp%d)
       dev.pcm.%d.rec.*  for "record" (cdev = dsp%d.vr%d)
   * Don't expect that it will magically give you ability to split
     "recording source" (eg: 1 channel for cdrom, 1 channel for mic,
     etc). Just admit that you only have a *single* recording source /
     channel. Please bug your hardware vendor instead :)

- Bump maxautovchans from 4 to 16. For a full-fledged multimedia
  desktop/workstation with too many soundservers installed (esound,
  artsd, jackd, pulse/polypaudio, ding-dong pling plong mudkip fuh fuh,
  etc), 4 seems inadequate. There will be no memory penalty here, since
  virtual channels are allocate only by demand.

- Nuke/Rework the entire statically created cdev entries. Everything is
  clonable through snd own clone manager which designed to withstand many
  kind of abusive devfs droids such as:
      * while : ; do /bin/test -e /dev/dsp ; done
      * jot 16777216 0 | while read x ; do ls /dev/dsp0.$x ; done
      * hundreds (could be thousands) concurrent threads/process opening
	"/dev/dsp" (previously, this might result EBUSY even with just
	3 contesting threads/procs).
  o Reusable clone objects (instead of creating new one like there's no
    tomorrow) after certain expiration deadline. The clone allocator will
    decide whether to reuse, share, or creating new clone.
  o Automatic garbage collector.

- Dynamic unit magic allocator. Maximum attached soundcards can be tuned
  using tunable "hw.snd.maxunit" (Default to 512). Minimum is 16, and
  maximum is 2048.

- ..other fixes, mostly related to concurrency issues.

joel@ will do the manpage updates on sound(4).

Have fun.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Rework the entire pcm_channel structure:
  * Remove rarely used link placeholder, instead, make each pcm_channel
    as head/link of each own/each other. Unlock - Lock sequence due to
    sleep malloc has been reduced.
  * Implement "busy" queue which will contain list of busy/active
    channels. This greatly reduce locking contention for example while
    servicing interrupt for hardware with many channels or when virtual
    channels reach its 256 peak channels.

- So I heard you like v chan ... O RLY?
  Welcome to Virtual **Record** Channels (vrec, rec vchans, vchans for
  recording, Rec-Chan, you decide), the ultimate solutions for your
  nagging O_RDWR full-duplex wannabe (note: flash plugins) monopolizing
  single record channel causing EBUSY.  Vrec works exactly like Vchans
  (or, should I rename it to "Vplay" :) , except that it operates on the
  opposite direction (recording). Up to 256 vrecs (like vchans) are
  possible.

  Notes:
   * Relocate dev.pcm.%d.{vchans,vchanformat,vchanrate} to each of its
     respective node/direction:
       dev.pcm.%d.play.* for "play"   (cdev = dsp%d.vp%d)
       dev.pcm.%d.rec.*  for "record" (cdev = dsp%d.vr%d)
   * Don't expect that it will magically give you ability to split
     "recording source" (eg: 1 channel for cdrom, 1 channel for mic,
     etc). Just admit that you only have a *single* recording source /
     channel. Please bug your hardware vendor instead :)

- Bump maxautovchans from 4 to 16. For a full-fledged multimedia
  desktop/workstation with too many soundservers installed (esound,
  artsd, jackd, pulse/polypaudio, ding-dong pling plong mudkip fuh fuh,
  etc), 4 seems inadequate. There will be no memory penalty here, since
  virtual channels are allocate only by demand.

- Nuke/Rework the entire statically created cdev entries. Everything is
  clonable through snd own clone manager which designed to withstand many
  kind of abusive devfs droids such as:
      * while : ; do /bin/test -e /dev/dsp ; done
      * jot 16777216 0 | while read x ; do ls /dev/dsp0.$x ; done
      * hundreds (could be thousands) concurrent threads/process opening
	"/dev/dsp" (previously, this might result EBUSY even with just
	3 contesting threads/procs).
  o Reusable clone objects (instead of creating new one like there's no
    tomorrow) after certain expiration deadline. The clone allocator will
    decide whether to reuse, share, or creating new clone.
  o Automatic garbage collector.

- Dynamic unit magic allocator. Maximum attached soundcards can be tuned
  using tunable "hw.snd.maxunit" (Default to 512). Minimum is 16, and
  maximum is 2048.

- ..other fixes, mostly related to concurrency issues.

joel@ will do the manpage updates on sound(4).

Have fun.
</pre>
</div>
</content>
</entry>
<entry>
<title>sndbuf_alloc() now accept dmaflags argument which will be forwarded to</title>
<updated>2007-04-18T18:26:41+00:00</updated>
<author>
<name>Ariff Abdullah</name>
<email>ariff@FreeBSD.org</email>
</author>
<published>2007-04-18T18:26:41+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=2e334adf6a1959f29ad75e3c0933d72d892ac5d1'/>
<id>2e334adf6a1959f29ad75e3c0933d72d892ac5d1</id>
<content type='text'>
internal bus_dmammem_alloc() for greater flexibility on setting up DMA /
page attributes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
internal bus_dmammem_alloc() for greater flexibility on setting up DMA /
page attributes.
</pre>
</div>
</content>
</entry>
<entry>
<title>Memory leak killing spree, mostly bus_dma(9) related.</title>
<updated>2007-03-21T18:17:03+00:00</updated>
<author>
<name>Ariff Abdullah</name>
<email>ariff@FreeBSD.org</email>
</author>
<published>2007-03-21T18:17:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=703c934a48e8465f0027506356f83b05f291d731'/>
<id>703c934a48e8465f0027506356f83b05f291d731</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[stage: 2/9]</title>
<updated>2007-03-16T17:13:44+00:00</updated>
<author>
<name>Ariff Abdullah</name>
<email>ariff@FreeBSD.org</email>
</author>
<published>2007-03-16T17:13:44+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=4dfcb0573f4ce188e27e4770b757179a22cced98'/>
<id>4dfcb0573f4ce188e27e4770b757179a22cced98</id>
<content type='text'>
Use inlined min() rather than MIN() macross.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use inlined min() rather than MIN() macross.
</pre>
</div>
</content>
</entry>
<entry>
<title>Spring cleanup on irrelevant NULL checking over M_WAITOK allocations.</title>
<updated>2007-03-15T18:19:01+00:00</updated>
<author>
<name>Ariff Abdullah</name>
<email>ariff@FreeBSD.org</email>
</author>
<published>2007-03-15T18:19:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=4beb77e6739e921e5369a93e135e71d7044990fb'/>
<id>4beb77e6739e921e5369a93e135e71d7044990fb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix huge memory leak within sound buffer (during channel destruction,</title>
<updated>2007-02-01T09:46:03+00:00</updated>
<author>
<name>Ariff Abdullah</name>
<email>ariff@FreeBSD.org</email>
</author>
<published>2007-02-01T09:46:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9e4c8259a38ae0c56c8d5d359120977c0ae3a631'/>
<id>9e4c8259a38ae0c56c8d5d359120977c0ae3a631</id>
<content type='text'>
buffer resizing, etc.) that was here since eon. Free all (unmanaged)
allocated buffer through sndbuf_destroy() in case we forgot to call
sndbuf_free(). For a managed buffer (mostly hw specific managed buffer),
either provide CHANNEL_FREE() method with appropriate return value to
invoke semi-automatic sndbuf_free() or simply do it on their own. If
everything is failed, sndbuf_destroy() will come to the rescue as a
final measure.

MFC after:	3 days
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
buffer resizing, etc.) that was here since eon. Free all (unmanaged)
allocated buffer through sndbuf_destroy() in case we forgot to call
sndbuf_free(). For a managed buffer (mostly hw specific managed buffer),
either provide CHANNEL_FREE() method with appropriate return value to
invoke semi-automatic sndbuf_free() or simply do it on their own. If
everything is failed, sndbuf_destroy() will come to the rescue as a
final measure.

MFC after:	3 days
</pre>
</div>
</content>
</entry>
<entry>
<title>Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes</title>
<updated>2006-11-26T12:24:06+00:00</updated>
<author>
<name>Ariff Abdullah</name>
<email>ariff@FreeBSD.org</email>
</author>
<published>2006-11-26T12:24:06+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a580b31a54a7d147994d0036c97bba9056c6b38f'/>
<id>a580b31a54a7d147994d0036c97bba9056c6b38f</id>
<content type='text'>
in every sense.

General
-------

- Multichannel safe, endian safe, format safe
   * Large part of critical pcm filters such as vchan.c, feeder_rate.c,
     feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that
     using them does not cause the pcm data to be converted to 16bit little
     endian.
   * Macrosses for accessing pcm data safely are defined within sound.h in
     the form of PCM_READ_* / PCM_WRITE_*
   * Currently, most of them are probably limited for mono/stereo handling,
     but the future addition of true multichannel will be much easier.

- Low latency operation
  * Well, this require lot more works to do not just within sound driver,
    but we're heading towards right direction. Buffer/block sizing within
    channel.c is rewritten to calculate precise allocation for various
    combination of sample/data/rate size. As a result, applying correct
    SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar
    to what commercial 4front driver do.
  * Signal handling fix. ctrl+c of "cat /dev/zero &gt; /dev/dsp" does not
    result long delay.
  * Eliminate sound truncation if the sound data is too small.
    DIY:
      1) Download / extract
         http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz
      2) Do a comparison between "cat state*.au &gt; /dev/dsp" and
         "for x in state*.au ; do cat $x &gt; /dev/dsp ; done"
         - there should be no "perceivable" differences.
    Double close for PR kern/31445.

  CAVEAT: Low latency come with (unbearable) price especially for poorly
          written applications. Applications that trying to act smarter
	  by requesting (wrong) blocksize/blockcount will suffer the most.
	  Fixup samples/patches can be found at:
	  http://people.freebsd.org/~ariff/ports/

- Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42)
  due to closer compatibility with 4front driver.
  Discussed with: marcus@ (long time ago?)

- All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been
  moved to their own dev sysctl nodes, notably:
  hw.snd.pcm%d.vchans -&gt; dev.pcm.%d.vchans
  Bump __FreeBSD_version.

Driver specific
---------------

- Ditto for sysctls.

- snd_atiixp, snd_es137x, snd_via8233, snd_hda
  * Numerous cleanups and fixes.
  * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme.
   This was intended for pure debugging and latency measurement, but proven
   good enough in few unexpected and rare cases (such as problematic shared
   IRQ with GIANT devices - USB). Polling can be enabled/disabled through
   dev.pcm.0.polling. Disabled by default.

- snd_ich
  * Fix possible overflow during speed calibration. Delay final
    initialization (pcm_setstatus) after calibration finished.
    PR: kern/100169
    Tested by: Kevin Overman &lt;oberman@es.net&gt;
  * Inverted EAPD for few Nec VersaPro.
    PR: kern/104715
    Submitted by: KAWATA Masahiko &lt;kawata@mta.biglobe.ne.jp&gt;

Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman,
those at #freebsd-azalia @ freenode and others for testing.

Joel Dahl will do the manpage update.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
in every sense.

General
-------

- Multichannel safe, endian safe, format safe
   * Large part of critical pcm filters such as vchan.c, feeder_rate.c,
     feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that
     using them does not cause the pcm data to be converted to 16bit little
     endian.
   * Macrosses for accessing pcm data safely are defined within sound.h in
     the form of PCM_READ_* / PCM_WRITE_*
   * Currently, most of them are probably limited for mono/stereo handling,
     but the future addition of true multichannel will be much easier.

- Low latency operation
  * Well, this require lot more works to do not just within sound driver,
    but we're heading towards right direction. Buffer/block sizing within
    channel.c is rewritten to calculate precise allocation for various
    combination of sample/data/rate size. As a result, applying correct
    SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar
    to what commercial 4front driver do.
  * Signal handling fix. ctrl+c of "cat /dev/zero &gt; /dev/dsp" does not
    result long delay.
  * Eliminate sound truncation if the sound data is too small.
    DIY:
      1) Download / extract
         http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz
      2) Do a comparison between "cat state*.au &gt; /dev/dsp" and
         "for x in state*.au ; do cat $x &gt; /dev/dsp ; done"
         - there should be no "perceivable" differences.
    Double close for PR kern/31445.

  CAVEAT: Low latency come with (unbearable) price especially for poorly
          written applications. Applications that trying to act smarter
	  by requesting (wrong) blocksize/blockcount will suffer the most.
	  Fixup samples/patches can be found at:
	  http://people.freebsd.org/~ariff/ports/

- Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42)
  due to closer compatibility with 4front driver.
  Discussed with: marcus@ (long time ago?)

- All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been
  moved to their own dev sysctl nodes, notably:
  hw.snd.pcm%d.vchans -&gt; dev.pcm.%d.vchans
  Bump __FreeBSD_version.

Driver specific
---------------

- Ditto for sysctls.

- snd_atiixp, snd_es137x, snd_via8233, snd_hda
  * Numerous cleanups and fixes.
  * _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme.
   This was intended for pure debugging and latency measurement, but proven
   good enough in few unexpected and rare cases (such as problematic shared
   IRQ with GIANT devices - USB). Polling can be enabled/disabled through
   dev.pcm.0.polling. Disabled by default.

- snd_ich
  * Fix possible overflow during speed calibration. Delay final
    initialization (pcm_setstatus) after calibration finished.
    PR: kern/100169
    Tested by: Kevin Overman &lt;oberman@es.net&gt;
  * Inverted EAPD for few Nec VersaPro.
    PR: kern/104715
    Submitted by: KAWATA Masahiko &lt;kawata@mta.biglobe.ne.jp&gt;

Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman,
those at #freebsd-azalia @ freenode and others for testing.

Joel Dahl will do the manpage update.
</pre>
</div>
</content>
</entry>
</feed>
