Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys
At Thu, 9 Apr 2020 16:54:12 +0200,
Joerg Sonnenberger wrote:
> There are two possible reasons for a lower limit for the buffer size:
> (1) The device requires a certain amount.
> (2) The system wants to ensure the interrupt rate doesn't go over a
> certain rate.
>
> The real value shouldn't be a constant, but the maximum of the two?
# Thanks for rewording!
I think what you are talking about is not so wrong, but our topics
don't seem the same.
(a1) The audio driver has blk_ms variable (in audio_softc).
(In fact, blk_ms is not an integer in millisec, is rational number
though. But this is not main topic here)
(a2) The initial value of blk_ms is AUDIO_BLK_MS constant defined
in sys/dev/audio/audiodef.h .
(a3) And you can overwrite AUDIO_BLK_MS in your kernel configuration
file (if you wish).
(a4) When attaching audio, or when chaning hardware frequency (by
audiocfg), or when changing blk_ms (by sysctl), the audio layer
(re-)calculates blocksize (in bytes) from blk_ms and hardware
frequency. And audio negotiates the blocksize to MD driver (using
round_blocksize interface). Then audio uses obtained blocksize.
Thus, (as you may know,) audio interrupt period is decided by the
blocksize, not by HZ.
# By the way, originally, round_blocksize is not a negotiation
# interface. It just "rounds (down or up)" given blocksize.
(a5) However even if the blocksize is agreed between audio layer
and MD driver, it's different problem that whether the final output
sound is useful or comfortable by human user. For example,
- You may be able to notice out-of-sync between audio and video
if the blocksize is too large.
- It may not be able to process audio data within a given interrupt
period if the blocksize is too small. This is noticeable on
older machines.
Note that MD driver agreed the blocksize but MD driver doesn't
need to consider the time that audio layer takes to process and
synthesize tracks on that system.
This will be a long topic so that I don't go here.
Your (1) looks almost (a4) and it should work.
Your (2) and later looks to me to (a2)/(a4) ?.
I don't intend about lower limit here (If my previous yds example
was bad or shortage in word, it was my fault).
What I intended was default value in (a2) with considering (a5).
Does this help to share the topic?
Thanks,
---
Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>
Home |
Main Index |
Thread Index |
Old Index