* [PATCH v3 00/11] add build option to disable audio subsystem
@ 2026-03-15 20:16 Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 01/11] audio: add `audio` build option for meson and Kconfig Sergei Heifetz
` (10 more replies)
0 siblings, 11 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
This series adds a compile-time option to disable building
audio-related sources (mostly, files under `audio/` and `hw/audio/`).
It adds `--disable-audio` and `--enable-audio` options to the
`configure` script. Audio remains enabled by default, and the changes are
harmless in that case.
When audio is disabled, it may not be possible to build a number of
devices and machines. This is expected, and can be addressed on a
case-by-case basis if needed. For now, this is done only for the
PC Speaker (PCSPK).
This feature may be useful in production environments which only use a
specific subset of QEMU’s functionality and, in particular, do not need
the audio subsystem. In such environments it is generally beneficial to
avoid building unused code, for both security and maintenance reasons
(for example, to satisfy various static code analysers).
Changes in v3:
* ui/vnc:
- Included some useful information in the commit message.
- Added a note in qemu-options.hx about using VNC with `--disable-audio`.
- Made a few stylistic changes.
* system/vl:
- Updated qemu-options.hx so the `audiodev` and `audio` options are
omitted if audio is disabled.
* ui/dbus:
- Updated ui/dbus.c so the code related to the `audiodev` property
is not compiled if audio is disabled.
- In qapi/ui.json, made the `*audiodev` field of the DisplayDBus struct
conditional so it's not present if audio is disabled.
- Added a brief note about disabling audio in the D-Bus section of
qemu-options.hx.
* The `audio: do not build..` patch:
- audio/audio-stub.c is removed. Instead, new ifdefs are added in a few
places.
* Added a patch that removes the `audiodevs` root container in qom/object.c
if audio is disabled.
* Rebased onto the master branch.
Changes in v2:
* Rebased onto the master branch (in particular, onto the changes from the
large series submitted by Marc-André Lureau).
* D-Bus is now handled differently when audio is disabled: instead of
interrupting initialisation, we simply don’t initialise the audio
interface.
* Incorporated a few changes suggested by Paolo Bonzini and Thomas Huth.
The main ones are:
- Cleaned up the PCSPK changes (removed redundant ifdefs and the
`audio_be` field).
- Removed the HMP commands rather than stubbing them out.
- Replaced the `configure` change with a change in
`scripts/meson-buildoptions.sh`.
- Removed `qdev_prop_audiodev` in `hw/core/qdev-properties-system.c`
rather than stubbing out `audio_be_get_id`.
(Here "removed" means adding an appropriate ifdef.)
Sergei Heifetz (11):
audio: add `audio` build option for meson and Kconfig
ui/vnc: disable audio feature when configured with --disable-audio
tests/qtest: remove -audio none when configured with --disable-audio
hw/audio/pcspk: change PCSPK behaviour with --disable-audio
Kconfig: add AUDIO dependency to audio-related devices
system/vl: remove audio and audiodev options when audio is disabled
ui/dbus: run without Audio interface when audio is disabled
tests/audio: do not compile if audio is disabled
audio: do not build audio-related sources with --disable-audio
qom: remove audiodevs root container if audio is disabled
meson.build: ignore audio drivers when configured with --disable-audio
Kconfig.host | 3 ++
audio/meson.build | 4 ++
hmp-commands-info.hx | 2 +
hmp-commands.hx | 2 +
hw/audio/Kconfig | 21 ++++----
hw/audio/pcspk.c | 12 ++++-
hw/core/machine.c | 6 +++
hw/core/qdev-properties-system.c | 2 +
hw/i386/pc.c | 2 +
hw/usb/Kconfig | 2 +-
meson.build | 83 ++++++++++++++++++--------------
meson_options.txt | 3 ++
qapi/audio.json | 3 +-
qapi/ui.json | 2 +-
qemu-options.hx | 9 ++++
qom/object.c | 2 +
replay/meson.build | 9 +++-
replay/replay-audio-stub.c | 21 ++++++++
replay/stubs-system.c | 12 -----
scripts/meson-buildoptions.sh | 3 ++
system/runstate.c | 2 +
system/vl.c | 8 +++
tests/audio/meson.build | 2 +-
tests/qtest/libqtest.c | 2 +
ui/dbus.c | 8 +++
ui/vnc.c | 27 +++++++++++
26 files changed, 190 insertions(+), 62 deletions(-)
create mode 100644 replay/replay-audio-stub.c
--
2.34.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 01/11] audio: add `audio` build option for meson and Kconfig
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 02/11] ui/vnc: disable audio feature when configured with --disable-audio Sergei Heifetz
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
This patch adds the `audio` option to meson_options.txt. It is
propagated into Kconfig as AUDIO. It is enabled by default.
The corresponding `--disable-audio` and `--enable-audio` options
for `configure` are also added.
For now, this option does nothing. In subsequent patches, it will
gradually disable audio in different places. The final goal is to stop
building sources from `audio/` and `hw/audio/` and other audio-related
files (except for some stubs). Note that this intent is different from
`-audio none`, which mutes audio but still compiles the audio subsystem.
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
Kconfig.host | 3 +++
meson.build | 3 +++
meson_options.txt | 3 +++
scripts/meson-buildoptions.sh | 3 +++
4 files changed, 12 insertions(+)
diff --git a/Kconfig.host b/Kconfig.host
index 933425c74b4..ec129aa4fc0 100644
--- a/Kconfig.host
+++ b/Kconfig.host
@@ -29,6 +29,9 @@ config IVSHMEM
config TPM
bool
+config AUDIO
+ bool
+
config FDT
bool
diff --git a/meson.build b/meson.build
index ed82247111e..d05533488f9 100644
--- a/meson.build
+++ b/meson.build
@@ -68,6 +68,8 @@ foreach target : target_dirs
endforeach
have_user = have_linux_user or have_bsd_user
+have_audio = get_option('audio').disable_auto_if(not have_system).allowed()
+
############
# Programs #
############
@@ -3277,6 +3279,7 @@ disassemblers = {
have_ivshmem = config_host_data.get('CONFIG_EVENTFD')
host_kconfig = \
(get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \
+ (have_audio ? ['CONFIG_AUDIO=y'] : []) + \
(have_tpm ? ['CONFIG_TPM=y'] : []) + \
(pixman.found() ? ['CONFIG_PIXMAN=y'] : []) + \
(spice.found() ? ['CONFIG_SPICE=y'] : []) + \
diff --git a/meson_options.txt b/meson_options.txt
index 31d5916cfce..d22386b4c15 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -71,6 +71,9 @@ option('malloc_trim', type : 'feature', value : 'auto',
option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
value: 'system', description: 'choose memory allocator to use')
+option('audio', type: 'feature', value: 'auto',
+ description: 'Audio support')
+
option('kvm', type: 'feature', value: 'auto',
description: 'KVM acceleration support')
option('mshv', type: 'feature', value: 'auto',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index ca5b113119a..05c55d2e70f 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -96,6 +96,7 @@ meson_options_help() {
printf "%s\n" ' af-xdp AF_XDP network backend support'
printf "%s\n" ' alsa ALSA sound support'
printf "%s\n" ' attr attr/xattr support'
+ printf "%s\n" ' audio Audio support'
printf "%s\n" ' auth-pam PAM access control'
printf "%s\n" ' blkio libblkio block device driver'
printf "%s\n" ' bochs bochs image format support'
@@ -243,6 +244,8 @@ _meson_option_parse() {
--disable-asan) printf "%s" -Dasan=false ;;
--enable-attr) printf "%s" -Dattr=enabled ;;
--disable-attr) printf "%s" -Dattr=disabled ;;
+ --enable-audio) printf "%s" -Daudio=enabled ;;
+ --disable-audio) printf "%s" -Daudio=disabled ;;
--audio-drv-list=*) quote_sh "-Daudio_drv_list=$2" ;;
--enable-auth-pam) printf "%s" -Dauth_pam=enabled ;;
--disable-auth-pam) printf "%s" -Dauth_pam=disabled ;;
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 02/11] ui/vnc: disable audio feature when configured with --disable-audio
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 01/11] audio: add `audio` build option for meson and Kconfig Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 03/11] tests/qtest: remove -audio none " Sergei Heifetz
` (8 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
Disable the audio feature in VNC when QEMU is configured with
`--disable-audio`. Do not compile the corresponding audio-related
code.
The audio feature is disabled in a way that makes a QEMU server behave
like a non-QEMU server (as far as audio is concerned). The client sends
the audio pseudo-encoding, but the server does not respond with
confirmation, because send_ext_audio_ack is now behind an #ifdef.
A well-behaved client should handle this accordingly and continue
using VNC without sending any audio-related messages to the server.
If a client misbehaves and sends VNC_MSG_CLIENT_QEMU_AUDIO while
the audio feature is disabled, the server will close the connection with
an error.
The behaviour described above is already present when there is no audiodev
(`vs->vd->audio_be` is NULL).
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
---
qemu-options.hx | 3 +++
ui/vnc.c | 27 +++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/qemu-options.hx b/qemu-options.hx
index 890c4f1d230..04ea2239296 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2723,6 +2723,9 @@ SRST
must be omitted, otherwise is must be present and specify a
valid audiodev.
+ If QEMU is configured with ``--disable-audio``, this parameter
+ is not present and audio is not transmitted over VNC.
+
``power-control=on|off``
Permit the remote client to issue shutdown, reboot or reset power
control requests.
diff --git a/ui/vnc.c b/ui/vnc.c
index 952976e9649..0ee5502d1e6 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1072,6 +1072,7 @@ static void vnc_update_throttle_offset(VncState *vs)
size_t offset =
vs->client_width * vs->client_height * vs->client_pf.bytes_per_pixel;
+#ifdef CONFIG_AUDIO
if (vs->audio_cap) {
int bps;
switch (vs->as.fmt) {
@@ -1091,6 +1092,7 @@ static void vnc_update_throttle_offset(VncState *vs)
}
offset += vs->as.freq * bps * vs->as.nchannels;
}
+#endif
/* Put a floor of 1MB on offset, so that if we have a large pending
* buffer and the display is resized to a small size & back again
@@ -1214,6 +1216,7 @@ static int vnc_update_client(VncState *vs, int has_dirty)
return n;
}
+#ifdef CONFIG_AUDIO
/* audio */
static void audio_capture_notify(void *opaque, audcnotification_e cmd)
{
@@ -1293,6 +1296,7 @@ static void audio_del(VncState *vs)
vs->audio_cap = NULL;
}
}
+#endif
static void vnc_disconnect_start(VncState *vs)
{
@@ -1332,7 +1336,9 @@ void vnc_disconnect_finish(VncState *vs)
#ifdef CONFIG_VNC_SASL
vnc_sasl_client_cleanup(vs);
#endif /* CONFIG_VNC_SASL */
+#ifdef CONFIG_AUDIO
audio_del(vs);
+#endif
qkbd_state_lift_all_keys(vs->vd->kbd);
if (vs->mouse_mode_notifier.notify != NULL) {
@@ -2097,6 +2103,7 @@ static void send_ext_key_event_ack(VncState *vs)
vnc_flush(vs);
}
+#ifdef CONFIG_AUDIO
static void send_ext_audio_ack(VncState *vs)
{
vnc_lock_output(vs);
@@ -2110,6 +2117,7 @@ static void send_ext_audio_ack(VncState *vs)
vnc_unlock_output(vs);
vnc_flush(vs);
}
+#endif
static void send_xvp_message(VncState *vs, int code)
{
@@ -2197,10 +2205,15 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
send_ext_key_event_ack(vs);
break;
case VNC_ENCODING_AUDIO:
+#ifdef CONFIG_AUDIO
if (vs->vd->audio_be) {
vnc_set_feature(vs, VNC_FEATURE_AUDIO);
send_ext_audio_ack(vs);
}
+#else
+ VNC_DEBUG("Audio encoding received with audio subsystem "
+ "disabled\n");
+#endif
break;
case VNC_ENCODING_WMVi:
vnc_set_feature(vs, VNC_FEATURE_WMVI);
@@ -2394,7 +2407,9 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
{
int i;
uint16_t limit;
+#ifdef CONFIG_AUDIO
uint32_t freq;
+#endif
VncDisplay *vd = vs->vd;
if (data[0] > 3) {
@@ -2572,6 +2587,7 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
break;
}
+#ifdef CONFIG_AUDIO
if (len == 2)
return 4;
@@ -2626,6 +2642,9 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
break;
}
break;
+#else
+ abort();
+#endif
default:
VNC_DEBUG("Msg: %d\n", read_u16(data, 0));
@@ -3369,10 +3388,12 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc,
vs->last_x = -1;
vs->last_y = -1;
+#ifdef CONFIG_AUDIO
vs->as.freq = 44100;
vs->as.nchannels = 2;
vs->as.fmt = AUDIO_FORMAT_S16;
vs->as.big_endian = false;
+#endif
qemu_mutex_init(&vs->output_mutex);
vs->bh = qemu_bh_new(vnc_jobs_bh, vs);
@@ -3649,9 +3670,11 @@ static QemuOptsList qemu_vnc_opts = {
},{
.name = "non-adaptive",
.type = QEMU_OPT_BOOL,
+#ifdef CONFIG_AUDIO
},{
.name = "audiodev",
.type = QEMU_OPT_STRING,
+#endif
},{
.name = "power-control",
.type = QEMU_OPT_BOOL,
@@ -4084,7 +4107,9 @@ void vnc_display_open(const char *id, Error **errp)
const char *saslauthz;
int lock_key_sync = 1;
int key_delay_ms;
+#ifdef CONFIG_AUDIO
const char *audiodev;
+#endif
const char *passwordSecret;
if (!vd) {
@@ -4242,6 +4267,7 @@ void vnc_display_open(const char *id, Error **errp)
}
vd->ledstate = 0;
+#ifdef CONFIG_AUDIO
audiodev = qemu_opt_get(opts, "audiodev");
if (audiodev) {
vd->audio_be = audio_be_by_name(audiodev, errp);
@@ -4251,6 +4277,7 @@ void vnc_display_open(const char *id, Error **errp)
} else {
vd->audio_be = audio_get_default_audio_be(NULL);
}
+#endif
device_id = qemu_opt_get(opts, "display");
if (device_id) {
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 03/11] tests/qtest: remove -audio none when configured with --disable-audio
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 01/11] audio: add `audio` build option for meson and Kconfig Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 02/11] ui/vnc: disable audio feature when configured with --disable-audio Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 04/11] hw/audio/pcspk: change PCSPK behaviour " Sergei Heifetz
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
It does not matter much whether `-audio none` is passed. In the future,
support for `-audio none` with `--disable-audio` will be dropped, so we
should remove it beforehand.
(We could preserve `-audio none` with `--disable-audio` for compatibility
reasons, but we choose not to because they have different meanings:
`--disable-audio` will eventually mean having no audio backend at all,
while `-audio none` means using the `none` audio backend.)
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/qtest/libqtest.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 051faf31e14..a59fdaf3973 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -464,7 +464,9 @@ gchar *qtest_qemu_args(const char *extra_args)
"-chardev socket,path=%s,id=char0 "
"-mon chardev=char0,mode=control "
"-display none "
+#ifdef CONFIG_AUDIO
"-audio none "
+#endif
"%s"
"%s"
" -accel qtest",
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 04/11] hw/audio/pcspk: change PCSPK behaviour with --disable-audio
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
` (2 preceding siblings ...)
2026-03-15 20:16 ` [PATCH v3 03/11] tests/qtest: remove -audio none " Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 05/11] Kconfig: add AUDIO dependency to audio-related devices Sergei Heifetz
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
PCSPK (PC Speaker) is an embedded audio device. We don't want it to use audio
when QEMU is configured with `--disable-audio`. This is achieved with minimal,
non-invasive changes to the code.
In essence, the changes ensure that PCSPK does not have a corresponding
audio backend, while functioning the same way in non-audio aspects.
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/audio/pcspk.c | 12 +++++++++++-
hw/i386/pc.c | 2 ++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
index 6b826507ce3..54e18822651 100644
--- a/hw/audio/pcspk.c
+++ b/hw/audio/pcspk.c
@@ -48,17 +48,20 @@ struct PCSpkState {
MemoryRegion ioport;
uint32_t iobase;
+ PITCommonState *pit;
+#ifdef CONFIG_AUDIO
uint8_t sample_buf[PCSPK_BUF_LEN];
AudioBackend *audio_be;
SWVoiceOut *voice;
- PITCommonState *pit;
unsigned int pit_count;
unsigned int samples;
unsigned int play_pos;
+#endif
uint8_t data_on;
uint8_t dummy_refresh_clock;
};
+#ifdef CONFIG_AUDIO
static const char *s_spk = "pcspk";
static inline void generate_samples(PCSpkState *s)
@@ -130,6 +133,7 @@ static int pcspk_audio_init(PCSpkState *s)
return 0;
}
+#endif
static uint64_t pcspk_io_read(void *opaque, hwaddr addr,
unsigned size)
@@ -160,11 +164,13 @@ static void pcspk_io_write(void *opaque, hwaddr addr, uint64_t val,
s->data_on = (val >> 1) & 1;
pit_set_gate(s->pit, 2, gate);
+#ifdef CONFIG_AUDIO
if (s->voice) {
if (gate) /* restart */
s->play_pos = 0;
audio_be_set_active_out(s->audio_be, s->voice, gate & s->data_on);
}
+#endif
}
static const MemoryRegionOps pcspk_io_ops = {
@@ -195,10 +201,12 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
isa_register_ioport(isadev, &s->ioport, s->iobase);
+#ifdef CONFIG_AUDIO
if (s->audio_be && audio_be_check(&s->audio_be, errp)) {
pcspk_audio_init(s);
return;
}
+#endif
}
static const VMStateDescription vmstate_spk = {
@@ -213,7 +221,9 @@ static const VMStateDescription vmstate_spk = {
};
static const Property pcspk_properties[] = {
+#ifdef CONFIG_AUDIO
DEFINE_AUDIO_PROPERTIES(PCSpkState, audio_be),
+#endif
DEFINE_PROP_UINT32("iobase", PCSpkState, iobase, 0x61),
DEFINE_PROP_LINK("pit", PCSpkState, pit, TYPE_PIT_COMMON, PITCommonState *),
};
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index addf602da08..8a4adee78e9 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1599,8 +1599,10 @@ static void pc_machine_initfn(Object *obj)
pc_system_flash_create(pcms);
pcms->pcspk = isa_new(TYPE_PC_SPEAKER);
+#ifdef CONFIG_AUDIO
object_property_add_alias(OBJECT(pcms), "pcspk-audiodev",
OBJECT(pcms->pcspk), "audiodev");
+#endif
if (pcmc->pci_enabled) {
cxl_machine_init(obj, &pcms->cxl_devices_state);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 05/11] Kconfig: add AUDIO dependency to audio-related devices
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
` (3 preceding siblings ...)
2026-03-15 20:16 ` [PATCH v3 04/11] hw/audio/pcspk: change PCSPK behaviour " Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 06/11] system/vl: remove audio and audiodev options when audio is disabled Sergei Heifetz
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
The idea of the `--disable-audio` option is to stop building audio-related
source files. Although this is not yet implemented, we can already make
the existing AUDIO Kconfig option a dependency for a number of devices so
that the build does not break when we remove `audio/` and other sources.
Note that some machines have embedded audio devices and therefore cannot
be used with `--disable-audio` at all. `-audio none` should be used for
such machines if audio needs to be muted.
The only device that is purposefully not included in this patch is PCSPK
(PC speaker), because its code has already been modified to work with
`--disable-audio`.
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/audio/Kconfig | 21 ++++++++++++---------
hw/usb/Kconfig | 2 +-
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/hw/audio/Kconfig b/hw/audio/Kconfig
index daf060e1be0..0479818e3f5 100644
--- a/hw/audio/Kconfig
+++ b/hw/audio/Kconfig
@@ -1,37 +1,37 @@
config SB16
bool
default y
- depends on ISA_BUS
+ depends on ISA_BUS && AUDIO
config ES1370
bool
default y if PCI_DEVICES
- depends on PCI
+ depends on PCI && AUDIO
config AC97
bool
default y if PCI_DEVICES
- depends on PCI
+ depends on PCI && AUDIO
config ADLIB
bool
default y
- depends on ISA_BUS
+ depends on ISA_BUS && AUDIO
config GUS
bool
default y
- depends on ISA_BUS
+ depends on ISA_BUS && AUDIO
config CS4231A
bool
default y
- depends on ISA_BUS
+ depends on ISA_BUS && AUDIO
config HDA
bool
default y if PCI_DEVICES
- depends on PCI
+ depends on PCI && AUDIO
config PCSPK
bool
@@ -40,18 +40,21 @@ config PCSPK
config WM8750
bool
- depends on I2C
+ depends on I2C && AUDIO
config PL041
bool
+ depends on AUDIO
config CS4231
bool
+ depends on AUDIO
config ASC
bool
+ depends on AUDIO
config VIRTIO_SND
bool
default y
- depends on VIRTIO
+ depends on VIRTIO && AUDIO
diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
index de95686720c..e3705858926 100644
--- a/hw/usb/Kconfig
+++ b/hw/usb/Kconfig
@@ -98,7 +98,7 @@ config USB_STORAGE_UAS
config USB_AUDIO
bool
default y
- depends on USB
+ depends on USB && AUDIO
config USB_SERIAL
bool
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 06/11] system/vl: remove audio and audiodev options when audio is disabled
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
` (4 preceding siblings ...)
2026-03-15 20:16 ` [PATCH v3 05/11] Kconfig: add AUDIO dependency to audio-related devices Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 07/11] ui/dbus: run without Audio interface " Sergei Heifetz
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
Remove the audio and audiodev runtime options when QEMU is configured
with `--disable-audio`.
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
---
qemu-options.hx | 2 ++
system/vl.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/qemu-options.hx b/qemu-options.hx
index 04ea2239296..29dc865820a 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -788,6 +788,7 @@ SRST
ERST
+#ifdef CONFIG_AUDIO
DEF("audio", HAS_ARG, QEMU_OPTION_audio,
"-audio [driver=]driver[,prop=value[,...]]\n"
" specifies default audio backend when `audiodev` is not\n"
@@ -1109,6 +1110,7 @@ SRST
Write recorded audio into the specified file. Default is
``qemu.wav``.
ERST
+#endif
DEF("device", HAS_ARG, QEMU_OPTION_device,
"-device driver[,prop=value[,...]]\n"
diff --git a/system/vl.c b/system/vl.c
index 38d7b849e0a..9ed0285c47a 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -2250,7 +2250,9 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp)
static bool is_qemuopts_group(const char *group)
{
if (g_str_equal(group, "object") ||
+#ifdef CONFIG_AUDIO
g_str_equal(group, "audiodev") ||
+#endif
g_str_equal(group, "machine") ||
g_str_equal(group, "smp-opts") ||
g_str_equal(group, "boot-opts")) {
@@ -2267,6 +2269,7 @@ static void qemu_record_config_group(const char *group, QDict *dict,
object_option_add_visitor(v);
visit_free(v);
+#ifdef CONFIG_AUDIO
} else if (g_str_equal(group, "audiodev")) {
Audiodev *dev = NULL;
Visitor *v = qobject_input_visitor_new_keyval(QOBJECT(dict));
@@ -2274,6 +2277,7 @@ static void qemu_record_config_group(const char *group, QDict *dict,
audio_add_audiodev(dev);
}
visit_free(v);
+#endif
} else if (g_str_equal(group, "machine")) {
/*
@@ -3059,6 +3063,7 @@ void qemu_init(int argc, char **argv)
}
break;
#endif
+#ifdef CONFIG_AUDIO
case QEMU_OPTION_audiodev:
default_audio = 0;
audio_parse_option(optarg);
@@ -3099,6 +3104,7 @@ void qemu_init(int argc, char **argv)
}
break;
}
+#endif
case QEMU_OPTION_h:
help(0);
break;
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 07/11] ui/dbus: run without Audio interface when audio is disabled
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
` (5 preceding siblings ...)
2026-03-15 20:16 ` [PATCH v3 06/11] system/vl: remove audio and audiodev options when audio is disabled Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-19 7:58 ` Markus Armbruster
2026-03-15 20:16 ` [PATCH v3 08/11] tests/audio: do not compile if " Sergei Heifetz
` (3 subsequent siblings)
10 siblings, 1 reply; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
D-Bus display can be used even when QEMU is configured with
`--disable-audio`. In that case, audio interface will not be available
on `/org/qemu/Display1/Audio`.
(The current handling of the situation when audio is enabled but
no D-Bus-compatible audio backend is available is different and
hasn’t been changed.)
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
---
qapi/ui.json | 2 +-
qemu-options.hx | 4 ++++
ui/dbus.c | 8 ++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/qapi/ui.json b/qapi/ui.json
index e3da77632a8..62eb05c6091 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1385,7 +1385,7 @@
'data' : { '*rendernode' : 'str',
'*addr': 'str',
'*p2p': 'bool',
- '*audiodev': 'str' } }
+ '*audiodev': { 'type': 'str', 'if': 'CONFIG_AUDIO' } } }
##
# @DisplayGLMode:
diff --git a/qemu-options.hx b/qemu-options.hx
index 29dc865820a..20d15c0004f 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2232,6 +2232,10 @@ SRST
If no audio backend is specified and the dbus display backend is
specified, the dbus audio backend is used by default.
+ (If audio is disabled at compile time via the ``--disable-audio`` option,
+ no audio backend is used, and none of the audio-related D-Bus interfaces
+ are exported.)
+
The connection is registered with the "org.qemu" name (and queued when
already owned).
diff --git a/ui/dbus.c b/ui/dbus.c
index 4f24215555a..99dac3e7feb 100644
--- a/ui/dbus.c
+++ b/ui/dbus.c
@@ -217,6 +217,7 @@ dbus_display_complete(UserCreatable *uc, Error **errp)
return;
}
+#ifdef CONFIG_AUDIO
{
AudioBackend *audio_be = audio_get_default_audio_be(NULL);
if (audio_be && !audio_be_can_set_dbus_server(audio_be)) {
@@ -232,6 +233,7 @@ dbus_display_complete(UserCreatable *uc, Error **errp)
return;
}
}
+#endif
consoles = g_array_new(FALSE, FALSE, sizeof(guint32));
for (idx = 0;; idx++) {
@@ -370,6 +372,7 @@ set_dbus_addr(Object *o, const char *str, Error **errp)
dd->dbus_addr = g_strdup(str);
}
+#ifdef CONFIG_AUDIO
static char *
get_audiodev(Object *o, Error **errp)
{
@@ -386,6 +389,7 @@ set_audiodev(Object *o, const char *str, Error **errp)
g_free(dd->audiodev);
dd->audiodev = g_strdup(str);
}
+#endif
static int
@@ -412,7 +416,9 @@ dbus_display_class_init(ObjectClass *oc, const void *data)
ucc->complete = dbus_display_complete;
object_class_property_add_bool(oc, "p2p", get_dbus_p2p, set_dbus_p2p);
object_class_property_add_str(oc, "addr", get_dbus_addr, set_dbus_addr);
+#ifdef CONFIG_AUDIO
object_class_property_add_str(oc, "audiodev", get_audiodev, set_audiodev);
+#endif
object_class_property_add_enum(oc, "gl-mode",
"DisplayGLMode", &DisplayGLMode_lookup,
get_gl_mode, set_gl_mode);
@@ -502,7 +508,9 @@ dbus_init(DisplayState *ds, DisplayOptions *opts)
object_get_objects_root(),
"dbus-display", &error_fatal,
"addr", opts->u.dbus.addr ?: "",
+#ifdef CONFIG_AUDIO
"audiodev", opts->u.dbus.audiodev ?: "",
+#endif
"gl-mode", DisplayGLMode_str(mode),
"p2p", yes_no(opts->u.dbus.p2p),
NULL);
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 08/11] tests/audio: do not compile if audio is disabled
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
` (6 preceding siblings ...)
2026-03-15 20:16 ` [PATCH v3 07/11] ui/dbus: run without Audio interface " Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 09/11] audio: do not build audio-related sources with --disable-audio Sergei Heifetz
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
If QEMU is configured with --disable-audio, do not compile the audio
tests.
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/audio/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/audio/meson.build b/tests/audio/meson.build
index 84754bde221..97c1d623bbd 100644
--- a/tests/audio/meson.build
+++ b/tests/audio/meson.build
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
-if not have_system
+if not have_audio
subdir_done()
endif
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 09/11] audio: do not build audio-related sources with --disable-audio
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
` (7 preceding siblings ...)
2026-03-15 20:16 ` [PATCH v3 08/11] tests/audio: do not compile if " Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-19 8:36 ` Markus Armbruster
2026-03-15 20:16 ` [PATCH v3 10/11] qom: remove audiodevs root container if audio is disabled Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 11/11] meson.build: ignore audio drivers when configured with --disable-audio Sergei Heifetz
10 siblings, 1 reply; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
When QEMU is configured with `--disable-audio`, do not build any
audio-related sources.
- audio/meson.build and replay/meson.build:
Exclude audio-related sources when audio is disabled.
- replay/replay-audio-stub.c:
Move the existing stubs from replay/stubs-system.c into a separate
file.
- qapi/audio.json:
Remove the QMP `query-audiodevs` command.
- hmp-commands*.hx:
Remove the HMP `info capture`, `stopcapture` and `wavcapture`
commands.
- Other source files:
Wrap audio-related code in ifdefs.
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
---
audio/meson.build | 4 ++++
hmp-commands-info.hx | 2 ++
hmp-commands.hx | 2 ++
hw/core/machine.c | 6 ++++++
hw/core/qdev-properties-system.c | 2 ++
qapi/audio.json | 3 ++-
replay/meson.build | 9 ++++++++-
replay/replay-audio-stub.c | 21 +++++++++++++++++++++
replay/stubs-system.c | 12 ------------
system/runstate.c | 2 ++
system/vl.c | 2 ++
11 files changed, 51 insertions(+), 14 deletions(-)
create mode 100644 replay/replay-audio-stub.c
diff --git a/audio/meson.build b/audio/meson.build
index 0e33b6f9836..4cd855d2b9a 100644
--- a/audio/meson.build
+++ b/audio/meson.build
@@ -1,4 +1,8 @@
audio_ss = ss.source_set()
+if not have_audio
+ subdir_done()
+endif
+
audio_ss.add(files(
'audio.c',
'audio-be.c',
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 74c741f80e2..a959479024a 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -364,6 +364,7 @@ SRST
ERST
/* BEGIN deprecated */
+#ifdef CONFIG_AUDIO
{
.name = "capture",
.args_type = "",
@@ -376,6 +377,7 @@ SRST
``info capture``
Show capture information (deprecated).
ERST
+#endif
/* END deprecated */
{
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 5cc4788f12d..e8b8175bb94 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -765,6 +765,7 @@ SRST
ERST
/* BEGIN deprecated */
+#ifdef CONFIG_AUDIO
{
.name = "wavcapture",
.args_type = "path:F,audiodev:s,freq:i?,bits:i?,nchannels:i?",
@@ -802,6 +803,7 @@ SRST
Deprecated.
ERST
+#endif
/* END deprecated */
{
diff --git a/hw/core/machine.c b/hw/core/machine.c
index a14ad05b9a6..920a74b3aef 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -678,6 +678,7 @@ bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type)
return allowed;
}
+#ifdef CONFIG_AUDIO
static char *machine_get_audiodev(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
@@ -697,6 +698,7 @@ static void machine_set_audiodev(Object *obj, const char *value,
g_free(ms->audiodev);
ms->audiodev = g_strdup(value);
}
+#endif
HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
{
@@ -990,6 +992,7 @@ out_free:
qapi_free_BootConfiguration(config);
}
+#ifdef CONFIG_AUDIO
void machine_add_audiodev_property(MachineClass *mc)
{
ObjectClass *oc = OBJECT_CLASS(mc);
@@ -1000,6 +1003,7 @@ void machine_add_audiodev_property(MachineClass *mc)
object_class_property_set_description(oc, "audiodev",
"Audiodev to use for default machine devices");
}
+#endif
static bool create_default_memdev(MachineState *ms, const char *path,
Error **errp)
@@ -1286,7 +1290,9 @@ static void machine_finalize(Object *obj)
g_free(ms->device_memory);
g_free(ms->nvdimms_state);
g_free(ms->numa_state);
+#ifdef CONFIG_AUDIO
g_free(ms->audiodev);
+#endif
}
bool machine_usb(MachineState *machine)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index a402321f42c..8679a71b538 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -483,6 +483,7 @@ const PropertyInfo qdev_prop_netdev = {
};
+#ifdef CONFIG_AUDIO
/* --- audiodev --- */
static void get_audiodev(Object *obj, Visitor *v, const char* name,
void *opaque, Error **errp)
@@ -519,6 +520,7 @@ const PropertyInfo qdev_prop_audiodev = {
.get = get_audiodev,
.set = set_audiodev,
};
+#endif
bool qdev_prop_set_drive_err(DeviceState *dev, const char *name,
BlockBackend *value, Error **errp)
diff --git a/qapi/audio.json b/qapi/audio.json
index 2df87b97101..28fda7c8ac3 100644
--- a/qapi/audio.json
+++ b/qapi/audio.json
@@ -540,4 +540,5 @@
# Since: 8.0
##
{ 'command': 'query-audiodevs',
- 'returns': ['Audiodev'] }
+ 'returns': ['Audiodev'],
+ 'if': 'CONFIG_AUDIO' }
diff --git a/replay/meson.build b/replay/meson.build
index 4b4175e8dd4..dc2e94e8975 100644
--- a/replay/meson.build
+++ b/replay/meson.build
@@ -7,7 +7,14 @@ system_ss.add(when: 'CONFIG_TCG', if_true: files(
'replay-char.c',
'replay-snapshot.c',
'replay-net.c',
- 'replay-audio.c',
'replay-random.c',
'replay-debugging.c',
), if_false: files('stubs-system.c'))
+
+if have_audio
+ system_ss.add(when: 'CONFIG_TCG',
+ if_true: files('replay-audio.c'),
+ if_false: files('replay-audio-stub.c'))
+else
+ system_ss.add(files('replay-audio-stub.c'))
+endif
diff --git a/replay/replay-audio-stub.c b/replay/replay-audio-stub.c
new file mode 100644
index 00000000000..b3da8e15583
--- /dev/null
+++ b/replay/replay-audio-stub.c
@@ -0,0 +1,21 @@
+/*
+ * Stub for replay-audio.c
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "system/replay.h"
+
+void replay_audio_in_start(size_t *nsamples)
+{
+}
+void replay_audio_in_sample_lr(uint64_t *left, uint64_t *right)
+{
+}
+void replay_audio_in_finish(void)
+{
+}
+void replay_audio_out(size_t *played)
+{
+}
diff --git a/replay/stubs-system.c b/replay/stubs-system.c
index b2c52bc4043..454415ae8e4 100644
--- a/replay/stubs-system.c
+++ b/replay/stubs-system.c
@@ -15,18 +15,6 @@ void replay_input_sync_event(void)
void replay_add_blocker(const char *feature)
{
}
-void replay_audio_in_start(size_t *nsamples)
-{
-}
-void replay_audio_in_sample_lr(uint64_t *left, uint64_t *right)
-{
-}
-void replay_audio_in_finish(void)
-{
-}
-void replay_audio_out(size_t *played)
-{
-}
void replay_breakpoint(void)
{
}
diff --git a/system/runstate.c b/system/runstate.c
index eca722b43c6..7fb104f6515 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -1035,7 +1035,9 @@ void qemu_cleanup(int status)
/* vhost-user must be cleaned up before chardevs. */
tpm_cleanup();
net_cleanup();
+#ifdef CONFIG_AUDIO
audio_cleanup();
+#endif
monitor_cleanup();
qemu_chr_cleanup();
user_creatable_cleanup();
diff --git a/system/vl.c b/system/vl.c
index 9ed0285c47a..bd2b6439f00 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -2069,10 +2069,12 @@ static void qemu_create_early_backends(void)
* setting machine properties, so they can be referred to.
*/
configure_blockdev(&bdo_queue, machine_class, snapshot);
+#ifdef CONFIG_AUDIO
audio_init_audiodevs();
if (default_audio) {
audio_create_default_audiodevs();
}
+#endif
}
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 10/11] qom: remove audiodevs root container if audio is disabled
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
` (8 preceding siblings ...)
2026-03-15 20:16 ` [PATCH v3 09/11] audio: do not build audio-related sources with --disable-audio Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 11/11] meson.build: ignore audio drivers when configured with --disable-audio Sergei Heifetz
10 siblings, 0 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
When QEMU is configured with `--disable-audio`, we don't need the
`audiodevs` root container.
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
---
qom/object.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/qom/object.c b/qom/object.c
index ff8ede8a328..4545c0d7bc3 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1730,7 +1730,9 @@ const char *object_property_get_type(Object *obj, const char *name, Error **errp
}
static const char *const root_containers[] = {
+#ifdef CONFIG_AUDIO
"audiodevs",
+#endif
"chardevs",
"objects",
"backend"
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 11/11] meson.build: ignore audio drivers when configured with --disable-audio
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
` (9 preceding siblings ...)
2026-03-15 20:16 ` [PATCH v3 10/11] qom: remove audiodevs root container if audio is disabled Sergei Heifetz
@ 2026-03-15 20:16 ` Sergei Heifetz
10 siblings, 0 replies; 14+ messages in thread
From: Sergei Heifetz @ 2026-03-15 20:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Michael S. Tsirkin, Alex Bennée,
Markus Armbruster, Philippe Mathieu-Daudé, Marcel Apfelbaum,
Paolo Bonzini, Fabiano Rosas, Marc-André Lureau,
Eduardo Habkost, Yanan Wang, Zhao Liu, Richard Henderson,
Dr. David Alan Gilbert, Thomas Huth, Daniel P. Berrangé,
Laurent Vivier, Gerd Hoffmann, Sergei Heifetz
When QEMU is configured with `--disable-audio`, we do not need to add the
audio drivers list to config_host_data. We also do not need to print this
list.
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
meson.build | 80 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 45 insertions(+), 35 deletions(-)
diff --git a/meson.build b/meson.build
index d05533488f9..7f71dce3ae5 100644
--- a/meson.build
+++ b/meson.build
@@ -2280,46 +2280,55 @@ endif
config_host_data = configuration_data()
config_host_data.set('CONFIG_HAVE_RUST', have_rust)
-audio_drivers_selected = []
-if have_system
- audio_drivers_available = {
- 'alsa': alsa.found(),
- 'coreaudio': coreaudio.found(),
- 'dsound': dsound.found(),
- 'jack': jack.found(),
- 'oss': oss.found(),
- 'pa': pulse.found(),
- 'pipewire': pipewire.found(),
- 'sdl': sdl.found(),
- 'sndio': sndio.found(),
- }
- foreach k, v: audio_drivers_available
- config_host_data.set('CONFIG_AUDIO_' + k.to_upper(), v)
- endforeach
+config_host_data.set('CONFIG_AUDIO', have_audio)
+if have_audio
+ audio_drivers_selected = []
+ if have_system
+ audio_drivers_available = {
+ 'alsa': alsa.found(),
+ 'coreaudio': coreaudio.found(),
+ 'dsound': dsound.found(),
+ 'jack': jack.found(),
+ 'oss': oss.found(),
+ 'pa': pulse.found(),
+ 'pipewire': pipewire.found(),
+ 'sdl': sdl.found(),
+ 'sndio': sndio.found(),
+ }
+ foreach k, v: audio_drivers_available
+ config_host_data.set('CONFIG_AUDIO_' + k.to_upper(), v)
+ endforeach
- # Default to native drivers first, OSS second, SDL third
- audio_drivers_priority = \
- [ 'pa', 'coreaudio', 'dsound', 'sndio', 'oss' ] + \
- (host_os == 'linux' ? [] : [ 'sdl' ])
- audio_drivers_default = []
- foreach k: audio_drivers_priority
- if audio_drivers_available[k]
- audio_drivers_default += k
- endif
- endforeach
+ # Default to native drivers first, OSS second, SDL third
+ audio_drivers_priority = \
+ [ 'pa', 'coreaudio', 'dsound', 'sndio', 'oss' ] + \
+ (host_os == 'linux' ? [] : [ 'sdl' ])
+ audio_drivers_default = []
+ foreach k: audio_drivers_priority
+ if audio_drivers_available[k]
+ audio_drivers_default += k
+ endif
+ endforeach
+ foreach k: get_option('audio_drv_list')
+ if k == 'default'
+ audio_drivers_selected += audio_drivers_default
+ elif not audio_drivers_available[k]
+ error('Audio driver "@0@" not available.'.format(k))
+ else
+ audio_drivers_selected += k
+ endif
+ endforeach
+ endif
+ config_host_data.set('CONFIG_AUDIO_DRIVERS',
+ '"' + '", "'.join(audio_drivers_selected) + '", ')
+else
foreach k: get_option('audio_drv_list')
- if k == 'default'
- audio_drivers_selected += audio_drivers_default
- elif not audio_drivers_available[k]
- error('Audio driver "@0@" not available.'.format(k))
- else
- audio_drivers_selected += k
+ if k != 'default'
+ error('Audio drivers are not supported because audio is disabled.')
endif
endforeach
endif
-config_host_data.set('CONFIG_AUDIO_DRIVERS',
- '"' + '", "'.join(audio_drivers_selected) + '", ')
have_host_block_device = (host_os != 'darwin' or
cc.has_header('IOKit/storage/IOMedia.h'))
@@ -4710,7 +4719,8 @@ if enable_modules
summary_info += {'alternative module path': get_option('module_upgrades')}
endif
summary_info += {'fuzzing support': get_option('fuzzing')}
-if have_system
+summary_info += {'Audio support': have_audio}
+if have_audio
summary_info += {'Audio drivers': ' '.join(audio_drivers_selected)}
endif
summary_info += {'Trace backends': ','.join(get_option('trace_backends'))}
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v3 07/11] ui/dbus: run without Audio interface when audio is disabled
2026-03-15 20:16 ` [PATCH v3 07/11] ui/dbus: run without Audio interface " Sergei Heifetz
@ 2026-03-19 7:58 ` Markus Armbruster
0 siblings, 0 replies; 14+ messages in thread
From: Markus Armbruster @ 2026-03-19 7:58 UTC (permalink / raw)
To: Sergei Heifetz
Cc: qemu-devel, Eric Blake, Michael S. Tsirkin, Alex Bennée,
Philippe Mathieu-Daudé, Marcel Apfelbaum, Paolo Bonzini,
Fabiano Rosas, Marc-André Lureau, Eduardo Habkost,
Yanan Wang, Zhao Liu, Richard Henderson, Dr. David Alan Gilbert,
Thomas Huth, Daniel P. Berrangé, Laurent Vivier,
Gerd Hoffmann, devel
Sergei Heifetz <heifetz@yandex-team.com> writes:
> D-Bus display can be used even when QEMU is configured with
> `--disable-audio`. In that case, audio interface will not be available
> on `/org/qemu/Display1/Audio`.
>
> (The current handling of the situation when audio is enabled but
> no D-Bus-compatible audio backend is available is different and
> hasn’t been changed.)
>
> Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
> ---
> qapi/ui.json | 2 +-
> qemu-options.hx | 4 ++++
> ui/dbus.c | 8 ++++++++
> 3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/qapi/ui.json b/qapi/ui.json
> index e3da77632a8..62eb05c6091 100644
> --- a/qapi/ui.json
> +++ b/qapi/ui.json
> @@ -1385,7 +1385,7 @@
> 'data' : { '*rendernode' : 'str',
> '*addr': 'str',
> '*p2p': 'bool',
> - '*audiodev': 'str' } }
> + '*audiodev': { 'type': 'str', 'if': 'CONFIG_AUDIO' } } }
Is this a compatibility break?
DisplayDBus is only used in DisplayOptions, which is only used as return
type of query-display-options in the QAPI schema. However, vl.c also
uses it to parse -display.
Removing parameter @audiodev from -display is technically a
compatibility break. However, we're removing an optional paramater that
would always be rejected when present: it has no valid value, because
there are no audiodevs.
Removal from query-display-options is similar: it could not be present.
Removal affects introspection, which could conceivably confuse client.
I don't expect such trouble here, because @audiodev always existed, i.e.
there's no real reason to look for it in introspection.
I think we're okay. I'm cc'ing the libvirt list just in case.
Do we need a release note?
Do we need an entry in docs/about/removed-features.rst? Feels a bit
odd; we're not removing a feature, we're adding one, namely "can compile
out audio".
>
> ##
> # @DisplayGLMode:
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 29dc865820a..20d15c0004f 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2232,6 +2232,10 @@ SRST
> If no audio backend is specified and the dbus display backend is
> specified, the dbus audio backend is used by default.
>
> + (If audio is disabled at compile time via the ``--disable-audio`` option,
> + no audio backend is used, and none of the audio-related D-Bus interfaces
> + are exported.)
> +
Well, audio is either compiled in or it isn't.
If it's compiled in, then why tell the user how things behave when it's
not?
If it's not compiled in, then why document stuff that doesn't work? How
much of -audiodev still works then? -audiodev none? Anything else?
> The connection is registered with the "org.qemu" name (and queued when
> already owned).
>
[...]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 09/11] audio: do not build audio-related sources with --disable-audio
2026-03-15 20:16 ` [PATCH v3 09/11] audio: do not build audio-related sources with --disable-audio Sergei Heifetz
@ 2026-03-19 8:36 ` Markus Armbruster
0 siblings, 0 replies; 14+ messages in thread
From: Markus Armbruster @ 2026-03-19 8:36 UTC (permalink / raw)
To: Sergei Heifetz
Cc: qemu-devel, Eric Blake, Michael S. Tsirkin, Alex Bennée,
Philippe Mathieu-Daudé, Marcel Apfelbaum, Paolo Bonzini,
Fabiano Rosas, Marc-André Lureau, Eduardo Habkost,
Yanan Wang, Zhao Liu, Richard Henderson, Dr. David Alan Gilbert,
Thomas Huth, Daniel P. Berrangé, Laurent Vivier,
Gerd Hoffmann
Sergei Heifetz <heifetz@yandex-team.com> writes:
> When QEMU is configured with `--disable-audio`, do not build any
> audio-related sources.
>
> - audio/meson.build and replay/meson.build:
> Exclude audio-related sources when audio is disabled.
>
> - replay/replay-audio-stub.c:
> Move the existing stubs from replay/stubs-system.c into a separate
> file.
>
> - qapi/audio.json:
> Remove the QMP `query-audiodevs` command.
>
> - hmp-commands*.hx:
> Remove the HMP `info capture`, `stopcapture` and `wavcapture`
> commands.
>
> - Other source files:
> Wrap audio-related code in ifdefs.
>
> Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
[...]
> diff --git a/qapi/audio.json b/qapi/audio.json
> index 2df87b97101..28fda7c8ac3 100644
> --- a/qapi/audio.json
> +++ b/qapi/audio.json
> @@ -540,4 +540,5 @@
> # Since: 8.0
> ##
> { 'command': 'query-audiodevs',
> - 'returns': ['Audiodev'] }
> + 'returns': ['Audiodev'],
> + 'if': 'CONFIG_AUDIO' }
Could we disable all the audio stuff here?
I tried, patch appended. What do you think?
> diff --git a/replay/meson.build b/replay/meson.build
> index 4b4175e8dd4..dc2e94e8975 100644
> --- a/replay/meson.build
> +++ b/replay/meson.build
> @@ -7,7 +7,14 @@ system_ss.add(when: 'CONFIG_TCG', if_true: files(
> 'replay-char.c',
> 'replay-snapshot.c',
> 'replay-net.c',
> - 'replay-audio.c',
> 'replay-random.c',
> 'replay-debugging.c',
> ), if_false: files('stubs-system.c'))
> +
> +if have_audio
> + system_ss.add(when: 'CONFIG_TCG',
> + if_true: files('replay-audio.c'),
> + if_false: files('replay-audio-stub.c'))
> +else
> + system_ss.add(files('replay-audio-stub.c'))
> +endif
> diff --git a/replay/replay-audio-stub.c b/replay/replay-audio-stub.c
> new file mode 100644
> index 00000000000..b3da8e15583
> --- /dev/null
> +++ b/replay/replay-audio-stub.c
> @@ -0,0 +1,21 @@
> +/*
> + * Stub for replay-audio.c
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "system/replay.h"
> +
> +void replay_audio_in_start(size_t *nsamples)
> +{
> +}
> +void replay_audio_in_sample_lr(uint64_t *left, uint64_t *right)
> +{
> +}
> +void replay_audio_in_finish(void)
> +{
> +}
> +void replay_audio_out(size_t *played)
> +{
> +}
Should this go into stubs/ instead? Genuine question! I can't tell
when we use stubs/foo*.c and when we use foo/*stub.c.
> diff --git a/replay/stubs-system.c b/replay/stubs-system.c
> index b2c52bc4043..454415ae8e4 100644
> --- a/replay/stubs-system.c
> +++ b/replay/stubs-system.c
> @@ -15,18 +15,6 @@ void replay_input_sync_event(void)
> void replay_add_blocker(const char *feature)
> {
> }
> -void replay_audio_in_start(size_t *nsamples)
> -{
> -}
> -void replay_audio_in_sample_lr(uint64_t *left, uint64_t *right)
> -{
> -}
> -void replay_audio_in_finish(void)
> -{
> -}
> -void replay_audio_out(size_t *played)
> -{
> -}
> void replay_breakpoint(void)
> {
> }
[...]
Note on the appended patch: the change to ui/dbus.c should be a separate
cleanup patch.
diff --git a/qapi/audio.json b/qapi/audio.json
index 28fda7c8ac..4f5f5dd988 100644
--- a/qapi/audio.json
+++ b/qapi/audio.json
@@ -49,7 +49,8 @@
'*channels': 'uint32',
'*voices': 'uint32',
'*format': 'AudioFormat',
- '*buffer-length': 'uint32' } }
+ '*buffer-length': 'uint32' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevGenericOptions:
@@ -65,7 +66,8 @@
{ 'struct': 'AudiodevGenericOptions',
'data': {
'*in': 'AudiodevPerDirectionOptions',
- '*out': 'AudiodevPerDirectionOptions' } }
+ '*out': 'AudiodevPerDirectionOptions' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevDBusOptions:
@@ -85,7 +87,8 @@
'data': {
'*in': 'AudiodevPerDirectionOptions',
'*out': 'AudiodevPerDirectionOptions',
- '*nsamples': 'uint32'} }
+ '*nsamples': 'uint32'},
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevAlsaPerDirectionOptions:
@@ -107,7 +110,8 @@
'data': {
'*dev': 'str',
'*period-length': 'uint32',
- '*try-poll': 'bool' } }
+ '*try-poll': 'bool' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevAlsaOptions:
@@ -126,7 +130,8 @@
'data': {
'*in': 'AudiodevAlsaPerDirectionOptions',
'*out': 'AudiodevAlsaPerDirectionOptions',
- '*threshold': 'uint32' } }
+ '*threshold': 'uint32' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevSndioOptions:
@@ -148,7 +153,8 @@
'*in': 'AudiodevPerDirectionOptions',
'*out': 'AudiodevPerDirectionOptions',
'*dev': 'str',
- '*latency': 'uint32'} }
+ '*latency': 'uint32'},
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevCoreaudioPerDirectionOptions:
@@ -163,7 +169,8 @@
{ 'struct': 'AudiodevCoreaudioPerDirectionOptions',
'base': 'AudiodevPerDirectionOptions',
'data': {
- '*buffer-count': 'uint32' } }
+ '*buffer-count': 'uint32' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevCoreaudioOptions:
@@ -179,7 +186,8 @@
{ 'struct': 'AudiodevCoreaudioOptions',
'data': {
'*in': 'AudiodevCoreaudioPerDirectionOptions',
- '*out': 'AudiodevCoreaudioPerDirectionOptions' } }
+ '*out': 'AudiodevCoreaudioPerDirectionOptions' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevDsoundOptions:
@@ -199,7 +207,8 @@
'data': {
'*in': 'AudiodevPerDirectionOptions',
'*out': 'AudiodevPerDirectionOptions',
- '*latency': 'uint32' } }
+ '*latency': 'uint32' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevJackPerDirectionOptions:
@@ -233,7 +242,8 @@
'*client-name': 'str',
'*connect-ports': 'str',
'*start-server': 'bool',
- '*exact-name': 'bool' } }
+ '*exact-name': 'bool' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevJackOptions:
@@ -249,7 +259,8 @@
{ 'struct': 'AudiodevJackOptions',
'data': {
'*in': 'AudiodevJackPerDirectionOptions',
- '*out': 'AudiodevJackPerDirectionOptions' } }
+ '*out': 'AudiodevJackPerDirectionOptions' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevOssPerDirectionOptions:
@@ -271,7 +282,8 @@
'data': {
'*dev': 'str',
'*buffer-count': 'uint32',
- '*try-poll': 'bool' } }
+ '*try-poll': 'bool' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevOssOptions:
@@ -301,7 +313,8 @@
'*out': 'AudiodevOssPerDirectionOptions',
'*try-mmap': 'bool',
'*exclusive': 'bool',
- '*dsp-policy': 'uint32' } }
+ '*dsp-policy': 'uint32' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevPaPerDirectionOptions:
@@ -326,7 +339,8 @@
'data': {
'*name': 'str',
'*stream-name': 'str',
- '*latency': 'uint32' } }
+ '*latency': 'uint32' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevPaOptions:
@@ -345,7 +359,8 @@
'data': {
'*in': 'AudiodevPaPerDirectionOptions',
'*out': 'AudiodevPaPerDirectionOptions',
- '*server': 'str' } }
+ '*server': 'str' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevPipewirePerDirectionOptions:
@@ -370,7 +385,8 @@
'data': {
'*name': 'str',
'*stream-name': 'str',
- '*latency': 'uint32' } }
+ '*latency': 'uint32' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevPipewireOptions:
@@ -386,7 +402,8 @@
{ 'struct': 'AudiodevPipewireOptions',
'data': {
'*in': 'AudiodevPipewirePerDirectionOptions',
- '*out': 'AudiodevPipewirePerDirectionOptions' } }
+ '*out': 'AudiodevPipewirePerDirectionOptions' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevSdlPerDirectionOptions:
@@ -401,7 +418,8 @@
{ 'struct': 'AudiodevSdlPerDirectionOptions',
'base': 'AudiodevPerDirectionOptions',
'data': {
- '*buffer-count': 'uint32' } }
+ '*buffer-count': 'uint32' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevSdlOptions:
@@ -417,7 +435,8 @@
{ 'struct': 'AudiodevSdlOptions',
'data': {
'*in': 'AudiodevSdlPerDirectionOptions',
- '*out': 'AudiodevSdlPerDirectionOptions' } }
+ '*out': 'AudiodevSdlPerDirectionOptions' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevWavOptions:
@@ -436,7 +455,8 @@
'data': {
'*in': 'AudiodevPerDirectionOptions',
'*out': 'AudiodevPerDirectionOptions',
- '*path': 'str' } }
+ '*path': 'str' },
+ 'if': 'CONFIG_AUDIO' }
##
# @AudioFormat:
@@ -460,7 +480,8 @@
# Since: 4.0
##
{ 'enum': 'AudioFormat',
- 'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32', 'f32' ] }
+ 'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32', 'f32' ],
+ 'if': 'CONFIG_AUDIO' }
##
# @AudiodevDriver:
@@ -484,7 +505,8 @@
{ 'name': 'sdl', 'if': 'CONFIG_AUDIO_SDL' },
{ 'name': 'sndio', 'if': 'CONFIG_AUDIO_SNDIO' },
{ 'name': 'spice', 'if': 'CONFIG_SPICE' },
- 'wav' ] }
+ 'wav' ],
+ 'if': 'CONFIG_AUDIO' }
##
# @Audiodev:
@@ -530,7 +552,8 @@
'if': 'CONFIG_AUDIO_SNDIO' },
'spice': { 'type': 'AudiodevGenericOptions',
'if': 'CONFIG_SPICE' },
- 'wav': 'AudiodevWavOptions' } }
+ 'wav': 'AudiodevWavOptions' },
+ 'if': 'CONFIG_AUDIO' }
##
# @query-audiodevs:
diff --git a/audio/mixeng.h b/audio/mixeng.h
index f63283f408..0dfd5204a6 100644
--- a/audio/mixeng.h
+++ b/audio/mixeng.h
@@ -25,6 +25,8 @@
#ifndef QEMU_MIXENG_H
#define QEMU_MIXENG_H
+#ifdef CONFIG_AUDIO
+
#ifdef FLOAT_MIXENG
typedef float mixeng_real;
struct mixeng_volume { int mute; mixeng_real r; mixeng_real l; };
@@ -56,4 +58,5 @@ uint32_t st_rate_frames_in(void *opaque, uint32_t frames_out);
void mixeng_clear (struct st_sample *buf, int len);
void mixeng_volume (struct st_sample *buf, int len, struct mixeng_volume *vol);
+#endif
#endif /* QEMU_MIXENG_H */
diff --git a/include/qemu/audio-capture.h b/include/qemu/audio-capture.h
index f1319c9002..5774967c0e 100644
--- a/include/qemu/audio-capture.h
+++ b/include/qemu/audio-capture.h
@@ -8,6 +8,8 @@
#include "audio.h"
+#ifdef CONFIG_AUDIO
+
struct capture_ops {
void (*info) (void *opaque);
void (*destroy) (void *opaque);
@@ -30,4 +32,5 @@ void audio_be_del_capture(
CaptureVoiceOut *cap,
void *cb_opaque);
+#endif
#endif /* QEMU_AUDIO_CAPTURE_H */
diff --git a/include/qemu/audio.h b/include/qemu/audio.h
index cff8a334f3..1788a54877 100644
--- a/include/qemu/audio.h
+++ b/include/qemu/audio.h
@@ -32,6 +32,8 @@
#include "gio/gio.h"
#endif
+#ifdef CONFIG_AUDIO
+
typedef void (*audio_callback_fn) (void *opaque, int avail);
typedef struct audsettings {
@@ -240,4 +242,7 @@ static inline bool audio_format_is_signed(AudioFormat fmt)
#define TYPE_AUDIO_BACKEND "audio-backend"
OBJECT_DECLARE_TYPE(AudioBackend, AudioBackendClass, AUDIO_BACKEND)
+#else
+//#define audio_cleanup() ((void)0)
+#endif
#endif /* QEMU_AUDIO_H */
diff --git a/ui/vnc.h b/ui/vnc.h
index ec8d0c91b5..89e0199be1 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -184,7 +184,9 @@ struct VncDisplay
VncDisplaySASL sasl;
#endif
+#ifdef CONFIG_AUDIO
AudioBackend *audio_be;
+#endif
VMChangeStateEntry *vmstate_handler_entry;
};
@@ -325,8 +327,10 @@ struct VncState
pixman_format_code_t client_format;
int client_endian; /* G_LITTLE_ENDIAN or G_BIG_ENDIAN */
+#ifdef CONFIG_AUDIO
CaptureVoiceOut *audio_cap;
struct audsettings as;
+#endif
VncReadEvent *read_handler;
size_t read_handler_expect;
diff --git a/ui/dbus.c b/ui/dbus.c
index 99dac3e7fe..6086efd017 100644
--- a/ui/dbus.c
+++ b/ui/dbus.c
@@ -35,7 +35,6 @@
#include "ui/egl-context.h"
#endif
#include "qemu/audio.h"
-#include "audio/audio_int.h" /* FIXME: use QOM dynamic cast instead of drv->name */
#include "qapi/error.h"
#include "trace.h"
diff --git a/ui/vnc.c b/ui/vnc.c
index 0ee5502d1e..7004c875a1 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1103,7 +1103,13 @@ static void vnc_update_throttle_offset(VncState *vs)
if (vs->throttle_output_offset != offset) {
trace_vnc_client_throttle_threshold(
vs, vs->ioc, vs->throttle_output_offset, offset, vs->client_width,
- vs->client_height, vs->client_pf.bytes_per_pixel, vs->audio_cap);
+ vs->client_height, vs->client_pf.bytes_per_pixel,
+#ifdef CONFIG_AUDIO
+ vs->audio_cap
+#else
+ NULL
+#endif
+ );
}
vs->throttle_output_offset = offset;
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-03-19 8:37 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15 20:16 [PATCH v3 00/11] add build option to disable audio subsystem Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 01/11] audio: add `audio` build option for meson and Kconfig Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 02/11] ui/vnc: disable audio feature when configured with --disable-audio Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 03/11] tests/qtest: remove -audio none " Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 04/11] hw/audio/pcspk: change PCSPK behaviour " Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 05/11] Kconfig: add AUDIO dependency to audio-related devices Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 06/11] system/vl: remove audio and audiodev options when audio is disabled Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 07/11] ui/dbus: run without Audio interface " Sergei Heifetz
2026-03-19 7:58 ` Markus Armbruster
2026-03-15 20:16 ` [PATCH v3 08/11] tests/audio: do not compile if " Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 09/11] audio: do not build audio-related sources with --disable-audio Sergei Heifetz
2026-03-19 8:36 ` Markus Armbruster
2026-03-15 20:16 ` [PATCH v3 10/11] qom: remove audiodevs root container if audio is disabled Sergei Heifetz
2026-03-15 20:16 ` [PATCH v3 11/11] meson.build: ignore audio drivers when configured with --disable-audio Sergei Heifetz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox