-
Notifications
You must be signed in to change notification settings - Fork 64
Implement VirtIO sound device playback #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4a8a6fc to
0902227
Compare
This comment was marked as outdated.
This comment was marked as outdated.
0902227 to
ebba2c7
Compare
2b1009d to
be7ad90
Compare
jserv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run clang-format before submitting.
jserv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consult https://github.com/cntools/cnfa/blob/master/.github/workflows/build-cnfa.yml and mention the build dependency in top-level README.md.
a67216b to
1fc471c
Compare
862cb51 to
da29ce5
Compare
Simply share the prebuilt Linux kernel image file, rootfs, and test files via Google Drive, Dropbox, or similar services as they are intended to be temporary. |
c3a13e4 to
e4b1e34
Compare
|
Hi @jserv , This Dropbox share link contains the files that reviewers will need: https://www.dropbox.com/scl/fo/vv3luiccfco5tjwt8tqxm/AANAyYgL9qvVPhuT4dtkkIA?rlkey=dv84qtw9y4e0ea8go03q5qwf8&st=73j9agts&dl=0 The usage of files are described as follows:
|
|
Tested on macOS + Apple M1: Then, it got stuck without progress. |
e4b1e34 to
e900054
Compare
Thanks for helping the tests on macOS. I guess it is some kind of locking issue. For comparison on Linux + X86 it runs like this: |
|
Consider the change below to suppress compilation warnings raised by CNFA: --- a/Makefile
+++ b/Makefile
@@ -85,6 +85,7 @@ CNFA_LIB := cnfa/CNFA_sf.h
$(CNFA_LIB): cnfa/Makefile cnfa/os_generic
$(MAKE) -C $(dir $<) CNFA_sf.h
main.o: $(CNFA_LIB)
+virtio-snd.o: CFLAGS += -Wno-unused-parameter
endif
# .DEFAULT_GOAL should be set to all since the very first target is not all |
|
Hi @jserv ,
After checking the CNFA part, the coreaudio just like the PulseAudio/PipeWire part: no need to use a dedicated thread for pushing PCM frames. I would like to ask which one you prefer for resolving this issue:
|
8d1a115 to
244b758
Compare
244b758 to
1391e28
Compare
1391e28 to
726c2a7
Compare
0a0027f to
1223fff
Compare
It is reasonable to exclude macOS. |
527e5dc to
3674157
Compare
|
|
||
| #ifndef container_of | ||
| #ifdef __LIST_HAVE_TYPEOF | ||
| #define container_of(ptr, type, member) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to check __LIST_HAVE_TYPEOF here.
The limitations are listed as follows: 1. The emulator will hang if PulseAudio is enabled on host. The reason is that the host OS cannot close CNFA driver because CNFA driver reference count is not zero (PulseAudio holds one reference count). What's worse, CNFA cannot initialize if PulseAudio is disabled, As it needs a dedicated threading model (CNFA uses different threading models between pure ALSA and PulseAudio environment), we suggest users need mitigations (for instance, restart the emulator after playing sound) or just wait for the future release. 2. The playback may play with repeating artifact (for example, A "front center" ALSA example sound will sound like "front front center"). The root cause is the Linux Kernel and it hasn't got fixed even in mainline version. See https://lore.kernel.org/all/[email protected]/T/ for more information.
3674157 to
f473e91
Compare
|
Thank @Cuda-Chen for contributing! |
Implement VirtIO sound device supporting these operations (the item with checked box checked means it is implemented right now):
VIRTIO_SND_R_JACK_INFOVIRTIO_SND_R_PCM_INFOVIRTIO_SND_R_CHMAP_INFOVIRTIO_SND_R_PCM_SET_PARAMSVIRTIO_SND_R_PCM_PREPAREVIRTIO_SND_R_PCM_RELEASEVIRTIO_SND_R_PCM_STARTVIRTIO_SND_R_PCM_STOPLimitations
The emulator will hang if PulseAudio is enabled on host.
It causes to CNFA and CNFA cannot initialize if PulseAudio
is disabled, What's worse, it needs re-working as CNFA uses
different threading models between pure ALSA and PulseAudio environment.
Therefore, users need mitigations (i.e., restart the emulator after
playing sound) or just wait for the future release.
The playback may plays with repeating artifact (for example,
A "front center" ALSA example sound will sound like "front front
center"). The root cause is the Linux Kernel and it hasn't got
fixed even in mainline version.
Test Cases
boot up test
test procedures
make checkto runsemu.dmesg).expected results
check driver configuration
test procedures
aplay -lin emulator.expected results
play sound
test procedures
speaker-testin emulator.expected results
speaker-testis executing.play sequence sound
test procedures
aplay /usr/share/sounds/alsa/Front_Center.wavin emulator.expected results