From: Martin Kletzander <mkletzan@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
libvir-list@redhat.com,
"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
qemu-devel@nongnu.org, "Yanan Wang" <wangyanan55@huawei.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Qiuhao Li" <Qiuhao.Li@outlook.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Darren Kenny" <darren.kenny@oracle.com>,
"Bandan Das" <bsd@redhat.com>,
qemu-arm@nongnu.org, "Jan Kiszka" <jan.kiszka@web.de>,
"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Alexander Bulekov" <alxndr@bu.edu>,
"Thomas Huth" <huth@tuxfamily.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH 07/18] Introduce machine's default-audiodev property
Date: Fri, 29 Apr 2022 13:36:43 +0200 [thread overview]
Message-ID: <YmvNyzUtCmL59gi8@wheatley> (raw)
In-Reply-To: <Ymaq1ouZVKD5kZfV@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 5102 bytes --]
On Mon, Apr 25, 2022 at 03:06:14PM +0100, Daniel P. Berrangé wrote:
>On Mon, Apr 25, 2022 at 10:21:50AM +0200, Martin Kletzander wrote:
>> Many machine types have default audio devices with no way to set the underlying
>> audiodev. Instead of adding an option for each and every one of them this new
>> property can be used as a default during machine initialisation when creating
>> such devices.
>>
>> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
>> ---
>> hw/core/machine.c | 23 +++++++++++++++++++++++
>> include/hw/boards.h | 1 +
>> 2 files changed, 24 insertions(+)
>>
>> diff --git a/hw/core/machine.c b/hw/core/machine.c
>> index cb9bbc844d24..d055a126d398 100644
>> --- a/hw/core/machine.c
>> +++ b/hw/core/machine.c
>> @@ -596,6 +596,22 @@ static void machine_set_memdev(Object *obj, const char *value, Error **errp)
>> ms->ram_memdev_id = g_strdup(value);
>> }
>>
>> +static char *machine_get_default_audiodev(Object *obj, Error **errp)
>> +{
>> + MachineState *ms = MACHINE(obj);
>> +
>> + return g_strdup(ms->default_audiodev);
>> +}
>> +
>> +static void machine_set_default_audiodev(Object *obj, const char *value,
>> + Error **errp)
>> +{
>> + MachineState *ms = MACHINE(obj);
>> +
>> + g_free(ms->default_audiodev);
>> + ms->default_audiodev = g_strdup(value);
>> +}
>> +
>> HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
>> {
>> int i;
>> @@ -867,6 +883,12 @@ static void machine_class_init(ObjectClass *oc, void *data)
>> object_class_property_set_description(oc, "confidential-guest-support",
>> "Set confidential guest scheme to support");
>>
>> + object_class_property_add_str(oc, "default-audiodev",
>> + machine_get_default_audiodev,
>> + machine_set_default_audiodev);
>> + object_class_property_set_description(oc, "default-audiodev",
>> + "Audiodev to use for default machine devices");
>> +
>
>Hmm, if we add this, people might reasonably question why this default
>audiodev can't be used for everything, instead of making other 'audiodev'
>parameter mandatory.
>
>For the x86 machines we have a property tied specifically to the PC
>speaker.
>
> -machine ...,pcspk-audiodev=<name>
>
>
>If we assume that's the desired pattern, then every machine which has
>a built-in audio device should gain some "{$device}-audiodev" proprerty
>where '$device' is some reasonable name for the built-in audio device
>of the machine. This would work better if a machine ended up with
>two built-in audio devices and needed separate audiodevs for them.
>
Which is what I wanted to avoid because it creates huge amount of names
which are not easy to find out. I imagine that the default audio
devices which already exist are not much known and mostly used as-is
without the users needing to figure out what they are. Especially those
that are enabled even with -nodefaults. And I expect people who just
want to just emulate an old Palm do not really want to specify the names
of both devices which need an audiodev, especially when one of them is a
touch display or something weird like that. Moreover you cannot specify
anything for these devices currently, so you cannot use two different
backends now.
I understand that the naming suggests it would be a default audiodev for
anything without one explicitly specified, but I could not think of any
other suitable name. And I felt like having a default that would be
used for all devices defeats the purpose of removing default audiodev.
If adding a machine option for every such device is the way to go, then
I can try changing that. Hopefully that would not turn into another
18-patch series =) So should I prefer that route?
>
>> /* For compatibility */
>> object_class_property_add_str(oc, "memory-encryption",
>> machine_get_memory_encryption, machine_set_memory_encryption);
>> @@ -961,6 +983,7 @@ static void machine_finalize(Object *obj)
>> g_free(ms->device_memory);
>> g_free(ms->nvdimms_state);
>> g_free(ms->numa_state);
>> + g_free(ms->default_audiodev);
>> }
>>
>> bool machine_usb(MachineState *machine)
>> diff --git a/include/hw/boards.h b/include/hw/boards.h
>> index d64b5481e834..5be1de50af03 100644
>> --- a/include/hw/boards.h
>> +++ b/include/hw/boards.h
>> @@ -346,6 +346,7 @@ struct MachineState {
>> */
>> MemoryRegion *ram;
>> DeviceMemoryState *device_memory;
>> + char *default_audiodev;
>>
>> ram_addr_t ram_size;
>> ram_addr_t maxram_size;
>> --
>> 2.35.1
>>
>
>With regards,
>Daniel
>--
>|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
>|: https://libvirt.org -o- https://fstop138.berrange.com :|
>|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-04-29 11:37 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 8:21 [PATCH 00/18] RFC: Remove deprecated audio features Martin Kletzander
2022-04-25 8:21 ` [PATCH 01/18] hw/audio: Remove -soundhw support Martin Kletzander
2022-04-25 13:16 ` Daniel P. Berrangé
2022-04-26 8:53 ` Stefan Hajnoczi
2022-04-27 10:10 ` Paolo Bonzini
2022-04-25 8:21 ` [PATCH 02/18] hw/input/tsc210x: Extract common init code into new function Martin Kletzander
2022-04-25 13:19 ` Daniel P. Berrangé
2022-04-25 8:21 ` [PATCH 03/18] hw/audio: Simplify hda audio init Martin Kletzander
2022-04-25 13:35 ` Daniel P. Berrangé
2022-04-25 14:06 ` Daniel P. Berrangé
2022-04-25 8:21 ` [PATCH 04/18] hw/audio/lm4549: Add errp error reporting to init function Martin Kletzander
2022-04-25 14:08 ` Daniel P. Berrangé
2022-04-25 8:21 ` [PATCH 05/18] tests/qtest: Specify audiodev= and -audiodev Martin Kletzander
2022-04-25 13:42 ` Daniel P. Berrangé
2022-04-29 10:37 ` Martin Kletzander
2022-04-25 8:21 ` [PATCH 06/18] ui/vnc: Require audiodev= Martin Kletzander
2022-04-25 13:48 ` Daniel P. Berrangé
2022-04-27 9:32 ` Paolo Bonzini
2022-04-27 9:41 ` Daniel P. Berrangé
2022-04-25 8:21 ` [PATCH 07/18] Introduce machine's default-audiodev property Martin Kletzander
2022-04-25 14:06 ` Daniel P. Berrangé
2022-04-29 11:36 ` Martin Kletzander [this message]
2022-04-25 8:21 ` [PATCH 08/18] audio: Add easy dummy audio initialiser Martin Kletzander
2022-04-25 8:21 ` [PATCH 09/18] hw/display/xlnx_dp.c: Add audiodev property Martin Kletzander
2022-04-25 8:21 ` [PATCH 10/18] hw/input/tsc210x.c: Support machine-default audiodev with fallback Martin Kletzander
2022-04-25 8:21 ` [PATCH 11/18] hw/arm: " Martin Kletzander
2022-04-25 8:21 ` [PATCH 12/18] hw/ppc: " Martin Kletzander
2022-04-25 8:21 ` [PATCH 13/18] audio: Make AUD_register_card fallible and require audiodev= Martin Kletzander
2022-04-25 13:34 ` Daniel P. Berrangé
2022-04-25 13:39 ` Daniel P. Berrangé
2022-04-25 8:21 ` [PATCH 14/18] audio: Require AudioState in AUD_add_capture Martin Kletzander
2022-04-25 14:11 ` Daniel P. Berrangé
2022-04-25 8:21 ` [PATCH 15/18] audio: Be more strict during audio backend initialisation Martin Kletzander
2022-04-25 14:16 ` Daniel P. Berrangé
2022-04-25 8:21 ` [PATCH 16/18] audio: Remove legacy audio environment variables and options Martin Kletzander
2022-04-25 14:19 ` Daniel P. Berrangé
2022-04-25 8:22 ` [PATCH 17/18] audio: Remove unused can_be_default Martin Kletzander
2022-04-25 14:19 ` Daniel P. Berrangé
2022-04-25 8:22 ` [PATCH 18/18] audio/spiceaudio: Fail initialisation when not using spice Martin Kletzander
2022-04-25 13:08 ` Daniel P. Berrangé
2022-04-25 17:05 ` [PATCH 00/18] RFC: Remove deprecated audio features Mark Cave-Ayland
2022-04-29 12:04 ` Martin Kletzander
2022-04-26 8:54 ` Stefan Hajnoczi
2023-09-15 11:47 ` Paolo Bonzini
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=YmvNyzUtCmL59gi8@wheatley \
--to=mkletzan@redhat.com \
--cc=Qiuhao.Li@outlook.com \
--cc=alistair@alistair23.me \
--cc=alxndr@bu.edu \
--cc=berrange@redhat.com \
--cc=bsd@redhat.com \
--cc=darren.kenny@oracle.com \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=f4bug@amsat.org \
--cc=hpoussin@reactos.org \
--cc=huth@tuxfamily.org \
--cc=jan.kiszka@web.de \
--cc=kraxel@redhat.com \
--cc=libvir-list@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu_oss@crudebyte.com \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
--cc=wangyanan55@huawei.com \
/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).