The NetBSD Project

CVS log for src/sys/dev/audio/audiodef.h

[BACK] Up to [cvs.NetBSD.org] / src / sys / dev / audio

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.20 / (download) - annotate - [select for diffs], Sat Aug 13 06:47:41 2022 UTC (20 months ago) by isaki
Branch: MAIN
CVS Tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, bouyer-sunxi-drm-base, bouyer-sunxi-drm, HEAD
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored) to selected 1.15 (colored)

audio: Rework about usrbuf allocation.
- Allocate the usrbuf from kmem(9) instead of uvm(9).  The usrbuf has used
  uvm(9), in case mmap(2) might be issued later.  However, despite the most
  apps don't use mmap(2), allocating (and reallocating) uvm(9) every time
  would be expensive.  In addition, uvm(9) for recording usrbuf was totally
  pointless now.
- For playback, the usrbuf memory will be allocated in pages.  Because the
  usrbuf for playback is mostly near 64KB for backward compatibility.
  This will reduce reallocation especially from the initial ulaw to the most
  commonly used format like slinear16/2ch/48kHz.
- When mmap(2) is called, it will replace the playback usrbuf from kmem(9) to
  uvm(9).
- Prohibit changing playback format once mmap(2) is called.
  It follows netbsd-7.
- For recording, the usrbuf memory will be allocated in the requested size
  every time as before.  Because the usrbuf for recording is only one block
  and is enough small to the page in the most case.
Inspired by PR kern/56947.

Revision 1.19 / (download) - annotate - [select for diffs], Sat Apr 23 07:55:07 2022 UTC (23 months, 3 weeks ago) by isaki
Branch: MAIN
Changes since 1.18: +2 -6 lines
Diff to previous 1.18 (colored) to selected 1.15 (colored)

audio(4): Remove no longer used counters.
These were used at very early phase of development.

Revision 1.18 / (download) - annotate - [select for diffs], Wed Apr 20 07:11:13 2022 UTC (23 months, 4 weeks ago) by isaki
Branch: MAIN
Changes since 1.17: +8 -3 lines
Diff to previous 1.17 (colored) to selected 1.15 (colored)

audio(4): Rework AUDIO_GETOOFFS.
- Count .samples/.deltablks in blocks.  It makes .deltablks integer wrap
  around safe.
- Remove suspicious one block offset from .offset.  I added the offset
  because it was observed so on NetBSD7.  But according to manpage, it
  should not be.  And it looks fine without the offset.
- Related to that, remove a comment in AUDIO_WSEEK.
  Limit the user-visible buffer to usrbuf only.

Revision 1.17 / (download) - annotate - [select for diffs], Wed Apr 20 06:05:22 2022 UTC (23 months, 4 weeks ago) by isaki
Branch: MAIN
Changes since 1.16: +19 -4 lines
Diff to previous 1.16 (colored) to selected 1.15 (colored)

audio(4): Make recording buffer more robust.
Previously, main buffer in recording track was usrbuf, which is the closest
buffer to the userland.  Because, this buffer arrangement was symmetrical
with the playback track, and had affinity with the past implementation.
However, in the current implementation, read(2) (from user application)
takes recorded block out from inputbuf, which is the closest buffer to
rmixer, to usrbuf.  So it was not good way to use the usrbuf as main buffer.
Now, usrbuf in recording track holds only fragment bytes in order to
transfer to the userland, and main buffer in recording track is the inputbuf,
the closest to rmixer.

Buffer size of the inputbuf is also modified.  Previously, it was less than
64KB or at least 4 blocks.  This had affinity with playback track and the
past implementation.  But this was not appropriate for both formats with
too large frames or too small frames.  In large frames (for example,
192kHz/12ch), 184KB buffer would be allocated but it corresponds to only
40msec.  In opposite, in small frames (for example, 8000Hz/1ch), 64KB
buffer would be allocated and it corresponds to 4.1 seconds.  But for such
machines that have 8000Hz/1ch device, in-kernel 64KB memory would probably
be expensive.
Now, inputbuf will always be allocated 16(NBLKIN) blocks, regardless of its
hardware format.  It corresponds to 160msec on modern archs (if blk_ms=10),
or 640msec on antique archs (if blk_ms=40).

