Integrated into D43679. The parameter iteration shouldn't produce duplicate entries anymore.
- Queries
- All Stories
- Search
- Advanced Search
- Transactions
- Transaction Logs
Advanced Search
Feb 9 2024
Feb 7 2024
Feb 6 2024
Moved the special treatment of USB 1.1 devices up to where the USB bus speed is
queried. This should clarify the intent to only detect more than 4 channels if
the default_channels is set to a higher value.
Sorry this took some time, but here is a list of info I'd want to have in the man page if I was an end user.
Be specific about when these settings are helpful. We don't want users to set them unnecessarily, due to possible side effects on other uaudio devices.
In D43767#998113, @christos wrote:In D43767#998111, @dev_submerge.ch wrote:The only case here is a duplicate sample rate, right?
For my device yeah, but I'm not sure if more sophisticated devices would print configs with multiple different channels or bits, which is why I added a check for channels and bits as well.
I'm uneasy to do this in the descriptor loop (why?).
I think it's much simpler and less invasive to integrate this with the changes in D43679. Would that be ok for you? I'll update it anyway today.We could add an inner loop in uaudio_chan_fill_info() indeed. The reason I did it in the descriptor loop was so that we only check against valid values (the loop is placed after we've made sure the rate/channel/bit config is supported), whereas in uaudio_chan_fill_info() we'd get check against non-supported values as well.
That being said, even if we move the loop in uaudio_chan_fill_info(), I think it's better to have 2 separate patches as these patches are not directly related.
In D43766#998109, @christos wrote:In D43766#998108, @dev_submerge.ch wrote:Not opposed to this, just note that it may be of limited value. The sample rate can effectively change at runtime, see uaudio_chan_set_param_speed().
Yeap, but that's still better than the current out-of-context dump, which requires one to have read the code to understand which config is selected. After all, this is printed during attach so it's expected that this reflects the state of the device during attach, and not runtime.
The only case here is a duplicate sample rate, right? I'm uneasy to do this in the descriptor loop (why?).
Not opposed to this, just note that it may be of limited value. The sample rate can effectively change at runtime, see uaudio_chan_set_param_speed().
Feb 4 2024
In D43679#997460, @christos wrote:In D43679#997388, @dev_submerge.ch wrote:An example: My RME BabyFace has a 10 in 12 out channel configuration, and a 2 in 2 out channel configuration. Let's say I want to use the 2 in 2 out configuration because most audio applications cannot cope with 12 channels, and I can't route everything through Jack. I also have an SPL Crimson, 6 in 6 out. And I have a Focusrite Scarlett 18 in 20 out.
Current implementation: If I set default_channels=2, only the BabyFace is detected. I can set default_channels=6, and then I get both the BabyFace and the Crimson. But no way to use the Scarlett at the same time.
My proposal: I can set default_channels=2, and get all of them detected correctly. Caveat: Any other uaudio device with a 2 channel configuration will have that configuration selected.
We may need to make these sysctls per-device instead of global. I can take care of this if we agree to go ahead with it.
In D43679#997248, @christos wrote:If the defaults can only take values between a certain range (i.e channels can be up to 64 and bits up to 32), and this patch also allows the driver to detect configs with higher values than the default, why don't we just start from the maximum value for both channels and bits instead of doing this hack, since we know that the default_*s are going to fall into those ranges anyway? Since in the iteration we try all possible combinations, we know that one of the configurations will end up being what the user would have defined using the defaults. This way we might not even need those controls at all. Also, following the same logic, do we need default_rate if the driver will only create channels for supported rates?
Correct me if I am missing something here, but I don't see where else those tunable values are used except in uaudio_chan_fill_info() which seems to search for and create configs for all supported channel/bits/rate combinations, and just includes a case where it tests if the user-supplied value is supported.
Jan 31 2024
Have a look at D43679 - that should make documentation of default_bits and default_channels easier.
Not very elegant, but the whole iteration method here is somewhat crude. The default_rate sysctl already acts like a default, and does not prevent other sample rates from the list. Leave it unchanged.
As communicated in private, the latest update to this change fixes all kernel panics and witness complaints.
Jan 30 2024
In D43649#996000, @christos wrote:In D43649#995968, @dev_submerge.ch wrote:In D43649#995852, @christos wrote:Now that I think about it, the "default_" prefix is kind of misleading. These variables act like a ceiling value, so maybe we should rename them to "max_"? snd_uaudio configures the channels, rate and bits by searching in descending order either from the default_ value or the maximum defined in the source code.
I think the default_ sysctl knobs would be more useful (and easier to document) if they actually acted like defaults. Would it be an option to improve the implementation in that way and handle them separately from the buffer_ms case?
Can you elaborate on what you mean by "separately"?
In D43649#995852, @christos wrote:Now that I think about it, the "default_" prefix is kind of misleading. These variables act like a ceiling value, so maybe we should rename them to "max_"? snd_uaudio configures the channels, rate and bits by searching in descending order either from the default_ value or the maximum defined in the source code.
Unfortunately I still get the kernel panic when I pull the USB plug, see inline comments.
The case without pulling the plug first: When I stop Jack, there's no kernel panic now, but I get the following messages:
Jan 30 13:59:09 current kernel: exclusive sleep mutex clone lock (clone manager) r = 0 (0xfffff8011ac4d2e0) locked @ /usr/src/sys/dev/sound/clone.c:390 Jan 30 13:59:09 current kernel: stack backtrace: Jan 30 13:59:09 current kernel: #0 0xffffffff80bc7c15 at witness_debugger+0x65 Jan 30 13:59:09 current kernel: #1 0xffffffff80bc8d79 at witness_warn+0x3e9 Jan 30 13:59:09 current kernel: #2 0xffffffff80adf0fe at destroy_dev+0x1e Jan 30 13:59:09 current kernel: #3 0xffffffff80885823 at snd_clone_gc+0x223 Jan 30 13:59:09 current kernel: #4 0xffffffff80885b82 at snd_clone_unref+0x52 Jan 30 13:59:09 current kernel: #5 0xffffffff808cf44b at dsp_close+0x73b Jan 30 13:59:09 current kernel: #6 0xffffffff809db9bf at devfs_close+0x48f Jan 30 13:59:09 current kernel: #7 0xffffffff8112e002 at VOP_CLOSE_APV+0x32 Jan 30 13:59:09 current kernel: #8 0xffffffff80c640a0 at vn_close1+0x100 Jan 30 13:59:09 current kernel: #9 0xffffffff80c626af at vn_closefile+0x3f Jan 30 13:59:09 current kernel: #10 0xffffffff809dc37b at devfs_close_f+0x2b Jan 30 13:59:09 current kernel: #11 0xffffffff80aece5b at _fdrop+0x1b Jan 30 13:59:09 current kernel: #12 0xffffffff80af06c3 at closef+0x1e3 Jan 30 13:59:09 current kernel: #13 0xffffffff80af45e6 at closefp_impl+0x76 Jan 30 13:59:09 current kernel: #14 0xffffffff81058463 at amd64_syscall+0x153 Jan 30 13:59:09 current kernel: #15 0xffffffff8102ab1b at fast_syscall_common+0xf8
In D41942#995265, @meka_tilda.center wrote:Interesting. I just tested, and if I boot my machine while interface is on, kld_list and buffer_ms together do the trick. I mean, jack_iodelay reports exactly same latency as if I loaded the module, set buffer_ms and then turned on the interface. Maybe my interface is slow to respond initially, so sysctl has time to kick in?
Thanks for picking this up, @christos.
Jan 29 2024
Jan 28 2024
FYI, if I disable vchans on the device, the mutex clone kernel panic also occurs when I just stop Jack as usual. Without forcing a device detach by pulling the USB plug. It seems like the mutex owner assertions in snd_clone_wakeup() are violated even without running the pcm_unregister() code first. Hope this helps.
Jan 27 2024
Could you commit it if there are no other issues? Thank you!
In D41942#994910, @meka_tilda.center wrote:I didn't answer about re-plugging. No, the interface is always connected and I don't touch the cables.
Jan 25 2024
Jackpot again! ;-)
This time it's a different problem, see inline comment.
Jan 24 2024
In D43545#993577, @christos wrote:In D43545#993573, @dev_submerge.ch wrote:Jackpot! Kernel panic on the first attempt! ;-)
See inline comment, don't have an explanation yet why this happens there.Interesting, I'll have to investigate this.
What did you do to reproduce it?
Jackpot! Kernel panic on the first attempt! ;-)
See inline comment, don't have an explanation yet why this happens there.
Jan 22 2024
Meka, according to USB descriptor your audio interface is fine with 1ms intervals (bInterval = 0x0004). So that's not the problem. And the latency doesn't even change without this patch, we know that worked before. Did you replug the device after you changed the buffer_ms sysctl? New buffer_ms values may not become effective immediately, depending on your settings.
Jan 21 2024
Thanks for all the measurements, Meka! It seems like the buffer_ms sysctl doesn't have any effect at all. I suspect your audio interface to demand a longer interval in its USB descriptor. Could you
Jan 20 2024
@br I changed the default period from 128 to 256, compared to the port version of snd_hdspe_alt. That should be closer to the playback blocksize given by the pcm latency settings by default. Could you please test this in your HDSPe AIO setup and make sure the system defaults (vchanformat=s16le:2.0, vchanrate=48000, latency=2, latency_profile=1) work fine?
Hi Meka, sorry to hear, hope you are well now.
Your measurements seem to be accurate. Unfortunately they do not match my expectations, as I would have estimated more like a ~12ms reduction in this scenario.
I'll try to verify my own tests, but could you measure the new default of buffer_ms=4 in your setup? And a period of 768 in addition to 512 and 1024? Thanks!
I may have to check with the version of Jack in ports, I did my measurements with the new sosso backend which does mmap io.
Jan 19 2024
Clarified buffer_ms sysctl description as suggested by @emaste.
Jan 18 2024
@meka_tilda.center Any comment on your test results?
Introduced UAUDIO_BUFFER_MS_MIN and UAUDIO_BUFFER_MS_MAX as constants.
Intentionally left the comments that mention 8 ms max buffer length. It
gives some understandable context and that value will probably never change
as long as current USB audio standards are supported.
Jan 17 2024
Please note that this commit depends on rGd7fde2c9eccf, and thus also on rGb6052c10fb4ad. These were not marked for MFC. Don't know much about MFC procedures, but cherry-picking this commit without the others will probably fail. Feel free to MFC them as well if needed.
Looks good to me, /dev/sndstat output is
Jan 14 2024
Fixed various style(9) issues.
Jan 12 2024
Thanks. I'll fix the style(9) issues you mentioned and some more that I just spotted now - probably tomorrow.
Jan 11 2024
Regarding future support of additional RME cards, I looked briefly into that when I decided for the bitset approach on physical ports. Obviously there's a limit to that (32 bits). But physical ports on the AIO Pro look like the same as AIO, MADI FX has 5 ports and the others have even less. Thus I wouldn't worry too much about this limit, we may have to adapt more aspects of the driver anyway. The linux driver for example handles MADI and AES in separate files from AIO and RayDAT.
Jan 10 2024
Tested on 15.0-CURRENT as of 2024-01-09, on amd64 with an RME HDSPe RayDAT card. I have this code in use for several months now, as a separate kernel module from ports.
Jan 4 2024
- Should be all tabs now between #define and macros.
- Table lookup instead of magic number 15 for clock_source sysctl.
- Moved clock source setting register value creation to tables in hdspe.c.
- Simplified and cleaned up clock source related macros.
- Removed unused and invalid HDSPM_CLOCK_MODE_MASTER macro.
Jan 2 2024
I'll fix up the patches tomorrow, see inline comments.
Dec 31 2023
Fix minor readability and style(9) issues.
Dec 30 2023
This is part of the improvements developed on github as an alternative kernel module for HDSPe sound cards. I built that separately as a local port / package. As such these changes have been tested extensively with a HDSPe RayDAT card, and are in use for several months now.
Thanks for testing, Meka! Could you elaborate on how you did the latency measurements?
Because jack_iodelay reports a decrease of only ~2ms in total roundtrip latency, whereas the extra loopback latency decreases by ~300 frames (~6ms at 48kHz). Any other changes in the setup or Jack settings?
Nov 24 2023
Ping! Also, patch briefly tested on 15.0-CURRENT as of today. No regressions, works as expected.
Sep 23 2023
@mav I hope it's ok to add you as a reviewer / committer here? Or should I ask someone else instead?
Sep 22 2023
FYI, my patch is here D41942: snd_uaudio(4): Adapt buffer length to buffer_ms tunable. for review. I'll add more info this weekend.
Sep 12 2023
Update: Looks like the current snd_uaudio implementation actually does transfers according to USB standard, it spreads the isochronous frames over the whole transfer interval. I was misled by parts of the code, and the fact that usbdump(8) only shows the first millisecond of longer transfers. Sorry for the noise.
Sep 4 2023
I didn't promise it to be easy, but I think USB transfer size should be as close to sound(4) fragment size, if it can't be equal, as for other sound cards.
Sep 3 2023
Well, these are three different topics then:
After some thought I have a different proposal:
Sep 1 2023
Chiming in here as I have some experience with the snd_uaudio module and its code. I do support this change, but I think the title is a bit misleading.
Feb 12 2023
Hm, are you guys aware that this commit removes the default dependency on MySQL when no specific options are set?
That means users of akonadi in its standard setup will now render their existing installations unusable by a package upgrade.
I was lucky to catch this when doing pkg autoremove, but not everybody knows about that.
Dec 14 2021
As suggested, add PRIV_SCHED_SETPOLICY to the kernel privileges granted by the mac_priority realtime policy, instead of including PRIV_SCHED_RTPRIO in the thread creation checks.
In D33393#755615, @kib wrote:...
SETPOLICY is used only there, to allow thread to set scheduling policy on the new thread.
Dec 13 2021
In D33393#755402, @kib wrote:I do not think this is right. Basically, you make SETPOLICY redundant with RTPRIO.
Dec 12 2021
Dec 8 2021
Thanks for the review. I had to reword the mentions of sysctl security.bsd.unprivileged_idprio a bit in the man pages, for clarity.
Changes:
- Code style fixes as suggested.
- Keep sysctl security.bsd.unprivileged_idprio description in the man pages, as being deprecated.
Dec 4 2021
In D33191#751760, @kib wrote:I still think that mac_prio or mac_sched_prio are better names, because they are more specific.
Changes:
- Rename module to mac_priority
- Cosmetic changes as suggested
Dec 2 2021
In D33191#750467, @kib wrote:Did you considered adding the same knob for the idle priority? security.bsd.unprivileged_idprio sysctl could be at least deprecated then, and even removed in HEAD.
- Extended diff context
- Subversion keywords removed from new files
- Group id defined in sys/conf.h