qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [RFC][PATCH 4/4] Add support for Marvell 88w8618 / MusicPal
Date: Thu, 17 Apr 2008 21:06:57 +0200	[thread overview]
Message-ID: <48079FD1.3040706@web.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0804162232490.2778@linmac.oyster.ru>

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

malc wrote:
> On Tue, 15 Apr 2008, Jan Kiszka wrote:
> 
>> malc wrote:
>>> So just leave the callback until free get's big enough, you will get
>>> dropouts either way, it's just that. I guess you might also use the
>>> AUD_init_time_stamp_out/AUD_get_elapsed_usec_out mechanism
>>> (implemenation
>>> is right at the end of audio/audio_template.h), but i still think that
>>> just going with free is saner approach.
>>
>> Well, took some iterations to switch my mind completely to the new
>> model, but now this timestamp-free version runs as smooth as the
>> previous one:
> 
> Glad to hear that.
> 
>> static void audio_callback(void *opaque, int free)
>> {
>>     mv88w8618_audio_state *s = opaque;
>>     unsigned int block_size, written;
>>
>>     block_size = s->threshold/2 - s->block_written;
>>     if (free - s->last_free < block_size)
>>         return;
>>
>>     audio_fill_mixer_buffer(s, block_size);
>>     written = AUD_write(s->voice, s->mixer_buffer, block_size);
>>
>>     s->last_free = free - written;
>>
>>     if (written < block_size) {
>>         s->block_written += written;
>>         return;
>>     }
>>     s->block_written = 0;
>>
>>     if (s->play_pos == 0) {
>>         s->status |= MP_AUDIO_TX_HALF;
>>         s->play_pos = s->threshold/2;
>>     } else {
>>         s->status |= MP_AUDIO_TX_FULL;
>>         s->play_pos = 0;
>>     }
>>
>>     if (s->status & s->irq_enable)
>>         qemu_irq_raise(s->irq);
>> }
>>
>> [ This would be even simpler if I could assume written == block_size ||
>>  written == 0. But who knows... ]
> 
> The API has no way to enforce this, therefore the only sane option is to
> assume it will happen. I confess i don't quite get the logic behind the
> last_free, but as you said, it works smoothly, so be it.

It's kind of a beautification: If the host buffer is larger than
s->threshold (the buffer size the guest wishes to use), there would be
an initial IRQ burst otherwise until the host buffer is consumed.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

  reply	other threads:[~2008-04-17 19:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-13 10:11 [Qemu-devel] [RFC][PATCH 4/4] Add support for Marvell 88w8618 / MusicPal Jan Kiszka
2008-04-13 20:52 ` malc
2008-04-14  6:59   ` [Qemu-devel] " Jan Kiszka
2008-04-14 13:12     ` Stuart Brady
2008-04-14 16:21       ` Jan Kiszka
2008-04-14 16:49     ` malc
2008-04-14 17:47       ` Jan Kiszka
2008-04-15 17:38         ` malc
2008-04-15 21:03           ` Jan Kiszka
2008-04-16 18:40             ` malc
2008-04-17 19:06               ` Jan Kiszka [this message]
2008-04-14 19:21 ` Jan Kiszka
2008-04-14 21:34   ` Jan Kiszka
2008-04-17  0:24 ` [Qemu-devel] " andrzej zaborowski
2008-04-17  0:46   ` andrzej zaborowski
2008-04-17 19:06   ` [Qemu-devel] " Jan Kiszka
2008-04-18 18:12     ` Jan Kiszka
2008-04-18 18:43       ` andrzej zaborowski
2008-04-19 19:01         ` Jan Kiszka
2008-04-20  4:11           ` andrzej zaborowski
2008-04-20 15:52             ` Jan Kiszka
2008-04-20 17:38               ` andrzej zaborowski
2008-04-20 16:32 ` [Qemu-devel] [PATCH] " Jan Kiszka

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=48079FD1.3040706@web.de \
    --to=jan.kiszka@web.de \
    --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).