qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Subject: Re: Fwd: VirtioSound device emulation implementation
Date: Mon, 19 Apr 2021 18:03:11 +0530	[thread overview]
Message-ID: <CAAQ-SiPqqbZnUFmOa=qYuLW-zC6kazg_n=u3p9YS80rnka3n=A@mail.gmail.com> (raw)
In-Reply-To: <CAAQ-SiOSw9u=yFrakjjjTvozpAW3nxhC+QeW7wswMSzSeZ_AVg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2614 bytes --]

On Mon, 19 Apr 2021 at 18:00, Shreyansh Chouhan <
chouhan.shreyansh2702@gmail.com> wrote:

>
> On Fri, 16 Apr 2021 at 17:02, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
>>   Hi,
>>
>> > I learned that the callback passed in AUD_open_out, (lets call it the
>> write
>> > audio callback,)  is supposed to mix and write the
>> > buffers to HWVoiceOut. I have written that, the basic algorithm being:
>> >
>> > 1. Pop element from tx virtqueue.
>> > 2. Get the xfer header from the elem->out_sg (iov_to_buf(elem->out_sg,
>> 1,
>> > 0, &hdr, sizeof(hdr)))
>> > 3. Get the buffer from elem->out_sg (iov_to_buf(elem->out_sg, 1,
>> > sizeof(hdr), &mixbuf, period_bytes))
>> > 4. AUD_write the buffer
>>
>> AUD_write returns the number of bytes actually accepted.
>>
>> In case the audio backend consumed the complete buffer you can go ahead
>> as described.  Otherwise stop here and resume (try AUD_write() the
>> remaining data) when the callback is called again.
>>
> The callback that is supposed to write the buffers to HWVoiceOut has to
> do it such that it only writes the buffers for the streams that it was
> called by. The tx
> virtqueue is going to have buffers for all the streams. How do I handle
> this situation?
>
> Say, I have 3 output streams 0, 1 and 2, the callback was called on stream
> 0, how do
> I only play buffers corresponding to this stream? Is there a way by which
> I could iterate over
> the virtqeueue?
>
> If not then I should probably store the VirtQueueElements corresponding to
> a specific stream
> in the stream itself. I have to store the elements because I'd have to
> write to the response and
> mark these elements as used, (via virtqueue_push i think.)
>
> Also, is virtqueue a 'queue'? I remember reading in the specs that the
> device can consume
> the buffers in any order it prefers unless a feature bit is negotiated. So
> does virtqueue_pop
> always return the first element that entered the queue? (FIFO?)
>
> If it is FIFO, then I think the only way would be to iterate over the
> virtqueue. However if `virtqueu_pop`
> does return the last inserted element, I can use `handle_tx`
>
to get the last element inserted and then add it to the corresponding
stream.

Sorry for the incomplete mail. I don't know how I hit send.

>
>
>> No problem.  I'm likewise busy or on (easter) vacation at times and fail
>> to send timely answers (sorry for that).
>>
> Also that's fine, I just got a bit worried :)

I think once this `tx` part is done I'll have the pcm streams ready, and I
can send in patches by tonight
or tomorrow evening latest.

>
>> HTH & take care,
>>   Gerd
>>
>>

[-- Attachment #2: Type: text/html, Size: 4255 bytes --]

  reply	other threads:[~2021-04-19 12:36 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 10:00 VirtioSound device emulation implementation Shreyansh Chouhan
2021-01-06 11:40 ` Alex Bennée
2021-01-07 14:58   ` Shreyansh Chouhan
2021-01-07 15:58     ` Gerd Hoffmann
2021-01-07 17:17     ` Alex Bennée
2021-01-08  7:53       ` Shreyansh Chouhan
2021-01-08  8:34       ` Gerd Hoffmann
2021-01-10  8:25         ` Shreyansh Chouhan
     [not found]           ` <CAAQ-SiPiq5NQN=2mvP3isZ9PtYO2Bu64kVEvE6T+3OJd5B-U5A@mail.gmail.com>
2021-01-11  6:29             ` Fwd: " Shreyansh Chouhan
2021-01-11 11:59               ` Alex Bennée
2021-01-14 15:00                 ` Shreyansh Chouhan
2021-01-14 17:41                   ` Alex Bennée
2021-01-15  8:00                     ` Shreyansh Chouhan
2021-01-17 10:30                       ` Shreyansh Chouhan
2021-01-18 18:53                         ` Shreyansh Chouhan
2021-01-20 11:41                           ` Shreyansh Chouhan
2021-01-25  6:02                             ` Shreyansh Chouhan
2021-01-25 11:23                               ` Alex Bennée
2021-01-28  4:28                                 ` Shreyansh Chouhan
2021-01-28 10:42                                   ` Alex Bennée
2021-01-28 15:40                                     ` Shreyansh Chouhan
2021-01-28 11:25                                   ` Gerd Hoffmann
2021-01-28 15:50                                     ` Shreyansh Chouhan
2021-01-28 16:30                                       ` Gerd Hoffmann
2021-01-28 17:34                                         ` Shreyansh Chouhan
2021-02-11  4:59                                           ` Shreyansh Chouhan
2021-02-15 14:39                                             ` Gerd Hoffmann
2021-04-04 13:55                                               ` Shreyansh Chouhan
2021-04-16 11:32                                                 ` Gerd Hoffmann
2021-04-19 12:30                                                   ` Shreyansh Chouhan
2021-04-19 12:33                                                     ` Shreyansh Chouhan [this message]
2021-04-19 13:10                                                     ` Gerd Hoffmann
     [not found]                                                       ` <CAAQ-SiMf=BV-HUudRayZkRPJjmkYWuiBuKqYHHLzYjcFnPOgLQ@mail.gmail.com>
     [not found]                                                         ` <20210419135627.dlerwnswhfxt6ciz@sirius.home.kraxel.org>
     [not found]                                                           ` <CAAQ-SiM6uWUgHTS5PQ-hSkuXNOoKC7fw6Y1ZHhJ0MCUE3oaBqg@mail.gmail.com>
     [not found]                                                             ` <20210420071304.gmndase3r6mwp5yt@sirius.home.kraxel.org>
     [not found]                                                               ` <CAAQ-SiPPNK0xqnPPSjNZgwQCs+Vj0_A5koq5xK8HzhZKDgqVJw@mail.gmail.com>
2021-12-29  5:52                                                                 ` Shreyansh Chouhan
2022-01-20 10:39                                                                   ` Laurent Vivier
2022-02-07  4:06                                                                     ` Shreyansh Chouhan
2022-02-08 17:26                                                                       ` Shreyansh Chouhan

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='CAAQ-SiPqqbZnUFmOa=qYuLW-zC6kazg_n=u3p9YS80rnka3n=A@mail.gmail.com' \
    --to=chouhan.shreyansh2702@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).