From nobody Tue Apr 7 08:12:06 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.com ARC-Seal: i=1; a=rsa-sha256; t=1773605977; cv=none; d=zohomail.com; s=zohoarc; b=ToPpSQELdJqdfUoMLkUNqihbKuKvIZLDRuAzDo5TAAcHo1q+nFLEu5qvG2zAQKXVh+V9oOPzZh+fRK2U+ITKCbMWVqIFb3Gq+XP11SD9L4t7pHoUSblB3BNSPWq6QMucqVYaTcYAR9A4qcU7NFcYNS1dBWS5fdHwpgix3tEXlHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773605977; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OtOi++Rdlpxpjg6Ayel0tUplois5GcilUO3H0jXdAjs=; b=iG65oK870wmvAuhfhpKHCKEWYcTfV3MsIJJQJ710v7uP+lmBNsBPc744Rl+5jw4+UDWGdr9uJ17WTRYg0+O0nY/rKTEYJeM71cb01hnfSNCpwJa/oYptOHc1q1hIUCfB2QTsu9CdKSFU1s9kZNgD6rgQwfy+3Je8RD6S8puc3mo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773605977600732.6606059573372; Sun, 15 Mar 2026 13:19:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w1ruL-0006ON-84; Sun, 15 Mar 2026 16:17:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w1ru8-0006Lp-Ab for qemu-devel@nongnu.org; Sun, 15 Mar 2026 16:17:43 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w1ru1-0002MI-Fo for qemu-devel@nongnu.org; Sun, 15 Mar 2026 16:17:37 -0400 Received: from mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net [IPv6:2a02:6b8:c2d:3530:0:640:eca4:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 19263C015E; Sun, 15 Mar 2026 23:17:08 +0300 (MSK) Received: from localhost (unknown [2a02:6bf:8080:b49::1:d]) by mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 6HRU4I1AiW20-yuy6ChCo; Sun, 15 Mar 2026 23:17:07 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.com; s=default; t=1773605827; bh=OtOi++Rdlpxpjg6Ayel0tUplois5GcilUO3H0jXdAjs=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=huuZ+LQvIvRoJf0WZ3+3oXHA/ft6/TgW7eqVgOi2Zme9TwY+dkejGUMwpgGsaQ59H Bjf/ZRlGRqH3O/pJfmpr6UP4CFHX8Z1QX6noHw3WpDApmgRY8BDxitViK7cRFfHfu0 2Y6mZCgOGj4K3dpwxYFIn9wWkKs2WKoyGWKYXwbs= Authentication-Results: mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.com From: Sergei Heifetz To: qemu-devel@nongnu.org Cc: Eric Blake , "Michael S. Tsirkin" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Paolo Bonzini , Fabiano Rosas , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eduardo Habkost , Yanan Wang , Zhao Liu , Richard Henderson , "Dr. David Alan Gilbert" , Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Laurent Vivier , Gerd Hoffmann , Sergei Heifetz Subject: [PATCH v3 09/11] audio: do not build audio-related sources with --disable-audio Date: Mon, 16 Mar 2026 01:16:44 +0500 Message-Id: <20260315201646.96862-10-heifetz@yandex-team.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315201646.96862-1-heifetz@yandex-team.com> References: <20260315201646.96862-1-heifetz@yandex-team.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=heifetz@yandex-team.com; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.com) X-ZM-MESSAGEID: 1773605979139158500 Content-Type: text/plain; charset="utf-8" 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 --- 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 =3D 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 =20 /* BEGIN deprecated */ +#ifdef CONFIG_AUDIO { .name =3D "capture", .args_type =3D "", @@ -376,6 +377,7 @@ SRST ``info capture`` Show capture information (deprecated). ERST +#endif /* END deprecated */ =20 { 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 =20 /* BEGIN deprecated */ +#ifdef CONFIG_AUDIO { .name =3D "wavcapture", .args_type =3D "path:F,audiodev:s,freq:i?,bits:i?,nchannels:i?", @@ -802,6 +803,7 @@ SRST =20 Deprecated. ERST +#endif /* END deprecated */ =20 { 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, co= nst char *type) return allowed; } =20 +#ifdef CONFIG_AUDIO static char *machine_get_audiodev(Object *obj, Error **errp) { MachineState *ms =3D MACHINE(obj); @@ -697,6 +698,7 @@ static void machine_set_audiodev(Object *obj, const cha= r *value, g_free(ms->audiodev); ms->audiodev =3D g_strdup(value); } +#endif =20 HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine) { @@ -990,6 +992,7 @@ out_free: qapi_free_BootConfiguration(config); } =20 +#ifdef CONFIG_AUDIO void machine_add_audiodev_property(MachineClass *mc) { ObjectClass *oc =3D 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 mac= hine devices"); } +#endif =20 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 } =20 bool machine_usb(MachineState *machine) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.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 =3D { }; =20 =20 +#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 =3D { .get =3D get_audiodev, .set =3D set_audiodev, }; +#endif =20 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 } =20 =20 --=20 2.34.1