Skip to contentSkip to conversation

audio: remove QEMU_AUDIO_* and -audio-help support

PATCH In review Paolo Bonzini 2 participants 4 messages Sep 5, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 audio: remove QEMU_AUDIO_* and -audio-help support

These have been deprecated for a long time, and the introduction of -audio in 7.1.0 has cemented the new way of specifying an audio backend. Remove all the associated baggage, including the concept of default audio backends.

---
 audio/alsaaudio.c               |   1 -
 audio/audio.c                   |  44 +--
 audio/audio.h                   |   1 -
 audio/audio_int.h               |   2 -
 audio/audio_legacy.c            | 591 --------------------------------
 audio/coreaudio.m               |   1 -
 audio/dbusaudio.c               |   1 -
 audio/dsoundaudio.c             |   1 -
 audio/jackaudio.c               |   1 -
 audio/meson.build               |   1 -
 audio/noaudio.c                 |   1 -
 audio/ossaudio.c                |   1 -
 audio/paaudio.c                 |   1 -
 audio/pwaudio.c                 |   1 -
 audio/sdlaudio.c                |   1 -
 audio/sndioaudio.c              |   1 -
 audio/wavaudio.c                |   1 -
 docs/about/deprecated.rst       |   8 -
 docs/about/removed-features.rst |   6 +
 qemu-options.hx                 |  10 -
 softmmu/vl.c                    |   4 -
 21 files changed, 10 insertions(+), 669 deletions(-)
 delete mode 100644 audio/audio_legacy.c