Revision 1.16 / (download) - annotate - [select for diffs], Sat Aug 21 10:18:14 2021 UTC (2 years, 7 months ago) by andvar
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

s/recoding/recording/ in comments where it didn't actually mean recoding.

Revision 1.15 / (download) - annotate - [selected], Sun Sep 13 04:14:48 2020 UTC (3 years, 7 months ago) by isaki
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-futex, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.14: +12 -3 lines
Diff to previous 1.14 (colored)

Support audio descriptor for fstat(1).
sys/dev/audio/*.h: export only what we need for fstat.

Revision 1.7.2.4 / (download) - annotate - [select for diffs], Mon May 18 18:12:24 2020 UTC (3 years, 11 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE
Changes since 1.7.2.3: +1 -12 lines
Diff to previous 1.7.2.3 (colored) to branchpoint 1.7 (colored) next main 1.8 (colored) to selected 1.15 (colored)

Pull up following revision(s) (requested by isaki in ticket #911):

	sys/dev/audio/audiodef.h: revision 1.13
	sys/dev/audio/audiodef.h: revision 1.14
	sys/arch/sparc/include/param.h: revision 1.74
	sys/arch/evbarm/conf/GENERIC64: revision 1.148
	sys/arch/sh3/include/param.h: revision 1.25
	sys/arch/evbarm/conf/GENERIC: revision 1.75
	sys/arch/m68k/include/param.h: revision 1.23
	sys/arch/amd64/conf/GENERIC: revision 1.564
	sys/arch/hppa/include/param.h: revision 1.27
	sys/dev/audio/audio.c: revision 1.68
	sys/arch/vax/include/param.h: revision 1.63
	sys/dev/audio/audio.c: revision 1.69

Reduce default AUDIO_BLK_MS from 40msec to 10msec on all platform except m68k
(m68k uses 40msec default as before).  And remove the option from GENERIC.

- It's not good idea to set such parameter in individual GENERICs.
- 4msec is (probably no problem for most modern real hardware but)
  too aggressive to be default.
- 10msec is too severe for antique machines but it's hard to draw a line.

Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.

Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.


Move machine dependent AUDIO_BLK_MS default value to <machine/param.h>.
If the port has __AUDIO_BLK_MS in <machine/param.h>, it will be used.

Otherwise the default value (currently 10 msec) defined in audio.c will
be used.  This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block.  Currently hppa, m68k, sh3, sparc(!64) and vax are.

For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).

But please don't be eager to make the default value shorter.
<machine/param.h> was discussed in source-changes-d.  It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this.  Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html

Revision 1.14 / (download) - annotate - [select for diffs], Wed Apr 29 03:58:27 2020 UTC (3 years, 11 months ago) by isaki
Branch: MAIN
Changes since 1.13: +1 -20 lines
Diff to previous 1.13 (colored) to selected 1.15 (colored)

Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.
Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.

Revision 1.4.2.4 / (download) - annotate - [select for diffs], Mon Apr 13 08:04:18 2020 UTC (4 years ago) by martin
Branch: phil-wifi
Changes since 1.4.2.3: +30 -5 lines
Diff to previous 1.4.2.3 (colored) next main 1.5 (colored) to selected 1.15 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.4.2.3 / (download) - annotate - [select for diffs], Wed Apr 8 14:08:03 2020 UTC (4 years ago) by martin
Branch: phil-wifi
Changes since 1.4.2.2: +27 -7 lines
Diff to previous 1.4.2.2 (colored) to selected 1.15 (colored)

Merge changes from current as of 20200406

Revision 1.13 / (download) - annotate - [select for diffs], Sat Mar 28 08:35:36 2020 UTC (4 years ago) by isaki
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh
Changes since 1.12: +11 -3 lines
Diff to previous 1.12 (colored) to selected 1.15 (colored)

Reduce default AUDIO_BLK_MS from 40msec to 10msec on all platform except m68k
(m68k uses 40msec default as before).  And remove the option from GENERIC.
- It's not good idea to set such parameter in individual GENERICs.
- 4msec is (probably no problem for most modern real hardware but)
  too aggressive to be default.
- 10msec is too severe for antique machines but it's hard to draw a line.

Revision 1.7.2.3 / (download) - annotate - [select for diffs], Sat Mar 21 15:47:00 2020 UTC (4 years ago) by martin
Branch: netbsd-9
Changes since 1.7.2.2: +4 -1 lines
Diff to previous 1.7.2.2 (colored) to branchpoint 1.7 (colored) to selected 1.15 (colored)

Pull up following revision(s) (requested by isaki in ticket #794):

	sys/dev/audio/audiodef.h: revision 1.10
	sys/dev/audio/audio.c: revision 1.56 (via patch)
	sys/dev/audio/audio.c: revision 1.57
	sys/dev/audio/audiovar.h: revision 1.8
	sys/dev/audio/audio.c: revision 1.38

Remove obsoleted comment.

Prevent a race between audiodetach and fileops methods using psref(9).
Fix PR kern/54427.
Thank you so much riastradh@

Release memories on audiobellclose.
It's rest of the last commit.

Revision 1.7.2.2 / (download) - annotate - [select for diffs], Sat Mar 21 15:41:18 2020 UTC (4 years ago) by martin
Branch: netbsd-9
Changes since 1.7.2.1: +10 -5 lines
Diff to previous 1.7.2.1 (colored) to branchpoint 1.7 (colored) to selected 1.15 (colored)

Pull up following revision(s) (requested by isaki in ticket #793):

	sys/dev/audio/audio.c: revision 1.42
	sys/dev/audio/audio.c: revision 1.47
	sys/dev/audio/audiodef.h: revision 1.9

Remove incorrect KASSERT(!mutex_owned()).
Pointed out by riastradh@.

Improve KASSERT messages.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Mar 5 15:18:55 2020 UTC (4 years, 1 month ago) by riastradh
Branch: MAIN
Changes since 1.11: +1 -2 lines
Diff to previous 1.11 (colored) to selected 1.15 (colored)

Revert "Include opt_diagnostic.h for DIAGNOSTIC."

This did not do what I thought it did.  opt_diagnostic.h is only for
the unused _DIAGNOSTIC, which seems like an abortive attempt to
incrementally convert DIAGNOSTIC to an opt_*.h option rather than a
command-line option.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Mar 5 08:08:33 2020 UTC (4 years, 1 month ago) by riastradh
Branch: MAIN
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored) to selected 1.15 (colored)

Include opt_diagnostic.h for DIAGNOSTIC.

...at least, in header files, which may not have already included
libkern.h.

Revision 1.7.4.2 / (download) - annotate - [select for diffs], Sat Feb 29 20:19:07 2020 UTC (4 years, 1 month ago) by ad
Branch: ad-namecache
Changes since 1.7.4.1: +13 -5 lines
Diff to previous 1.7.4.1 (colored) to branchpoint 1.7 (colored) next main 1.8 (colored) to selected 1.15 (colored)

Sync with head.

Revision 1.10 / (download) - annotate - [select for diffs], Sun Feb 23 07:17:01 2020 UTC (4 years, 1 month ago) by isaki
Branch: MAIN
CVS Tags: is-mlppp-base, is-mlppp, ad-namecache-base3
Changes since 1.9: +4 -1 lines
Diff to previous 1.9 (colored) to selected 1.15 (colored)

Prevent a race between audiodetach and fileops methods using psref(9).
Fix PR kern/54427.
Thank you so much riastradh@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Feb 22 06:58:39 2020 UTC (4 years, 1 month ago) by isaki
Branch: MAIN
Changes since 1.8: +10 -5 lines
Diff to previous 1.8 (colored) to selected 1.15 (colored)

Improve KASSERT messages.

Revision 1.7.2.1 / (download) - annotate - [select for diffs], Mon Jan 27 07:06:02 2020 UTC (4 years, 2 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-0-RELEASE, netbsd-9-0-RC2
Changes since 1.7: +5 -1 lines
Diff to previous 1.7 (colored) to selected 1.15 (colored)

Pull up following revision(s) (requested by nia in ticket #657):

	sys/dev/files.audio: revision 1.13
	sys/dev/files.audio: revision 1.14
	sys/arch/amd64/conf/GENERIC: revision 1.559
	sys/arch/evbarm/conf/GENERIC: revision 1.71
	sys/arch/evbarm/conf/GENERIC64: revision 1.134
	sys/dev/audio/audiodef.h: revision 1.8

Set AUDIO_BLK_MS=4 - unlikely to cause significant overhead on non-m68k.

Several of us have been setting this in /etc/sysctl.conf for months, to
get better performance from applications that require synced audio, etc.
It's also mentioned as a good value with low overhead on most archs here:
href="https://mail-index.netbsd.org/tech-kern/2019/12/07/msg025830.html

We could probably go lower, but this is low enough to make most/all
software run well, removing frame drops. It's also low enough to get
emulators/mednafen to stop complaining in the console.

defopt AUDIO_BLK_MS

Follow amd64 and set AUDIO_BLK_MS=4 by default

defopt -> defparam (oops)

Revision 1.7.4.1 / (download) - annotate - [select for diffs], Sat Jan 25 22:38:45 2020 UTC (4 years, 2 months ago) by ad
Branch: ad-namecache
Changes since 1.7: +5 -1 lines
Diff to previous 1.7 (colored) to selected 1.15 (colored)

Sync with head.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Jan 25 12:15:35 2020 UTC (4 years, 2 months ago) by jmcneill
Branch: MAIN
CVS Tags: ad-namecache-base2
Changes since 1.7: +5 -1 lines
Diff to previous 1.7 (colored) to selected 1.15 (colored)

defopt AUDIO_BLK_MS

Revision 1.7 / (download) - annotate - [select for diffs], Sat Jul 6 12:58:58 2019 UTC (4 years, 9 months ago) by isaki
Branch: MAIN
CVS Tags: phil-wifi-20191119, netbsd-9-base, netbsd-9-0-RC1, ad-namecache-base1, ad-namecache-base
Branch point for: netbsd-9, ad-namecache
Changes since 1.6: +6 -1 lines
Diff to previous 1.6 (colored) to selected 1.15 (colored)

Implement auto recovery of the mixing volume.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jun 26 06:57:45 2019 UTC (4 years, 9 months ago) by isaki
Branch: MAIN
Changes since 1.5: +23 -1 lines
Diff to previous 1.5 (colored) to selected 1.15 (colored)

Improve audiobell (and interfaces with audio).
- Generate pseudo sine wave if possible.  It may improve timbre.
  If it cannot represent a sine wave, it falls back to a triangular
  wave or a rectangular wave.
- Volume adjustment.
- Calculate playback frequency based on mixer frequency.
  Now audiobellopen() initializes playback parameters other than
  sample_rate, and new audiobellsetrate() sets sample_rate.

Revision 1.5 / (download) - annotate - [select for diffs], Tue Jun 25 13:07:48 2019 UTC (4 years, 9 months ago) by isaki
Branch: MAIN
Changes since 1.4: +6 -2 lines
Diff to previous 1.4 (colored) to selected 1.15 (colored)

Put the lowered mixing volume back when all playback tracks are closed.
TODO: about long life descriptor.

Revision 1.4.2.2 / (download) - annotate - [select for diffs], Mon Jun 10 22:07:06 2019 UTC (4 years, 10 months ago) by christos
Branch: phil-wifi
Changes since 1.4.2.1: +416 -0 lines
Diff to previous 1.4.2.1 (colored) to selected 1.15 (colored)

Sync with HEAD

Revision 1.4.2.1, Mon Jun 10 13:49:39 2019 UTC (4 years, 10 months ago) by christos
Branch: phil-wifi
Changes since 1.4: +0 -410 lines
FILE REMOVED

file audiodef.h was added on branch phil-wifi on 2019-06-10 22:07:06 +0000

Revision 1.4 / (download) - annotate - [select for diffs], Mon Jun 10 13:49:39 2019 UTC (4 years, 10 months ago) by isaki
Branch: MAIN
Branch point for: phil-wifi
Changes since 1.3: +1 -7 lines
Diff to previous 1.3 (colored) to selected 1.15 (colored)

Use AUDIO_SCALEDOWN() macro rather than seemingly strange ifdefs.
Discussed on source-changes-d.

Revision 1.3 / (download) - annotate - [select for diffs], Thu May 23 12:20:27 2019 UTC (4 years, 10 months ago) by isaki
Branch: MAIN
CVS Tags: phil-wifi-20190609
Changes since 1.2: +1 -8 lines
Diff to previous 1.2 (colored) to selected 1.15 (colored)

Remove unnecessary file lock.
It has been introduced to prevent multiple syscalls entering
simultaneously.  But it's completely unnecessary.
It fixes firefox problem in PR kern/54177.

Revision 1.2 / (download) - annotate - [select for diffs], Wed May 8 13:40:17 2019 UTC (4 years, 11 months ago) by isaki
Branch: MAIN
Changes since 1.1: +423 -0 lines
Diff to previous 1.1 (colored) to selected 1.15 (colored)

Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly.  Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism.  The encoding/channels/frequency
  conversions are completely handled in the upper layer.  So the hard-
  ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
  - Obsoletes query_encoding and add query_format instead.
  - Obsoletes set_params and add set_format instead.
  - Remove drain, setfd, mappage.
  - The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c         -> dev/audio/audio.c (rewritten)
- dev/audiovar.h      -> dev/audio/audiovar.h
- dev/audio_dai.h     -> dev/audio/audio_dai.h
- dev/audio_if.h      -> dev/audio/audio_if.h
- dev/audiobell.c     -> dev/audio/audiobell.c
- dev/audiobellvar.h  -> dev/audio/audiobellvar.h
- dev/mulaw.[ch]      -> dev/audio/mulaw.[ch] + dev/audio/alaw.c

Revision 1.1.2.2 / (download) - annotate - [select for diffs], Wed Apr 24 12:14:56 2019 UTC (4 years, 11 months ago) by isaki
Branch: isaki-audio2
Changes since 1.1.2.1: +1 -2 lines
Diff to previous 1.1.2.1 (colored) next main 1.2 (colored) to selected 1.15 (colored)

Accept if bufsize returned from round_buffersize() is a multiple of
blksize.

Revision 1.1.2.1 / (download) - annotate - [select for diffs], Sun Apr 21 04:28:59 2019 UTC (4 years, 11 months ago) by isaki
Branch: isaki-audio2
Changes since 1.1: +424 -0 lines
Diff to previous 1.1 (colored) to selected 1.15 (colored)

Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
 audio.c -> dev/audio.c: completely rewritten.
 mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
 audiovar.h, mulaw.h: should be removed.
 audio/linear.c: efficient new linear-linear converter.
 auconv.[ch]: should be removed but need some functions for now.
 aurateconv, auvolconv: removed (new audio.c handles it).
 audiobell.c: efficient and small new bell driver.
 audiobelldata.h: removed 4KB sine wave data.
 pad/pad.c: catch up audio, but not cloneable for now.

Revision 1.1, Sun Apr 21 04:28:59 2019 UTC (4 years, 11 months ago) by isaki
Branch: MAIN
Branch point for: isaki-audio2
FILE REMOVED

file audiodef.h was initially added on branch isaki-audio2.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>