qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 24/26] audio: do not use first -audiodev as default audio device
Date: Fri,  6 Oct 2023 13:14:10 +0200	[thread overview]
Message-ID: <20231006111412.13130-25-pbonzini@redhat.com> (raw)
In-Reply-To: <20231006111412.13130-1-pbonzini@redhat.com>

It is now possible to specify the options for the default audio device
using -audio, so there is no need anymore to use a fake -audiodev option.

Remove the fall back to QTAILQ_FIRST(&audio_states), instead remember the
AudioState that was created from default_audiodevs and use that one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 audio/audio.c                   | 25 +++++++------------------
 docs/about/deprecated.rst       |  6 ------
 docs/about/removed-features.rst | 15 +++++++++++++++
 3 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/audio/audio.c b/audio/audio.c
index a5e6eb4952e..bd4bcabccaf 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -104,6 +104,7 @@ static audio_driver *audio_driver_lookup(const char *name)
 
 static QTAILQ_HEAD(AudioStateHead, AudioState) audio_states =
     QTAILQ_HEAD_INITIALIZER(audio_states);
+static AudioState *default_audio_state;
 
 const struct mixeng_volume nominal_volume = {
     .mute = 0,
@@ -1660,6 +1661,7 @@ static void free_audio_state(AudioState *s)
 
 void audio_cleanup(void)
 {
+    default_audio_state = NULL;
     while (!QTAILQ_EMPTY(&audio_states)) {
         AudioState *s = QTAILQ_FIRST(&audio_states);
         QTAILQ_REMOVE(&audio_states, s, list);
@@ -1760,6 +1762,7 @@ static AudioState *audio_init(Audiodev *dev, Error **errp)
             goto out;
         }
     } else {
+        assert(!default_audio_state);
         for (;;) {
             AudiodevListEntry *e = QSIMPLEQ_FIRST(&default_audiodevs);
             if (!e) {
@@ -1801,24 +1804,9 @@ out:
 bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
 {
     if (!card->state) {
-        if (!QTAILQ_EMPTY(&audio_states)) {
-            /*
-             * FIXME: once it is possible to create an arbitrary
-             * default device via -audio DRIVER,OPT=VALUE (no "model"),
-             * replace this special case with the default AudioState*,
-             * storing it in a separate global.  For now, keep the
-             * warning to encourage moving off magic use of the first
-             * -audiodev.
-             */
-            if (QSIMPLEQ_EMPTY(&default_audiodevs)) {
-                dolog("Device %s: audiodev default parameter is deprecated, please "
-                      "specify audiodev=%s\n", name,
-                      QTAILQ_FIRST(&audio_states)->dev->id);
-            }
-            card->state = QTAILQ_FIRST(&audio_states);
-        } else {
-            card->state = audio_init(NULL, errp);
-            if (!card->state) {
+        if (!default_audio_state) {
+            default_audio_state = audio_init(NULL, errp);
+            if (!default_audio_state) {
                 if (!QSIMPLEQ_EMPTY(&audiodevs)) {
                     error_append_hint(errp, "Perhaps you wanted to use -audio or set audiodev=%s?\n",
                                       QSIMPLEQ_FIRST(&audiodevs)->dev->id);
@@ -1826,6 +1814,7 @@ bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
                 return false;
             }
         }
+        card->state = default_audio_state;
     }
 
     card->name = g_strdup (name);
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 2f51cf770ae..d59bcf36230 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -37,12 +37,6 @@ coverage.
 System emulator command line arguments
 --------------------------------------
 
-Creating sound card devices without ``audiodev=`` property (since 4.2)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-When not using the deprecated legacy audio config, each sound card
-should specify an ``audiodev=`` property.
-
 Short-form boolean options (since 6.0)
 ''''''''''''''''''''''''''''''''''''''
 
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index 8a0a8fe0765..ed94b4cd0c8 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -442,6 +442,21 @@ line using a ``secret`` object instance.
 The ``-audiodev`` and ``-audio`` command line options are now the only
 way to specify audio backend settings.
 
+Using ``-audiodev`` to define the default audio backend (removed in 8.2)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+If no audiodev property is specified, previous versions would use the
+first ``-audiodev`` command line option as a fallback.  Starting with
+version 8.2, audio backends created with ``-audiodev`` will only be
+used by clients (sound cards, machines with embedded sound hardware, VNC)
+that refer to it in an ``audiodev=`` property.
+
+In order to configure a default audio backend, use the ``-audio``
+command line option without specifying a ``model``; while previous
+versions of QEMU required a model, starting with version 8.2
+QEMU does not require a model and will not create any sound card
+in this case.
+
 Note that the default audio backend must be configured on the command
 line if the ``-nodefaults`` options is used.
 
-- 
2.41.0



  parent reply	other threads:[~2023-10-06 11:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 11:13 [PULL 00/26] Audio, source reorg, HVF changes for 2023-10-06 Paolo Bonzini
2023-10-06 11:13 ` [PULL 01/26] target/i386/hvf: Remove unused includes in 'hvf-i386.h' Paolo Bonzini
2023-10-06 11:13 ` [PULL 02/26] sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets Paolo Bonzini
2023-10-06 11:13 ` [PULL 03/26] util/log: re-allow switching away from stderr log file Paolo Bonzini
2023-10-06 11:13 ` [PULL 04/26] target/i386: Check for USER_ONLY definition instead of SOFTMMU one Paolo Bonzini
2023-10-06 11:13 ` [PULL 05/26] softmmu/trace-events: Fix a typo Paolo Bonzini
2023-10-06 11:13 ` [PULL 06/26] travis-ci: Correct invalid mentions of 'softmmu' by 'system' Paolo Bonzini
2023-10-06 11:13 ` [PULL 07/26] cpu: Correct invalid mentions of 'softmmu' by 'system-mode' Paolo Bonzini
2023-10-06 11:13 ` [PULL 08/26] fuzz: Correct invalid mentions of 'softmmu' by 'system' Paolo Bonzini
2023-10-06 11:13 ` [PULL 09/26] tcg: Correct invalid mentions of 'softmmu' by 'system-mode' Paolo Bonzini
2023-10-06 11:13 ` [PULL 10/26] accel: Rename accel_softmmu* -> accel_system* Paolo Bonzini
2023-10-06 11:13 ` [PULL 11/26] gdbstub: Rename 'softmmu' -> 'system' Paolo Bonzini
2023-10-06 11:13 ` [PULL 12/26] semihosting: Rename softmmu_FOO_user() -> uaccess_FOO_user() Paolo Bonzini
2023-10-06 11:13 ` [PULL 13/26] target/i386: Rename i386_softmmu_kvm_ss -> i386_kvm_ss Paolo Bonzini
2023-10-06 11:14 ` [PULL 14/26] hw/virtio/meson: Rename softmmu_virtio_ss -> system_virtio_ss Paolo Bonzini
2023-10-06 11:14 ` [PULL 15/26] meson: Rename softmmu_mods -> system_mods Paolo Bonzini
2023-10-06 11:14 ` [PULL 16/26] meson: Rename target_softmmu_arch -> target_system_arch Paolo Bonzini
2023-10-06 11:14 ` [PULL 17/26] system: Rename softmmu/ directory as system/ Paolo Bonzini
2023-10-06 11:14 ` [PULL 18/26] configure: change $softmmu to $system Paolo Bonzini
2023-10-06 11:14 ` [PULL 19/26] cutils: squelch compiler warnings with custom paths Paolo Bonzini
2023-10-06 11:14 ` [PULL 20/26] audio: error hints need a trailing \n Paolo Bonzini
2023-10-06 11:14 ` [PULL 21/26] audio: disable default backends if -audio/-audiodev is used Paolo Bonzini
2023-10-06 11:14 ` [PULL 22/26] audio: extract audio_define_default Paolo Bonzini
2023-10-06 11:14 ` [PULL 23/26] audio: extend -audio to allow creating a default backend Paolo Bonzini
2023-10-06 11:14 ` Paolo Bonzini [this message]
2023-10-06 11:14 ` [PULL 25/26] audio: reintroduce default audio backend for VNC Paolo Bonzini
2023-10-06 11:14 ` [PULL 26/26] audio, qtest: get rid of QEMU_AUDIO_DRV Paolo Bonzini
2023-10-08  6:13 ` [PULL 00/26] Audio, source reorg, HVF changes for 2023-10-06 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=20231006111412.13130-25-pbonzini@redhat.com \
    --to=pbonzini@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).