qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: VirtioSound device emulation implementation


From: Gerd Hoffmann
Subject: Re: Fwd: VirtioSound device emulation implementation
Date: Mon, 15 Feb 2021 15:39:34 +0100

  Hi,

> I read the source code for the `gus` sound device. (gus.c) And set up the
> audiosettings and SWVoiceOut
> from there. Here is my first question, I feel as if SWVoiceOut should be
> available per stream.

Correct.

> So the `VirtIOSound` device would have a list of `SWVoiceOut`?

In the simplest case just one, most devices have two (one 'out' for
playback, one 'in' for recording).  Can be more.

> Secondly I saw in the `ac97.c` source, (which is a PCI sound device,) a lot
> of PCIDev related set up in
> the realize function, but they were not present in the `virtio-net.c`
> source. Do I need them? (`ac97.c` set
> up PCI_COMMAND, PCI_STATUS, PCI_BASE_ADDRESS and similar things in PCIDev.
> For now the pci
> setup in `virtio-snd-pci.c` basically mimics `virtio-net-pci.c` which uses
> a `VirtIOPCIProxy` obj.)

In case of a virtio-pci device VirtIOPCIProxy will deal with all the pci
details, no need for you to set this up.

> Thirdly, the properties are registered at two different places, once in the
> `virtio-net.c` source and once
> in the `virtio-net-pci.c` source. I understand the the ones in
> `virito-net.c`/`virtio-snd.c` they are the device
> properties, as in the configurations we can set for the device and other,
> well, properties. But what
> exactly are the properties defined in the `virtio-net-pci.c` source file? I
> have a vague idea of
> what they are, but I can't exactly put my finger on it. It's almost as if
> `virtio-net` and `virito-net-pci`
> are two different devices each with thier own properties, and the
> virtio-net-pci helps communication
> between virtio-net and QEMU guest.

virtio-net-pci.c is a small wrapper which combines virtio-net.c and
VirtIOPCIProxy.  Most properties virtio-net-pci.c has are just aliases
and come from either VirtIOPCIProxy or virtio-net.c

> Since there can be more than on streams and more than one jacks, we
> need to have a list of configurations for them, and since they should
> be index adressable, should I use an array for them? When I was
> reading the source I did not come across a QEMU list structure with
> indexed adressing.  If there is one please let me know.

I'd suggest to simply use an array.

> Finally, I do understand what the pcm streams are, and I have been able to
> set them up with hardcoded
> initial configs (modulo the hda part). But I do not understand what exactly
> are `jacks` and what should I do to set them up.
> Which source file should I look at for this? I came across a few jack
> related structs, but didn't see
> a device using them. (I did not search for it as vigorously, I only tried
> grepping in `hw/audio` and the
> only results were from `intel-hda-defs`. They were comments on enums. Again
> since I was writing
> this mail I thought I should ask it here too.)

Jacks are modeled after hda specification.  See also hda-codec-common.h
They basically describe the inputs and outputs, along the lines of "this
output is a green line-out jack / blue line-out jack / speaker / ...".

In case of qemu it is all virtual anyway and doesn't matter that much.
The guest might show this in the audio config tools though, so it
should be something commonly used.  hda-duplex for example uses "red
line-in" for recording and "green line-out" for playback because those
are the colors typically used for these jacks on your laptop.

HTH,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]