Internships/ProjectIdeas/VirtioSound: Difference between revisions

From QEMU
No edit summary
Line 1: Line 1:
=== Implement virtio-sound emulation ===
=== Implement virtio-sound emulation as a Rust vhost-user back-end ===
   
   
'''Summary:''' Implement device emulation for the new virtio-sound device.
'''Summary:''' Implement device emulation for the new virtio-sound device.
Line 5: Line 5:
The VIRTIO specification defines a sound device and Linux has a guest driver for it, but QEMU does not emulate the virtio-sound device yet.
The VIRTIO specification defines a sound device and Linux has a guest driver for it, but QEMU does not emulate the virtio-sound device yet.


The goal is to implement virtio-sound in QEMU with mono and stereo playback and capture. There is unfinished code for virtio-sound playback support that you can use as a starting point. It will be necessary to clean up the code and add capture support.
The goal is to implement virtio-sound emulation with mono and stereo playback and capture support. The code should be developed as a vhost-user back-end (a standalone program that communicates with QEMU) using the Rust vhost-user and gstreamer crates. The vhost crate handles the interfacing with QEMU and the low-level VIRTIO details. The gstreamer crate is a cross-platform multimedia API that abstracts the native audio API (ALSA, CoreAudio, etc).


As stretch goals you can implement additional functionality covered by the specification, including support for multi-channel devices (e.g. surround sound playback), channel maps, etc.
As stretch goals you can implement additional functionality covered by the VIRTIO sound device specification, including support for multi-channel devices (e.g. surround sound playback), channel maps, etc. If you have even more time you can implement QEMU dbus-display support for streaming audio over remote desktop connections (for remote viewers like VNC/RDP/Spice).


To familiarize yourself with the project idea (see links below):
To familiarize yourself with the project idea (see links below):
# Review the VIRTIO sound device specification.
# Review the VIRTIO sound device specification.
# Review the audio/audio.h QEMU audio subsystem API.
# Review the vhost-user crate's vhost-user-backend module and the gstreamer crate.
# Review the unfinished patches.
# Review the unfinished patches for an idea of how to implement the device in C.


This project will expose you to device emulation, VIRTIO, and you'll learn how audio devices work at the hardware interface level.
Intermediate Rust programming skills are required for this project. This project will expose you to device emulation, VIRTIO, and you'll learn how audio devices work at the hardware interface level.


'''Links:'''
'''Links:'''
* Device specification: https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-52900014
* Device specification: https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-52900014
* Linux guest driver: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/virtio
* Linux guest driver: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/virtio
* QEMU audio subsystem: https://git.qemu.org/?p=qemu.git;a=tree;f=audio
* vhost crate: https://github.com/rust-vmm/vhost/tree/main/crates/vhost-user-backend
* QEMU audio devices: https://git.qemu.org/?p=qemu.git;a=tree;f=hw/audio
* gstreamer crate: https://docs.rs/gstreamer/latest/gstreamer/
* dbus-display: https://www.qemu.org/docs/master/interop/dbus-display.html


'''Details:'''
'''Details:'''

Revision as of 20:48, 31 January 2023

Implement virtio-sound emulation as a Rust vhost-user back-end

Summary: Implement device emulation for the new virtio-sound device.

The VIRTIO specification defines a sound device and Linux has a guest driver for it, but QEMU does not emulate the virtio-sound device yet.

The goal is to implement virtio-sound emulation with mono and stereo playback and capture support. The code should be developed as a vhost-user back-end (a standalone program that communicates with QEMU) using the Rust vhost-user and gstreamer crates. The vhost crate handles the interfacing with QEMU and the low-level VIRTIO details. The gstreamer crate is a cross-platform multimedia API that abstracts the native audio API (ALSA, CoreAudio, etc).

As stretch goals you can implement additional functionality covered by the VIRTIO sound device specification, including support for multi-channel devices (e.g. surround sound playback), channel maps, etc. If you have even more time you can implement QEMU dbus-display support for streaming audio over remote desktop connections (for remote viewers like VNC/RDP/Spice).

To familiarize yourself with the project idea (see links below):

  1. Review the VIRTIO sound device specification.
  2. Review the vhost-user crate's vhost-user-backend module and the gstreamer crate.
  3. Review the unfinished patches for an idea of how to implement the device in C.

Intermediate Rust programming skills are required for this project. This project will expose you to device emulation, VIRTIO, and you'll learn how audio devices work at the hardware interface level.

Links:

Details:

  • Skill level: intermediate/advanced
  • Language: C
  • Mentor: Stefan Hajnoczi <stefanha@redhat.com>
  • Suggested by: Gerd Hoffmann <kraxel@redhat.com>