Bug 281390

Summary: sound: OSS have no AFMT_FLOAT support
Product: Base System Reporter: Ivan Rozhuk <rozhuk.im>
Component: kernAssignee: Christos Margiolis <christos>
Status: Open ---    
Severity: Affects Some People CC: agh, bsdcode, christos, emaste, markj, rozhuk.im, sascha.folie
Priority: ---    
Version: Unspecified   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=157050
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264973
Bug Depends on:    
Bug Blocks: 280612    

Description Ivan Rozhuk 2024-09-09 12:38:33 UTC
Past issues:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=157050
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=184380

In the wild some software from ports that have OSS support just define AFMT_FLOAT inside own code.

AFMT_FLOAT used in wine: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264973
Currently as workaround wine builds with ALSA.


I suggest to add some in kernel conversion from AFMT_FLOAT to some thing that aleady support by "PCM subsystem mixing through its feeder subsystem" or update feeder subsystem to support AFMT_FLOAT.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2024-09-30 05:45:30 UTC
^Triage: I don't see a proposed solution yet, so "In Progress" may be premature.
Comment 2 Christos Margiolis freebsd_committer freebsd_triage 2024-09-30 15:22:43 UTC
(In reply to Mark Linimon from comment #1)
I am working on it.
Comment 3 Christos Margiolis freebsd_committer freebsd_triage 2024-11-16 18:15:54 UTC
https://reviews.freebsd.org/D47638
Comment 6 Ed Maste freebsd_committer freebsd_triage 2024-11-19 16:01:26 UTC
(In reply to Ivan Rozhuk from comment #4)
Note that we need not plain float->int but rather (float*constant)->int; this could be done with integer instructions but either way this should be something we look at after profiling if the overhead of fpu_kern_enter/_leave is excessive.
Comment 7 Ivan Rozhuk 2024-11-19 17:51:20 UTC
(In reply to Ed Maste from comment #6)

(float*constant)->int -> float->(int*constant) ? :)

As described in http://0x80.pl/articles/convert-float-to-integer.html float to int conversion should be not so expensive as fpu_kern_**() staff.

Also their code simple and under BSD2 license.