From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: balaton@eik.bme.hu, berrange@redhat.com
Subject: [PATCH 2/7] audio: disable default backends if -audio/-audiodev is used
Date: Thu, 5 Oct 2023 14:58:10 +0200 [thread overview]
Message-ID: <20231005125815.66082-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20231005125815.66082-1-pbonzini@redhat.com>
Match what is done for other options, for example -monitor. Require
the user to specify a backend if one is specified on the command line.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
audio/audio.c | 9 +--------
audio/audio.h | 1 +
docs/about/removed-features.rst | 4 ++++
system/vl.c | 7 +++++++
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/audio/audio.c b/audio/audio.c
index 98621576d95..67a7e25254d 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1688,14 +1688,10 @@ static const VMStateDescription vmstate_audio = {
static void audio_validate_opts(Audiodev *dev, Error **errp);
-static void audio_create_default_audiodevs(void)
+void audio_create_default_audiodevs(void)
{
const char *drvname = getenv("QEMU_AUDIO_DRV");
- if (!defaults_enabled()) {
- return;
- }
-
/* QEMU_AUDIO_DRV=none is used by libqtest. */
if (drvname && !g_str_equal(drvname, "none")) {
error_report("Please use -audiodev instead of QEMU_AUDIO_*");
@@ -1827,9 +1823,6 @@ bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
}
card->state = QTAILQ_FIRST(&audio_states);
} else {
- if (QSIMPLEQ_EMPTY(&default_audiodevs)) {
- audio_create_default_audiodevs();
- }
card->state = audio_init(NULL, errp);
if (!card->state) {
if (!QSIMPLEQ_EMPTY(&audiodevs)) {
diff --git a/audio/audio.h b/audio/audio.h
index 80f3f92124d..53b1d7e6227 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -170,6 +170,7 @@ void audio_sample_from_uint64(void *samples, int pos,
void audio_define(Audiodev *audio);
void audio_parse_option(const char *opt);
+void audio_create_default_audiodevs(void);
void audio_init_audiodevs(void);
void audio_help(void);
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index e83ed087f6b..58c94392c65 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -442,6 +442,10 @@ line using a ``secret`` object instance.
The ``-audiodev`` and ``-audio`` command line options are now the only
way to specify audio backend settings.
+QEMU does not create default audio backends anymore if any of the
+``-audiodev``, ``-audio`` or ``-nodefaults`` options are used on the
+command line.
+
Creating vnc without ``audiodev=`` property (removed in 8.2)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
diff --git a/system/vl.c b/system/vl.c
index 98e071e63bb..7ca92d4490d 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -184,6 +184,7 @@ static const char *qtest_log;
static bool opt_one_insn_per_tb;
static int has_defaults = 1;
+static int default_audio = 1;
static int default_serial = 1;
static int default_parallel = 1;
static int default_monitor = 1;
@@ -1327,6 +1328,7 @@ static void qemu_disable_default_devices(void)
default_sdcard = 0;
}
if (!has_defaults) {
+ default_audio = 0;
default_monitor = 0;
default_net = 0;
default_vga = 0;
@@ -1963,6 +1965,9 @@ static void qemu_create_early_backends(void)
*/
configure_blockdev(&bdo_queue, machine_class, snapshot);
audio_init_audiodevs();
+ if (default_audio) {
+ audio_create_default_audiodevs();
+ }
}
@@ -2925,6 +2930,7 @@ void qemu_init(int argc, char **argv)
break;
#endif
case QEMU_OPTION_audiodev:
+ default_audio = 0;
audio_parse_option(optarg);
break;
case QEMU_OPTION_audio: {
@@ -2933,6 +2939,7 @@ void qemu_init(int argc, char **argv)
Audiodev *dev = NULL;
Visitor *v;
QDict *dict = keyval_parse(optarg, "driver", &help, &error_fatal);
+ default_audio = 0;
if (help || (qdict_haskey(dict, "driver") &&
is_help_option(qdict_get_str(dict, "driver")))) {
audio_help();
--
2.41.0
next prev parent reply other threads:[~2023-10-05 12:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 12:58 [PATCH 0/7] audio: redo default audio backend creation Paolo Bonzini
2023-10-05 12:58 ` [PATCH 1/7] audio: error hints need a trailing \n Paolo Bonzini
2023-10-05 12:58 ` Paolo Bonzini [this message]
2023-10-05 12:58 ` [PATCH 3/7] audio: extract audio_define_default Paolo Bonzini
2023-10-05 12:58 ` [PATCH 4/7] audio: extend -audio to allow creating a default backend Paolo Bonzini
2023-10-05 12:58 ` [PATCH 5/7] audio: do not use first -audiodev as default audio device Paolo Bonzini
2023-10-05 13:33 ` BALATON Zoltan
2023-10-05 13:38 ` BALATON Zoltan
2023-10-05 15:09 ` Paolo Bonzini
2023-10-05 15:40 ` BALATON Zoltan
2023-10-05 16:41 ` Paolo Bonzini
2023-10-05 18:20 ` BALATON Zoltan
2023-10-05 12:58 ` [PATCH 6/7] audio: reintroduce default audio backend for VNC Paolo Bonzini
2023-10-05 12:58 ` [PATCH 7/7] audio, qtest: get rid of QEMU_AUDIO_DRV Paolo Bonzini
2023-10-09 10:46 ` [PATCH 0/7] audio: redo default audio backend creation Marc-André Lureau
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=20231005125815.66082-3-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=berrange@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).