qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bandan Das <bsd@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 0/2] Make mixer emulation configurable at runtime
Date: Wed, 28 Aug 2013 11:52:49 -0400	[thread overview]
Message-ID: <jpga9k1rewe.fsf@redhat.com> (raw)
In-Reply-To: 87bo4igou0.fsf@blackfin.pond.sub.org

Markus Armbruster <armbru@redhat.com> writes:

> Bandan Das <bsd@redhat.com> writes:
>
>> Currently, hda-codec mixer emulation can only be enabled by using the
>> "--enable-mixemu" option to configure at compile time. These patches add 
>> the option to make it configurable at runtime as well. 
>>
>> An example usage could be a qemu cmdline  : 
>> "-device hda-duplex,mixer=(on/off)" although this 
>> is not part of this change.
>
> Really?  I see a new property "mixer" in PATCH 2/2.  It's UINT32 rather
> than BOOL, though.

Well, what else can I say, Bad example... 

> Let's review where we are and where your patch takes us.
>
> CONFIG_MIXEMU is set by configure --enable-mixemu (default off).  It
> does two things:
>
> * It makes mixeng_volume() actually do something.  Users:
>
>   audio_pcm_sw_read():
>
>     if (!(hw->ctl_caps & VOICE_VOLUME_CAP)) {
>         mixeng_volume (sw->buf, ret, &sw->vol);
>     }
>
>   audio_pcm_sw_write():
>
>         if (!(sw->hw->ctl_caps & VOICE_VOLUME_CAP)) {
>             mixeng_volume (sw->buf, swlim, &sw->vol);
>         }
>
>   Only pulse and the spice audio backends set VOICE_VOLUME_CAP.
>
>   Impact on users isn't obvious to me.
>
> * Devices hda-{output,duplex,micro} have a mixer if and only if
>   CONFIG_MIXEMU is enabled.
>
>   Reason: their mixer cannot work without CONFIG_MIXEMU.  Advertizing a
>   broken hardware mixer to guests breaks volume control.  Not nice.  So,
>   advertize it only when it works.  When CONFIG_MIXEMU is disabled, the
>   hardware provides no mixer, guests fall back to a software mixer, and
>   volume control works.  Commit d61a4ce.
>
>   So, -device hda-duplex gives you *different* devices depending on
>   whether you enabled mixer emulation.  Enabling/disabling QEMU's mixer
>   emulation changes guest ABI.  This was a bad idea.  We should have
>   created either two sets of devices, one with and one without a mixer,
>   or a device property to control mixer presence.
>
>   Your patch implements the latter.  And boy is it ugly :)
>

I prefer having a device property rather than two different devices
which is probably overkill IMO. This is the most straight-forward way
I could do it.

> Questions (not just for you, Bandan):
>
> 1. Why is CONFIG_MIXEMU off by default?
>
>    We generally default optional code to "on", to avoid bit-rot.  We
>    make exceptions only when the optional code is truly unwanted by a
>    clear majority of our users.  Why would anyone want hda audio devices
>    without a mixer?
>
> 2. Why do we bother providing these devices when CONFIG_MIXEMU off?
>
>    Why would anyone want hda audio devices without a mixer?  Why
>    wouldn't anyone who wants hda audio devices also want CONFIG_MIXEMU
>    enabled?
>
>    The only remotely convincing reason I can think of is "we foolishly
>    provided them, and now we have to keep them for backward
>    compatibility".
>
> 3. Why does CONFIG_MIXEMU exist?
>
I can post a patch for it (again) on top of these changes and 
see where it goes. If the default value of the "mixer" property stays
off, malc's concerns mentioned elsewhere in this thread will be taken 
care of too (I think).

Bandan
>    Closest thing to a discussion I could find in the list archives:
>
>    http://lists.gnu.org/archive/html/qemu-devel/2012-03/msg02313.html
>    http://lists.gnu.org/archive/html/qemu-devel/2012-04/msg02285.html
>
>    I don't exactly find the argument for CONFIG_MIXEMU convincing.

  parent reply	other threads:[~2013-08-28 15:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-27 19:17 [Qemu-devel] [PATCH 0/2] Make mixer emulation configurable at runtime Bandan Das
2013-08-27 19:17 ` [Qemu-devel] [PATCH 1/2] hda-codec: refactor common definitions into a header file Bandan Das
2013-08-28  8:02   ` Markus Armbruster
2013-08-27 19:17 ` [Qemu-devel] [PATCH 2/2] hda-codec: make mixemu selectable at runtime Bandan Das
2013-08-28  9:13 ` [Qemu-devel] [PATCH 0/2] Make mixer emulation configurable " Markus Armbruster
2013-08-28 11:07   ` Paolo Bonzini
2013-08-28 11:33   ` Gerd Hoffmann
2013-08-28 11:45     ` Markus Armbruster
2013-08-28 11:52       ` Gerd Hoffmann
2013-08-28 15:52   ` Bandan Das [this message]
2013-08-28 16:37     ` Markus Armbruster
2013-08-28 17:35       ` 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=jpga9k1rewe.fsf@redhat.com \
    --to=bsd@redhat.com \
    --cc=armbru@redhat.com \
    --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).