summary refs log tree commit diff stats
path: root/system/vl.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-10-05 11:55:03 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-10-08 21:08:27 +0200
commitc753bf479ab75fe245c2de6a414b60b9e25a2bd7 (patch)
tree56d8800fe00a370420f6fa672b55c4f1517a92bc /system/vl.c
parentc7c5caeb1f314c5662a3b2985fe3befebf45b650 (diff)
downloadfocaccia-qemu-c753bf479ab75fe245c2de6a414b60b9e25a2bd7.tar.gz
focaccia-qemu-c753bf479ab75fe245c2de6a414b60b9e25a2bd7.zip
audio: disable default backends if -audio/-audiodev is used
Match what is done for other options, for example -monitor, and also
the behavior of QEMU 8.1 (see the "legacy_config" variable).  Require
the user to specify a backend if one is specified on the command line.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'system/vl.c')
-rw-r--r--system/vl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/system/vl.c b/system/vl.c
index 98e071e63b..7ca92d4490 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();