From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JpC40-0003aa-3L for qemu-devel@nongnu.org; Thu, 24 Apr 2008 20:45:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JpC3y-0003ZS-Kz for qemu-devel@nongnu.org; Thu, 24 Apr 2008 20:45:19 -0400 Received: from [199.232.76.173] (port=38478 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JpC3y-0003ZM-Ea for qemu-devel@nongnu.org; Thu, 24 Apr 2008 20:45:18 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JpC3x-0005xa-Uk for qemu-devel@nongnu.org; Thu, 24 Apr 2008 20:45:18 -0400 Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate01.web.de (Postfix) with ESMTP id 84F3EDCB55AC for ; Fri, 25 Apr 2008 02:45:16 +0200 (CEST) Received: from [88.65.242.3] (helo=[192.168.1.198]) by smtp08.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1JpC3w-0003Td-00 for qemu-devel@nongnu.org; Fri, 25 Apr 2008 02:45:16 +0200 Message-ID: <48112992.2000602@web.de> Date: Fri, 25 Apr 2008 02:45:06 +0200 From: Jan Kiszka MIME-Version: 1.0 Subject: Re: [Qemu-devel] [4249] Improve audio api use in WM8750. References: <4810FBF9.1040308@web.de> <48111E61.9050002@web.de> <4811213C.7020507@web.de> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig0C1B1711F7561EDF92CFFD34" Sender: jan.kiszka@web.de 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) --------------enig0C1B1711F7561EDF92CFFD34 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable andrzej zaborowski wrote: > On 25/04/2008, Jan Kiszka wrote: >> Jan Kiszka wrote: >> > Nothing is crawling here, just use a reasonable threshold for flush= ing >> > _after_ the callback. Need to check, but maybe we can even wait the= a >> > full buffer. >> >> >> Of course not the full buffer, but its half is fine as it generally >> leaves enough time to the guest to refill the other half: >> >> Index: hw/wm8750.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- hw/wm8750.c (Revision 4250) >> +++ hw/wm8750.c (Arbeitskopie) >> @@ -73,14 +73,10 @@ static void wm8750_audio_out_cb(void *op >> >> { >> struct wm8750_s *s =3D (struct wm8750_s *) opaque; >> >> >> - if (s->idx_out >=3D free_b) { >> - s->idx_out =3D free_b; >> - s->req_out =3D 0; >> >> + s->req_out =3D free_b; >> + s->data_req(s->opaque, free_b >> 2, s->req_in >> 2); >> >> + if (s->idx_out >=3D sizeof(s->data_out)/2) >=20 > The checking of whether the guest filled enough data happens in > wm8750_dac_dat(), I don't see why do it second time here. The only > place we need an additional check is before s->dat_req call, which you > remove. True, that's redundant, let's fix it this way (this even obsoletes the flush in out_cb): Index: hw/wm8750.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- hw/wm8750.c (Revision 4250) +++ hw/wm8750.c (Arbeitskopie) @@ -73,14 +73,8 @@ static void wm8750_audio_out_cb(void *op { struct wm8750_s *s =3D (struct wm8750_s *) opaque; =20 - if (s->idx_out >=3D free_b) { - s->idx_out =3D free_b; - s->req_out =3D 0; - wm8750_out_flush(s); - } else - s->req_out =3D free_b - s->idx_out; -=20 - s->data_req(s->opaque, s->req_out >> 2, s->req_in >> 2); + s->req_out =3D free_b; + s->data_req(s->opaque, free_b >> 2, s->req_in >> 2); } =20 struct wm_rate_s { @@ -623,7 +617,7 @@ void wm8750_dac_dat(void *opaque, uint32 *data =3D sample & s->outmask; s->req_out -=3D 4; s->idx_out +=3D 4; - if (s->idx_out >=3D sizeof(s->data_out) || s->req_out <=3D 0) + if (s->idx_out >=3D sizeof(s->data_out)/2 || s->req_out <=3D 0) wm8750_out_flush(s); } =20 --------------enig0C1B1711F7561EDF92CFFD34 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 iD8DBQFIESmbniDOoMHTA+kRAqpvAJ4xGq0KnW1axFD1RplkCizkvk2MUwCfR4Lh RMJutn2a8yXihLdOsTrl0tQ= =vhev -----END PGP SIGNATURE----- --------------enig0C1B1711F7561EDF92CFFD34--