audio/alsaaudio.c +0 -1
index 057571dd1e0..5ffb39c4182 100644
@@ -960,7 +960,6 @@ static struct audio_driver alsa_audio_driver = {
     .init           = alsa_audio_init,
     .fini           = alsa_audio_fini,
     .pcm_ops        = &alsa_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in  = INT_MAX,
     .voice_size_out = sizeof (ALSAVoiceOut),
audio/audio.c +4 -40

67 lines not on this page · raw message

audio/audio.h +0 -1
index 01bdc567fb1..a276ec13eba 100644
@@ -172,7 +172,6 @@ void audio_define(Audiodev *audio);
 void audio_parse_option(const char *opt);
 bool audio_init_audiodevs(void);
 void audio_help(void);
-void audio_legacy_help(void);
 
 AudioState *audio_state_by_name(const char *name);
 const char *audio_get_id(QEMUSoundCard *card);
audio/audio_int.h +0 -2
index e57ff50155a..e6fee5ba4b7 100644
@@ -146,7 +146,6 @@ struct audio_driver {
     void (*set_dbus_server) (AudioState *s, GDBusObjectManagerServer *manager, bool p2p);
 #endif
     struct audio_pcm_ops *pcm_ops;
-    int can_be_default;
     int max_voices_out;
     int max_voices_in;
     size_t voice_size_out;
@@ -297,7 +296,6 @@ typedef struct AudiodevListEntry {
 } AudiodevListEntry;
 
 typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead;
-AudiodevListHead audio_handle_legacy_opts(void);
 
 void audio_free_audiodev_list(AudiodevListHead *head);
 
audio/audio_legacy.c deleted +0 -591

591 lines not on this page · raw message

audio/coreaudio.m +0 -1
index 4695291621a..e5612138a74 100644
@@ -673,7 +673,6 @@ static void coreaudio_audio_fini (void *opaque)
     .init           = coreaudio_audio_init,
     .fini           = coreaudio_audio_fini,
     .pcm_ops        = &coreaudio_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = 1,
     .max_voices_in  = 0,
     .voice_size_out = sizeof (coreaudioVoiceOut),
audio/dbusaudio.c +0 -1
index 7a11fbfb420..df81e6d9f0b 100644
@@ -676,7 +676,6 @@ static struct audio_driver dbus_audio_driver = {
     .fini            = dbus_audio_fini,
     .set_dbus_server = dbus_audio_set_server,
     .pcm_ops         = &dbus_pcm_ops,
-    .can_be_default  = 1,
     .max_voices_out  = INT_MAX,
     .max_voices_in   = INT_MAX,
     .voice_size_out  = sizeof(DBusVoiceOut),
audio/dsoundaudio.c +0 -1
index 3fb67ec3eed..311e3421846 100644
@@ -721,7 +721,6 @@ static struct audio_driver dsound_audio_driver = {
     .init           = dsound_audio_init,
     .fini           = dsound_audio_fini,
     .pcm_ops        = &dsound_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in  = 1,
     .voice_size_out = sizeof (DSoundVoiceOut),
audio/jackaudio.c +0 -1
index 5bdf3d7a78d..fd2d2fd5acb 100644
@@ -669,7 +669,6 @@ static struct audio_driver jack_driver = {
     .init           = qjack_init,
     .fini           = qjack_fini,
     .pcm_ops        = &jack_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in  = INT_MAX,
     .voice_size_out = sizeof(QJackOut),
audio/meson.build +0 -1
index df4d968c0fe..c8f658611f4 100644
@@ -1,7 +1,6 @@
 system_ss.add([spice_headers, files('audio.c')])
 system_ss.add(files(
   'audio-hmp-cmds.c',
-  'audio_legacy.c',
   'mixeng.c',
   'noaudio.c',
   'wavaudio.c',
audio/noaudio.c +0 -1
index 4fdee5adecf..81570bfa962 100644
@@ -135,7 +135,6 @@ static struct audio_driver no_audio_driver = {
     .init           = no_audio_init,
     .fini           = no_audio_fini,
     .pcm_ops        = &no_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in  = INT_MAX,
     .voice_size_out = sizeof (NoVoiceOut),
audio/ossaudio.c +0 -1
index e8d732b612c..5a4094af707 100644
@@ -779,7 +779,6 @@ static struct audio_driver oss_audio_driver = {
     .init           = oss_audio_init,
     .fini           = oss_audio_fini,
     .pcm_ops        = &oss_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in  = INT_MAX,
     .voice_size_out = sizeof (OSSVoiceOut),
audio/paaudio.c +0 -1
index 529b39daacc..02d18eabf50 100644
@@ -928,7 +928,6 @@ static struct audio_driver pa_audio_driver = {
     .init           = qpa_audio_init,
     .fini           = qpa_audio_fini,
     .pcm_ops        = &qpa_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in  = INT_MAX,
     .voice_size_out = sizeof (PAVoiceOut),
audio/pwaudio.c +0 -1
index b6a38738ee9..6044c9ebe50 100644
@@ -841,7 +841,6 @@ static struct audio_driver pw_audio_driver = {
     .init = qpw_audio_init,
     .fini = qpw_audio_fini,
     .pcm_ops = &qpw_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in = INT_MAX,
     .voice_size_out = sizeof(PWVoiceOut),
audio/sdlaudio.c +0 -1
index 68a237b76b4..5177e31d9b4 100644
@@ -493,7 +493,6 @@ static struct audio_driver sdl_audio_driver = {
     .init           = sdl_audio_init,
     .fini           = sdl_audio_fini,
     .pcm_ops        = &sdl_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in  = INT_MAX,
     .voice_size_out = sizeof(SDLVoiceOut),
audio/sndioaudio.c +0 -1
index 3fde01fdbd5..61260361ad6 100644
@@ -550,7 +550,6 @@ static struct audio_driver sndio_audio_driver = {
     .init           = sndio_audio_init,
     .fini           = sndio_audio_fini,
     .pcm_ops        = &sndio_pcm_ops,
-    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in  = INT_MAX,
     .voice_size_out = sizeof(SndioVoice),
audio/wavaudio.c +0 -1
index 6445a2cb90c..57435c23e58 100644
@@ -208,7 +208,6 @@ static struct audio_driver wav_audio_driver = {
     .init           = wav_audio_init,
     .fini           = wav_audio_fini,
     .pcm_ops        = &wav_pcm_ops,
-    .can_be_default = 0,
     .max_voices_out = 1,
     .max_voices_in  = 0,
     .voice_size_out = sizeof (WAVVoiceOut),
docs/about/deprecated.rst +0 -8
index 92a2bafd2bd..90bb02669ba 100644
@@ -37,14 +37,6 @@ coverage.
 System emulator command line arguments
 --------------------------------------
 
-``QEMU_AUDIO_`` environment variables and ``-audio-help`` (since 4.0)
-'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-The ``-audiodev`` argument is now the preferred way to specify audio
-backend settings instead of environment variables.  To ease migration to
-the new format, the ``-audiodev-help`` option can be used to convert
-the current values of the environment variables to ``-audiodev`` options.
-
 Creating sound card devices and vnc without ``audiodev=`` property (since 4.2)
 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
docs/about/removed-features.rst +6 -0
index 5b258b446b6..ae41816f7b2 100644
@@ -436,6 +436,12 @@ the process listing. This was replaced by the new ``password-secret``
 option which lets the password be securely provided on the command
 line using a ``secret`` object instance.
 
+``QEMU_AUDIO_`` environment variables and ``-audio-help`` (since 8.2)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+The ``-audiodev`` and ``-audio`` command line options are now the only
+way to specify audio backend settings.
+
 QEMU Machine Protocol (QMP) commands
 ------------------------------------
 
qemu-options.hx +0 -10
index 29b98c3d4c5..3bb6fca58e4 100644
@@ -712,16 +712,6 @@ SRST
 ERST
 
 
-HXCOMM Deprecated by -audiodev
-DEF("audio-help", 0, QEMU_OPTION_audio_help,
-    "-audio-help     show -audiodev equivalent of the currently specified audio settings\n",
-    QEMU_ARCH_ALL)
-SRST
-``-audio-help``
-    Will show the -audiodev equivalent of the currently specified
-    (deprecated) environment variables.
-ERST
-
 DEF("audio", HAS_ARG, QEMU_OPTION_audio,
     "-audio [driver=]driver,model=value[,prop[=value][,...]]\n"
     "                specifies the audio backend and device to use;\n"
softmmu/vl.c +0 -4
index 78b6570f19c..54a5723f43d 100644
@@ -2922,10 +2922,6 @@ void qemu_init(int argc, char **argv)
                 }
                 break;
 #endif
-            case QEMU_OPTION_audio_help:
-                audio_legacy_help();
-                exit (0);
-                break;
             case QEMU_OPTION_audiodev:
                 audio_parse_option(optarg);
                 break;
Signature · 1 line
2.41.0
#1 lore raw
Quoted 80 lines · Paolo Bonzini

These have been deprecated for a long time, and the introduction of -audio in 7.1.0 has cemented the new way of specifying an audio backend. Remove all the associated baggage, including the concept of default audio backends.

---
  audio/alsaaudio.c               |   1 -
  audio/audio.c                   |  44 +--
  audio/audio.h                   |   1 -
  audio/audio_int.h               |   2 -
  audio/audio_legacy.c            | 591 --------------------------------
  audio/coreaudio.m               |   1 -
  audio/dbusaudio.c               |   1 -
  audio/dsoundaudio.c             |   1 -
  audio/jackaudio.c               |   1 -
  audio/meson.build               |   1 -
  audio/noaudio.c                 |   1 -
  audio/ossaudio.c                |   1 -
  audio/paaudio.c                 |   1 -
  audio/pwaudio.c                 |   1 -
  audio/sdlaudio.c                |   1 -
  audio/sndioaudio.c              |   1 -
  audio/wavaudio.c                |   1 -
  docs/about/deprecated.rst       |   8 -
  docs/about/removed-features.rst |   6 +
  qemu-options.hx                 |  10 -
  softmmu/vl.c                    |   4 -
  21 files changed, 10 insertions(+), 669 deletions(-)

delete mode 100644 audio/audio_legacy.c

audio/alsaaudio.c +0 -1
index 057571dd1e0..5ffb39c4182 100644
@@ -960,7 +960,6 @@ static struct audio_driver alsa_audio_driver = {
      .init           = alsa_audio_init,
      .fini           = alsa_audio_fini,
      .pcm_ops        = &alsa_pcm_ops,
-    .can_be_default = 1,
      .max_voices_out = INT_MAX,
      .max_voices_in  = INT_MAX,
      .voice_size_out = sizeof (ALSAVoiceOut),
audio/audio.c +0 -20
index 90c7c49d116..13f519611f6 100644
@@ -111,8 +111,6 @@ const struct mixeng_volume nominal_volume = {
  #endif
  };
 
-static bool legacy_config = true;
-
  int audio_bug (const char *funcname, int cond)
  {
      if (cond) {
@@ -1712,46 +1710,14 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
      /* silence gcc warning about uninitialized variable */
      AudiodevListHead head = QSIMPLEQ_HEAD_INITIALIZER(head);
 
-    if (using_spice) {
-        /*
-         * When using spice allow the spice audio driver being picked
-         * as default.
-         *
-         * Temporary hack.  Using audio devices without explicit
-         * audiodev= property is already deprecated.  Same goes for
-         * the -soundhw switch.  Once this support gets finally
-         * removed we can also drop the concept of a default audio
-         * backend and this can go away.
-         */
-        driver = audio_driver_lookup("spice");
-        if (driver) {
-            driver->can_be_default = 1;
-        }
-    }
-
      if (dev) {
          /* -audiodev option */
-        legacy_config = false;

audio/audio.c static AudioState *audio_init(Audiodev *dev, const char *name) · line 1719

Quoted 10 lines
audio/audio.c +3 -5
          drvname = AudiodevDriver_str(dev->driver);
      } else if (!QTAILQ_EMPTY(&audio_states)) {
-        if (!legacy_config) {
-            dolog("Device %s: audiodev default parameter is deprecated, please "
-                  "specify audiodev=%s\n", name,
-                  QTAILQ_FIRST(&audio_states)->dev->id);
-        }
+        dolog("Device %s: audiodev default parameter is deprecated, please "
+              "specify audiodev=%s\n", name,
+              QTAILQ_FIRST(&audio_states)->dev->id);

You said that you removed the default handling ... so this log message looks suspicious ... is this code block still required?

Quoted 4 lines
audio/audio.c +0 -3
          return QTAILQ_FIRST(&audio_states);
-    } else {
-        /* legacy implicit initialization */
-        head = audio_handle_legacy_opts();

audio/audio.c static AudioState *audio_init(Audiodev *dev, const char *name) · line 1721

Quoted 10 lines
audio/audio.c +0 -9
-        /*
-         * In case of legacy initialization, all Audiodevs in the list will have
-         * the same configuration (except the driver), so it doesn't matter which
-         * one we chose.  We need an Audiodev to set up AudioState before we can
-         * init a driver.  Also note that dev at this point is still in the
-         * list.
-         */
-        dev = QSIMPLEQ_FIRST(&head)->dev;
-        audio_validate_opts(dev, &error_abort);
      }

Thomas

#2 lore raw
Quoted 7 lines · Thomas Huth
Quoted 5 lines

+        dolog("Device %s: audiodev default parameter is deprecated, please "
+              "specify audiodev=%s\n", name,
+              QTAILQ_FIRST(&audio_states)->dev->id);

You said that you removed the default handling ... so this log message looks suspicious ... is this code block still required?

I was referring to the ".can_be_default" argument, maybe I should change "default audio backend" to "default audio driver" in the commit message?
Unfortunately this code (which is a separate entry in deprecated.rst)
cannot be removed because of non-qdevified soundcards.

Paolo

Reviewed-by
#3 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 7 lines · Thomas Huth
Quoted 5 lines

+        dolog("Device %s: audiodev default parameter is deprecated, please "
+              "specify audiodev=%s\n", name,
+              QTAILQ_FIRST(&audio_states)->dev->id);

You said that you removed the default handling ... so this log message looks suspicious ... is this code block still required?

I was referring to the ".can_be_default" argument, maybe I should change "default audio backend" to "default audio driver" in the commit message?

No, I think it's fine. Thanks for the clarification!