Discussion of the implementations of VIRTIO specification
 help / color / mirror / Atom feed
From: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
To: Roman Kiryanov <rkir@google.com>
Cc: virtio-dev@lists.oasis-open.org, JP Cottin <jpcottin@google.com>,
	Jorge Moreira Broche <jemoreira@google.com>
Subject: Re: [virtio-dev] virtio-snd and snapshots (e.g. in QEMU) when audio is active
Date: Fri, 21 Jul 2023 09:44:36 +0200	[thread overview]
Message-ID: <ZLo3ZDfJvS/hAJVp@fedora> (raw)
In-Reply-To: <CAOGAQeoLSGR2RtRHX0kyS5dxK=wa+mDZ8BRyZX5oDKaL16LdSg@mail.gmail.com>

Hello Roman,

On Wed, Jul 19, 2023 at 04:21:08PM -0700, Roman Kiryanov wrote:
> Hi,
> 
> I work in Android Studio Emulator and we use virtio-snd (implemented
> ourselves) for audio output/input. According to the spec (1.2), the
> device has one TX virtqueue for all output streams and one RX
> virtqueue for all input streams. Each stream may and usually have more
> than one period (I request 4 periods).
> 
> Because virtqueues are shared between streams (if there are more than
> one stream in the same direction), I cannot fetch vq messages when a
> stream needs one. I fetch vq messages (and put them into my own buffer
> to process them later) when the kernel puts them into a vq. I hope
> this is correct. 

I think this is correct. If I understand correctly, this is the idea of
the pre-buffering after the PREPARE command, i.e., to feed the audio
engine before to START streaming (see section 5.14.6.6.1 PCM Command
Lifecycle).

> I think I tried processing them immediately (at least
> for TX) but the kernel was not happy with this because I was draining
> the buffer too fast causing XRUN.
> If a snapshot request comes when audio streams are active I may have
> several unprocessed messages for several streams for both TX and RX.
> In my case messages are VirtQueueElement* which I don't think can be
> saved directly.
> 
> Could you please advise what a device is expected to do in this case?
> 

Do you mean what a VMM shall do when taking a snapshot regarding the
virtio-snd device?

Matias


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


  parent reply	other threads:[~2023-07-21  7:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 23:21 [virtio-dev] virtio-snd and snapshots (e.g. in QEMU) when audio is active Roman Kiryanov
2023-07-20 15:40 ` Stefan Hajnoczi
2023-07-22  5:15   ` Roman Kiryanov
2023-07-21  7:44 ` Matias Ezequiel Vara Larsen [this message]
2023-07-22  5:19   ` Roman Kiryanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZLo3ZDfJvS/hAJVp@fedora \
    --to=mvaralar@redhat.com \
    --cc=jemoreira@google.com \
    --cc=jpcottin@google.com \
    --cc=rkir@google.com \
    --cc=virtio-dev@lists.oasis-open.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox