| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Breaks another deadlock between sc_lock and high-priority xcalls at
softint serial. With any luck, this should be the last such softint
deadlock in audio!
|
|
Holding sc_lock is not necessary -- I reviewed all ~70 cases in-tree,
and none of them rely on state protected by sc_lock. Essentially
everything just copies from static data or data initialized at attach
time.
(Exceptions: tms320av110.c issues a bus_space_read_1, but I don't see
any reason why that needs to be serialized; and uaudio.c reads from
sc_dying, but that's not necessary and also not protected by sc_lock
anyway.)
Holding sc_lock is harmful because at least hdafg(4) can trigger module
autoload that leads to pserialize_perform, which waits for logic to run
at softint serial on all CPUs; at the same time, audio_softintr_rd/wr
run at softint serial and take sc_lock, so this leads to deadlock.
|
|
define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd.
Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location
and size, and the value placed in that field, are the same as the previous
code, but we're bumping __NetBSD_Version__ so 3rd-party module source code
can adapt, as needed.
NetBSD 9.99.89
|
|
|
|
|
|
|
|
Minor KNF along the way.
|
|
at the same time. Fix PR kern/56308.
|
|
Instead of refusing to open /dev/audioN for writes when the device
doesn't support playback, just refuse to issue writes.
Although it seems more sensible to me to reject writable opens early
on, and it seems Solaris does so, this makes querying device
properties a little trickier and is a change to the NetBSD semantics.
|
|
Previously, in revision 1.100, I factored the SLIST_REMOVE out of
audio_unlink and audio_close up into audioclose since it is now used
by /dev/audio, /dev/audioctl, and /dev/mixer alike. But I didn't
realize that the order
1. audio_track_drain
2. SLIST_REMOVE from sc_files
was significant; it matters because audio_track_drain waits for
wakeups that are delivered by hardware interrupts only to files
listed in sc_files.
This also fixes a bug introduced with the audiobell -- it was missing
the SLIST_REMOVE altogether.
For now, duplicate the SLIST_REMOVE calls in a few more places --
this is suboptimal but I want to make sure the logic works before
factoring it all out to tidy up.
|
|
|
|
This is necessary so that on detach we set file->dying before any
operations, particularly audioclose, try to acquire a psref by the
time the audio softc is gone.
Candidate fix for PR kern/56164.
|
|
No other file operations are possible by the time we get to
audioclose.
|
|
Otherwise we may race with open, leaking a cred no longer in use and
freeing a cred still in use.
|
|
|
|
Don't return 0 indicating successful open of an unusable device!
|
|
If one is requested and _not_ supported, fail; otherwise we might
enter audio_write with a null play track and crash on KASSERT.
|
|
Scoring by channel count makes sense when you are using hardware that
supports mono and stereo formats. However, if your hardware also supports
surround formats, defaulting to those might be confusing. So, don't
prefer them.
Problem reported and fix tested by tcmart14 with a 2015 model Macbook Pro.
|
|
|
|
as the caller may be a device that carries more than one.
|
|
Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.
Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)
Remove unnecessary or redundant interface attributes where they're not
needed.
There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)
...and a sentinel value CFARG_EOL.
Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.
Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
|
|
even if blk_ms is small.
This fixes PR kern/56059.
|
|
Pointed out by riastradh@.
|
|
psref(9), as well as others(audioread, audiowrite, etc..).
- Rename audio_file_enter to audio_sc_acquire_fromfile, audio_file_exit
to audio_sc_release, for clarify. These are the reference counter for
this sc.
- Introduce audio_sc_acquire_foropen for audio{,bell}open.
- audio_open needs to examine sc_dying again before inserting it into
sc_files, in order to keep sc_files consistency.
The race between audiodetach and audioopen is pointed out by riastradh@.
Thank you for many advices.
|
|
This can remove a different copy of audio_exlock_enter() in audio_unlink()
and can use normal one. Also, in audiodetach(), this can set the exlock
at more natual order (before calling audio_unlink()).
No noticeable functional changes are intended.
Thanks for comments, riastradh@.
|
|
- prefix MD device name if it's considered to be related to the MD driver.
- revise some messages.
|
|
sys/modules is compiled with -Wzero-length-format and this
makes sys/modules compilable even if AUDIO_DEBUG is defined.
|
|
|
|
|
|
fo_poll is expected to return revents rather than errno on error.
|
|
audio_unlink() must be called without exlock held (and
audio_mixer_destroy() must be called with exlock held).
This makes unplugging during playing/recording work (again).
Reported by Julian Coleman on current-users:
http://mail-index.netbsd.org/current-users/2020/12/10/msg040050.html
|
|
|
|
This also fixes a few resource leaks on error case.
|
|
if fd_allocfile() failed, since rev 1.65.
Will fix PR kern/55848.
|
|
sys/dev/audio/*.h: export only what we need for fstat.
|
|
It's about 2~3 times faster on my amd64 and x68k(68030).
|
|
|
|
|
|
|
|
|
|
- Revert temporary usage of sc_[pr]busy during suspend. These indicate
whether the mixer needs to be restarted or not.
- Avoid timeout error when about to suspend.
|
|
|
|
|
|
It's always signed, unless it's LINEAR8.
PR kern/55175
|
|
audio_[r/p]mixer_start should never be called when the device is
marked busy.
Resolves a panic on resume when audio is playing, PR kern/55301
|
|
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
|
|
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
|