Open Cuda-Chen opened 4 months ago
we can use VirtIO sound with ALSA architecture.
Can you illustrate the progress and the potential integration considerations?
Hi @jserv ,
For the progress:
make check
but not sudo make check
as it will complains incorrect parameter related errors). ALSA plug-in [semu]
in Volume Levels).For potential integration considerations:
alsa-utils
for testing the sound device.semu
is aiming for a lightweight emulator.Hi @jserv ,
For the supporting operations mentioned in https://github.com/sysprog21/semu/pull/53, to let semu
plays sound I consider it requires to support more operations (and the operations are mentioned in VirtIO official document), should we investigate then list the operations that have to be implemented to support the common sound operation (e.g., playing sound, querying sound device information, etc.)?
should we investigate then list the operations that have to be implemented to support the common sound operation (e.g., playing sound, querying sound device information, etc.)?
Yes, go ahead.
For this issue, I am going to implement VirtIO sound device supporting these operations:
VIRTIO_SND_R_PCM_INFO
VIRTIO_SND_R_CHMAP_INFO
VIRTIO_SND_R_JACK_INFO
VIRTIO_SND_R_PCM_SET_PARAMS
VIRTIO_SND_R_PCM_PREPARE
VIRTIO_SND_R_PCM_RELEASE
VIRTIO_SND_R_PCM_START
VIRTIO_SND_R_PCM_STOP
Update:
VirtIO SoundCard at platform/f4400000.virtio/virtio2
is actually attached to the kernel.controlCX
(X
stands for the card number of VirtIO SoundCard) in /dev/snd/
./dev/snd/
:controlCX
pcmCXDYc
pcmCXDYp
VirtIO SoundCard
does not expose any endpoint for PCM playback, there is no way to play sound via VirtIO SoundCard
.I am going to solve the sound card endpoint issue first.
Update:
pcmCXDYc
appears in /dev/snd/
, and aplay -l
can list the VirtIO Sound Card.speaker-test
and aplay
exit with non-zero return value because an unknown type (0x0
) is sent from driver to virtio-snd after pcm_prepare state.Statue update:
VIRTIO_SND_R_PCM_PREPARE
state.
- I am going to implement to receive the PCM frames from TX queue to buffer so that we can play the sound.
Do you think whether if single-threaded queue manipulation is enough. I am not sure that such TX queue can be operated without extra threads.
Do you think whether if single-threaded queue manipulation is enough. I am not sure that such TX queue can be operated without extra threads.
For my current findings, qemu and rust-vmm do not use any extra threads to operate TX queue. However, we may consider using extra threads as it seems we have to notify the device to complete transmission once it gets PCM frame from TX queue.
Statue update:
Statue update:
Currently, semu lacks of sound playing feature.
To implement, we can use VirtIO sound with ALSA architecture.