All of lore.kernel.org
 help / color / mirror / Atom feed
From: malc <av1474@comtv.ru>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Document Qemu coding style
Date: Wed, 1 Apr 2009 03:49:43 +0400 (MSD)	[thread overview]
Message-ID: <Pine.LNX.4.64.0904010331210.4074@linmac.oyster.ru> (raw)
In-Reply-To: <60cad3f0903311628o6ae85144tf1f9c425ff3bcecb@mail.gmail.com>

On Wed, 1 Apr 2009, David Turner wrote:

> On Wed, Apr 1, 2009 at 12:38 AM, malc <av1474@comtv.ru> wrote:
>
> >
> > For starters you could have asked about things you believe are subtle.
> >
>
> True enough, but for a long time the project was confidential and alluding
> to it publicly
> was not recommended. I'll try to break the habit.
>
>
> >
> > Now to the part i do not understand: what do you mean by time-based(sic)?
>
>
> > There's one clock involved, as far as audio is concerned, and it's the
> > one dervied from the speed with which host audio can consume/produce
> > audio, anything else just doesn't work (for scenarios i was interested
> > in anyway)
> >
>
> I had some problems when running qemu on low-powered computers. If I
> remember correctly, the emulation part was taking so much of the CPU
> that audio could very well stutter in strange ways on some
> platforms. One of the reason for it was that the host audio output
> (e.g. esd) stopped consuming samples at a consistent rate, which
> forced SWVoiceOut buffers to fill up and delay audio production in
> the emulated system even more.

Hmm.. please define low-powered.. Audio started being developed on a
1Ghz Athlon, granted the machine was equipped with Aureal Vortex 2 and
i had a luxory of using [ADA]C_FIXED_SETTINGS set to zero and
DAC_VOICES set to something reasonable thus basically avoiding
software mixing altogether, that said some of the old DOS games/demos
use Soundblaster/OPL[23] in such creative ways so doing things in
software even with au8830 was sometimes inevitable...

And FWIW nowadays it's MPC7447A at 1.3Ghz which is not speed demon
either. Not that i dont belive you, esp considering esd thrown into
equation, but it would be interesting to know what people deem
low-powered currently.

> In certain cases, there is also a non-trivial latency between the
> moment the emulated system produces audio-samples (e.g. sends them
> through dma to the emulated hardware), and the moment it is
> effectively sent to the host backend. This is mostly related to
> playing with the audio timer tick configuration which by default is
> so small that it should not matter.
>
> What I mean by time-based means a way to deal with varying latencies
> in both audio production and consumption. I agree it's a hard
> problem and is not totally required for QEMU. It's just that I spent
> some time trying to understand how the audio subsystem dealt with
> the problem, except that it didn't.

Well.. I certainly fail to see how adding some other clock would
overcome the fact that something can't keep up.. (rt priorties and
suchlike?)

>
> >
> > As for the question of why everything just calls audio_pcm_sw_write
> > raised in AUDIO.txt, the reason, if my memory serves and it might as
> > well not do that all that well, things are the way they are for the
> > reason that any given driver can, theoretically, use the respective
> > audio subsystems/libraries own, less naive, st_rate_flow equivalent.
> >
>
> Interesting, thanks for the explanation, this makes it clear.
>
>
> > P.S. Last/only time i looked at Android couldn't help but notice that,
> >     apart from other things, capture was implemented for coreaudio,
> >     it would have been nice, if for nothing else but the sake of
> >     completeness, to have that in main QEMU too.
> >
>
> Actually, the details of audio-related changes performed are:
>
> - adding audio input to the CoreAudio backend
>
> - adding dynamic linking support to the esd and alsa backends
> (using dlopen/dlsym allows the emulator to run on platforms where
> all the corresponding libraries / sound server are not available).

I don't think this is worth it for QEMU, after all shipping binaries
is not what it's best known for.

> - rewriting the sdl backend run_out() method. For some reason the old one
> tended to lock up QEMU in certain weird cases I could never
> completely understand.

Hmm..

> - modifying the sub-system to be able to use different backends for
>   audio input and output.

Yeah i recall seeing this, and was wondering why Android needed this
functionality.

> - adding a new "winaudio.c" backend for Windows that uses Wave
>   functions instead of DirectX (mainly to be able to build on old
>   versions of mingw that didn't provide directx-compatible headers,
>   I'm not sure if it's still needed these days, but at least the
>   code is 10x simpler than the dxaudio.c one, talk about a complex
>   sound API).
>

Complexity notwithstanding i happen to like the way things are done in
DSound, the conceptually simple approach that is.

> I plan to provide patches for all of these for upstream. Sorry if this
> hasn't been done yet.
>

Nice to hear that.

-- 
mailto:av1474@comtv.ru

  reply	other threads:[~2009-03-31 23:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-29 21:23 [Qemu-devel] [PATCH] Document Qemu coding style Avi Kivity
2009-03-30  1:15 ` malc
2009-03-30 18:28 ` Blue Swirl
2009-03-30 19:02   ` M. Warner Losh
2009-03-30 19:55     ` Avi Kivity
2009-03-30 19:54   ` Avi Kivity
2009-03-30 21:43     ` Lennart Sorensen
2009-03-30 22:15       ` M. Warner Losh
2009-03-30 23:38         ` Lennart Sorensen
2009-03-31  0:09           ` M. Warner Losh
2009-03-31  5:59           ` Laurent Desnogues
2009-03-31 12:58             ` David Turner
2009-03-31 13:31               ` Avi Kivity
2009-03-31 21:18                 ` David Turner
2009-03-31 16:18               ` Blue Swirl
2009-03-31 21:48                 ` David Turner
2009-03-31 22:38                   ` malc
2009-03-31 23:28                     ` David Turner
2009-03-31 23:49                       ` malc [this message]
2009-04-01  0:25                         ` David Turner
2009-04-01  1:02                           ` malc
2009-04-01  9:04               ` Daniel P. Berrange
2009-03-30 19:58   ` Avi Kivity
2009-03-30 20:10     ` Glauber Costa
2009-03-30 20:35       ` Avi Kivity
2009-03-30 20:37         ` Glauber Costa
2009-03-30 20:20   ` Andreas Färber
2009-03-30 21:45   ` Lennart Sorensen
2009-03-30 22:16     ` M. Warner Losh
2009-03-31  5:42     ` Gleb Natapov
2009-03-31 13:47 ` Paul Brook
2009-04-01  8:51 ` Richard W.M. Jones
2009-04-01  9:04   ` Avi Kivity

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=Pine.LNX.4.64.0904010331210.4074@linmac.oyster.ru \
    --to=av1474@comtv.ru \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.