From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JmZRo-00022p-Es for qemu-devel@nongnu.org; Thu, 17 Apr 2008 15:07:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JmZRj-0001wP-Uj for qemu-devel@nongnu.org; Thu, 17 Apr 2008 15:07:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JmZRj-0001wE-BG for qemu-devel@nongnu.org; Thu, 17 Apr 2008 15:06:59 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JmZRi-00074m-Lv for qemu-devel@nongnu.org; Thu, 17 Apr 2008 15:06:58 -0400 Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate01.web.de (Postfix) with ESMTP id ECEE5DBAE9CC for ; Thu, 17 Apr 2008 21:06:57 +0200 (CEST) Received: from [88.64.31.1] (helo=[192.168.1.198]) by smtp08.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1JmZRh-0001oO-00 for qemu-devel@nongnu.org; Thu, 17 Apr 2008 21:06:57 +0200 Message-ID: <48079FD1.3040706@web.de> Date: Thu, 17 Apr 2008 21:06:57 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4801DC59.1010403@web.de> <480300D2.2060400@web.de> <480398A8.5000404@web.de> <4805180C.9010806@web.de> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig1E52AA50C13E3DEB6B042507" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [RFC][PATCH 4/4] Add support for Marvell 88w8618 / MusicPal Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig1E52AA50C13E3DEB6B042507 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable malc wrote: > On Tue, 15 Apr 2008, Jan Kiszka wrote: >=20 >> 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 tha= t >>> 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: >=20 > Glad to hear that. >=20 >> static void audio_callback(void *opaque, int free) >> { >> mv88w8618_audio_state *s =3D opaque; >> unsigned int block_size, written; >> >> block_size =3D s->threshold/2 - s->block_written; >> if (free - s->last_free < block_size) >> return; >> >> audio_fill_mixer_buffer(s, block_size); >> written =3D AUD_write(s->voice, s->mixer_buffer, block_size); >> >> s->last_free =3D free - written; >> >> if (written < block_size) { >> s->block_written +=3D written; >> return; >> } >> s->block_written =3D 0; >> >> if (s->play_pos =3D=3D 0) { >> s->status |=3D MP_AUDIO_TX_HALF; >> s->play_pos =3D s->threshold/2; >> } else { >> s->status |=3D MP_AUDIO_TX_FULL; >> s->play_pos =3D 0; >> } >> >> if (s->status & s->irq_enable) >> qemu_irq_raise(s->irq); >> } >> >> [ This would be even simpler if I could assume written =3D=3D block_si= ze || >> written =3D=3D 0. But who knows... ] >=20 > The API has no way to enforce this, therefore the only sane option is t= o > 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 --------------enig1E52AA50C13E3DEB6B042507 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFIB5/RniDOoMHTA+kRAkIQAJ9DjMAVHGhdlCSYMIBrX5SlUqhOfQCfUmDS 1HYoEf0tcXDc6eb33sCN/6U= =f0Oi -----END PGP SIGNATURE----- --------------enig1E52AA50C13E3DEB6B042507--