From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771240654; cv=none; d=zohomail.com; s=zohoarc; b=eVaOfKDrDF2c/FMJpxV56yxjDN+R9ZrjRx7vdRh5gFCJQxcylc9fIAULyGSdFmUbPsI8vA4IY9Fbe9N9onvxxvvy+Y6sM3RXSiqPC/Qs99qHTmDBu8cPh/IAWjJgbJGdSCO5s60vyttQ05mnQTS51YGCs3GZ66s0Nevirqglhbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771240654; h=Content-Type: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=a+cxlaNFYy99fV6iC6NoJX8UA3JXNvcFW8aev589keg=; b=gfoXoqoJ9Ah3T7J4jIBeGU2C9tQBhCakMlcITxBgymIJBs811or0dGXCmLPXB3YQsbATLwxBTkl+kptmA5q5gb0CzcJJZbsm25EQ3Sik3w65sc9h5rcFEWO/sLUVYhBH7TxEA3i4exsHolENPsjyDLDQK3ASX7K17CWd/olXamk= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771240654009223.864808579464; Mon, 16 Feb 2026 03:17:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwa3-0004kq-96; Mon, 16 Feb 2026 06:15:55 -0500 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 1vrwZu-0004im-GX for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwZs-0007Hb-Tb for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:46 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-502-RLLL5PiYMpqruZ6MocVKDg-1; Mon, 16 Feb 2026 06:15:41 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A01E11956046; Mon, 16 Feb 2026 11:15:38 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F1A5930001A5; Mon, 16 Feb 2026 11:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a+cxlaNFYy99fV6iC6NoJX8UA3JXNvcFW8aev589keg=; b=dNl4XLLv7fkaPzR9ZlxrbNwLqc12PRjStui0RwU3aXFreXYQPpAKmqqDrecpHjJt6aDy53 aLMz/8LA47KHdUcWr0p16xvscEX34fIo5YPWyBea5fUwSgHpqHpESjQSOYazSmjWhtT+R3 SWgMb75hKhn2XibJi/UphT73kGmmJmM= X-MC-Unique: RLLL5PiYMpqruZ6MocVKDg-1 X-Mimecast-MFC-AGG-ID: RLLL5PiYMpqruZ6MocVKDg_1771240538 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:50 +0100 Subject: [PATCH 01/85] audio: remove obsolete/obscure functions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-1-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=4945; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=uYrPkyR2tbIVOyryH+czFSaxcbDkF6UtkEqgWhCJ+H4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxO+d6ICHrYv6hGlpFTYw4HlvaAJ7jd9uV2n b++9zOtZzOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5b+ND/45TvOtX8BfOgqI/W0WnB0DA3lCeo9vR9NhkjsyE8sMg9eDfy31jADVynQbEoVUnCOiNbW LacedWyycQSv0tN4DL4/ESoDW/GTGFwDhsekJU0U4diB91TIvDV+6VNxPGZmD3z6cqpUa7xAMhf qBw2Rj8onPuEUDHF4OVETHE315S0netvAkRzgz2tl8QmPnUD9X6LixK7+ODCudfw+97A7Tgbek/ BN0hAfPOfxjFHEB8w1TCErVbP/jL4fczUNPVRFwQs3zA12SrY4HMoYwhG348QdRuHDQ7FpHfvW0 OTrMbh788HQHh5EeW+MpnanXhfzER4ddQRAEgsfJE6m01FxJ/MbItTvxFPvZSDFdQ4QUhI6h56X BENf82M6X6AU62wnN6xXxrEVPB4okoOaI2GxO+GMrkYRslH71z5QtK+l2VBkV4kVilBcGlWf4Bo K3GK0+kezAw4LXApbdr7EmUEVJx3+lS+FwqSNlkvH3Qtnt9duvKfRl263nWSxUzmUrQwWjRX+qh i6q/y55qgJqKCgju5u40cApg0N2CaGsrvplSDQVB42PyHtRY/EE9QPumyQSS2Z0hqUztPMDuMlL ZZIEzoEv0+p21MXRIcZzxY2BhjrUW/fa7iH7Wvw8826HlaiaHqHonGSJIcwmjDbnF8i9TqPRa8x ShaaWhtzyr06BCg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771240656179154100 AUD_init_time_stamp_{in,out} and AUD_get_elapsed_usec_{in,out} are only used by the adlib device. The result isn't actually being used since ADLIB_KILL_TIMERS was set some 20y ago. Let's drop this dead code now. Drop QEMUAudioTimeStamp as well as reported by Akihiko Odaki. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_template.h | 34 ------------------= ---- include/qemu/audio.h | 10 ------- hw/audio/adlib.c | 18 +----------- .../codeconverter/codeconverter/test_regexps.py | 1 - 4 files changed, 1 insertion(+), 62 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index 7a8c431f2d7..1ab3c47fd76 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -569,40 +569,6 @@ bool glue(AUD_is_active_, TYPE)(SW *sw) return sw ? sw->active : 0; } =20 -void glue (AUD_init_time_stamp_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts) -{ - if (!sw) { - return; - } - - ts->old_ts =3D sw->hw->ts_helper; -} - -uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *t= s) -{ - uint64_t delta, cur_ts, old_ts; - - if (!sw) { - return 0; - } - - cur_ts =3D sw->hw->ts_helper; - old_ts =3D ts->old_ts; - /* dolog ("cur %" PRId64 " old %" PRId64 "\n", cur_ts, old_ts); */ - - if (cur_ts >=3D old_ts) { - delta =3D cur_ts - old_ts; - } else { - delta =3D UINT64_MAX - old_ts + cur_ts; - } - - if (!delta) { - return 0; - } - - return muldiv64 (delta, sw->hw->info.freq, 1000000); -} - #undef TYPE #undef HW #undef SW diff --git a/include/qemu/audio.h b/include/qemu/audio.h index a92e0b70ef0..a1a64ad340d 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -50,10 +50,6 @@ struct AudioBackendClass { =20 typedef struct AudioBackend AudioBackend; =20 -typedef struct QEMUAudioTimeStamp { - uint64_t old_ts; -} QEMUAudioTimeStamp; - bool AUD_backend_check(AudioBackend **be, Error **errp); =20 SWVoiceOut *AUD_open_out ( @@ -71,9 +67,6 @@ int AUD_get_buffer_size_out (SWVoiceOut *sw); void AUD_set_active_out(SWVoiceOut *sw, bool on); bool AUD_is_active_out(SWVoiceOut *sw); =20 -void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); -uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); - #define AUDIO_MAX_CHANNELS 16 typedef struct Volume { bool mute; @@ -112,9 +105,6 @@ size_t AUD_read (SWVoiceIn *sw, void *pcm_buf, size_t s= ize); void AUD_set_active_in(SWVoiceIn *sw, bool on); bool AUD_is_active_in(SWVoiceIn *sw); =20 -void AUD_init_time_stamp_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); -uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); - void audio_cleanup(void); =20 typedef struct st_sample st_sample; diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 8b9fe53e17b..efab5107a4c 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -34,8 +34,6 @@ =20 #define DEBUG 0 =20 -#define ADLIB_KILL_TIMERS 1 - #define ADLIB_DESC "Yamaha YM3812 (OPL2)" =20 #if DEBUG @@ -71,7 +69,6 @@ struct AdlibState { uint64_t dexp[2]; SWVoiceOut *voice; int left, pos, samples; - QEMUAudioTimeStamp ats; FM_OPL *opl; PortioList port_list; }; @@ -88,19 +85,7 @@ static void adlib_kill_timers (AdlibState *s) =20 for (i =3D 0; i < 2; ++i) { if (s->ticking[i]) { - uint64_t delta; - - delta =3D AUD_get_elapsed_usec_out (s->voice, &s->ats); - ldebug ( - "delta =3D %f dexp =3D %f expired =3D> %d", - delta / 1000000.0, - s->dexp[i] / 1000000.0, - delta >=3D s->dexp[i] - ); - if (ADLIB_KILL_TIMERS || delta >=3D s->dexp[i]) { - adlib_stop_opl_timer (s, i); - AUD_init_time_stamp_out (s->voice, &s->ats); - } + adlib_stop_opl_timer(s, i); } } } @@ -149,7 +134,6 @@ static void timer_handler (void *opaque, int c, double = interval_Sec) #endif =20 s->dexp[n] =3D interval_Sec * 1000000.0; - AUD_init_time_stamp_out (s->voice, &s->ats); } =20 static int write_audio (AdlibState *s, int samples) diff --git a/scripts/codeconverter/codeconverter/test_regexps.py b/scripts/= codeconverter/codeconverter/test_regexps.py index 2b9f5b80111..f92389e9618 100644 --- a/scripts/codeconverter/codeconverter/test_regexps.py +++ b/scripts/codeconverter/codeconverter/test_regexps.py @@ -202,7 +202,6 @@ def test_struct_re(): uint64_t dexp[2]; SWVoiceOut *voice; int left, pos, samples; - QEMUAudioTimeStamp ats; FM_OPL *opl; PortioList port_list; } AdlibState; --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771240650; cv=none; d=zohomail.com; s=zohoarc; b=WUQajwK3OTtQq1bP1vtYbUhWccmwujY+it0j8l64kvZRv1wiKKj10B8igefQJ3Ex+nEirWqass85cLD1sArtKdbGc0EGImKP5SWnai7esKIX18i/FNPrAsZeTTRLuKdMDPjPg7oc7PFgiqnkgB1kjov6wTsw2gNsdJuT/DcPLYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771240650; h=Content-Type: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=7MlFTFz5SURHIKJ7Chwid9xkKley/jFZjjT9ZD8VwRk=; b=gl7LiSkTDNYxliOifas//yt/GXdSNZm7gv7QwjlyxIseWc9lcBSRyxZzlzMLIBDpVsn/lvDd81UjLQtbhysziMOtuHUi3vhpXAbHeDLdPgD3/oS3gke5rW6UnVSlN3QwcEFsZWIcd3hKL3Ap7pmme6yc98bnVYhLxFXo/SokYHA= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771240650078980.1719978728369; Mon, 16 Feb 2026 03:17:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwa4-0004lN-2o; Mon, 16 Feb 2026 06:15:56 -0500 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 1vrwZy-0004jb-8K for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwZw-0007IC-SZ for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:50 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-551-Iqjo95IbO6-uth_fyNUh9A-1; Mon, 16 Feb 2026 06:15:44 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9E2601955BC1; Mon, 16 Feb 2026 11:15:42 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BE1E01955F43; Mon, 16 Feb 2026 11:15:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7MlFTFz5SURHIKJ7Chwid9xkKley/jFZjjT9ZD8VwRk=; b=P5pi4zrhnwd0wWjK+ljhJ+brggUOSrTHo+wtrU8XM4yXZTyzePqCPjRi37cyHTmIULi9UR cMvHodD0TCfQOISpXs4jt3QWrNmF6Zk63rGyxzIu1HToH9sDruchhAcnTZkVUC7+FSw9YF SrQH9QB+quI6EFCaC3RiyRUR30P9zdI= X-MC-Unique: Iqjo95IbO6-uth_fyNUh9A-1 X-Mimecast-MFC-AGG-ID: Iqjo95IbO6-uth_fyNUh9A_1771240542 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:51 +0100 Subject: [PATCH 02/85] adlib: remove dead code MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-2-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=815; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=NB1RxHPpsDtB0Hj+b8jAY+ZHvQgT3NFrR5FzA9w1Gw4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOp0rnV0W1P+b7sRUoECuJ9slq/i14tEiJI vNrBDjBmRSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5QcfD/9QalNaqugfYM5ToCEAKHYctl6ujrL5rfpHsNkoy2GQ7L1tv25nWTXIbQbSk9VKt39lnk8 rJhEFI1rHDeeL2MbBebSrB02xH81zi8g3z08P27yFhsV5GpEUfGaHP2uwwDUybKDis9Ni+M/QEW /HPVUhb/E9+YFGNuO3SzHzGQ2eAAXK2LOU38WZEGNTz4KusC4SyZ8lBMIKADuO2Jz3Zde9BQPPr a/d1MlpkA41TlYzdtGIQw73ZyyPwawXSbZl1mIKn+WY/zXHsLt96G+PSJQJP8eAZrzM+3P+8M2G fTSVYCc9F/FvIwPGheF83tnO6FNnUTXK/AGtPZa4JiD+jdv6gDa2aB/RL9NCAQ2lX1Pnzi5h9ax 1aStAmAc1FW/QK5XpRnagdFvX/25cpjycgqxyfZ4lALJGosASw/R1gqgkd9vvKkiIMbPjvPOGYx mlyqC/lYuuvIhtyQrYRJo9GhUh/o6dk2xC8sZU3e0uVuEToc2rRvnkFF7rrd5pWNrGKbFoJWszJ bsDJLfQLJYL6de8EjNUlCipcqzJ/XGwI59JdtRhM1cdUt3KK234KmfKNBolRw8wQ/W/7hRjf7iB 5j7FO0iib2u+WxXgdU+Dnne62DanZ5UksCcL8HmckCpH00uRo+HdjpzbnC/qITZiAUG9ERN+KFh NDhXltwcqCGAShA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771240651846154100 Previous commit drop the need for this field. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- hw/audio/adlib.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index efab5107a4c..f79654627f5 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -66,7 +66,6 @@ struct AdlibState { int64_t exp[2]; #endif int16_t *mixbuf; - uint64_t dexp[2]; SWVoiceOut *voice; int left, pos, samples; FM_OPL *opl; @@ -133,7 +132,6 @@ static void timer_handler (void *opaque, int c, double = interval_Sec) s->exp[n] =3D exp; #endif =20 - s->dexp[n] =3D interval_Sec * 1000000.0; } =20 static int write_audio (AdlibState *s, int samples) --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771240568; cv=none; d=zohomail.com; s=zohoarc; b=mZE7auH0471hmj1+25MMMgHwpl5ch50E4QrbOZWfPSHyGRFBlOYlDDKX5MBstSexO2Hz1kG/oWPlGNdRQR5gsvvqM3yYYQyEATHPha9CrhJCvSX/445x939VM7Z2vmwOZuKv60aUgbJzO14Xf8/X6z0FdQ1S/MA9vF5P7qg/Qrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771240568; h=Content-Type: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=03yR22OPWyv4xOgsTRflUVZkTa9pLbZJpc7QOwE/YKQ=; b=ZOEB5RXodgMgLfpEp15jdogiEkFM9KNVVeRu3WrO/nachSXeYYHwbEX7daVyQM1IQ8OsfIDYTsSTla2kzImYExGptAQV9LELeUjZ+sMf2qiYyTR3ctBtEIuXRfW/akn4VXPH7h7vMi8L8JgG+rAsLyqIA6fcCyN/rhxU5VdG4Gk= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771240568841486.28674956781174; Mon, 16 Feb 2026 03:16:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwa5-0004m8-CD; Mon, 16 Feb 2026 06:15:57 -0500 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 1vrwa3-0004kn-2B for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwa1-0007JL-62 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:54 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-575-S_3Rn-x3NoK6-w9xBzQ9TQ-1; Mon, 16 Feb 2026 06:15:47 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CE3911955D4D; Mon, 16 Feb 2026 11:15:45 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8A63119560B2; Mon, 16 Feb 2026 11:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=03yR22OPWyv4xOgsTRflUVZkTa9pLbZJpc7QOwE/YKQ=; b=TGoOJBTQFu7C3Tf5HBYi/M8siHV5k4SBHvv+N6mzwbfue1JVNCOy0DSuThYqEn+vZtf25V pEwvem1zNM/pOYu2WWNQ32IVxz0kxPsH6LEyF364V92kI/g/U68QlA0blUWPlY1xa+IH7f gAPyf+p8/pkwYYwqaIHE8tOJb85AtMg= X-MC-Unique: S_3Rn-x3NoK6-w9xBzQ9TQ-1 X-Mimecast-MFC-AGG-ID: S_3Rn-x3NoK6-w9xBzQ9TQ_1771240545 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:52 +0100 Subject: [PATCH 03/85] audio/adlib: drop ts_helper HWVoice field MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-3-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1480; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/79pMsmTucvlzgY5FBqKNb003r8HB/EPhG2j1zf1dS8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOtpJ93glYebWbW0M9TwpEeqzqZE8wKES33 RpgLlFp1SaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5R1BEAC1bQIZC001c8va6eb/i5dK/TdhxHw+4klXKNMMuGSZ+JwVRaxYcY7R2CI478M/ELBtQkY 4/V5alEvtX2F2ho08cK0axbyCE9VkCq08MmXq2+UuHz8eHd2r27EX+JZ3m5ErrQtunIk1afEn82 sKHC1peBr6Zq/FTNB+ud/MzVK7zm35OlZWeVzcnT5C3fOF1WPO1w/IrQgUppQUhgBqkeZi/aVtX NPx/fEL/1WMRR91QxWWTXhZXoWYbJ5f7zkNI5mouFp8VR6lxzOXd5v1XYqcNb7/osyRUMjfVkqN 74FaxTgii9tdNhEKUozF5fa8jXTmqhA4Gzw6K5rQ1+njUcGNkBC6kO2wqBHPUf6/EoGRozaLvCg f/3qksrInIQLbaMRlHJnz1Zt/1Si+6IkEmpzxG7mF92uQyaeGp5hrQ+W/w9s9ws3/bdyURTfP1X ba2QcsfkupaOjIF41sA0EXVftgZKcakw3OsJUedprcVxnx+2QvkoyfeHTR+g7lWDE3Hzgd8aI/Q Tx2HAZmVKIfOSmhcZ2C9hhzhKRI6y6EiXKDSn/gTQG+9wtIzwNiVCPkUJEXJmZSRc+8F4x+HbRS 3tDMRV15aAagKqjcM/gYsyJzxB6OiK841t7AZOOvvcww5ujOeoltNFXQrFxdMdIlAakRx7KZSSX g9lwi9ZRnAbskLg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771240571451154100 Previous commits made this dead code. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 2 -- audio/audio.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index b2b8002477c..20b4c87b0b6 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -77,7 +77,6 @@ typedef struct HWVoiceOut { struct audio_pcm_info info; =20 f_sample *clip; - uint64_t ts_helper; =20 STSampleBuffer mix_buf; void *buf_emul; @@ -99,7 +98,6 @@ typedef struct HWVoiceIn { t_sample *conv; =20 size_t total_samples_captured; - uint64_t ts_helper; =20 STSampleBuffer conv_buf; void *buf_emul; diff --git a/audio/audio.c b/audio/audio.c index b7a28f79d4f..a218570a4f4 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1240,7 +1240,6 @@ static void audio_run_out(AudioBackend *s) #endif =20 if (played) { - hw->ts_helper +=3D played; audio_capture_mix_and_clear (hw, prev_rpos, played); } =20 @@ -1320,7 +1319,6 @@ static void audio_run_in(AudioBackend *s) =20 min =3D audio_pcm_hw_find_min_in (hw); hw->total_samples_captured +=3D captured - min; - hw->ts_helper +=3D captured; =20 for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { sw->total_hw_samples_acquired -=3D min; --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771241685; cv=none; d=zohomail.com; s=zohoarc; b=F5w7W82TmL9Yx9dCX2f5QojBjBVLmI013j9aV6UdLCTGMn9wYxkf1LPs/oP5xOpr16laBaSxNPpSSywwq41IK+COXQoqgZS/9UxedApcTSAMVE+9MJEPrPSw+7RyyI1Uu8cZAMjOgGbMsMTzyflThMY3f0QvW+uELGJhZWv/o6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771241685; h=Content-Type: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=TQTKsJe+H0JmAEbmIdQJvVw5lqnUUPR6AFifO+6umuY=; b=dgcBusK5C+j/Uxtn9Rhieh38PpLGIfEP6fhDI0kiYYDkwoByMhJFjclqsUpkIuihv4ftuY0AKKXdAQlbc2krv/N0s/N3TP98QXuWZc6Fdi6dgZYPVN+8Rf+h2NyxHyFKyjsQ4BQ3lCCohO4532IpN9k0Ft/GPlLxn+usjluPT3U= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771241685327802.146810222423; Mon, 16 Feb 2026 03:34:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwa6-0004ma-PT; Mon, 16 Feb 2026 06:15:58 -0500 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 1vrwa4-0004lb-DT for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwa2-0007Ji-AI for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:56 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-WlHKukHPNKiwgDbFuE7VgQ-1; Mon, 16 Feb 2026 06:15:50 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4409719560B2; Mon, 16 Feb 2026 11:15:48 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9BDD019560A2; Mon, 16 Feb 2026 11:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TQTKsJe+H0JmAEbmIdQJvVw5lqnUUPR6AFifO+6umuY=; b=AIz/btq0KIH9fBPBxN7ONXn+va/nUrALzVPPN4sOc9V/pZ8OcCR1WbQudLC7e+L20tuWtE lJGx8pjH1fX62PfUiPYWWV0hFG2wsG53P7JWegzC59IEcH9OcX5GAnU6QI+zWJJdxOHpzJ T928Fs0cbZMd6stc88Ruzp/6WsJHqp0= X-MC-Unique: WlHKukHPNKiwgDbFuE7VgQ-1 X-Mimecast-MFC-AGG-ID: WlHKukHPNKiwgDbFuE7VgQ_1771240548 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:53 +0100 Subject: [PATCH 04/85] audio/dbus: make "dbus" the default backend when using -display dbus MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-4-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3368; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=i0hZV7AIfgA8SuFqO30DlmD20T1D7KstDiHR2TRDsyg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOjI4h00rSui2Rb0WXtwvFdNIDvuQWGaEkY Dk/2hw+feaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5XPyEACk3jplro9UmB+SMonTa5N8UUYgLik3j3qZoeg8vDsKCsCksav3E995HKv41rj/FcTkydl edVc022hab9KCZmexplrB3uZ2GtGzNAhTieFPzeRENWBfgppc+0ngp4KT2f5npPVnBJfBn9wzPX e50DMTOmSFA+iO4WVzrFPWHeZS8aodZeu/KZkPzAk/j9GLsUg3Ep02EJfaTTkfAnzr3GoOtRHN4 a3BlijkBRWQdWt7Ia5a7rgEuhXT7jpIIHbDqPpqperJxlG641+RvSgt+jUJ4oEhuA74dq4MNXIf OroHkt2VWw5I6iyeV0NNEgo5gnsInGPxCCP+yO6iDOSrQ8inCCgF2CxHHxyxaEn6HBg4iLUnJki D0xgHTsTTUTm5Mx0nM8lbcz6ZRPOrxiO2HrpiMZw/9QrLRpoOWQaCgmHnJciam/gltxcyPxVr+6 af7A4wfFwrv2EvPAvcAMqdxiXM15g2KzHhZWOd4qSWIpdgrs6pOpZmqVuSX4TqD2x011JyEmEtX Loj8pdWMz7BadQSTzxYnZ9EzX1NwTUp96QYywcj7wrnFIBFNHcrIeygMPgh7DMeNq1YMYIIKzP5 UaL8mZrdXHxotWOcVGQV7MEqWq32QI10d7d+y/muzHJmv2R4AeYLsoEWQGUW09ZBd3OX025rySs v2Tc9NYJTyHijtg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771241689226154100 Set "using_dbus_display" during early_dbus_init(), so that we can try to create the "dbus" audio backend by default from audio_prio_list. This makes dbus audio work by default when using an audio device, without having to setup and wire up the -audiodev manually. The added FIXME is addressed in the following commits. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio.c | 3 +++ audio/dbusaudio.c | 8 +++++++- ui/dbus.c | 22 +++++++++++++++++----- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index a218570a4f4..9563583cd1e 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -58,6 +58,9 @@ that we generate the list. */ const char *audio_prio_list[] =3D { +#ifdef CONFIG_GIO + "dbus", +#endif "spice", CONFIG_AUDIO_DRIVERS "none", diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index d729a810aa6..1fe7c4ed647 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -32,6 +32,7 @@ #endif =20 #include "ui/dbus.h" +#include "ui/dbus-display.h" #include "ui/dbus-display1.h" =20 #define AUDIO_CAP "dbus" @@ -408,8 +409,13 @@ dbus_enable_in(HWVoiceIn *hw, bool enable) static void * dbus_audio_init(Audiodev *dev, Error **errp) { - DBusAudio *da =3D g_new0(DBusAudio, 1); + DBusAudio *da; =20 + if (!qemu_using_dbus_display(errp)) { + return NULL; + } + + da =3D g_new0(DBusAudio, 1); da->dev =3D dev; da->out_listeners =3D g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); diff --git a/ui/dbus.c b/ui/dbus.c index 31f6eb1189f..0be1931d208 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -35,6 +35,7 @@ #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" =20 @@ -218,9 +219,20 @@ dbus_display_complete(UserCreatable *uc, Error **errp) return; } =20 - if (dd->audiodev && *dd->audiodev) { - AudioBackend *audio_be =3D audio_be_by_name(dd->audiodev, errp); - if (!audio_be || !audio_be_set_dbus_server(audio_be, dd->server, d= d->p2p, errp)) { + { + AudioBackend *audio_be =3D audio_get_default_audio_be(NULL); + + if (audio_be && !g_str_equal(audio_be->drv->name, "dbus")) { + audio_be =3D NULL; + } + if (dd->audiodev && *dd->audiodev) { + audio_be =3D audio_be_by_name(dd->audiodev, errp); + if (!audio_be) { + return; + } + } + if (audio_be && + !audio_be_set_dbus_server(audio_be, dd->server, dd->p2p, errp)= ) { return; } } @@ -475,6 +487,8 @@ early_dbus_init(DisplayOptions *opts) #endif } =20 + using_dbus_display =3D 1; + type_register_static(&dbus_vc_type_info); } =20 @@ -488,8 +502,6 @@ dbus_init(DisplayState *ds, DisplayOptions *opts) exit(1); } =20 - using_dbus_display =3D 1; - object_new_with_props(TYPE_DBUS_DISPLAY, object_get_objects_root(), "dbus-display", &error_fatal, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771240624; cv=none; d=zohomail.com; s=zohoarc; b=SqvJehuaASSImmjsojud54AUj7K/y9b3gVlaJSsZCXw1Oz1KPrx5TSJJ4NIPXeShl0TgmbR5STlk63abtMc9E/q3co92sjJKezr2jWpPzNsgjzD7FzPyq4OgtnEyh2P7aVJGoQ4GuKlSSbg4XBD2OZ7nhPVBBRGHL3ZuE5IS1Ek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771240624; h=Content-Type: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=VuljhDTSEvIRuZWMVHmH3upAs1bYNZiEpsxb8H2Doiw=; b=VW0AU4uKNRhfYyhrPAa7OrJni2obeBJbuyQnOvRxkO74V7wulktnRB+X1GrBBR38zUH0sWV1ShYfg2GbyVvlmihOU3/oFaA0wI4h70CQxSMUnualOOvazmepLkEFQTvx17PHQRrDOqZG2zd6kqq4Njl3uzFZeRUe8EuGfVnRegQ= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177124062454851.57952682287919; Mon, 16 Feb 2026 03:17:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwa9-0004nm-BF; Mon, 16 Feb 2026 06:16:01 -0500 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 1vrwa7-0004n6-Pj for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwa6-0007KO-7g for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:15:59 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-216-iZtgyr17M0iD3JE5wpsMFA-1; Mon, 16 Feb 2026 06:15:54 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D401E1956053; Mon, 16 Feb 2026 11:15:51 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 495551800465; Mon, 16 Feb 2026 11:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VuljhDTSEvIRuZWMVHmH3upAs1bYNZiEpsxb8H2Doiw=; b=Pvdao70vnUO5Uq4/o4mOlg8qdnWuODknYCMzaIaoWP5Exm36a2iyRwTgbpuCqzrza3PgIF qd2+xQgut0bEf4d0T/S55e+xizEwKOc3ZvPHfZFtNY3VW6YbxlVoOmPHPnG7GujrgZyPII KAeIY1QRNyU3GoKeXtKrrNICW08FIWY= X-MC-Unique: iZtgyr17M0iD3JE5wpsMFA-1 X-Mimecast-MFC-AGG-ID: iZtgyr17M0iD3JE5wpsMFA_1771240552 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:54 +0100 Subject: [PATCH 05/85] qemu-options.hx: clarify default audio backend selection MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-5-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2296; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=pQYsT12b6ItIPMgGRIh+ZR0w15tO/zqPK/vSleMzRTE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOb9dt2y32Y/FDaf8C1TrhPWMaFY/kg3NdL ZeMYcpsaAeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5QFRD/0edP1XArxaXBfn+guGHQ9iSZrkUsjvktz6g29yhu91BAjerkh21m2hmdaNTn0rblFj6hP g1PYUDV0Kya38dRGf82Hxt45XAn/gU27TaKYSQitnN3fsJOMpXysc0aTdQ15YEPuIxoFKHei0gD fN/obH8fBgabgIm4jag4XLFOV5qB8lNgLVPElYY7NEEgi2Y8qYYP0iIZK5+2tIXeHiRMIpfbCYR SResGMpbD3IAoJiKJgCgJbxwloo9GkF4xzIJFX9iJ7g9DiX7oU+LZBsvgjg2hcZ7uQZKHENjaUM bz/BearoPvN6awCZlUwzAZZycoKil5OE1gXId2Hw2G8sbpGc0Nuto7KA3W1qYBhb+lrd07W3y1f ZRJfsWB5qOtRxurDzaaByrok3+zLPh1AbQNU+0itoggb453jM2dnRVSVyfE1dGyhwKMPGm8+ZOc KIyJsVCoWfp8JLzRxjbSNJ+7hW7pl+nvxbXSOC/W2K23tnudLFNR2R/v2uTG+fZFtmbxCBzEmf5 Ii/ycc8ww3VfEtS7g4G8Yf21074CrL+COEtE6ozf501RKT8UOn5guFGOkPB3tJlB4hCoB38p49D KlPy0kAaNMwTn5rwVrqSXj0TC2HAQ05cMDLrSBcEhJf8orqXhPnSgH+Ei1aVVrjbd+jwHzDtTk5 dNtTYqoOOaTP2dQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771240627727154100 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- qemu-options.hx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 33fcfe7ce66..15a6f82043a 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -896,11 +896,16 @@ DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev, QEMU_ARCH_ALL) SRST ``-audiodev [driver=3D]driver,id=3Did[,prop[=3Dvalue][,...]]`` - Adds a new audio backend driver identified by id. There are global - and driver specific properties. Some values can be set differently - for input and output, they're marked with ``in|out.``. You can set - the input's property with ``in.prop`` and the output's property with - ``out.prop``. For example: + Adds a new audio backend driver identified by id. + + If no audio backend is specified, QEMU will attempt to select a + default one. The ``-display`` option may influence which backend is + selected. + + There are global and driver specific properties. Some values can be + set differently for input and output, they're marked with ``in|out.``. + You can set the input's property with ``in.prop`` and the output's + property with ``out.prop``. For example: =20 :: =20 @@ -2198,8 +2203,11 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, , QEMU_ARCH_ALL) SRST ``-display type`` - Select type of display to use. Use ``-display help`` to list the avail= able - display types. Valid values for type are + Select type of display to use. This may also influence the default + audio backend selection. + + Use ``-display help`` to list the available display types. Valid values + for type are =20 ``spice-app[,gl=3Don|off]`` Start QEMU as a Spice server and launch the default Spice client @@ -2209,6 +2217,9 @@ SRST ``dbus`` Export the display over D-Bus interfaces. (Since 7.0) =20 + If no audio backend is specified and the dbus display backend is + specified, the dbus audio backend is used by default. + The connection is registered with the "org.qemu" name (and queued = when already owned). =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771240635; cv=none; d=zohomail.com; s=zohoarc; b=H2GX/BH1/8fBsBTsu7Su2yLYZNOWj2hEtyrNnjvFhWL6T8KvL3l4MRPAgpmWIftxFIawedwYk9TCMwBkBgQM9NMxyMsdmLn2Ll38Y5Qli5rK80y6nuDXDaxYioz9xgbPDPjCYHRsYiGf+C6VUYAihh3Bt+RAeOwrFr370ah8l/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771240635; h=Content-Type: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=6VfogaPHf/Z+L9b7Y13bG+eABGPqx21qH8NhHT2gnNM=; b=mUmpJys75HC8/MD/0923XBpLQULgkLJphgdvJ3NHm9oXEs65TT3x7o9hC/Hf0tEzLfGIkvJR9rOlepi+n21nxogdrk6iv0g+tdtdsd3D4VAaQ5LCIlgP4zjCZ6KH02oon+bfseCNk7W6QQgQmrzdBEsF2Whc9EEawOz/u63IlnU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771240635157830.4864442065431; Mon, 16 Feb 2026 03:17:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwaC-0004oZ-7b; Mon, 16 Feb 2026 06:16:04 -0500 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 1vrwaB-0004oD-7f for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwa9-0007L3-Lb for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:02 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-372-1y5fjROjOhSx0_O4i7YO0g-1; Mon, 16 Feb 2026 06:15:56 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 827551955D88; Mon, 16 Feb 2026 11:15:54 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D7F7D1955F43; Mon, 16 Feb 2026 11:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6VfogaPHf/Z+L9b7Y13bG+eABGPqx21qH8NhHT2gnNM=; b=ZRdcPn2HvthbVQ/y7WN6l6RlTIIwsqkvkUHLfGzuhl0iSsDOq1BilCLmqU/7/hpzPoJqKl aFah+7n/2D02jMisj2XUp7CfItOYAM5eVMrWzrTjFLyr3GPqTVAVMWcf5EpMBEsDayrU50 Ao4H9/9+gXKamFHXPZV5WLX/cf1dvgU= X-MC-Unique: 1y5fjROjOhSx0_O4i7YO0g-1 X-Mimecast-MFC-AGG-ID: 1y5fjROjOhSx0_O4i7YO0g_1771240554 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:55 +0100 Subject: [PATCH 06/85] qemu-options.hx: document -audiodev dbus MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-6-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1123; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=4z4LECFy6R6KVgt/u7UO4ATuY8GKjOnvDAw3YOWYVi0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOX9kHbpwVs6KRYut1JR49y+n4qjf3d4FLe Uq3KmX5bW6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5fVjD/0QMFFJ51oD2c3FzFYpoiB86kipeqVkr7ZkvssaX1+/e9cy2N40gzdDpNZbaG4pQ+7qIsR OjFz+Luvr77Tu9a9M8Hd9/eGHmCf0OxR7cmnbX/dIGUCMpAC9u+gb3SYYZscprQy/CkeGvglvfC nEBF0JcPWy3kJeMLREXG5fGnqzxV5BB++G3jRsX0Fsug+rNrKcKADcgbc07xcZt9CQ1NFq08srv rSKx8eGoWqMARcf6dEUC/25ANxwPrvSxF3Zo6HWC479TX/rSz1/9VvchbT2QC5ieCr6/45DfBG+ eU4yY6E55P+D6QH6sAG4qI7r0xgXF+0HZJGQdXjooYldcW7IW/bAekD3jI+uWDycRXTsboQur/O CQBUh+w+nv/F9iCxTz5vgWhisJEJSUvt8VlzA+wAcUH4LPwygVP/zTv0Wi9fOxQ1FU++qcDPbrl 5ilGfjW6JYJncutW9Oxgm9QRPJVp09vlQKhcJgh+GkT2p0T7iISVDMk+awSGgu0Idf2yN9TpT4O Pv65ULbh97FeWsb0eBpOGbxERK6r+WRxMZpOFobBKI5u3y9lLnAnF3SGhNxA/FDm2WPp1wvh41z 5KuAWeAKVz4awzixS7Ykxz6TezB4eH6Bns8jee86JnUw8Qxm5W8bqCVkDiCBaWpdtNMj/7kWK0i eUeORBX/6QEveLQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771240637533154100 Document the backend introduced in commit 739362d420 ("audio: add dbus audio backend"). Reported-by: Mark Cave-Ayland Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- qemu-options.hx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 15a6f82043a..4043e8ca22b 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -991,6 +991,16 @@ SRST ``in|out.buffer-count=3Dcount`` Sets the count of the buffers. =20 +``-audiodev dbus,id=3Did[,prop[=3Dvalue][,...]]`` + Creates a D-Bus backend. It must be associated with the display + (as ``-display dbus,audiodev=3Did``). (Since 7.0) + + D-Bus specific options are: + + ``nsamples`` + Number of samples per read/write (default to 480, 10ms at 48kHz) + (Since 10.0) + ``-audiodev dsound,id=3Did[,prop[=3Dvalue][,...]]`` Creates a backend using Microsoft's DirectSound. This backend is only available on Windows and only supports playback. --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771240635; cv=none; d=zohomail.com; s=zohoarc; b=kb0NtibSIxLtKo2+Xk6p+/soyJNxPfeX0Syfn92L9IVMMv6/VnjKT+PMsweFKju5/NJhXdTs0nea7xIXpSFP/TWA2NMXyzEuxtDrknuVds+rnlW35yk3d23Edy+MqqkP1dj3kQ+DCRXe9mMiE1IrewfYsNyTYs1IlNUeN6jSca4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771240635; h=Content-Type: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=D9XkBQ/oXbUz12+FCnU0YeeeK3GbFA4EHm+vljyv3ok=; b=Ehn3v47+sVNFVJBshxnXx0I/12iyUSS/riTbVnGuREV+JLImRDiexIAPe3EKX6rEDhdzkoVzpnP8DnhhEbLNVfKmSS/qVNmhvPLB6Y6sEmjxWPPQuaG1AfuWqvb5lg3hYteWwGk3u/rp2i2biCUbTTySxrMgtOZeg88Ct01yLnY= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177124063540966.11912832370649; Mon, 16 Feb 2026 03:17:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwaG-0004pu-9z; Mon, 16 Feb 2026 06:16:08 -0500 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 1vrwaE-0004pU-HI for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaC-0007LY-UP for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:06 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-527-RpNXw8lZM26MNj3Q9FJTrA-1; Mon, 16 Feb 2026 06:15:59 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 47A771955D7A; Mon, 16 Feb 2026 11:15:57 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5094B30001B9; Mon, 16 Feb 2026 11:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D9XkBQ/oXbUz12+FCnU0YeeeK3GbFA4EHm+vljyv3ok=; b=Ok5tkaCb8c54zATvrMy5MwQ/QDc+yGEpWQ718DHJjXIQmt3GYfjl5GRtyN4tUDYFrfXmOf NAo2N259OqfzGus34Xuow7jdWXAStscWK37Zo/nV/mpskbk2frGJ9ekJy9WeHtLRm6vgbL pCIKTlAylbSJEWGHarZItzm0OjC/S68= X-MC-Unique: RpNXw8lZM26MNj3Q9FJTrA-1 X-Mimecast-MFC-AGG-ID: RpNXw8lZM26MNj3Q9FJTrA_1771240557 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:56 +0100 Subject: [PATCH 07/85] audio: replace vm_running with runstate_is_running() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-7-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2337; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=n+3siSegRS3y0Lxy97FkNncK5ldFf6lqIw8dDZCokNw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOGDvONvX02CPcOt6tkRs08xUDFu7ySc7+o /ReRylaG5KJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5ZvSEACF2/YXNBDalAjxOarQ9NhDg6+Me+DQI1mfjYl7a+xqJ3DlQDt5g9pX0AyBIJSyZfwIige ih68uFC8nxwmzcVIhUECrfI7lGATri2iDpo6BSPcngqoJECDFbC68jvYBNEtLbD/4wA7DWKbiIN htHfkm9Ae6ZWwTjk3phiDFvOSWZ/B0xVXNDrjs9//whji+TiulX4gb1xT3KkmBJkk/XEexw7V98 650BGJPNEDdAXRvo4YmpBiSv5o4xaNJcdhNgT0UuvL4mSrZPhJEHUMkTmsp/l2RxGul+N2HILSP 1WwfErpdFtlXOIKxsYfIaSJ7aIWEc2coafvlahyxpIys3zcX4MDjo4fxR+fpzg0k3E4ev94LJgy DsyfBFXUgbeQL0XlJMxv6VuA+1VdXUtArf39F2PCwAujAOYweymWJEJpyYTQbtcXxBXijA25ohf JZbrLo99l0vERhLPbEoN4UbdFrQODP8kfK40S1fS0fvwpcG59gt1f/LGWG035fLDku6L4U3bw18 8F3JZbyvXR/Z6G5ExnN7SN+ciAQrbRHfAkH9w5hhrTJpqef8hXvfS13MTTBFMmHQoYpEK+30UHa HJGOd6PRfJo2Jr5bWcr6S4NRF0zxmIEX/zkzrz9/lxNsqjpE+6KhJZ8wFdEZ0iyyZpkbl4ia0tc bNe/xNhM9RlzMkw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771240637351158500 AudioBackend had a vm_running field which was set in audio_vm_change_state_handler(). The state change handler "bool running" argument is true when vm_prepare_start() calls it, and the VM runstate is either SUSPENDED or RUNNING. Audio hw voices shouldn't be running when the VM is suspended, but only when running. Thus replacing the vm_running field with a call to runstate_is_running() is both simpler and more correct. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 1 - audio/audio.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 20b4c87b0b6..25de0e3f9cf 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -252,7 +252,6 @@ typedef struct AudioBackend { QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head; int nb_hw_voices_out; int nb_hw_voices_in; - int vm_running; int64_t period_ticks; =20 bool timer_running; diff --git a/audio/audio.c b/audio/audio.c index 9563583cd1e..68698b13e15 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -933,7 +933,7 @@ void AUD_set_active_out(SWVoiceOut *sw, bool on) hw->pending_disable =3D 0; if (!hw->enabled) { hw->enabled =3D true; - if (s->vm_running) { + if (runstate_is_running()) { if (hw->pcm_ops->enable_out) { hw->pcm_ops->enable_out(hw, true); } @@ -979,7 +979,7 @@ void AUD_set_active_in(SWVoiceIn *sw, bool on) if (on) { if (!hw->enabled) { hw->enabled =3D true; - if (s->vm_running) { + if (runstate_is_running()) { if (hw->pcm_ops->enable_in) { hw->pcm_ops->enable_in(hw, true); } @@ -1598,7 +1598,6 @@ static void audio_vm_change_state_handler (void *opaq= ue, bool running, HWVoiceOut *hwo =3D NULL; HWVoiceIn *hwi =3D NULL; =20 - s->vm_running =3D running; while ((hwo =3D audio_pcm_hw_find_any_enabled_out(s, hwo))) { if (hwo->pcm_ops->enable_out) { hwo->pcm_ops->enable_out(hwo, running); --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771240624; cv=none; d=zohomail.com; s=zohoarc; b=giAp6NpvCm1kpjoJHjmgK3l5DGBTPJ5ZgOh8WMxof8zMHpLJS3Yc3ZrsmFVZvfls5/nltlEdpgnOHdU7+6XTDT5heH57jCV4IMQltsBUrrjDeCDHSlOSMjpeKZGh/VdVa5LKoHi3iCZKwdrVKGs5Pr+4r4wDOMIlGlgCh129LXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771240624; h=Content-Type: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=1Zx9tUgPYauS3ey3x8MRhHhI+AI2QGIcLzfbiUv0MoU=; b=m3GyPfXQHMfee0bR/7cU9eMsbnK+CLXHu5napGpcQQrOYksgCdUsPoUe7O//0dF7l6Tq9ZZwUkhBfpul4stUeJUkkjr1OsoB8UlqMRdiSAHvknH4J9pA02EHmKnulbLL33pNbslOJ4fXJWqEzGMX5eWX53qUsz+5nfulRGOmfYc= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771240624678518.4728350189486; Mon, 16 Feb 2026 03:17:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwaZ-00054M-UE; Mon, 16 Feb 2026 06:16:31 -0500 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 1vrwaK-0004vb-5t for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaF-0007Lq-8e for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:08 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-539-GnkfrpEwN6-rQdgXCf97uA-1; Mon, 16 Feb 2026 06:16:02 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0E1A81955E88; Mon, 16 Feb 2026 11:16:00 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 62D9519560AD; Mon, 16 Feb 2026 11:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1Zx9tUgPYauS3ey3x8MRhHhI+AI2QGIcLzfbiUv0MoU=; b=bj2JDcE/WG+tA0afuEfM1jA117MCJm5yP9zZFAhSS0i7euJMyGngpVVWWGgHwv2spCJ+NP o+kxdVZohicG/pXyt3Zrylz3PgEkcg/kcrDBrDP/6EFE4wpUsOGONJ9hLRWIdngHpd/JPZ YKtK7nM6pAY1rOWUr5AhCI1BdnYY5AQ= X-MC-Unique: GnkfrpEwN6-rQdgXCf97uA-1 X-Mimecast-MFC-AGG-ID: GnkfrpEwN6-rQdgXCf97uA_1771240560 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:57 +0100 Subject: [PATCH 08/85] audio: list backends as modules MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-8-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1122; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=8RNCjDZJyS99FQfKQHwCUPWQBTeZ+z6QEmMkBqjgbCg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOjiqYkb/gGmjzw5f6xEC8yFeCioIBUMa4S sMMFw+J2HqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5V7CD/9xKru/LK2lgX4C86GOaSRjp2RVfRZ/yasiByWUXUv3PBZKZMZobo/BRNf3kFhjl/3heiQ Zeh+jSys7GPQlsF9NULG9n11zqSG/SJHdgiwi28mwRrF7z0CEDMFrJWjXBpMHIkenQyV1G93h9c PLQPsqHd4UkGkzuKtK7JEDfBWk7of0uuOk3VN1yUx4wwHbAp3V5R3rK+50d/gb3nHCyl8YjSt2g EbTpFVy6jgTXHr/A/OFNgR1UTZCMkF9iXzM7I4UDTGPvy2BV3P2CcaPVBr0FG3PO8udN3Xfx9Jj INR0CELEMycWW9OPd21frl/CsgcULf9ylL1wOYILmAbTaR+W0OlvPmD0X9Jmvex1Lva7E7fWQhO P9w2mxx/tzQ9dJcJdLDNUAOhKnLvi8mEhKO6oJ/pbKmCsLcW85VrqXdCajP4P1ZNzRxwUe6XKJ5 L/TJ5iWlhbJJdrqjAJgkipLsHvy3kKu1J3sBac3PkmEy0WM9GPoHFvUp16HGnlm2OtDuZPIigUe laybi10ZafbvmL/5QzzO+82kFoZGqoYE0FG0m6eW0M/kgIjyev32jQDI9CadRcvx2Fj+e45xh8g LIHMihhIAFIUqK4i5c441C+OPFwBs4crfAG7FIjm9IW4Q8JGbiLKvTgwKh1NRSaKzWjCQlNUFy+ V7icFWJIpd7vzfQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771240627606158500 Windows doesn't support modules, atm, but we can treat it as a regular audio unit regardless. MacOs does support module, so this is fine. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/meson.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/audio/meson.build b/audio/meson.build index b2dca2c6409..23fb66d571f 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -8,12 +8,11 @@ system_ss.add(files( # deprecated since v10.2, to be removed system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c')) =20 -system_ss.add(when: coreaudio, if_true: files('coreaudio.m')) -system_ss.add(when: dsound, if_true: files('dsoundaudio.c', 'audio_win_int= .c')) - audio_modules =3D {} foreach m : [ ['alsa', alsa, files('alsaaudio.c')], + ['coreaudio', coreaudio, files('coreaudio.m')], + ['dsound', dsound, files('dsoundaudio.c', 'audio_win_int.c')], ['oss', oss, files('ossaudio.c')], ['pa', pulse, files('paaudio.c')], ['sdl', sdl, files('sdlaudio.c')], --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242469; cv=none; d=zohomail.com; s=zohoarc; b=N/QE7LZxUt/5vFiLj3iGYsUssNHRKZq0T65ohwoHFjVh0tNLuNIefxUPt/Gw9BIhMie4gudzGTHtwHSZBal0IYi5bfYl4Z1KQ1IXGUMQlPeKcOmiw3m9+1NTwpcds/NafgLIukn9Bo7yBMF6+uVpbh1RLdkzAoO3SLJz0qyIQro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242469; h=Content-Type: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=58QRcSder0RaqQBxAedoRAnN13Ui3FUWfO2I/pFVn1M=; b=YhV7W12QGa3m4iOebbpo+TA8lmqZey/yqIKB66bjvvPGouHmclf4GliG/vmmXS2TWB7TKkwZG1L/t3HIblb7xRMFaRsll6fLyORN0bECpFTttnf2hy11DR43c0PSPOzKo8JwqCBTAfPJ4CvcxoXxeKsgAcppWRuPH9QNme48+vM= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242469240821.1595630881338; Mon, 16 Feb 2026 03:47:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwbr-00062k-TM; Mon, 16 Feb 2026 06:17:49 -0500 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 1vrwaS-00054I-Hw for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaI-0007M4-U6 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:13 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-196-z6KJDR3nMCudWPFGktoPzA-1; Mon, 16 Feb 2026 06:16:04 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7D5FA1800349; Mon, 16 Feb 2026 11:16:02 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D49B930001B9; Mon, 16 Feb 2026 11:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=58QRcSder0RaqQBxAedoRAnN13Ui3FUWfO2I/pFVn1M=; b=hV95g5WKHVWcijr8UCHO7CME0AKDJnz+CZB4Uj/xvYauBiXdmrAUaw4VPV36h3e5Xd2DBG mEKJzLUwlxd0CJEm9iy5Yb9hrDBLoBRutab1YhlJZdwUC72o7MkrxniZ4pYgzheX8rxwpN EQgarafzQvbjqWIOaJP0b32tJcPtaBY= X-MC-Unique: z6KJDR3nMCudWPFGktoPzA-1 X-Mimecast-MFC-AGG-ID: z6KJDR3nMCudWPFGktoPzA_1771240562 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:58 +0100 Subject: [PATCH 09/85] build-sys: create a libaudio MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-9-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1548; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Hk7/EXh9zm0G5EktVx4Fxa+ZyOM5/pIT6vTnyxaK2F8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxO6qngCi7boRhVlrkB6kH1FyUurZHfm9x8j KRTcrGJN1+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5flQD/wNpuizM5bLhXysInhyfoF+cqOdpy9PueN8IwskFnP4s1GcSpYxqJfQ5nQQl+8UJtEgg33 jAERBlDyLAd8HJ9tqUKGDAIvdxBp72dhI6BIeEBHn/ZnDS2tzit79MnRpJaYmVxS67QpasHk+8v ez3Rz82svmoIdqGrcqQAPAhL2robuu23n3jF2FKk/+3Gtm02N/ASPMl2OOIcKA7cwItAnhPR8tj HWE9tOIxo1ytzTU8FbAWkYP0CIjKaXZgrxUsayYHRAYQgXdwgWbiAkwOxUNv7UWLrrTjs6jqqjZ 2jg5pydR7zbB6z6yoFmsCxIQ7qwQKTZT2E9IbJYRJSgtp+r6W5p9IBeVJVK/Zj4y1KFZ8qdvx73 u4QmnVnSwLunkINZzVc/yIwLwgsmHNEudc84eLOI70b4wdZ3o8UJxVui+YQsNBfRlhk5D4G6jgp +VlZsviVNtmLuj28zpUDNm/9LFbECuJv9BHoIFGw9ARWpqddvPiYtsXearaIzw9nrAvudNI+qMo t21LQwfHDw5No63rMpJVDUbAO793acxRsKJO431kPWibHmmVNyK+/YxjcJyvxoALBOvBe4YLzDI cSFxy+OY+xMp7DRFM9KNyL8CgVfqVCmy+ljf4DRW5QmndoWeTqiR3CzxgPrm8TUJ3j6VU1TlyTN ciIkcsznw2BlPNw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242472188158500 This can help create tests, for example. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- meson.build | 10 +++++++++- audio/meson.build | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 4af32c3e1f2..904605b844f 100644 --- a/meson.build +++ b/meson.build @@ -4070,11 +4070,19 @@ libhwcore =3D static_library('hwcore', sources: hwc= ore_ss.sources() + genh, hwcore =3D declare_dependency(objects: libhwcore.extract_all_objects(recur= sive: false)) common_ss.add(hwcore) =20 +audio_ss =3D audio_ss.apply({}) +libaudio =3D static_library('qemuaudio', audio_ss.sources() + genh, + dependencies: [audio_ss.dependencies()], + build_by_default: false) + +audio =3D declare_dependency(objects: libaudio.extract_all_objects(recursi= ve: false), + dependencies: [audio_ss.dependencies(), qom]) + ########### # Targets # ########### =20 -system_ss.add(authz, blockdev, chardev, crypto, io, qmp) +system_ss.add(authz, blockdev, chardev, crypto, io, qmp, audio) common_ss.add(qom, qemuutil) =20 libuser =3D static_library('user', diff --git a/audio/meson.build b/audio/meson.build index 23fb66d571f..a5fec14fb3a 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -1,4 +1,5 @@ -system_ss.add(files( +audio_ss =3D ss.source_set() +audio_ss.add(files( 'audio.c', 'mixeng.c', 'noaudio.c', --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243026; cv=none; d=zohomail.com; s=zohoarc; b=WgFzk5n58+lI/v8KEvaH5pA7BeBpoGNxN+JskG+l6MsjUxMI7c2ugOCjv6Ixbjgg20htpWybAAg9loaMpO/PSvAIgrUaffq00KcfZZwiYVLYBFHt+cblBIJaMXBrVfKozKAK3ROXOLYvmVYVXH/nS9OMbmhxfdP103fhHxT8Xu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243026; h=Content-Type: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=GBqAgB7LrCGMYNH0r4X9ORm6NR49Rz7X+bLJoA4G3bU=; b=PhRGCVVgcq+ogSVJiMlF9YUsgIdRfp6EfQtnn83LiVeGOZ7EeBNHPw3oKLuNWdQ64T+nZRpnGH5IiFrtGWo3GBj4dgbiVr9zKyUviqgoNLM0JQADNrGVIbdBIBGHjt6tyLwXCpBmOYnxK4tW37tcHtXbE/YgJjWr7CGGFqwT+aw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243026964414.208799443526; Mon, 16 Feb 2026 03:57:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwdI-0007il-UO; Mon, 16 Feb 2026 06:19:17 -0500 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 1vrwaS-00054L-JX for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaK-0007MO-PL for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:16 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-592-FI5tjmhYPm2FTWcH6gP5Tw-1; Mon, 16 Feb 2026 06:16:07 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 44FBF1956054; Mon, 16 Feb 2026 11:16:05 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 82D1630001A5; Mon, 16 Feb 2026 11:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GBqAgB7LrCGMYNH0r4X9ORm6NR49Rz7X+bLJoA4G3bU=; b=Tb88MYYbiu5sOG+aNp4g+te7fC8dKBVdLHumbseXX0D8oCAxJ/d6Rt/5zppRFzmnSTwEuj Sk7lZE7wl1b0CA3GyBGU4SoW3T86lnrhYWm0CaC1PVaNHxgfGI+w/2Kj0bcODuWvtM5pEL lCmZubbqiO9pCDztZM5Y3+jivoZ3XwM= X-MC-Unique: FI5tjmhYPm2FTWcH6gP5Tw-1 X-Mimecast-MFC-AGG-ID: FI5tjmhYPm2FTWcH6gP5Tw_1771240565 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:14:59 +0100 Subject: [PATCH 10/85] scripts/modinfo: add type annotations MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-10-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Yodel Eldar , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2026; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=5Hl18YRrW30PKleJRGv7L/P5HPSsWojpXhI13YBVZFo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOFBO2DEy9DCiSBBH6JrWUKzQ19rtPlAW3q hh/vhJqxwaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5TZFD/9OCmMWgXkQimmIu/VBagVrLlsqgce+i7mwDLu0NTXbuxuz57WTKX5X+q83E6w5JPI2TCU BEJxkB0YSE80BeeGVy0QqvZR++vRrzEIeiyhWbdJX88tZUPjjcOPbvU4tgzfZDJDJC4hjs+QIBE puLgCdYBH9JtPh+DKiyuMdovU5z+/XC+DffkvP8QhK817O0TAoAB66QXqxTVBP0q7dchPtOr1Jw k1H88MZ8jPKqDlHrAuRuv6hN1BEEKQKe+X/BzlNIJSdPcztUq2rhQeZshF9SPbhn+TIJlzh3vks bWUhyEU+rGE9NSG8cCKKGrrcFn46bm1gn/9YplwHTiSOW4xukT8y1ZYKEBSuvS9edOZa7uJR0EM Y2gthMqsMJes6VHq2AwpL8XGo+tAKQ/U6xKklOPEBIMbO+7Fd2Evp1tkTpYqmkXs30NEqXxMUFs D72sB+rFYmDG1zC+GGi27dyseDLpBggyO56E1ngyTykQQSNDnHGg9jBY9S4ZqzPtwYrEKvd51O4 6YefmW0KeiBnks3blymmVVz3yH3tO3ReMYdpWhi0tSG/kFstjYH3S3gTYlwPwDYBWAtGkDOhx1C 2vDTiw6dTIPGkyAPcIE+mC2nwRVENdlKIgnHDTbQDdNPvyfL9Gm27iDykgq8WpFyiJSXjh8ZL82 5ds0Z6g+Qq524Aw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243028283154100 Type annotations allow easier code reading, refactoring, checking etc. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Yodel Eldar Tested-by: Yodel Eldar Acked-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- scripts/modinfo-generate.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py index aaf23544c46..5a8abcae5d3 100644 --- a/scripts/modinfo-generate.py +++ b/scripts/modinfo-generate.py @@ -2,14 +2,16 @@ =20 import os import sys +from typing import Optional =20 -def print_array(name, values): + +def print_array(name: str, values: list[str]) -> None: if len(values) =3D=3D 0: return list =3D ", ".join(values) print(" .%s =3D ((const char*[]){ %s, NULL })," % (name, list)) =20 -def parse_line(line): +def parse_line(line: str) -> tuple[str, str]: kind =3D "" data =3D "" get_kind =3D False @@ -31,7 +33,7 @@ def parse_line(line): continue return (kind, data) =20 -def generate(name, lines, enabled): +def generate(name: str, lines: list[str], enabled: set[str]) -> Optional[s= et[str]]: arch =3D "" objs =3D [] deps =3D [] @@ -68,17 +70,17 @@ def generate(name, lines, enabled): print("},{") return {dep.strip('" ') for dep in deps} =20 -def print_pre(): +def print_pre() -> None: print("/* generated by scripts/modinfo-generate.py */") print("#include \"qemu/osdep.h\"") print("#include \"qemu/module.h\"") print("const QemuModinfo qemu_modinfo[] =3D {{") =20 -def print_post(): +def print_post() -> None: print(" /* end of list */") print("}};") =20 -def main(args): +def main(args: list[str]) -> None: if len(args) < 3 or args[0] !=3D '--devices': print('Expected: modinfo-generate.py --devices ' 'config-device.mak [modinfo files]', file=3Dsys.stderr) --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243935; cv=none; d=zohomail.com; s=zohoarc; b=AQJkwFJ7mFUc5/L+ucBqvGdK0KQACpAhbF8siEvays7LAZoiyFgk1rFt9ze59FHL2wqh+fBIz5z0NkmNcslS0FWRIzaWMIa7RptZu9bify1IUCbRtilcg0bY3VpPsA4DZ5vd2SceiS74T6GH28uqpcy8FEoj2Rfllzq8hzn910k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243935; h=Content-Type: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=DcRkDt70bkO+YZQKmaJcDHMEi8MiUA3/dOJCPeTuVkU=; b=Qt4+uKs4zGH2lVOrPj9wx0hbML7vV53QUPjxUls4VJdTfeh0lZ3q5vrotrYMBj8+TSgWGn26bIKJlqbd4PmB8k6xo9W4VA7k1fNyDYmDp/xLLmOl7Ab2yI8NkmWJG0uVPEDl8+/nCMYWyfd7FN4Rb9m55VIhcOQOSWkPpz48fnc= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243935171691.4997779401062; Mon, 16 Feb 2026 04:12:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweG-0002pI-BE; Mon, 16 Feb 2026 06:20:16 -0500 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 1vrwaW-00054u-Kg for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaS-0007N7-Cf for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:22 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-611-5RHoLEh0MVaTojp4SucqNA-1; Mon, 16 Feb 2026 06:16:12 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F31A9195FDC6; Mon, 16 Feb 2026 11:16:09 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9A12119560AD; Mon, 16 Feb 2026 11:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DcRkDt70bkO+YZQKmaJcDHMEi8MiUA3/dOJCPeTuVkU=; b=Jnh6sMHAnKB7jCvOJxYFIMC9T6BsHl9EHaEF8e+egZfBYiW55v3mU/lYdhXv1p7IeaQi6h 8zc30R/CI0Oo6UQz4xMhDex5VqWmdFEQi+oQ47M9iNOmHUvGPJRjrb7A6+2O0rTtd/96oZ fxmM7Ai2hmbPmJ07dCopGtUbpfmltwk= X-MC-Unique: 5RHoLEh0MVaTojp4SucqNA-1 X-Mimecast-MFC-AGG-ID: 5RHoLEh0MVaTojp4SucqNA_1771240570 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:00 +0100 Subject: [PATCH 11/85] scripts/modinfo: remove trailing ; MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-11-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=821; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=jO/uS3zWPerDiKB55gGBffN+gslwk9TYddoo2IYcEn0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOKyLebB9dbA3Yi+pm+Doa+X12WYuX0NNY/ hGeM5Wu3TCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5WYcD/9vGApJuOEWdD41azeS31nK7v5bhC6ySe5LF8ffctZu2LbZjH2c+AjAwHxKIYd8DtVAjR7 za6jHia2oL32mOgpksPgZ++Vw2pGLQn4HKF6abfZUdi7juoaOqnSUeWo9ubms40NtKiYUCN6SaW qr9WrqxBD4tBZgRfg2mrIt1ZKn/Wle8r9fEgevNihwJV/BWuovNQOTXAK387dpurpEK/30RiNQ+ oWrnt1qH0fccEEZQgkwwXwwdALYXxWzeokvILph2HLzGBNPiFlMTKp987XayrNjGl4Ck8DOXKDd AuvbSoyOXTtfZX987YM4qKp0LW7nx/IxPrNjtKB10ZoNhmp7mQ531YZrpwM+1WVy82flyBeb7t6 nb5MhxjyzBgFmsSEmW79uZAHteuy7Hs3BQOJv90gwjpmGOzOh5R7AsSZYrZs4lmm+D+0OEULn9c nEg7VayUaLGHTMWdKUa21jWGFrTP9y+fXHj0vffRq0aenUgRpT2zLyrrnYOF/33mZ7E5DriktCV Vg0O5bWAOHVer1x+l87LGcf9LJmISkLcA3ck1lcBCwhyJt+K9A/kn+9cIot2Ez3cvFwD7jRDjmd uHOQ6zpFVjYlCFWVRXQ8JBWhDDYT3pONYo8klZ2qHPg0HrZ/yvRPTwZERsfOsuHIRmhLPSCp3yl nIdi4inmHOfbb4w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243936210154100 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- scripts/modinfo-generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py index 5a8abcae5d3..83ffa4a7c52 100644 --- a/scripts/modinfo-generate.py +++ b/scripts/modinfo-generate.py @@ -48,7 +48,7 @@ def generate(name: str, lines: list[str], enabled: set[st= r]) -> Optional[set[str elif kind =3D=3D 'opts': opts.append(data) elif kind =3D=3D 'arch': - arch =3D data; + arch =3D data elif kind =3D=3D 'kconfig': # don't add a module which dependency is not enabled # in kconfig --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771240729; cv=none; d=zohomail.com; s=zohoarc; b=XBeuNx/BAgE5rPflXIKj2w8NriOPxiTmg9s0q0slwUDThn1M5d/ksGZwtCn3IRdQ0QBxznrKWnAGhLl43jrog5ZKXpZUokwbgFwxNlyEXO2fqY7+UMRXhfKCeLRatVQCMurcmRcoZSEs1bdOX1nfadkZBTWVDSSQah+qqjxGYKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771240729; h=Content-Type: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=0sXKT0Ld03CnuopYV5pr+w/M7OpGtHl5MthM69rARkU=; b=ZIe49aaPpeyuU1uw1+EUU0DVPkE/ILgtE5aGIx3gxoTPKdvj49KlaH5+Bmm2qSv1ViIKC0jPXYQKexIdJ9ovYC0G+qNjgEArkS/KclZb6zAK9rjgoZHo0pGVEUUsj6p/i5o6EEGRv/H6iMYoRWdklbv7440WxLQREsqzn1oOUGc= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771240729159215.03184777580316; Mon, 16 Feb 2026 03:18:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwcS-0006fb-5u; Mon, 16 Feb 2026 06:18:27 -0500 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 1vrwaY-00055r-GO for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaS-0007NQ-Dq for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:23 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-Ag8LUNY3MRi3FEsv_GoZjQ-1; Mon, 16 Feb 2026 06:16:14 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 85F45195605B; Mon, 16 Feb 2026 11:16:12 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D1D1F19560A2; Mon, 16 Feb 2026 11:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0sXKT0Ld03CnuopYV5pr+w/M7OpGtHl5MthM69rARkU=; b=I/XAuKkyYx5R8VHSZT3UiHlIA+5BQXa28m+Flo7YLfuyvDy2nfgXiBIdwvib7QwTiz6dx6 XtWtJX/PhX/dlCdnBIQjiaTA7geQ9Z86JYYSjrCqK8CqYHU/6GGA15iKcFHmNhiRWOe5He mk1RYTS9Rk22X6ZJm9CF9Z1dwNqxdKw= X-MC-Unique: Ag8LUNY3MRi3FEsv_GoZjQ-1 X-Mimecast-MFC-AGG-ID: Ag8LUNY3MRi3FEsv_GoZjQ_1771240572 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:01 +0100 Subject: [PATCH 12/85] scripts/modinfo: use in instead of find() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-12-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=797; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=BYuBcm8yqbptW3ccw20FEhHC025s0WWuO9BYWxMZccM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOW3fW0h8Qt2SJjOnGcrsWj4HJDx1rnrYGo CMA4rZskXyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5YDSEACWwGiKgwI19n8KTNKWNjJ4hSu0kE/dNUnCsDfkJn+XQRJ1dWSkV8w8+ymtR+s15fYYl6b j/XDxRIPTq+uJxar1XZL2L2pJR2tF1X5FYbm1SxbrzfNGXaVzm3nHRPtzP26KN5R9JB09Eqfk4Z 5nXXy3Zt/KX9NTXlyNi3oZDPvrpl3/SZSuCq5Yj764GnPnu242dYBXhmErSzu6DmVz/cPT6DP4O zAgSC65Y7AM8doHcrkBAQhoglAqEOMJNcIBbjGhfiA5YGvsDaCEQNjrxkhKNJ2LGIgoA4lWzRgV 3HVH4Mjh345Ytqc+XfOBBd9UZ3UvnGWQ4LBgv1Ahhp+1AKPMMhRBoJthdeMGKCFGxCNqHpL6nAm TzNsElkyWUjgOWEm+W6ezr0rcHro1vq+aNSZkoFzzFizcXlfycZJWUuKjGBBJASDnawq5C84WeL BDmUs+oZlK0hcyjhlHiaNsoyKY+mLKhjhXAvpfsFhTYKl0taBUX3DBSsVPYroenfjHKiq9gaT0Y iofUwdg/BQW3IlxO4PRg/tqgXVEYRaScre6OMO5fYUlRKwIorVdk6/QPZOFwLY6+yRfdPoFayzn 8vTMi11TVf4TE7zAFUtmw2YiKCgaJtHRo1O8MHwoP4wZJWjnQWnvhXnLG9wYz7NUnyg8Gcjkgvs 8G+lsOdxbu5Ox+A== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771240730157158500 Minor style improvement Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- scripts/modinfo-generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py index 83ffa4a7c52..63093a0f820 100644 --- a/scripts/modinfo-generate.py +++ b/scripts/modinfo-generate.py @@ -39,7 +39,7 @@ def generate(name: str, lines: list[str], enabled: set[st= r]) -> Optional[set[str deps =3D [] opts =3D [] for line in lines: - if line.find("MODINFO_START") !=3D -1: + if "MODINFO_START" in line: (kind, data) =3D parse_line(line) if kind =3D=3D 'obj': objs.append(data) --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244349; cv=none; d=zohomail.com; s=zohoarc; b=L+Qamnm4q7fk18abMJPCwSipxWLuYG0ifj90AWwuJpvnBsX3HuXWqcN1Jn6KfcvRxdGQ7av/BJ1eKZIAHWRQwsXND7wDngYyQ9f9YNjS/7LbZm5qJuHXGW2b811MhB9Hk++usiuNKa3x96me/OG2jZaQohvKni/kyq0kPSEXcgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244349; h=Content-Type: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=8Pvu9sPNY0tMfaU2ZV+9MViXpKMjnpndfyaKXMmfEhY=; b=VRSE7a9Y5aQVWBgm4/wKrMSbLCCT+MAf2tmMi1o0v42Zym6SoBa2gWHQfcIqu5/O+iTdZecuHDxri1LjcvPEiSARIhsCRvlcmJf91678OwJj/qXj8UaubV4Zzv/J88IsWIO9IIpskywTLPl7yEIoLZVSoShfivtgXoeSLm6CZiA= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244349739809.5321984790675; Mon, 16 Feb 2026 04:19:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwcp-00075u-Qb; Mon, 16 Feb 2026 06:18:48 -0500 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 1vrwaa-0005Au-4a for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaW-0007O6-Au for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:27 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-pnl55yZ8MWulEYuE4IEaVw-1; Mon, 16 Feb 2026 06:16:17 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 96E5F1954B07; Mon, 16 Feb 2026 11:16:15 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5616C18003F5; Mon, 16 Feb 2026 11:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Pvu9sPNY0tMfaU2ZV+9MViXpKMjnpndfyaKXMmfEhY=; b=W5f+pcsWTAC9x/OnF3J8qbL1OWGhHug8X2CRPLeKU0JIImtG90qrgS+47Ovbk590QEq/jz UlaQGAdIrMEZEkKWrGT9idaOKmKUToQGL+UMELaAsjZsEA5Q/Gs/Bdaq3Xpy34h3EnmbST 6JbrjUVYAkDlD8KG/JhlbfegaK5CRfw= X-MC-Unique: pnl55yZ8MWulEYuE4IEaVw-1 X-Mimecast-MFC-AGG-ID: pnl55yZ8MWulEYuE4IEaVw_1771240575 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:02 +0100 Subject: [PATCH 13/85] scripts/modinfo: use f-strings MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-13-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2413; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=6PlmzXnbqXoosgARgagqlx0sP0Vfwn0BB6rG0yq1OTU=; b=kA0DAAoB2ujhCXWWnOUByyZiAGmS/E7IT+AiivzWxJ5/k1ojjI9agX6/OR2qrMSpBZDldvWi3 4kCMwQAAQoAHRYhBIepvZM/h8YG0nb2Ldro4Ql1lpzlBQJpkvxOAAoJENro4Ql1lpzlbPkP/1Le IV2RB2XQ8S8T0Z4eOD28taggz8eeNA7/y0AoE8PoySxW+NL1t/nn6oMwr/HW8XQ2uxApoygq0Qt Rwfq5Y2PZW7xG+6ZI8Ew4E7VWJNOpA1Om9S0NYBs0zqfKsmbr55fqf9EWSalRp+70Sja/0XLXTn pXzTqD59f/g5DZXxznz7lXzw1zChWlRf/GVsbON0Rp7vLChbgEVif6AV7W/4iKXPLPG/Cq7ByOb 3VwJr0R4WL9Kolo0uhor7cYIriaAnR62zpKWhfJUjHvg/DAxTJrEWCNViTk4dLIZHLFDeamalBC Z5x2zY7mpGYctwoMSMMAnqDhnD1NhjTq5BZjGIcqFfGO9qabBMuq011pEg5s0RLxa61DGsdU5yj +3XQeicR/pRb0DgLc7vq/rJqrhrPZ5syyn4Sq9j9s0Yr6LRkIsVBwq3HXrJiWq7cqGVp1EZMuy3 +TjrY52v+WPMTtt+ORH6unmPf7/XMf3Fk360BRir0a7EeZTTxewCMwd49Oz1X8TVBwOADdHbezj c6QNcZRZo4VZwuRpmk9bpzqF/y+n1a2rbD4yI8ip5OylF3rhh/onLkmYe47H1OOqmuu/T/WejCU T9vMXDdrJ2BBiDvcfn5VMEO35Po+EeyrF+8ZkhfQjfGpWacfTihO57UMXBFaxlN43nvFxGmVEEp /Dr6e X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244352191158500 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- scripts/modinfo-generate.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py index 63093a0f820..8011c842caf 100644 --- a/scripts/modinfo-generate.py +++ b/scripts/modinfo-generate.py @@ -9,7 +9,7 @@ def print_array(name: str, values: list[str]) -> None: if len(values) =3D=3D 0: return list =3D ", ".join(values) - print(" .%s =3D ((const char*[]){ %s, NULL })," % (name, list)) + print(f" .{name} =3D ((const char*[]){{ {list}, NULL }}),") =20 def parse_line(line: str) -> tuple[str, str]: kind =3D "" @@ -53,17 +53,16 @@ def generate(name: str, lines: list[str], enabled: set[= str]) -> Optional[set[str # don't add a module which dependency is not enabled # in kconfig if data.strip() not in enabled: - print(" /* module {} isn't enabled in Kconfig. */" - .format(data.strip())) + print(f" /* module {data.strip()} isn't enabled in = Kconfig. */") print("/* },{ */") return None else: print("unknown:", kind) exit(1) =20 - print(" .name =3D \"%s\"," % name) + print(f' .name =3D "{name}",') if arch !=3D "": - print(" .arch =3D %s," % arch) + print(f" .arch =3D {arch},") print_array("objs", objs) print_array("deps", deps) print_array("opts", opts) @@ -100,7 +99,7 @@ def main(args: list[str]) -> None: for modinfo in args[2:]: with open(modinfo) as f: lines =3D f.readlines() - print(" /* %s */" % modinfo) + print(f" /* {modinfo} */") (basename, _) =3D os.path.splitext(modinfo) moddeps =3D generate(basename, lines, enabled) if moddeps is not None: @@ -110,8 +109,7 @@ def main(args: list[str]) -> None: =20 error =3D False for dep in deps.difference(modules): - print("Dependency {} cannot be satisfied".format(dep), - file=3Dsys.stderr) + print(f"Dependency {dep} cannot be satisfied", file=3Dsys.stderr) error =3D True =20 if error: --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242608; cv=none; d=zohomail.com; s=zohoarc; b=gl9p5CBDRnkFlQUA9dn6sFbiZvgnwJTYXSQ9i1fJ02RHU4XKMDHG/qg3stJjqbVgQeJJzf2Fvwa+9yBgIF6ZCSq5JqhvaNxaOF+QKsXEGkA0kmeuK7b36hiPZKRU43Kz4m+y3hxOwNJp5asMZpnu2Pa/NsADMxg+BE0Ul9w7Alo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242608; h=Content-Type: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=lTkiQYWm5xuq4+X2pL9s+wlSjm2scNT6GBeBn7FnNBE=; b=msG3N9DxdWgSd1qjFc8Z8cmiXiMUQzSNXke2MvhWWCXyXxFNS4ekPKEeTUTtpoQqrp56AyE7nNR+WVoaInMwc6H5dTN7IxhkDCsxA5KeQYg/2XCGXgJZ+/zg8wBc3en2PyeTctW0eZ/jv4Bd2L2sNb8kODcf2eKhkfy8rXG5VNI= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17712426085911019.429119289108; Mon, 16 Feb 2026 03:50:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwcV-0006gk-Iz; Mon, 16 Feb 2026 06:18:34 -0500 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 1vrwaa-0005CS-VP for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaY-0007OU-98 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:28 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-449-dW163pPLN9qyjDaw4h8kVg-1; Mon, 16 Feb 2026 06:16:20 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5CC8918004BB; Mon, 16 Feb 2026 11:16:18 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B648719560AD; Mon, 16 Feb 2026 11:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lTkiQYWm5xuq4+X2pL9s+wlSjm2scNT6GBeBn7FnNBE=; b=aKQ9r3t2t9zMY9orV2cUDS6XgIv2FSNRNoBfOMPGT7ZuBELTx77+qSi+WIu6ooQ358HH4I C9NgR89P490zCLmIgVP1NYXqow24U04PNfNzbVFLU1vToriAK8IWU1P0ATivN7z1UxracG 0NgJBOPaus4HlG4z7aoezPI+OaJywdU= X-MC-Unique: dW163pPLN9qyjDaw4h8kVg-1 X-Mimecast-MFC-AGG-ID: dW163pPLN9qyjDaw4h8kVg_1771240578 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:03 +0100 Subject: [PATCH 14/85] scripts/modinfo: use argparse MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-14-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2141; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=uHM8i5gf/zzsBO3Kh9KkNMm19zV45EUZ0obNueX90RM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOH/nUyiGANqnJl0lpVEmXIA13RQcePg0mV tRgOYRXje+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5ZuBD/4oN+R8DrwkF5AZJcF8hNM251PNwWLImR++7+b8SzneLnJpCIRzAOa32GfGjJRpz/Hgbs7 bWLWdTlvjaA/sXAKTkODXEYCh8AdQry56n9TaZQ8JRI6yysHrVju5AlOlLoyeXTzyEfn/29r/aj uhOr2vd6tz56r37amNnHnLNJ9S6qvOCpla+fhunhQLp/qe91ouuxM3PRPyoOU9p/cKu2Lg/JV+h jOyczxjCYxEkxh3zF7Nb6P5zfKlp3UjyfcE8D2esa7xN1gVAwcKIy6VMFpsHDsKPNRvqz+CUSHi A2DCvVhCnhZs8NocXOPATLANNEWLr7m55w30EVvafH5MyblcqgCdUb4Jen5u6aT38TXknmZFn/b xqjCgRn37HRJFIf+o8pxhABay0dTDl04+vkbXxPI3ffcI7JP2rU69ayd4NhWtdOIpNOL1f/Firj iO3rlL+RNHQmNHulA2+8BJDZ7rrf0Zk8Xe83jJ/7e7FdqtIiib3DQGnQZj8X6bk7CG+z+VCS+v7 rt6tqT85rZHmjX8LBVxn+JmF0TKdKcmlCz6ZXWFok64/apAY6SOW5LCYdJXhrBCVGoMODuyES88 IKnNrdLr5r64fcyjPnQIZVGdla5VG2Vb1wW/nD6ikej48nGPC2I0jBQ6af7dK740gd6eMdhcPr5 6i95ORloydmdbdw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771242633755158500 This will allow to tweak argument handling more easily next. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- scripts/modinfo-generate.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py index 8011c842caf..777d419aa33 100644 --- a/scripts/modinfo-generate.py +++ b/scripts/modinfo-generate.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 =20 +import argparse import os import sys from typing import Optional @@ -79,24 +80,28 @@ def print_post() -> None: print(" /* end of list */") print("}};") =20 -def main(args: list[str]) -> None: - if len(args) < 3 or args[0] !=3D '--devices': - print('Expected: modinfo-generate.py --devices ' - 'config-device.mak [modinfo files]', file=3Dsys.stderr) - exit(1) +def main() -> None: + parser =3D argparse.ArgumentParser( + description=3D'Generate C code for QEMU module info' + ) + parser.add_argument('--devices', required=3DTrue, + help=3D'path to config-device.mak') + parser.add_argument('modinfo', nargs=3D'+', + help=3D'modinfo files to process') + args =3D parser.parse_args() =20 # get all devices enabled in kconfig, from *-config-device.mak enabled =3D set() - with open(args[1]) as file: + with open(args.devices) as file: for line in file.readlines(): config =3D line.split('=3D') if config[1].rstrip() =3D=3D 'y': - enabled.add(config[0][7:]) # remove CONFIG_ + enabled.add(config[0][7:]) # remove CONFIG_ =20 deps =3D set() modules =3D set() print_pre() - for modinfo in args[2:]: + for modinfo in args.modinfo: with open(modinfo) as f: lines =3D f.readlines() print(f" /* {modinfo} */") @@ -116,4 +121,4 @@ def main(args: list[str]) -> None: exit(1) =20 if __name__ =3D=3D "__main__": - main(sys.argv[1:]) + main() --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771241636; cv=none; d=zohomail.com; s=zohoarc; b=G4SdxIoj5xxu/rW9hZTEZfRWIFhhIX1blE8pnmrIO8zQEkq+hwYmtryEUHupSNa2sW1ClkztJlQkdp6ouRVyXtWyzEvDJ91wpYivyRggQpoirFUgrEC9H4tW+AH+gSr6Fc2ppiNpU7ZnJwebk9cCT3r2Zl9Cn8SV7IYVO4OHJ1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771241636; h=Content-Type: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=VWwXEZKR8bIUCXjig+DEu3oAcncqyWxdQ+X9NJASFtc=; b=GXxSgqV+eqUGQbZtvo0pwT2BLnodqmqNskOmgnfVB4h3xOizpnq917rYmpHBdgKDWvM5H44++2TmS/rvgGRZ89gfiM7O0DO4bsR4eLwExAS6s9nuLpzhNZr3krb6Md1m0OfPStbuauH9M9tDN3QRVt2iIekok7Ui9E3X1SSaHvw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771241636362169.90091826183902; Mon, 16 Feb 2026 03:33:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwbu-00064x-Pe; Mon, 16 Feb 2026 06:17:51 -0500 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 1vrwab-0005Cb-F4 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaZ-0007PL-TZ for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:29 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-487e-6n4ORCq9ZDgnnCNzQ-1; Mon, 16 Feb 2026 06:16:23 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 260EA1955BC4; Mon, 16 Feb 2026 11:16:21 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3108230001A5; Mon, 16 Feb 2026 11:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VWwXEZKR8bIUCXjig+DEu3oAcncqyWxdQ+X9NJASFtc=; b=WkYCMoh4iqEXHWgdIeQcsFdKRGpRyuK6gtJsz50oXxuB8ofYmn3tUjKwC0uY1IzyMscsRA WEukbbqKy84wqU+aplATqmTpfG+d9rv60c2cOLVkoxTCdq882L9dcQWwL5/mKVAGA9E58Q jgr7Ie/T4ji+XRV9eNlYECJt8TnO/zE= X-MC-Unique: 487e-6n4ORCq9ZDgnnCNzQ-1 X-Mimecast-MFC-AGG-ID: 487e-6n4ORCq9ZDgnnCNzQ_1771240581 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:04 +0100 Subject: [PATCH 15/85] scripts/modinfo: make --devices optional MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-15-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1601; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=vHmD8YiBcGDbQ2SbYzxegTM9eh7UnvCnb+I1yQPLiVo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxO6L4Tlq/kBFHJX5uKWR5IIa9MbvTbXCTp8 YJbfdF+jJiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5eAYD/9hk8Az3YibcxpxTj3m7wxkG/kaEZ+TOfc+bFVjBb3PFKgN1u4wUnyiFTr21YhEhuXsv9e WtFYquEpEqJQSrXXEuSa8OE8Xew8cW5n0ppukijq9z5Pi5b0tiwJFCiSExH5WPCjdzJxz2LVJd6 N7HATa80A1Ci+6LQigbuEFKpp2G7sW/ExX71MbAqs2h5bbeBdF9mOPpXUYoRKq8b/0ftQBeTSSG 40/kslYMgZsfGcygyvKhPZGL5PMpjd88Wwjr8eJ4BoPAnYoGQ0YpifJ1UPMtUS9alQRr8nPeGH9 PzbcMx1NP4/oWDVnVzlKECHrl4uJnfkr8BLPrc0vVzW52lYxQCnKrEW0PUppVmuH2UH8+fo/65A /KqwnRAYhAEmV/uy9ir5rJwiSSEHwfVNDtQzuUcabiLyteZZOiRD08xjRQSjeLDtVuPlzfapfsl jF4HdG977t2TRvIupBsv/+NBCrynld5yVSpxbbJoGik2OesVe4dalCEzG0YTJf8qBWDzItQKEdC KU9kYgCPUMA98FwDH8n3howQk00ZnlBaez+TDGM2dQi23QCivUb8vDfwRHybllTWTyB2olaXSzT fdFDuD/UorxeYJKvNs5qR4IjZKXh3h/jYZwu2wdY+Ywz5whXot8PRkUT5kIFRzsdrOWsLpuMor8 hC9MNyW+35CXRRg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771241638900154100 This will allow to use modinfo-generate in cases where devices aren't relevant (tests etc) Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Mark Cave-Ayland w Reviewed-by: Akihiko Odaki --- scripts/modinfo-generate.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py index 777d419aa33..e7d35242414 100644 --- a/scripts/modinfo-generate.py +++ b/scripts/modinfo-generate.py @@ -84,7 +84,7 @@ def main() -> None: parser =3D argparse.ArgumentParser( description=3D'Generate C code for QEMU module info' ) - parser.add_argument('--devices', required=3DTrue, + parser.add_argument('--devices', help=3D'path to config-device.mak') parser.add_argument('modinfo', nargs=3D'+', help=3D'modinfo files to process') @@ -92,11 +92,12 @@ def main() -> None: =20 # get all devices enabled in kconfig, from *-config-device.mak enabled =3D set() - with open(args.devices) as file: - for line in file.readlines(): - config =3D line.split('=3D') - if config[1].rstrip() =3D=3D 'y': - enabled.add(config[0][7:]) # remove CONFIG_ + if args.devices: + with open(args.devices) as file: + for line in file.readlines(): + config =3D line.split('=3D') + if config[1].rstrip() =3D=3D 'y': + enabled.add(config[0][7:]) # remove CONFIG_ =20 deps =3D set() modules =3D set() --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243327; cv=none; d=zohomail.com; s=zohoarc; b=Uer5doItpjhOyUz8SwwRUQs6n/fdWCYbVu+gigFMgkeLQZjPnqqzlcZ10G6ptvrKW+puMvmGd5XWpymIi9gDMyWYl1IH0xrj0InVQ2B9bq+NyiS1sq7AhjbU5sOBffTf8IrkMfZ7SyzwVvpnVKqbj+EJaFJqAaaAWkXnmN2j/b4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243327; h=Content-Type: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=KCugop36CLelcrOMKIrKRT8HBbv47hNoq//wkZ62yVs=; b=asuRg82Gxj15r/ap/J8kxXh+cNoWqdDZGXHCgoXtEBvfKnIzJRCDDnnCxIGmSi3VQcYpLiudn8tM1p1eLyf+VaJ/HGG9u7LfsA7wAUDpCQEWry8o6Y2lLufvEwlpaSYKXKXUMAHj7zGFZFlCWpYk5U8MJBysk5z9WwUGLYCaMb8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243327623443.35651739349316; Mon, 16 Feb 2026 04:02:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwdW-0000GO-QR; Mon, 16 Feb 2026 06:19:30 -0500 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 1vrwaj-0005Hs-Tx for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwad-0007RW-Gb for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:32 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-112-mWSuph5cO9-5d6ohy55CpQ-1; Mon, 16 Feb 2026 06:16:25 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AE85B1800365; Mon, 16 Feb 2026 11:16:23 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1262A30001B9; Mon, 16 Feb 2026 11:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240590; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KCugop36CLelcrOMKIrKRT8HBbv47hNoq//wkZ62yVs=; b=Ca+erjM2yp/PiFS1jEuPyWh/BVf/FN4SSJ8HNfho1ZukNCvE+RMK7s4Mfa1gkZsNKlB8J5 jFLWuUlZW1o9hXxUG3t0pGowrA4fmUrlp+Do5YEhzG2G4oQQ01HnjzzM0j1dwXEYlErWT0 6Gr2ArKuuB5CzZZYfk6sYevHSlM16Ik= X-MC-Unique: mWSuph5cO9-5d6ohy55CpQ-1 X-Mimecast-MFC-AGG-ID: mWSuph5cO9-5d6ohy55CpQ_1771240583 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:05 +0100 Subject: [PATCH 16/85] scripts/modinfo: add --skip-missing-deps MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-16-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=5639; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=ygcT/EP4LKFFbInc5HK8ho4Iw+AmP0MuGXSJiZYYmoc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOHXNZrYPKLzyeQ8z6X6VU5BDpOUyVsw41/ lYzr9uHeLKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5fOoEACgLqwVa2Yp4SD81nT3uP6DNRwMv/bm+MDEtr03Tx3ZpY+cbGI9AqrnKs+PZXvncHYc/2X xNBAGp0uSQjaqqtYp5aG2QySNKk4rzm2woekbwTAyxZqqGd4uyVoA9hy7nhdbhqd0KlDojH5nEZ 3XlgBUTReQXcu2FS9gfwWuyl3KAMl2yBNvbMPjy5wpKDTe1qXdeKMEz1awemtRfR6ZL9xQlllSm HvpJVmhoxBrAmyCt/6ai4HAKMsev/TLAdahGsDnUgWssGt+ClYyUU2emrZjJIBPwVIKYOgG/yiH bvhaTZSK9eNORZ4SdBrxQEG4b0kna1P3qBUXb7B81fJl+5CsfgloftTDPC7+eLYPyIlWdHchKpt z1UyQMNMbzXorpK/UJWzVs5hFX+lKBrnWAX0Myi2L95391uDWc8/FMTE7/QNgYvInnZU3KkJjy+ k6vRD+Uii4YLWW1dgD0nwxilI+B6+1/H2sC3GsDHHZWUYyb2vlQZg2ToxoprAn/+2zeeq9GcTnV lNi+UPlD4IXv+bKk/Qb7D5PpKiSOvphPjkez9Yd4VQl7BNJ8dTJOeIv/cxJHBaZKjXmw40rEvOn OH9eWKy2JU7tMetm4ZjB4L5S/FflfJblgGv0s9b5o/ttsF8nw39j6x4AuFoDFz31CUZviLJAzw+ JHQyglWo+elR1bg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243329032158500 Add --skip-missing-deps flag that prints warnings for missing dependencies but continues without exiting with error code 1. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- scripts/modinfo-generate.py | 94 ++++++++++++++++++++++++++++++++++-------= ---- 1 file changed, 71 insertions(+), 23 deletions(-) diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py index e7d35242414..e231c129196 100644 --- a/scripts/modinfo-generate.py +++ b/scripts/modinfo-generate.py @@ -34,7 +34,8 @@ def parse_line(line: str) -> tuple[str, str]: continue return (kind, data) =20 -def generate(name: str, lines: list[str], enabled: set[str]) -> Optional[s= et[str]]: +def parse_modinfo(name: str, lines: list[str], enabled: set[str]) -> Optio= nal[dict]: + """Parse a modinfo file and return module metadata, or None if disable= d.""" arch =3D "" objs =3D [] deps =3D [] @@ -54,21 +55,39 @@ def generate(name: str, lines: list[str], enabled: set[= str]) -> Optional[set[str # don't add a module which dependency is not enabled # in kconfig if data.strip() not in enabled: - print(f" /* module {data.strip()} isn't enabled in = Kconfig. */") - print("/* },{ */") return None else: print("unknown:", kind) exit(1) =20 - print(f' .name =3D "{name}",') - if arch !=3D "": - print(f" .arch =3D {arch},") - print_array("objs", objs) - print_array("deps", deps) - print_array("opts", opts) + return { + 'name': name, + 'arch': arch, + 'objs': objs, + 'deps': deps, + 'opts': opts, + 'dep_names': {dep.strip('" ') for dep in deps} + } + +def generate(modinfo: str, mod: Optional[dict], + skip_reason: Optional[str]) -> None: + """Generate C code for a module.""" + print(f" /* {modinfo} */") + if mod is None: + if skip_reason =3D=3D "missing_deps": + print(" /* module has missing dependencies. */") + else: + print(" /* module isn't enabled in Kconfig. */") + print("/* },{ */") + return + + print(f' .name =3D "{mod["name"]}",') + if mod['arch'] !=3D "": + print(f" .arch =3D {mod['arch']},") + print_array("objs", mod['objs']) + print_array("deps", mod['deps']) + print_array("opts", mod['opts']) print("},{") - return {dep.strip('" ') for dep in deps} =20 def print_pre() -> None: print("/* generated by scripts/modinfo-generate.py */") @@ -86,6 +105,8 @@ def main() -> None: ) parser.add_argument('--devices', help=3D'path to config-device.mak') + parser.add_argument('--skip-missing-deps', action=3D'store_true', + help=3D'warn if a dependency is missing and contin= ue') parser.add_argument('modinfo', nargs=3D'+', help=3D'modinfo files to process') args =3D parser.parse_args() @@ -99,27 +120,54 @@ def main() -> None: if config[1].rstrip() =3D=3D 'y': enabled.add(config[0][7:]) # remove CONFIG_ =20 - deps =3D set() - modules =3D set() - print_pre() + # all_modules: modinfo path -> (basename, parsed module or None, skip_= reason) + all_modules =3D {} for modinfo in args.modinfo: with open(modinfo) as f: lines =3D f.readlines() - print(f" /* {modinfo} */") (basename, _) =3D os.path.splitext(modinfo) - moddeps =3D generate(basename, lines, enabled) - if moddeps is not None: - modules.add(basename) - deps.update(moddeps) - print_post() + mod =3D parse_modinfo(basename, lines, enabled) + skip_reason =3D "kconfig" if mod is None else None + all_modules[modinfo] =3D (basename, mod, skip_reason) + + # Collect all available module names + available =3D {basename for basename, mod, _ in all_modules.values() + if mod is not None} =20 - error =3D False - for dep in deps.difference(modules): + # Collect all dependencies + all_deps =3D set() + for basename, mod, _ in all_modules.values(): + if mod is not None: + all_deps.update(mod['dep_names']) + + # Check for missing dependencies + missing =3D all_deps.difference(available) + for dep in missing: print(f"Dependency {dep} cannot be satisfied", file=3Dsys.stderr) - error =3D True =20 - if error: + if missing and not args.skip_missing_deps: exit(1) =20 + # When skipping missing deps, iteratively remove modules with + # unsatisfiable dependencies + if args.skip_missing_deps and missing: + changed =3D True + while changed: + changed =3D False + for modinfo, (basename, mod, skip_reason) in list(all_modules.= items()): + if mod is None: + continue + if not mod['dep_names'].issubset(available): + available.discard(basename) + all_modules[modinfo] =3D (basename, None, "missing_dep= s") + changed =3D True + + # generate output + print_pre() + for modinfo in args.modinfo: + (basename, mod, skip_reason) =3D all_modules[modinfo] + generate(modinfo, mod, skip_reason) + print_post() + if __name__ =3D=3D "__main__": main() --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244535; cv=none; d=zohomail.com; s=zohoarc; b=lYqv0QiymULhWQ05Jlisj04O9R8LgM7ewkL3J7qr+ACVWzFHbJyMPy/YD0QzxBFmEl75c9SYxPKzMyvXljnTfyszth219xdvX39H6zQ6zP0+NrB4xs4hHPjDwrHQMiMRJBxhQjozArOLYh4xyaTNlEIWNpIGI0Thls3wnA1lqC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244535; h=Content-Type: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=PiNp7Bs6o58noepSb4ZJhulxFQccOR3mrQTA7FuQtxU=; b=iEfFjZOrkv93xJU+YGyOMhyP8kvzlK1lL47mUe/8iMNysKUj/99o4Io0vrRxNMuiACiaN5SmQh+3mB2yOOtjucHH6rGrDJ/C8eCCoy1NJVNEEOpd8H/hD1JhobZTPJD4Iv64gDKFQpx6eywh3J2Ux9ClIjQar8WuNtmYLwLH7f8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244535583528.4089820610608; Mon, 16 Feb 2026 04:22:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwch-0006rr-0D; Mon, 16 Feb 2026 06:18:40 -0500 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 1vrwal-0005Hv-PV for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwah-0007SD-RO for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:38 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-136-oy1fdGjvOtqU4u2GX6kfGA-1; Mon, 16 Feb 2026 06:16:27 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EA4DE1956094; Mon, 16 Feb 2026 11:16:25 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4BB8D1800464; Mon, 16 Feb 2026 11:16:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PiNp7Bs6o58noepSb4ZJhulxFQccOR3mrQTA7FuQtxU=; b=G21GSbAUcFDl6iOiLUJclM8ukwWdWQk9H7uY70dIG1s6U+Egi1Gr28QlRKyC/gJiQ88K/6 /YLatecIoO3PVef4MqTCL/M97QaeN0IB/VEjDeZJlE3bNl8msDicclLmRZuvQDb419a06J kYEZhATc0i74hjwk1F5816W4gDoU2Mk= X-MC-Unique: oy1fdGjvOtqU4u2GX6kfGA-1 X-Mimecast-MFC-AGG-ID: oy1fdGjvOtqU4u2GX6kfGA_1771240586 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:06 +0100 Subject: [PATCH 17/85] util: add some extra stubs for qemu modules initialization MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-17-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1129; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=0p2rFVhBpMNMUs9tMxnvfxcuRtuYlOuGuoE7FxD6FmI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOsm+4rwYJX7KYrAbNHOW4N3InH5fom7+BX eFgmummRU6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5QEgD/9wts+kf9cQB0JcrXewmZmcdhJGqAwHKP6qiMmshyK2fQ1Dp6Kl1IXCH7r3cZ6IQJluCq+ GoZADxmeKVBsYSENAbKtn8eyamOm6W56xtXkS5YBYmVZWk0VlsWhqrMrnZQ2P9JEjjp2qZDPIqD JkyVF2HdYfxzjWmO41rSM9seLWdvUdB/weDz8DdH1KbPSAM62NxYMXDegTkDEmxU6ykuE1Pb+ml eDgaXI5ygJLxmPk56GVvR/LEqSAShWK6sZe7HMfZKDrzRslq9eOtSiGPnWE8J9GHLZ1Vx0amPpd bTgzokFBsyFM4l1owuJAU34If3uvYlvXC/NeRpvm1W/UIZ9sgj9BIraRx6rty6rgJqfevokbxYt kN1SLaziNHPW9HB7W/iyzxhgt6dG9xPBwW6EGVwlTzqoagT/lffaDj9lUW+h0DkEt9J7VU02v2R ar4vK0IBqPfzl9OnYIPODyHb+G0I3gieEBbCW5TCZlSY+qo6WWLOWUYqJHarS5xGcLAC9UzHJJ2 erNduJcoW3Qa8AZ2iCq7+We6jn4y7OZVf7539ONqATZaUsZk3WLXV4ZbPCZQiWVQmaO9l1wj/Qw uldMmisPUy0WWqsjGe4k+zbai4AT+90rYV/Du4A5xjVVVud0azCaPVbCs3M/2+Z05YuAScSFwoD Y+/okbSk7FfQpGw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244537246154100 Avoid extra ifdef-ery when optionally supporting modules, as done in audio-test (and vl.c). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki --- system/vl.c | 2 -- util/module.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/system/vl.c b/system/vl.c index aa9a1550417..3e341142a0c 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2889,10 +2889,8 @@ void qemu_init(int argc, char **argv) =20 os_setup_limits(); =20 -#ifdef CONFIG_MODULES module_init_info(qemu_modinfo); module_allow_arch(target_name()); -#endif =20 qemu_init_subsystems(); =20 diff --git a/util/module.c b/util/module.c index 1aa2079d013..09dc43f51eb 100644 --- a/util/module.c +++ b/util/module.c @@ -396,6 +396,9 @@ void qemu_load_module_for_opts(const char *group) =20 #else =20 +const QemuModinfo qemu_modinfo[] =3D {}; + +void module_init_info(const QemuModinfo *info) {} void module_allow_arch(const char *arch) {} void qemu_load_module_for_opts(const char *group) {} int module_load(const char *prefix, const char *name, Error **errp) { retu= rn 2; } --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771245870; cv=none; d=zohomail.com; s=zohoarc; b=VP3CNFADHcQ0gS5Tcu7dF/1dj7H1AKhopSSK/PI+fj+/vkisdONrcItbgfWjvBFoudLEEetUjB1ZnU8hVTQvABGkMq+dcrNTctbjAEckO07CP9IEhXa88aQhJC4lp2f2JmlKzD3av1H3pAzULF8LQSn0LXrzlErHh3n+7du3tEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771245870; h=Content-Type: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=U3xIBvN95qHXHsq0xoLiJzxgBouxPOGkc64oTCZAQok=; b=VbIbHtehoMGRN+pMorG+M5+gv/WVDa6ZX4J8Apl0cqkDmILCW7SB0DLs4EQuOKH0URR8GEXSnPZVW01cBv8YtKJMMgWhH+jIHi6palmsAQogsGtNbCS2GpoQxWAhNlVyezI/+50ORtOCn9rZ+QbjVuHmqAg1ZNO4KspwaiPZlis= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771245870496697.3436643906718; Mon, 16 Feb 2026 04:44:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwdN-0007vy-1P; Mon, 16 Feb 2026 06:19:22 -0500 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 1vrwar-0005JS-PG for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwaj-0007SO-Qo for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:41 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-198-MpXdyA5NMDqOWILfKIiQ1g-1; Mon, 16 Feb 2026 06:16:30 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 736FD19560B2; Mon, 16 Feb 2026 11:16:28 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BDD2430001A5; Mon, 16 Feb 2026 11:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U3xIBvN95qHXHsq0xoLiJzxgBouxPOGkc64oTCZAQok=; b=d3p8cYqSWfU9hLFluTMOmAp6Z2o0PR5FZlFnKePiBBJqmwwNclP0kJD/9TTFK5rHkzb+CM daeR2ljOn4tcnhpKBlfiE/uu65HRM7IyXAru64iG+bxGMYwEZvZlAhcB/AdI78SOD1rntK q25hSob6fc2KgGK/gPKw3nDvWejefEY= X-MC-Unique: MpXdyA5NMDqOWILfKIiQ1g-1 X-Mimecast-MFC-AGG-ID: MpXdyA5NMDqOWILfKIiQ1g_1771240588 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:07 +0100 Subject: [PATCH 18/85] tests: start manual audio backend test MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-18-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=25709; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=LFmgbskSCK71ElN/GubZyRqCsfdOjnPkUhXawuYD0Ak=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxO/b5zE2ibxPlbbkleqhPOT8gBlYZreZYp8 4eJzVn2ClWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5WIOEAC6eB/U/i/AGMthWjhAy9jMHDTjTqYTAF6VdcvvLoJmVi83iQokrRifJUdZvq8ptj3B756 oJy3HUi4I7oWegEzXzoJojxX7U7/YMTa94O0o6TMKoOdCSWNpuhUUPZBbZk7I0/AtV/MkMraadf 9EtOo1idJ8JaJ0W0z6kLHTQ+Mep4GzsjniY5gOoO9d0+CWR4BJkKapzuZdnf7lob6thbVfMqCaP cUYFyQDgu0bvtxG+WddR0psAQDWHEmkYNQ8q7WjtOmXZv5CbTpR3ls5v5dXCXsTvX7dNuE91URv FGWrWsnMSYlVDSAtgr8hluFOWunwVU15nQXXmnvvRuQCgn3ZNviZ7bEvX7yR/ULinx/oQf1NN4b SvPHvx0ni6XldCjirm7wOPZyKU6gHSN6jltTBORtUOqOZEm/NRQzUozcy3iKm7Jy2OVMnlTkaW2 vLQ9YaGBuhDkc/32aIADjykfCz2/r1hSLleG9/qGyV7JFeT7Vofk2IHr/Qk8pxmx46ghXR+0OBQ 2aFKEaTeJ8JgdvPejt4j7ci//IkiHOQnwp0o5+LmmvMN2cxjuVc89BaPf3lsCFVvMQNVTCHXpEc HZwLaKrkp43/pMDMF8QbZQ3u64yKsI+r2Hy5OWcJg1AWTkG15XlUA5kHZL6q0L95BAY+aJZKUjb 7GxFaTCySz3l9gQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 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 @redhat.com) X-ZM-MESSAGEID: 1771245871721154100 Start a simple test program that will exercise the QEMU audio APIs. It is meant to run manually for now, as it accesses the sound system and produces sound by default, and also runs for a few seconds. We may want to make it silent or use the "none" (noaudio) backend by default though, so it can run as part of the automated test suite. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki --- MAINTAINERS | 1 + meson.build | 17 +- tests/audio/audio-stubs.c | 62 +++++ tests/audio/test-audio.c | 599 ++++++++++++++++++++++++++++++++++++++++++= ++++ audio/meson.build | 2 +- tests/audio/meson.build | 23 ++ tests/meson.build | 1 + ui/meson.build | 3 + 8 files changed, 702 insertions(+), 6 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index d3aa6d6732d..f52ead996b4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3034,6 +3034,7 @@ X: audio/sndioaudio.c X: audio/spiceaudio.c F: include/qemu/audio*.h F: qapi/audio.json +F: tests/audio/ =20 ALSA Audio backend M: Gerd Hoffmann diff --git a/meson.build b/meson.build index 904605b844f..659f4739b10 100644 --- a/meson.build +++ b/meson.build @@ -3879,6 +3879,7 @@ target_modules +=3D { 'accel' : { 'qtest': qtest_modu= le_ss }} modinfo_collect =3D find_program('scripts/modinfo-collect.py') modinfo_generate =3D find_program('scripts/modinfo-generate.py') modinfo_files =3D [] +audio_modinfo_files =3D [] =20 block_mods =3D [] system_mods =3D [] @@ -3906,15 +3907,21 @@ foreach d, list : modules install: true, install_dir: qemu_moddir) if module_ss.sources() !=3D [] - modinfo_files +=3D custom_target(d + '-' + m + '.modinfo', - output: d + '-' + m + '.modinfo', - input: sl.extract_all_objects(recur= sive: true), - capture: true, - command: [modinfo_collect, '@INPUT@= ']) + modinfo =3D custom_target(d + '-' + m + '.modinfo', + output: d + '-' + m + '.modinfo', + input: sl.extract_all_objects(recursive: t= rue), + capture: true, + command: [modinfo_collect, '@INPUT@']) + modinfo_files +=3D modinfo + if d =3D=3D 'audio' + audio_modinfo_files +=3D modinfo + endif endif else if d =3D=3D 'block' block_ss.add_all(module_ss) + elif d =3D=3D 'audio' + audio_ss.add_all(module_ss) else system_ss.add_all(module_ss) endif diff --git a/tests/audio/audio-stubs.c b/tests/audio/audio-stubs.c new file mode 100644 index 00000000000..dd7f635d460 --- /dev/null +++ b/tests/audio/audio-stubs.c @@ -0,0 +1,62 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * Stubs for audio test - provides missing functions for standalone audio = test + */ + +#include "qemu/osdep.h" +#include "qemu/dbus.h" +#include "ui/qemu-spice-module.h" +#include "ui/dbus-module.h" +#include "system/replay.h" +#include "system/runstate.h" + +int using_spice; +int using_dbus_display; + +struct QemuSpiceOps qemu_spice; + +GQuark dbus_display_error_quark(void) +{ + return g_quark_from_static_string("dbus-display-error-quark"); +} + +#ifdef WIN32 +/* from ui/dbus.h */ +bool +dbus_win32_import_socket(GDBusMethodInvocation *invocation, + GVariant *arg_listener, int *socket); + +bool +dbus_win32_import_socket(GDBusMethodInvocation *invocation, + GVariant *arg_listener, int *socket) +{ + return true; +} +#endif + +void replay_audio_in(size_t *recorded, st_sample *samples, + size_t *wpos, size_t size) +{ +} + +void replay_audio_out(size_t *played) +{ +} + +static int dummy_vmse; + +VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler = *cb, + void *opaque) +{ + return (VMChangeStateEntry *)&dummy_vmse; +} + +void qemu_del_vm_change_state_handler(VMChangeStateEntry *e) +{ +} + +bool runstate_is_running(void) +{ + return true; +} diff --git a/tests/audio/test-audio.c b/tests/audio/test-audio.c new file mode 100644 index 00000000000..edb4971972c --- /dev/null +++ b/tests/audio/test-audio.c @@ -0,0 +1,599 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qemu/config-file.h" +#include "qemu/cutils.h" +#include "qemu/help_option.h" +#include "qemu/module.h" +#include "qemu/main-loop.h" +#include "qemu/audio.h" +#include "qemu/log.h" +#include "qapi/error.h" +#include "trace/control.h" +#include "glib.h" + +#include "audio/audio_int.h" + +#include +#ifdef CONFIG_SDL +/* + * SDL insists on wrapping the main() function with its own implementation= on + * some platforms; it does so via a macro that renames our main function, = so + * must be #included here even with no SDL code called from this f= ile. + */ +#include +#endif + +#define SAMPLE_RATE 44100 +#define CHANNELS 2 +#define DURATION_SECS 2 +#define FREQUENCY 440.0 +#define BUFFER_FRAMES 1024 +#define TIMEOUT_SECS (DURATION_SECS + 1) + +/* Command-line options */ +static gchar *opt_audiodev; +static gchar *opt_trace; + +static GOptionEntry test_options[] =3D { + { "audiodev", 'a', 0, G_OPTION_ARG_STRING, &opt_audiodev, + "Audio device spec (e.g., none or pa,out.buffer-length=3D50000)", "D= EV" }, + { "trace", 'T', 0, G_OPTION_ARG_STRING, &opt_trace, + "Trace options (e.g., 'pw_*')", "TRACE" }, + { NULL } +}; + +#define TEST_AUDIODEV_ID "test" + +typedef struct TestSineState { + AudioBackend *be; + SWVoiceOut *voice; + int64_t total_frames; + int64_t frames_written; +} TestSineState; + +/* Default audio settings for tests */ +static const struct audsettings default_test_settings =3D { + .freq =3D SAMPLE_RATE, + .nchannels =3D CHANNELS, + .fmt =3D AUDIO_FORMAT_S16, + .endianness =3D 0, +}; + +static void dummy_audio_callback(void *opaque, int avail) +{ +} + +static AudioBackend *get_test_audio_backend(void) +{ + AudioBackend *be; + Error *err =3D NULL; + + if (opt_audiodev) { + be =3D audio_be_by_name(TEST_AUDIODEV_ID, &err); + } else { + be =3D audio_get_default_audio_be(&err); + } + + if (err) { + g_error("%s", error_get_pretty(err)); + error_free(err); + exit(1); + } + g_assert_nonnull(be); + return be; +} + +/* + * Helper functions for opening test voices with default settings. + * These reduce boilerplate in test functions. + */ +static SWVoiceOut *open_test_voice_out(AudioBackend *be, const char *name, + void *opaque, audio_callback_fn cb) +{ + struct audsettings as =3D default_test_settings; + SWVoiceOut *voice; + + voice =3D AUD_open_out(be, NULL, name, opaque, cb, &as); + g_assert_nonnull(voice); + return voice; +} + +static SWVoiceIn *open_test_voice_in(AudioBackend *be, const char *name, + void *opaque, audio_callback_fn cb) +{ + struct audsettings as =3D default_test_settings; + + return AUD_open_in(be, NULL, name, opaque, cb, &as); +} + +/* + * Generate 440Hz sine wave samples into buffer. + */ +static void generate_sine_samples(int16_t *buffer, int frames, + int64_t start_frame) +{ + for (int i =3D 0; i < frames; i++) { + double t =3D (double)(start_frame + i) / SAMPLE_RATE; + double sample =3D sin(2.0 * M_PI * FREQUENCY * t); + int16_t s =3D (int16_t)(sample * 32767.0); + + buffer[i * 2] =3D s; /* left channel */ + buffer[i * 2 + 1] =3D s; /* right channel */ + } +} + +static void test_sine_callback(void *opaque, int avail) +{ + TestSineState *s =3D opaque; + int16_t buffer[BUFFER_FRAMES * CHANNELS]; + int frames_remaining; + int frames_to_write; + size_t bytes_written; + + frames_remaining =3D s->total_frames - s->frames_written; + if (frames_remaining <=3D 0) { + return; + } + + frames_to_write =3D avail / (sizeof(int16_t) * CHANNELS); + frames_to_write =3D MIN(frames_to_write, BUFFER_FRAMES); + frames_to_write =3D MIN(frames_to_write, frames_remaining); + + generate_sine_samples(buffer, frames_to_write, s->frames_written); + + bytes_written =3D AUD_write(s->voice, buffer, + frames_to_write * sizeof(int16_t) * CHANNELS= ); + s->frames_written +=3D bytes_written / (sizeof(int16_t) * CHANNELS); +} + + +static void test_audio_out_sine_wave(void) +{ + TestSineState state =3D {0}; + int64_t start_time; + int64_t elapsed_ms; + + state.be =3D get_test_audio_backend(); + state.total_frames =3D SAMPLE_RATE * DURATION_SECS; + state.frames_written =3D 0; + + g_test_message("Opening audio output..."); + state.voice =3D open_test_voice_out(state.be, "test-sine", + &state, test_sine_callback); + + g_test_message("Playing 440Hz sine wave for %d seconds...", DURATION_S= ECS); + AUD_set_active_out(state.voice, true); + + /* + * Run the audio subsystem until all frames are written or timeout. + */ + start_time =3D g_get_monotonic_time(); + while (state.frames_written < state.total_frames) { + audio_run(state.be, "test"); + main_loop_wait(true); + + elapsed_ms =3D (g_get_monotonic_time() - start_time) / 1000; + if (elapsed_ms > TIMEOUT_SECS * 1000) { + g_test_message("Timeout waiting for audio to complete"); + break; + } + + g_usleep(G_USEC_PER_SEC / 100); /* 10ms */ + } + + g_test_message("Wrote %" PRId64 " frames (%.2f seconds)", + state.frames_written, + (double)state.frames_written / SAMPLE_RATE); + + g_assert_cmpint(state.frames_written, =3D=3D, state.total_frames); + + AUD_set_active_out(state.voice, false); + AUD_close_out(state.be, state.voice); +} + +static void test_audio_prio_list(void) +{ + g_autofree gchar *backends =3D NULL; + GString *str =3D g_string_new(NULL); + bool has_none =3D false; + + for (int i =3D 0; audio_prio_list[i]; i++) { + if (i > 0) { + g_string_append_c(str, ' '); + } + g_string_append(str, audio_prio_list[i]); + + if (g_strcmp0(audio_prio_list[i], "none") =3D=3D 0) { + has_none =3D true; + } + } + + backends =3D g_string_free(str, FALSE); + g_test_message("Available backends: %s", backends); + + /* The 'none' backend should always be available */ + g_assert_true(has_none); +} + +static void test_audio_out_active_state(void) +{ + AudioBackend *be; + SWVoiceOut *voice; + + be =3D get_test_audio_backend(); + voice =3D open_test_voice_out(be, "test-active", NULL, dummy_audio_cal= lback); + + g_assert_false(AUD_is_active_out(voice)); + + AUD_set_active_out(voice, true); + g_assert_true(AUD_is_active_out(voice)); + + AUD_set_active_out(voice, false); + g_assert_false(AUD_is_active_out(voice)); + + AUD_close_out(be, voice); +} + +static void test_audio_out_buffer_size(void) +{ + AudioBackend *be; + SWVoiceOut *voice; + int buffer_size; + + be =3D get_test_audio_backend(); + voice =3D open_test_voice_out(be, "test-buffer", NULL, dummy_audio_cal= lback); + + buffer_size =3D AUD_get_buffer_size_out(voice); + g_test_message("Buffer size: %d bytes", buffer_size); + g_assert_cmpint(buffer_size, >, 0); + + AUD_close_out(be, voice); + + g_assert_cmpint(AUD_get_buffer_size_out(NULL), =3D=3D, 0); +} + +static void test_audio_out_volume(void) +{ + AudioBackend *be; + SWVoiceOut *voice; + Volume vol; + + be =3D get_test_audio_backend(); + voice =3D open_test_voice_out(be, "test-volume", NULL, dummy_audio_cal= lback); + + vol =3D (Volume){ .mute =3D false, .channels =3D 2, .vol =3D {255, 255= } }; + AUD_set_volume_out(voice, &vol); + + vol =3D (Volume){ .mute =3D true, .channels =3D 2, .vol =3D {255, 255}= }; + AUD_set_volume_out(voice, &vol); + + vol =3D (Volume){ .mute =3D false, .channels =3D 2, .vol =3D {128, 128= } }; + AUD_set_volume_out(voice, &vol); + + AUD_close_out(be, voice); +} + +static void test_audio_in_active_state(void) +{ + AudioBackend *be; + SWVoiceIn *voice; + + be =3D get_test_audio_backend(); + voice =3D open_test_voice_in(be, "test-in-active", NULL, dummy_audio_c= allback); + if (!voice) { + g_test_skip("The backend may not support input"); + return; + } + + g_assert_false(AUD_is_active_in(voice)); + + AUD_set_active_in(voice, true); + g_assert_true(AUD_is_active_in(voice)); + + AUD_set_active_in(voice, false); + g_assert_false(AUD_is_active_in(voice)); + + AUD_close_in(be, voice); +} + +static void test_audio_in_volume(void) +{ + AudioBackend *be; + SWVoiceIn *voice; + Volume vol; + + be =3D get_test_audio_backend(); + voice =3D open_test_voice_in(be, "test-in-volume", NULL, dummy_audio_c= allback); + if (!voice) { + g_test_skip("The backend may not support input"); + return; + } + + vol =3D (Volume){ .mute =3D false, .channels =3D 2, .vol =3D {255, 255= } }; + AUD_set_volume_in(voice, &vol); + + vol =3D (Volume){ .mute =3D true, .channels =3D 2, .vol =3D {255, 255}= }; + AUD_set_volume_in(voice, &vol); + + AUD_close_in(be, voice); +} + + +/* Capture test state */ +#define CAPTURE_BUFFER_FRAMES (SAMPLE_RATE / 10) /* 100ms of audio */ +#define CAPTURE_BUFFER_SIZE (CAPTURE_BUFFER_FRAMES * CHANNELS * sizeof(i= nt16_t)) + +typedef struct TestCaptureState { + bool notify_called; + bool capture_called; + bool destroy_called; + audcnotification_e last_notify; + int16_t *captured_samples; + size_t captured_bytes; + size_t capture_buffer_size; +} TestCaptureState; + +static void test_capture_notify(void *opaque, audcnotification_e cmd) +{ + TestCaptureState *s =3D opaque; + s->notify_called =3D true; + s->last_notify =3D cmd; +} + +static void test_capture_capture(void *opaque, const void *buf, int size) +{ + TestCaptureState *s =3D opaque; + size_t bytes_to_copy; + + s->capture_called =3D true; + + if (!s->captured_samples || s->captured_bytes >=3D s->capture_buffer_s= ize) { + return; + } + + bytes_to_copy =3D MIN(size, s->capture_buffer_size - s->captured_bytes= ); + memcpy((uint8_t *)s->captured_samples + s->captured_bytes, buf, bytes_= to_copy); + s->captured_bytes +=3D bytes_to_copy; +} + +static void test_capture_destroy(void *opaque) +{ + TestCaptureState *s =3D opaque; + s->destroy_called =3D true; +} + +/* + * Compare captured audio with expected sine wave. + * Returns the number of matching samples (within tolerance). + */ +static int compare_sine_samples(const int16_t *captured, int frames, + int64_t start_frame, int tolerance) +{ + int matching =3D 0; + + for (int i =3D 0; i < frames; i++) { + double t =3D (double)(start_frame + i) / SAMPLE_RATE; + double sample =3D sin(2.0 * M_PI * FREQUENCY * t); + int16_t expected =3D (int16_t)(sample * 32767.0); + + /* Check left channel */ + if (abs(captured[i * 2] - expected) <=3D tolerance) { + matching++; + } + /* Check right channel */ + if (abs(captured[i * 2 + 1] - expected) <=3D tolerance) { + matching++; + } + } + + return matching; +} + +static void test_audio_capture(void) +{ + AudioBackend *be; + CaptureVoiceOut *cap; + SWVoiceOut *voice; + TestCaptureState state =3D {0}; + TestSineState sine_state =3D {0}; + struct audsettings as =3D default_test_settings; + struct audio_capture_ops ops =3D { + .notify =3D test_capture_notify, + .capture =3D test_capture_capture, + .destroy =3D test_capture_destroy, + }; + int64_t start_time; + int64_t elapsed_ms; + int captured_frames; + int matching_samples; + int total_samples; + double match_ratio; + + be =3D get_test_audio_backend(); + + state.captured_samples =3D g_malloc0(CAPTURE_BUFFER_SIZE); + state.captured_bytes =3D 0; + state.capture_buffer_size =3D CAPTURE_BUFFER_SIZE; + + cap =3D AUD_add_capture(be, &as, &ops, &state); + g_assert_nonnull(cap); + + sine_state.be =3D be; + sine_state.total_frames =3D CAPTURE_BUFFER_FRAMES; + sine_state.frames_written =3D 0; + + voice =3D open_test_voice_out(be, "test-capture-sine", + &sine_state, test_sine_callback); + sine_state.voice =3D voice; + + AUD_set_active_out(voice, true); + + start_time =3D g_get_monotonic_time(); + while (sine_state.frames_written < sine_state.total_frames || + state.captured_bytes < CAPTURE_BUFFER_SIZE) { + audio_run(be, "test-capture"); + main_loop_wait(true); + + elapsed_ms =3D (g_get_monotonic_time() - start_time) / 1000; + if (elapsed_ms > 1000) { /* 1 second timeout */ + break; + } + + g_usleep(G_USEC_PER_SEC / 1000); /* 1ms */ + } + + g_test_message("Wrote %" PRId64 " frames, captured %zu bytes", + sine_state.frames_written, state.captured_bytes); + + g_assert_true(state.capture_called); + g_assert_cmpuint(state.captured_bytes, >, 0); + + /* Compare captured data with expected sine wave */ + captured_frames =3D state.captured_bytes / (CHANNELS * sizeof(int16_t)= ); + if (captured_frames > 0) { + /* + * Allow some tolerance due to mixing/conversion. + * The tolerance accounts for potential rounding differences. + */ + matching_samples =3D compare_sine_samples(state.captured_samples, + captured_frames, 0, 100); + total_samples =3D captured_frames * CHANNELS; + match_ratio =3D (double)matching_samples / total_samples; + + g_test_message("Captured %d frames, %d/%d samples match (%.1f%%)", + captured_frames, matching_samples, total_samples, + match_ratio * 100.0); + + /* + * Expect at least 90% of samples to match within tolerance. + * Some variation is expected due to mixing engine processing. + */ + g_assert_cmpfloat(match_ratio, >=3D, 0.9); + } + + AUD_set_active_out(voice, false); + AUD_close_out(be, voice); + + AUD_del_capture(cap, &state); + g_assert_true(state.destroy_called); + + g_free(state.captured_samples); +} + +static void test_audio_null_handling(void) +{ + uint8_t buffer[64]; + + /* AUD_is_active_out/in(NULL) should return false */ + g_assert_false(AUD_is_active_out(NULL)); + g_assert_false(AUD_is_active_in(NULL)); + + /* AUD_get_buffer_size_out(NULL) should return 0 */ + g_assert_cmpint(AUD_get_buffer_size_out(NULL), =3D=3D, 0); + + /* AUD_write/read(NULL, ...) should return size (no-op) */ + g_assert_cmpuint(AUD_write(NULL, buffer, sizeof(buffer)), =3D=3D, + sizeof(buffer)); + g_assert_cmpuint(AUD_read(NULL, buffer, sizeof(buffer)), =3D=3D, + sizeof(buffer)); + + /* These should not crash */ + AUD_set_active_out(NULL, true); + AUD_set_active_out(NULL, false); + AUD_set_active_in(NULL, true); + AUD_set_active_in(NULL, false); +} + +static void test_audio_multiple_voices(void) +{ + AudioBackend *be; + SWVoiceOut *out1, *out2; + SWVoiceIn *in1; + + be =3D get_test_audio_backend(); + out1 =3D open_test_voice_out(be, "test-multi-out1", NULL, dummy_audio_= callback); + out2 =3D open_test_voice_out(be, "test-multi-out2", NULL, dummy_audio_= callback); + in1 =3D open_test_voice_in(be, "test-multi-in1", NULL, dummy_audio_cal= lback); + + AUD_set_active_out(out1, true); + AUD_set_active_out(out2, true); + AUD_set_active_in(in1, true); + + g_assert_true(AUD_is_active_out(out1)); + g_assert_true(AUD_is_active_out(out2)); + if (in1) { + g_assert_true(AUD_is_active_in(in1)); + } + + AUD_set_active_out(out1, false); + AUD_set_active_out(out2, false); + AUD_set_active_in(in1, false); + + AUD_close_in(be, in1); + AUD_close_out(be, out2); + AUD_close_out(be, out1); +} + +int main(int argc, char **argv) +{ + GOptionContext *context; + g_autoptr(GError) error =3D NULL; + g_autofree gchar *dir =3D NULL; + int ret; + + context =3D g_option_context_new("- QEMU audio test"); + g_option_context_add_main_entries(context, test_options, NULL); + + if (!g_option_context_parse(context, &argc, &argv, &error)) { + g_printerr("Option parsing failed: %s\n", error->message); + return 1; + } + g_option_context_free(context); + + g_test_init(&argc, &argv, NULL); + + module_call_init(MODULE_INIT_TRACE); + qemu_add_opts(&qemu_trace_opts); + if (opt_trace) { + trace_opt_parse(opt_trace); + qemu_set_log(LOG_TRACE, &error_fatal); + } + trace_init_backends(); + trace_init_file(); + + dir =3D g_test_build_filename(G_TEST_BUILT, "..", "..", NULL); + g_setenv("QEMU_MODULE_DIR", dir, true); + qemu_init_exec_dir(argv[0]); + module_call_init(MODULE_INIT_QOM); + module_init_info(qemu_modinfo); + + qemu_init_main_loop(&error_abort); + if (opt_audiodev) { + g_autofree gchar *spec =3D is_help_option(opt_audiodev) ? + opt_audiodev : g_strdup_printf("%s,id=3D%s", opt_audiodev, TES= T_AUDIODEV_ID); + audio_parse_option(spec); + } + audio_create_default_audiodevs(); + audio_init_audiodevs(); + + g_test_add_func("/audio/prio-list", test_audio_prio_list); + + g_test_add_func("/audio/out/active-state", test_audio_out_active_state= ); + g_test_add_func("/audio/out/sine-wave", test_audio_out_sine_wave); + g_test_add_func("/audio/out/buffer-size", test_audio_out_buffer_size); + g_test_add_func("/audio/out/volume", test_audio_out_volume); + g_test_add_func("/audio/out/capture", test_audio_capture); + + g_test_add_func("/audio/in/active-state", test_audio_in_active_state); + g_test_add_func("/audio/in/volume", test_audio_in_volume); + + g_test_add_func("/audio/null-handling", test_audio_null_handling); + g_test_add_func("/audio/multiple-voices", test_audio_multiple_voices); + + ret =3D g_test_run(); + + audio_cleanup(); + + return ret; +} diff --git a/audio/meson.build b/audio/meson.build index a5fec14fb3a..55ee0bfc865 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -32,7 +32,7 @@ endforeach if dbus_display module_ss =3D ss.source_set() module_ss.add(when: [gio, pixman], - if_true: [dbus_display1, files('dbusaudio.c')]) + if_true: [dbus_display1_h, files('dbusaudio.c')]) audio_modules +=3D {'dbus': module_ss} endif =20 diff --git a/tests/audio/meson.build b/tests/audio/meson.build new file mode 100644 index 00000000000..84754bde221 --- /dev/null +++ b/tests/audio/meson.build @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +if not have_system + subdir_done() +endif + +modinfo_dep =3D not_found +if enable_modules + modinfo_src =3D custom_target('modinfo.c', + output: 'modinfo.c', + input: audio_modinfo_files, + command: [modinfo_generate, '--skip-missin= g-deps', '@INPUT@'], + capture: true) + + modinfo_lib =3D static_library('modinfo.c', modinfo_src) + modinfo_dep =3D declare_dependency(link_with: modinfo_lib) +endif + +# manual audio test - not part of automated test suite +# as it relies on audio system +executable('test-audio', + sources: [files('test-audio.c', 'audio-stubs.c'), dbus_display1], + dependencies: [audio, qemuutil, modinfo_dep, gio, spice, sdl]) diff --git a/tests/meson.build b/tests/meson.build index cbe79162411..cb766e49ca4 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -83,6 +83,7 @@ if 'CONFIG_TCG' in config_all_accel subdir('tcg/plugins') endif =20 +subdir('audio') subdir('unit') subdir('qapi-schema') subdir('qtest') diff --git a/ui/meson.build b/ui/meson.build index 6371422c460..69404bca71a 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -70,6 +70,7 @@ if opengl.found() ui_modules +=3D {'egl-headless' : egl_headless_ss} endif =20 +dbus_display1 =3D files() if dbus_display dbus_ss =3D ss.source_set() env =3D environment() @@ -88,6 +89,8 @@ if dbus_display '--interface-prefix', 'org.qemu.= ', '--c-namespace', 'QemuDBus', '--generate-c-code', '@BASENAME@= ']) + dbus_display1_h =3D declare_dependency(dependencies: [gio], + sources: dbus_display1[0]) dbus_ss.add(when: gio, if_true: [files( 'dbus-chardev.c', --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242818; cv=none; d=zohomail.com; s=zohoarc; b=Gbnc9AGIL8bEJZyGodwSy8u3kgek/mMmOEhcddQfiya0+4oOEsqGKBc2WzUeL43w/06iFEj8cFrYC0Zt29UwFprLno/bV7kR5Mm3daYOuM1Tfh7txri9zMxWjZL/mkamLRhjFhiTEM681WAFE+4zvCOmwlOV9TJnKE87tZtDQXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242818; h=Content-Type: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=owCMqtDAeefUA/PLyaaNUJQAaFbI+2RUQ1YruU0M5ag=; b=MZ0qoGAxzkCUsql1hCN831AykZ+BFOQUkvnYiokA8841FyFR0HGCVRgu+V3hq3GZV/fPTk7JbzmcwtGiJ241srYqp2ycI9uZcMe5kioruLb1pVgccf4+0DcytkWeJfcArxZ8php+zTWKFsRbZfqqFY8pxppWk+M30TXT3HfuTjY= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242818507634.9318999519788; Mon, 16 Feb 2026 03:53:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwdV-0000AO-VZ; Mon, 16 Feb 2026 06:19:30 -0500 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 1vrwar-0005JQ-Ow for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwak-0007Sg-9P for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:40 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-108-orSCkSvbOhS5awcRN2Gnyw-1; Mon, 16 Feb 2026 06:16:33 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 125B9180047F; Mon, 16 Feb 2026 11:16:31 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 37C5E18003F5; Mon, 16 Feb 2026 11:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240597; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=owCMqtDAeefUA/PLyaaNUJQAaFbI+2RUQ1YruU0M5ag=; b=e9hP0KOEYS3kdc5XO/hHAWBgBRyTeUyS7SLDd4cJv33yxQuytGwTjeZzQHihwgCxIbju2j /QoPAjYUE8grb/j6I6XeYXOU11msMJr7YkvYqMVHEOkS0H/7nPLdSBxAlg/bbqlmSmFpKS t11AcV0IP1gRqCYmW6KuehkjHI0zs8M= X-MC-Unique: orSCkSvbOhS5awcRN2Gnyw-1 X-Mimecast-MFC-AGG-ID: orSCkSvbOhS5awcRN2Gnyw_1771240591 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:08 +0100 Subject: [PATCH 19/85] audio: constify audsettings argument MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-19-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=4072; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=H6n2uw6uj550TicI/7n5wOdjySxspRP/33lyJ5l2eig=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxOMws7WNYm/ZuK05nJjbuIFb6UOyEwrRK2m IvOqgGlWKWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TgAKCRDa6OEJdZac 5cfnEACA51/pvVdJhl5JbUBKtvX4vKk4LjULhzf9QOViMuTHEXT8QLpZNsJRGr+ZLSOaoW3w7m6 Fgc5se7RSlN7CcwoAZOVdfjEuAxB6Plr8ZOOjNkatHOMSowPZEWgrebqnMgEecroyt8SS6rJdOv bAQWKcTNqFKt5ihtCItzVYPG9F3ASSOA1HgUDvSrz8ptAJJY5WspvTZb7KId0Vd5ZG+OwmB3Qv/ d+4DGBhOc5eL+mYao06G1Fl88fa49MLvqA2Fz9tChwgieiuCsnC+EMUPLCXssCaURul2/xumaKE iqRLyRJP+qR/3agfcS9e/JT3dCqYP6/VcROQgWRl6mebTcNFDPIJh4/NvG5/Y7P0rkBRQWFjZTQ jaU4wPhaijevwEUD58g3yzNG7U65s9uAQODrWCIiF7fF0XIXBEoM09XUJlfQi2HVwhzWGSoUYuU bM2tIfyjRZ+lBuZRPACIbkMV21mtzzDPQYwc3R1YYTJKE+rpaRHrJYWCjaXrY2zGfv7q426HXaA bY5b9RLRf1UfzFpkwvA2g+vG3lTnoLw/Ej5WLFbjHp5X9LaCDzirBMkzt0BAJpt2HFdMo7tB+KW vVFeybKBcRwli39MaUiTcKAanSLyoN+RhZy1EP4KgXaD7lUZJYgeJCPftZifYI/Zq8DRKA3Jo6y THMl1IyipPeVmDQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771242821240154100 It shouldn't be modified by the audio functions. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 2 +- audio/audio_template.h | 6 +++--- include/qemu/audio.h | 4 ++-- audio/audio.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 25de0e3f9cf..a6276375887 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -265,7 +265,7 @@ extern const char *audio_prio_list[]; =20 void audio_driver_register(audio_driver *drv); =20 -void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings = *as); +void audio_pcm_init_info (struct audio_pcm_info *info, const struct audset= tings *as); void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int= len); =20 int audio_bug (const char *funcname, int cond); diff --git a/audio/audio_template.h b/audio/audio_template.h index 1ab3c47fd76..e69e6e74570 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -159,7 +159,7 @@ static int glue (audio_pcm_sw_init_, TYPE) ( SW *sw, HW *hw, const char *name, - struct audsettings *as + const struct audsettings *as ) { int err; @@ -426,7 +426,7 @@ static HW *glue(audio_pcm_hw_add_, TYPE)(AudioBackend *= s, struct audsettings *as static SW *glue(audio_pcm_create_voice_pair_, TYPE)( AudioBackend *s, const char *sw_name, - struct audsettings *as + const struct audsettings *as ) { SW *sw; @@ -491,7 +491,7 @@ SW *glue (AUD_open_, TYPE) ( const char *name, void *callback_opaque , audio_callback_fn callback_fn, - struct audsettings *as + const struct audsettings *as ) { AudioBackend *s =3D be; diff --git a/include/qemu/audio.h b/include/qemu/audio.h index a1a64ad340d..370e993f080 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -58,7 +58,7 @@ SWVoiceOut *AUD_open_out ( const char *name, void *callback_opaque, audio_callback_fn callback_fn, - struct audsettings *settings + const struct audsettings *settings ); =20 void AUD_close_out (AudioBackend *be, SWVoiceOut *sw); @@ -97,7 +97,7 @@ SWVoiceIn *AUD_open_in( const char *name, void *callback_opaque, audio_callback_fn callback_fn, - struct audsettings *settings + const struct audsettings *settings ); =20 void AUD_close_in(AudioBackend *be, SWVoiceIn *sw); diff --git a/audio/audio.c b/audio/audio.c index 68698b13e15..5dccb9b0a36 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -170,7 +170,7 @@ void AUD_log (const char *cap, const char *fmt, ...) va_end (ap); } =20 -static void audio_print_settings (struct audsettings *as) +static void audio_print_settings (const struct audsettings *as) { dolog ("frequency=3D%d nchannels=3D%d fmt=3D", as->freq, as->nchannels= ); =20 @@ -216,7 +216,7 @@ static void audio_print_settings (struct audsettings *a= s) AUD_log (NULL, "\n"); } =20 -static int audio_validate_settings (struct audsettings *as) +static int audio_validate_settings (const struct audsettings *as) { int invalid; =20 @@ -241,7 +241,7 @@ static int audio_validate_settings (struct audsettings = *as) return invalid ? -1 : 0; } =20 -static int audio_pcm_info_eq (struct audio_pcm_info *info, struct audsetti= ngs *as) +static int audio_pcm_info_eq (struct audio_pcm_info *info, const struct au= dsettings *as) { int bits =3D 8; bool is_signed =3D false, is_float =3D false; @@ -281,7 +281,7 @@ static int audio_pcm_info_eq (struct audio_pcm_info *in= fo, struct audsettings *a && info->swap_endianness =3D=3D (as->endianness !=3D HOST_BIG_ENDI= AN); } =20 -void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings = *as) +void audio_pcm_init_info (struct audio_pcm_info *info, const struct audset= tings *as) { int bits =3D 8, mul; bool is_signed =3D false, is_float =3D false; --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242234; cv=none; d=zohomail.com; s=zohoarc; b=SkMu05RJeRNLlR5YdXrI2yF8cvbg5nd8B1ZuPdewtM0tjwbCUXftfyA2poA+GFzDusEF8Wmv+Ci1Z9b1yn0CrD4g96E9Lzz3L17PSNPRDKW+QTos8DtsgS8PBVcvDnM3Rx3nLct81NW6kmhMVLjPWVow9EeJdCbygbaDneE2LeU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242234; h=Content-Type: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=sXW30UumLYxWWPpS7nnFOzuNZMWZaTtGVKTHNUU8ICg=; b=TQKtbEULzOGOi9XUo6Q6RLFSEqaeaVYWW8rI7bIwS6Nz1mhXSj709p1oKwjhpTQ/7hqVxO9RAzyl625a5Hp5pOJOkNL/GWzUyOElCU2kJEqZJ4KvYHoXRXvYnv25dHNYdautHHsjFpM8hFh4ZFH8h6ecxtTQBqsUKbG6aEUCcOo= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242234584882.5581095153192; Mon, 16 Feb 2026 03:43:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwdU-0008RN-GQ; Mon, 16 Feb 2026 06:19:29 -0500 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 1vrwaw-0005Ml-5A for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwar-0007T5-Gg for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:48 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-424-CplpqzP1OvmAB3Kn44eTAg-1; Mon, 16 Feb 2026 06:16:36 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6A6151956054; Mon, 16 Feb 2026 11:16:34 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4B6F919560A2; Mon, 16 Feb 2026 11:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sXW30UumLYxWWPpS7nnFOzuNZMWZaTtGVKTHNUU8ICg=; b=gsEFvRwx80UMMt+xmdaJmTCW3kfiLDUtBdZFSP5x7/2UwCOqLAcfUqiQ4f0YtbWGLp6Kfe 8V+ZVCVmVTmhMXkbgUZn/r5nxuPV+jCRrGZGMssMy5q7d4SqqRMxxgLslt588rxfKeCaMS wCV0/5oTGbod+fziOM5gYNfAwx/dz1k= X-MC-Unique: CplpqzP1OvmAB3Kn44eTAg-1 X-Mimecast-MFC-AGG-ID: CplpqzP1OvmAB3Kn44eTAg_1771240594 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:09 +0100 Subject: [PATCH 20/85] audio: introduce AudioMixengBackend MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-20-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=22549; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TWADWJLqjUZp+XDQueVSRfn8tBkFT5C/9utkI3kOOM4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPkssa1mN1u6ESQ0aZGPxTzWuVVy2DiToZG MV+bwuAtXiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5Y1uEACd4Q1CtBw+yEXSIAeDf/q1r3YqrKoOD2ikvWptOvCbNCBv4DlCg+d3Wq2vxrOjkqCVNKO 1QBSVapGbVGleviOtkbXtcHyVN6uhf0yalFuloZogV6rWprKrT44ZC8JIyZAoW7ZLH2wPUvrQEh wj2qX+MW9XjUdmAlJ5GLL0enZnb4IdelSmn1bafe8AZssgRR+sar0/akXoknUKCNa06f7UWWSrD Lax4BrhlZs+Wi1aD/QbpanbXhMuuH7BnPlSx4hg8UVOGLQATDKRXmW+MbVVSAOiJB0uWZ26NxHo vv5J8VjGjOxVmhQJV81EhVBo6GFQiAk9A/vByGRcGhmdnJ7tlR3gbzgZux5LZlcug4/0SW/kXtg fRWv88N3Fg/gS83stXcBGoogUvbMAUB4YzPppsbHU3zBH0HN/K9Na/u8RJJW/vZWYystk0XZ1a0 1AFUlorYx4JFIQW1wVgdNLv8S+9ES0LK5JG0UiwHDke17ZHR20T1IYOuW3r07Fcbh5YTpEpjTs9 g8IWYTscuFhhMOe9gtCBpaOTuBXy6acOSdygzqWFfO085agZ/BapZqLuBPFIJ13DbkO5jiviLWf v01ARZEoJZSnmtAzPYoDEougyLr0FE1m38Xe/dpqyHuwPCiGrimvSWw4UkyrYs4esPiP+jWmKjr BJ5GYAEd4zm95cw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771242238462154100 Introduce a sub-class for current "audio_driver" based implementations. Future AudioBackend implementations can do without it. Next cleanup will actually remove "audio_driver" struct altogether and make the subclass proper QOM objects. Public APIs still rely on backend being an AudioMixeng. They will assert() if not. This will be addressed later to allow other backends. Note that the initial naming proposed for this object was AudioDriver, however the semantics for "driver" is already overloaded and leads to confusion, in particular with the QAPI AudiodevDriver. The defining characteristic is of using QEMU's software mixing engine, so AudioMixengBackend. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 25 ++++++---- audio/audio_template.h | 18 +++---- include/qemu/audio.h | 17 +++++-- audio/alsaaudio.c | 2 +- audio/audio.c | 123 +++++++++++++++++++++++++++++++++++--------= ---- audio/dbusaudio.c | 8 +-- audio/ossaudio.c | 4 +- tests/audio/test-audio.c | 4 +- ui/dbus.c | 6 +-- 9 files changed, 143 insertions(+), 64 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index a6276375887..06f5160e8df 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -61,7 +61,7 @@ struct audio_pcm_info { int swap_endianness; }; =20 -typedef struct AudioBackend AudioBackend; +typedef struct AudioMixengBackend AudioMixengBackend; typedef struct SWVoiceCap SWVoiceCap; =20 typedef struct STSampleBuffer { @@ -70,7 +70,7 @@ typedef struct STSampleBuffer { } STSampleBuffer; =20 typedef struct HWVoiceOut { - AudioBackend *s; + AudioMixengBackend *s; bool enabled; int poll_mode; bool pending_disable; @@ -90,7 +90,7 @@ typedef struct HWVoiceOut { } HWVoiceOut; =20 typedef struct HWVoiceIn { - AudioBackend *s; + AudioMixengBackend *s; bool enabled; int poll_mode; struct audio_pcm_info info; @@ -110,7 +110,7 @@ typedef struct HWVoiceIn { } HWVoiceIn; =20 struct SWVoiceOut { - AudioBackend *s; + AudioMixengBackend *s; struct audio_pcm_info info; t_sample *conv; STSampleBuffer resample_buf; @@ -126,7 +126,7 @@ struct SWVoiceOut { }; =20 struct SWVoiceIn { - AudioBackend *s; + AudioMixengBackend *s; bool active; struct audio_pcm_info info; void *rate; @@ -239,8 +239,12 @@ struct SWVoiceCap { QLIST_ENTRY (SWVoiceCap) entries; }; =20 -typedef struct AudioBackend { - Object parent; +struct AudioMixengBackendClass { + AudioBackendClass parent_class; +}; + +struct AudioMixengBackend { + AudioBackend parent_obj; =20 struct audio_driver *drv; Audiodev *dev; @@ -257,7 +261,7 @@ typedef struct AudioBackend { bool timer_running; uint64_t timer_last; VMChangeStateEntry *vmse; -} AudioBackend; +}; =20 extern const struct mixeng_volume nominal_volume; =20 @@ -270,7 +274,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *i= nfo, void *buf, int len); =20 int audio_bug (const char *funcname, int cond); =20 -void audio_run(AudioBackend *s, const char *msg); +void audio_run(AudioMixengBackend *s, const char *msg); =20 const char *audio_application_name(void); =20 @@ -323,4 +327,7 @@ void audio_create_pdos(Audiodev *dev); AudiodevPerDirectionOptions *audio_get_pdo_in(Audiodev *dev); AudiodevPerDirectionOptions *audio_get_pdo_out(Audiodev *dev); =20 +#define TYPE_AUDIO_MIXENG_BACKEND "audio-mixeng-backend" +OBJECT_DECLARE_TYPE(AudioMixengBackend, AudioMixengBackendClass, AUDIO_MIX= ENG_BACKEND) + #endif /* QEMU_AUDIO_INT_H */ diff --git a/audio/audio_template.h b/audio/audio_template.h index e69e6e74570..a1f78d8748b 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -36,7 +36,7 @@ #define HWBUF hw->conv_buf #endif =20 -static void glue(audio_init_nb_voices_, TYPE)(AudioBackend *s, +static void glue(audio_init_nb_voices_, TYPE)(AudioMixengBackend *s, struct audio_driver *drv, in= t min_voices) { int max_voices =3D glue (drv->max_voices_, TYPE); @@ -221,7 +221,7 @@ static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw) static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) { HW *hw =3D *hwp; - AudioBackend *s =3D hw->s; + AudioMixengBackend *s =3D hw->s; =20 if (!hw->sw_head.lh_first) { #ifdef DAC @@ -236,12 +236,12 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) } } =20 -static HW *glue(audio_pcm_hw_find_any_, TYPE)(AudioBackend *s, HW *hw) +static HW *glue(audio_pcm_hw_find_any_, TYPE)(AudioMixengBackend *s, HW *h= w) { return hw ? hw->entries.le_next : glue (s->hw_head_, TYPE).lh_first; } =20 -static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioBackend *s, HW = *hw) +static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioMixengBackend *= s, HW *hw) { while ((hw =3D glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) { if (hw->enabled) { @@ -251,7 +251,7 @@ static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(A= udioBackend *s, HW *hw) return NULL; } =20 -static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioBackend *s, HW *hw, +static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioMixengBackend *s, = HW *hw, struct audsettings *as) { while ((hw =3D glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) { @@ -262,7 +262,7 @@ static HW *glue(audio_pcm_hw_find_specific_, TYPE)(Audi= oBackend *s, HW *hw, return NULL; } =20 -static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioBackend *s, +static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixengBackend *s, struct audsettings *as) { HW *hw; @@ -398,7 +398,7 @@ AudiodevPerDirectionOptions *glue(audio_get_pdo_, TYPE)= (Audiodev *dev) abort(); } =20 -static HW *glue(audio_pcm_hw_add_, TYPE)(AudioBackend *s, struct audsettin= gs *as) +static HW *glue(audio_pcm_hw_add_, TYPE)(AudioMixengBackend *s, struct aud= settings *as) { HW *hw; AudiodevPerDirectionOptions *pdo =3D glue(audio_get_pdo_, TYPE)(s->dev= ); @@ -424,7 +424,7 @@ static HW *glue(audio_pcm_hw_add_, TYPE)(AudioBackend *= s, struct audsettings *as } =20 static SW *glue(audio_pcm_create_voice_pair_, TYPE)( - AudioBackend *s, + AudioMixengBackend *s, const char *sw_name, const struct audsettings *as ) @@ -494,7 +494,7 @@ SW *glue (AUD_open_, TYPE) ( const struct audsettings *as ) { - AudioBackend *s =3D be; + AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(be); AudiodevPerDirectionOptions *pdo; =20 if (audio_bug(__func__, !be || !name || !callback_fn || !as)) { diff --git a/include/qemu/audio.h b/include/qemu/audio.h index 370e993f080..474d761f0be 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -44,11 +44,21 @@ typedef struct audsettings { typedef struct SWVoiceOut SWVoiceOut; typedef struct SWVoiceIn SWVoiceIn; =20 -struct AudioBackendClass { +typedef struct AudioBackend { + Object parent_obj; +} AudioBackend; + +typedef struct AudioBackendClass { ObjectClass parent_class; -}; =20 -typedef struct AudioBackend AudioBackend; + const char *(*get_id)(AudioBackend *be); +#ifdef CONFIG_GIO + bool (*set_dbus_server)(AudioBackend *be, + GDBusObjectManagerServer *manager, + bool p2p, + Error **errp); +#endif +} AudioBackendClass; =20 bool AUD_backend_check(AudioBackend **be, Error **errp); =20 @@ -125,6 +135,7 @@ AudioBackend *audio_be_by_name(const char *name, Error = **errp); AudioBackend *audio_get_default_audio_be(Error **errp); const char *audio_be_get_id(AudioBackend *be); #ifdef CONFIG_GIO +bool audio_be_can_set_dbus_server(AudioBackend *be); bool audio_be_set_dbus_server(AudioBackend *be, GDBusObjectManagerServer *server, bool p2p, diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 7d7da576dc9..814820e2864 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -41,7 +41,7 @@ struct pollhlp { struct pollfd *pfds; int count; int mask; - AudioBackend *s; + AudioMixengBackend *s; }; =20 typedef struct ALSAVoiceOut { diff --git a/audio/audio.c b/audio/audio.c index 5dccb9b0a36..75a7f694319 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -37,6 +37,7 @@ #include "qemu/log.h" #include "qemu/module.h" #include "qemu/help_option.h" +#include "qom/object.h" #include "system/system.h" #include "system/replay.h" #include "system/runstate.h" @@ -384,7 +385,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *i= nfo, void *buf, int len) /* * Capture */ -static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioBackend *s, +static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioMixengBackend= *s, struct audsettings= *as) { CaptureVoiceOut *cap; @@ -464,7 +465,7 @@ static void audio_detach_capture (HWVoiceOut *hw) =20 static int audio_attach_capture (HWVoiceOut *hw) { - AudioBackend *s =3D hw->s; + AudioMixengBackend *s =3D hw->s; CaptureVoiceOut *cap; =20 audio_detach_capture (hw); @@ -802,7 +803,7 @@ static void audio_pcm_print_info (const char *cap, stru= ct audio_pcm_info *info) /* * Timer */ -static int audio_is_timer_needed(AudioBackend *s) +static int audio_is_timer_needed(AudioMixengBackend *s) { HWVoiceIn *hwi =3D NULL; HWVoiceOut *hwo =3D NULL; @@ -820,7 +821,7 @@ static int audio_is_timer_needed(AudioBackend *s) return 0; } =20 -static void audio_reset_timer(AudioBackend *s) +static void audio_reset_timer(AudioMixengBackend *s) { if (audio_is_timer_needed(s)) { timer_mod_anticipate_ns(s->ts, @@ -842,7 +843,7 @@ static void audio_reset_timer(AudioBackend *s) static void audio_timer (void *opaque) { int64_t now, diff; - AudioBackend *s =3D opaque; + AudioMixengBackend *s =3D opaque; =20 now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); diff =3D now - s->timer_last; @@ -925,7 +926,7 @@ void AUD_set_active_out(SWVoiceOut *sw, bool on) =20 hw =3D sw->hw; if (sw->active !=3D on) { - AudioBackend *s =3D sw->s; + AudioMixengBackend *s =3D sw->s; SWVoiceOut *temp_sw; SWVoiceCap *sc; =20 @@ -973,7 +974,7 @@ void AUD_set_active_in(SWVoiceIn *sw, bool on) =20 hw =3D sw->hw; if (sw->active !=3D on) { - AudioBackend *s =3D sw->s; + AudioMixengBackend *s =3D sw->s; SWVoiceIn *temp_sw; =20 if (on) { @@ -1141,7 +1142,7 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, si= ze_t live) return clipped; } =20 -static void audio_run_out(AudioBackend *s) +static void audio_run_out(AudioMixengBackend *s) { HWVoiceOut *hw =3D NULL; SWVoiceOut *sw; @@ -1294,7 +1295,7 @@ static size_t audio_pcm_hw_run_in(HWVoiceIn *hw, size= _t samples) return conv; } =20 -static void audio_run_in(AudioBackend *s) +static void audio_run_in(AudioMixengBackend *s) { HWVoiceIn *hw =3D NULL; =20 @@ -1341,7 +1342,7 @@ static void audio_run_in(AudioBackend *s) } } =20 -static void audio_run_capture(AudioBackend *s) +static void audio_run_capture(AudioMixengBackend *s) { CaptureVoiceOut *cap; =20 @@ -1388,7 +1389,7 @@ static void audio_run_capture(AudioBackend *s) } } =20 -void audio_run(AudioBackend *s, const char *msg) +void audio_run(AudioMixengBackend *s, const char *msg) { audio_run_out(s); audio_run_in(s); @@ -1561,8 +1562,8 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf, s= ize_t size) return total; } =20 -static bool audio_driver_init(AudioBackend *s, struct audio_driver *drv, - Audiodev *dev, Error **errp) +static bool audio_driver_do_init(AudioMixengBackend *s, struct audio_drive= r *drv, + Audiodev *dev, Error **errp) { s->drv_opaque =3D drv->init(dev, errp); if (!s->drv_opaque) { @@ -1594,7 +1595,7 @@ static bool audio_driver_init(AudioBackend *s, struct= audio_driver *drv, static void audio_vm_change_state_handler (void *opaque, bool running, RunState state) { - AudioBackend *s =3D opaque; + AudioMixengBackend *s =3D opaque; HWVoiceOut *hwo =3D NULL; HWVoiceIn *hwi =3D NULL; =20 @@ -1616,7 +1617,47 @@ static const VMStateDescription vmstate_audio; =20 static void audio_be_init(Object *obj) { - AudioBackend *s =3D AUDIO_BACKEND(obj); +} + +static void audio_be_finalize(Object *obj) +{ +} + +static const char *audio_mixeng_backend_get_id(AudioBackend *be) +{ + return AUDIO_MIXENG_BACKEND(be)->dev->id; +} + +#ifdef CONFIG_GIO +static bool audio_mixeng_backend_set_dbus_server(AudioBackend *be, + GDBusObjectManagerServer = *manager, + bool p2p, + Error **errp) +{ + AudioMixengBackend *d =3D AUDIO_MIXENG_BACKEND(be); + + if (!d->drv->set_dbus_server) { + return false; + } + + return d->drv->set_dbus_server(be, manager, p2p, errp); +} + +#endif + +static void audio_mixeng_backend_class_init(ObjectClass *klass, const void= *data) +{ + AudioBackendClass *be =3D AUDIO_BACKEND_CLASS(klass); + + be->get_id =3D audio_mixeng_backend_get_id; +#ifdef CONFIG_GIO + be->set_dbus_server =3D audio_mixeng_backend_set_dbus_server; +#endif +} + +static void audio_mixeng_backend_init(Object *obj) +{ + AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(obj); =20 QLIST_INIT(&s->hw_head_out); QLIST_INIT(&s->hw_head_in); @@ -1629,9 +1670,9 @@ static void audio_be_init(Object *obj) vmstate_register_any(NULL, &vmstate_audio, s); } =20 -static void audio_be_finalize(Object *obj) +static void audio_mixeng_backend_finalize(Object *obj) { - AudioBackend *s =3D AUDIO_BACKEND(obj); + AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(obj); HWVoiceOut *hwo, *hwon; HWVoiceIn *hwi, *hwin; =20 @@ -1747,10 +1788,10 @@ static AudioBackend *audio_init(Audiodev *dev, Erro= r **errp) { int done =3D 0; const char *drvname; - AudioBackend *s; + AudioMixengBackend *s; struct audio_driver *driver; =20 - s =3D AUDIO_BACKEND(object_new(TYPE_AUDIO_BACKEND)); + s =3D AUDIO_MIXENG_BACKEND(object_new(TYPE_AUDIO_MIXENG_BACKEND)); =20 if (dev) { /* -audiodev option */ @@ -1758,7 +1799,7 @@ static AudioBackend *audio_init(Audiodev *dev, Error = **errp) drvname =3D AudiodevDriver_str(dev->driver); driver =3D audio_driver_lookup(drvname); if (driver) { - done =3D audio_driver_init(s, driver, dev, errp); + done =3D audio_driver_do_init(s, driver, dev, errp); } else { error_setg(errp, "Unknown audio driver `%s'", drvname); } @@ -1778,7 +1819,7 @@ static AudioBackend *audio_init(Audiodev *dev, Error = **errp) g_free(e); drvname =3D AudiodevDriver_str(dev->driver); driver =3D audio_driver_lookup(drvname); - if (audio_driver_init(s, driver, dev, NULL)) { + if (audio_driver_do_init(s, driver, dev, NULL)) { break; } qapi_free_Audiodev(dev); @@ -1790,7 +1831,7 @@ static AudioBackend *audio_init(Audiodev *dev, Error = **errp) goto out; } object_unref(s); - return s; + return AUDIO_BACKEND(s); =20 out: object_unref(s); @@ -1829,12 +1870,13 @@ bool AUD_backend_check(AudioBackend **be, Error **e= rrp) static struct audio_pcm_ops capture_pcm_ops; =20 CaptureVoiceOut *AUD_add_capture( - AudioBackend *s, + AudioBackend *be, struct audsettings *as, struct audio_capture_ops *ops, void *cb_opaque ) { + AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(be); CaptureVoiceOut *cap; struct capture_callback *cb; =20 @@ -2225,27 +2267,37 @@ AudioBackend *audio_be_by_name(const char *name, Er= ror **errp) } =20 #ifdef CONFIG_GIO +bool audio_be_can_set_dbus_server(AudioBackend *be) +{ + /* + * TODO: + * AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + * return klass->set_dbus_server !=3D NULL; + */ + return AUDIO_MIXENG_BACKEND(be)->drv->set_dbus_server !=3D NULL; +} + bool audio_be_set_dbus_server(AudioBackend *be, GDBusObjectManagerServer *server, bool p2p, Error **errp) { - assert(be !=3D NULL); + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 - if (!be->drv->set_dbus_server) { - error_setg(errp, "Audiodev '%s' is not compatible with DBus", be->= dev->id); + if (!audio_be_can_set_dbus_server(be)) { + error_setg(errp, "Audiodev '%s' is not compatible with DBus", + audio_be_get_id(be)); return false; } =20 - return be->drv->set_dbus_server(be, server, p2p, errp); + return klass->set_dbus_server(be, server, p2p, errp); } #endif =20 const char *audio_be_get_id(AudioBackend *be) { if (be) { - assert(be->dev); - return be->dev->id; + return AUDIO_BACKEND_GET_CLASS(be)->get_id(be); } else { return ""; } @@ -2320,13 +2372,24 @@ static const TypeInfo audio_be_info =3D { .instance_size =3D sizeof(AudioBackend), .instance_init =3D audio_be_init, .instance_finalize =3D audio_be_finalize, - .abstract =3D false, /* TODO: subclass drivers and make it abstract */ + .abstract =3D true, .class_size =3D sizeof(AudioBackendClass), }; =20 +static const TypeInfo audio_mixeng_backend_info =3D { + .name =3D TYPE_AUDIO_MIXENG_BACKEND, + .parent =3D TYPE_AUDIO_BACKEND, + .instance_size =3D sizeof(AudioMixengBackend), + .instance_init =3D audio_mixeng_backend_init, + .instance_finalize =3D audio_mixeng_backend_finalize, + .class_size =3D sizeof(AudioMixengBackendClass), + .class_init =3D audio_mixeng_backend_class_init, +}; + static void register_types(void) { type_register_static(&audio_be_info); + type_register_static(&audio_mixeng_backend_info); } =20 type_init(register_types); diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 1fe7c4ed647..96d4fa3f471 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -464,7 +464,7 @@ listener_in_vanished_cb(GDBusConnection *connection, } =20 static gboolean -dbus_audio_register_listener(AudioBackend *s, +dbus_audio_register_listener(AudioMixengBackend *s, GDBusMethodInvocation *invocation, #ifdef G_OS_UNIX GUnixFDList *fd_list, @@ -621,7 +621,7 @@ dbus_audio_register_listener(AudioBackend *s, } =20 static gboolean -dbus_audio_register_out_listener(AudioBackend *s, +dbus_audio_register_out_listener(AudioMixengBackend *s, GDBusMethodInvocation *invocation, #ifdef G_OS_UNIX GUnixFDList *fd_list, @@ -637,7 +637,7 @@ dbus_audio_register_out_listener(AudioBackend *s, } =20 static gboolean -dbus_audio_register_in_listener(AudioBackend *s, +dbus_audio_register_in_listener(AudioMixengBackend *s, GDBusMethodInvocation *invocation, #ifdef G_OS_UNIX GUnixFDList *fd_list, @@ -657,7 +657,7 @@ dbus_audio_set_server(AudioBackend *s, bool p2p, Error **errp) { - DBusAudio *da =3D s->drv_opaque; + DBusAudio *da =3D AUDIO_MIXENG_BACKEND(s)->drv_opaque; =20 g_assert(da); g_assert(!da->server); diff --git a/audio/ossaudio.c b/audio/ossaudio.c index c6cad47a015..6ad20ab1876 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -107,13 +107,13 @@ static void oss_anal_close (int *fdp) =20 static void oss_helper_poll_out (void *opaque) { - AudioBackend *s =3D opaque; + AudioMixengBackend *s =3D opaque; audio_run(s, "oss_poll_out"); } =20 static void oss_helper_poll_in (void *opaque) { - AudioBackend *s =3D opaque; + AudioMixengBackend *s =3D opaque; audio_run(s, "oss_poll_in"); } =20 diff --git a/tests/audio/test-audio.c b/tests/audio/test-audio.c index edb4971972c..66693f0fbfd 100644 --- a/tests/audio/test-audio.c +++ b/tests/audio/test-audio.c @@ -170,7 +170,7 @@ static void test_audio_out_sine_wave(void) */ start_time =3D g_get_monotonic_time(); while (state.frames_written < state.total_frames) { - audio_run(state.be, "test"); + audio_run(AUDIO_MIXENG_BACKEND(state.be), "test"); main_loop_wait(true); =20 elapsed_ms =3D (g_get_monotonic_time() - start_time) / 1000; @@ -432,7 +432,7 @@ static void test_audio_capture(void) start_time =3D g_get_monotonic_time(); while (sine_state.frames_written < sine_state.total_frames || state.captured_bytes < CAPTURE_BUFFER_SIZE) { - audio_run(be, "test-capture"); + audio_run(AUDIO_MIXENG_BACKEND(be), "test-capture"); main_loop_wait(true); =20 elapsed_ms =3D (g_get_monotonic_time() - start_time) / 1000; diff --git a/ui/dbus.c b/ui/dbus.c index 0be1931d208..905ee6fea71 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -221,8 +221,7 @@ dbus_display_complete(UserCreatable *uc, Error **errp) =20 { AudioBackend *audio_be =3D audio_get_default_audio_be(NULL); - - if (audio_be && !g_str_equal(audio_be->drv->name, "dbus")) { + if (audio_be && !audio_be_can_set_dbus_server(audio_be)) { audio_be =3D NULL; } if (dd->audiodev && *dd->audiodev) { @@ -231,8 +230,7 @@ dbus_display_complete(UserCreatable *uc, Error **errp) return; } } - if (audio_be && - !audio_be_set_dbus_server(audio_be, dd->server, dd->p2p, errp)= ) { + if (audio_be && !audio_be_set_dbus_server(audio_be, dd->server, dd= ->p2p, errp)) { return; } } --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244536; cv=none; d=zohomail.com; s=zohoarc; b=NCTe+7ASdni3mvXPPa0Os7RsT1sDzjps/zfKhaozvRlkLKxBZa5P9JwkYVbaqH7lRtbKTjZtn4K6OiDpVyzY+uDlwXnJpu+FMk1I2WQcxw/ZAWau1eCfJG3h+77SXFz23J35lk/t9vNC3chzeNP9D/T1fCmuGT2oueuLyJon0Jc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244536; h=Content-Type: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=gSrNsTt5OhqaSvFjhdYJ82+X+igQQqTBVU38kRxeX2E=; b=apTX3eT5I08gqh3lAaUOsa4LcR4vKVEYMGLz7wAGWUIhYOnUXNYF0b3S5QSjG3Povv75VdtA0VZp+5gpAmY1FreKxyNoC6mG1ccV6/ojFZtSiSpHggHyz+0JdWASw2hGMn7LokCBCQKENrVGEgXLswuCOC5bo7Nv6TFQMr7qvrQ= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244536704821.0211088992857; Mon, 16 Feb 2026 04:22:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwbx-0006Cf-64; Mon, 16 Feb 2026 06:17:55 -0500 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 1vrwau-0005LK-D0 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwar-0007TU-Gx for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:47 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-qR0lGbmUOqGSUCG5Sssfsg-1; Mon, 16 Feb 2026 06:16:38 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C90F719560B5; Mon, 16 Feb 2026 11:16:36 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2ADE319560A2; Mon, 16 Feb 2026 11:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gSrNsTt5OhqaSvFjhdYJ82+X+igQQqTBVU38kRxeX2E=; b=TaHhxT2yIXNtfwfuFbvyFxXSkCsDiDXj2l7PFMa6ULzGpWrS1Z4xITE09uoeUt8LPB6bIp nVrsXZtM9jcheXg4+z/hd07tLDQuwQuEZcjgl03e/4y0GZ4CQX1HJXIyecHY5k9QoBaH5z ztqlHdpJc9Kx0LzUaTKiDo/REVHCXJs= X-MC-Unique: qR0lGbmUOqGSUCG5Sssfsg-1 X-Mimecast-MFC-AGG-ID: qR0lGbmUOqGSUCG5Sssfsg_1771240596 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:10 +0100 Subject: [PATCH 21/85] audio: use DEFINE_TYPES MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-21-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2207; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=gobKDZoHJjzI4b+tyY2wIHYANsreP/cSqFXEdfYSp4E=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPZqvwAOE+WQ9+SJAqFDFfOT8hkiMO3JjaX 4PujVC/lgSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5ebuEACgEihyglGztshdETaDeHaVuIg0qhtzOQ2Gb/d3zR5O7YVfWNpEYCRgVwujPVC9ydlPoZw 4Xcy6a0xtD0X+g2TVOeem8+5LCzY0OEd5WDiG9TXP/9/yNP6DsUx4syQwtlLfrnX/l1h//41MNI fc/QSCUNJ0zUlDWcBlamU9HTKJ0BjxA9Y5Was+PUf7m3JcpNrah0X5ZM/Bp7MmX1NfeaAsnIxSV VDRbi5jv4QNQtTMpCMSBlIShk0BFfffzjtwuiDztRr+w838OumegW06wi6RHZNyYvLKPkhrN4Df 4B+44Y2tF6e381bd3fj3Ux4fGlxjgpWX0XLgUF3uXz+axp0/zSO7sqpVmMWz3r+PwgWQStIrjUF t/u9yHtYVazCWBVkMLqw5svh/k4Z682qxevtjeIvPl0wQB2UHE6KfB2qLit6ulNZxdD9kAJNxK1 hI0F0IURBIAk1Mdd6ywAs6sxbP/wygB9kUJfwoxAJNdAoLEO2/k9Ar7U0cBHz5ge8heKSxPj1sn 9LMTpfK7MrlI5DvXbt9LYyAR172RpRbD6hWPjP6phcJnxKyyUryYyfEGoadtcyztIB1I0KDF5LX Ge8tvKri0Ut+eOH49sHszAk0bmc38H2DI7ZI/E3jTUJRvN6ehGSekvlWTDHAxa+757ZefS7UAZd XUuz8S27Y+wjOmQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771244538814158500 It's the "modern" way of registring the object TypeInfo. Suggested-by: Mark Cave-Ayland Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki --- audio/audio.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 75a7f694319..c4e4adec106 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -2366,30 +2366,25 @@ AudiodevList *qmp_query_audiodevs(Error **errp) return ret; } =20 -static const TypeInfo audio_be_info =3D { - .name =3D TYPE_AUDIO_BACKEND, - .parent =3D TYPE_OBJECT, - .instance_size =3D sizeof(AudioBackend), - .instance_init =3D audio_be_init, - .instance_finalize =3D audio_be_finalize, - .abstract =3D true, - .class_size =3D sizeof(AudioBackendClass), -}; - -static const TypeInfo audio_mixeng_backend_info =3D { - .name =3D TYPE_AUDIO_MIXENG_BACKEND, - .parent =3D TYPE_AUDIO_BACKEND, - .instance_size =3D sizeof(AudioMixengBackend), - .instance_init =3D audio_mixeng_backend_init, - .instance_finalize =3D audio_mixeng_backend_finalize, - .class_size =3D sizeof(AudioMixengBackendClass), - .class_init =3D audio_mixeng_backend_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_BACKEND, + .parent =3D TYPE_OBJECT, + .instance_size =3D sizeof(AudioBackend), + .instance_init =3D audio_be_init, + .instance_finalize =3D audio_be_finalize, + .abstract =3D true, + .class_size =3D sizeof(AudioBackendClass), + }, + { + .name =3D TYPE_AUDIO_MIXENG_BACKEND, + .parent =3D TYPE_AUDIO_BACKEND, + .instance_size =3D sizeof(AudioMixengBackend), + .instance_init =3D audio_mixeng_backend_init, + .instance_finalize =3D audio_mixeng_backend_finalize, + .class_size =3D sizeof(AudioMixengBackendClass), + .class_init =3D audio_mixeng_backend_class_init, + } }; =20 -static void register_types(void) -{ - type_register_static(&audio_be_info); - type_register_static(&audio_mixeng_backend_info); -} - -type_init(register_types); +DEFINE_TYPES(audio_types) --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244637; cv=none; d=zohomail.com; s=zohoarc; b=DbvihiS5nDUxI6LCW3Ht+8J4gIIPQvrurg7N6PEtuOAQNs0a2QCw/XSBKFjojRk3JQdMXfN4b/tRzDAqdyrUoJbedJH/6EKKyR2OhRlmeTfUKD3zynZ1s5XkPVQ25yvBzNz0CumX8H23cm0Q3gg4tusN2IoKojbfVAhsQeeFu+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244637; h=Content-Type: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=LnSaRxBAGTqpOnRjgcU7fK6qN6/pVq5+xwI7hZXDScs=; b=gylyjtcCt19nCCqsG0J9SzMST7VSA7tIWlZ5zkFB7d4CeaKZH8tkmyWn54/UsWOW+9p6qe1kn9K+V6g7OZgkHBXcBDiBXWrFzg1t6AupIG8xLL1g0kbTdVamfOF2HtD+X23K8I5aWoMbM4HSwzooMIpNIYg/tzgZe6me3e6/42o= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244637890339.61946017280036; Mon, 16 Feb 2026 04:23:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwdX-0000LJ-Bm; Mon, 16 Feb 2026 06:19:31 -0500 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 1vrwb3-0005Oq-Lu for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwav-0007UA-OG for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:52 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-102-9K88Oy9KPICHbPifigC9Tg-1; Mon, 16 Feb 2026 06:16:42 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 45B5F1800465; Mon, 16 Feb 2026 11:16:40 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E625630001B9; Mon, 16 Feb 2026 11:16:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LnSaRxBAGTqpOnRjgcU7fK6qN6/pVq5+xwI7hZXDScs=; b=KvHooYU/5PRR1jGxt/ShjiKQ73H6WqiW7PDZRowjnfPYpD2MYSf0hKrxOTy0UX/cMGFscF 48OuXir78NInPhH37t0GJG6cNZkYT1avX7FBU9ysHX3MBZeicTL7ACDHUBR2pdg7OnJ3Gh f/pwjL1RYH15VPOeGYO7TC12g8wcuv8= X-MC-Unique: 9K88Oy9KPICHbPifigC9Tg-1 X-Mimecast-MFC-AGG-ID: 9K88Oy9KPICHbPifigC9Tg_1771240600 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:11 +0100 Subject: [PATCH 22/85] audio: simplify audio_init() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-22-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=4073; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=K/qLh28e2vPgm33e8WRKkMMDOHVC8mGtCBftRfM7Y78=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPuWQjmx+oAltbb6CXK981lEPRn579VgwUM BP+4Z5bxBSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5bgSD/9rUthyG3AFSNVI0xfNO8rT0yVrZymsmKqCeO4cVmf+zCoACx+uUNKiu6ePb2Kf9wo2KzU YSOpuk5GWAPC2vrgCyyPMn6whCoJpO3/VLqk9T1J618ttpwZcAJZjMzu/yAqdjTaubIZaJGeype 6J2dB5EWvCtzuRDRHrs//W1q6JVsH3F7Vq8qekTP7iTbn98OcAmwH4R/yAci1jdWf+R7hIFYR8Z LjbmlvX02P0W+BJWYvm2+JeMgrD9rQvpWi+V6GehY3VbuYcHL6zMConcsIlF3fyL83D3d2F+1n7 ShCZBB801J+7nUY0m4YRG7x3WcJg5kFQ12FMb55MULX66cA14EjMzRirps8NB6n1HW1OzjqVtbK zuw1HWCXafcGCTPhx2G1ICi//dp8LYOPJ9+p8VcfLRCEEd8FIViye9sCPpl3lLHFSn1op8pHFbR hCtfPEAyEesbztFukJfq2r6StLrcqAYdCYyYibCw1+ov0+1qnFSAC8p8lE3tB66gMTb4LAr9iP6 Pp9XSxZhvJSNNrx+p6YIR8t5QXOCiwPF34QpgBK9hsS1dRqTqtnrO+S/g9ByGMqmx2LZ0KGkujr oMEIJEfEfHxrrtiRXtvAaJIAX4nFuSa1wXtj8PaDsRTTUGkOr5HzhPyZSkInZaTFwV2oXqpJtBt iNEE/F7LmaMSSKQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244640520158500 Factorize looking up the driver in audio_driver_init() Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio.c | 66 ++++++++++++++++++++++++++-----------------------------= ---- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index c4e4adec106..10e32bcbb1a 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1562,11 +1562,18 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf,= size_t size) return total; } =20 -static bool audio_driver_do_init(AudioMixengBackend *s, struct audio_drive= r *drv, - Audiodev *dev, Error **errp) +static bool audio_driver_do_init(AudioMixengBackend *d, Error **errp) { - s->drv_opaque =3D drv->init(dev, errp); - if (!s->drv_opaque) { + const char *drvname =3D AudiodevDriver_str(d->dev->driver); + struct audio_driver *drv =3D audio_driver_lookup(drvname); + + if (!drv) { + error_setg(errp, "Unknown audio driver `%s'", drvname); + return false; + } + + d->drv_opaque =3D drv->init(d->dev, errp); + if (!d->drv_opaque) { return false; } =20 @@ -1579,14 +1586,14 @@ static bool audio_driver_do_init(AudioMixengBackend= *s, struct audio_driver *drv drv->pcm_ops->put_buffer_out =3D audio_generic_put_buffer_out; } =20 - audio_init_nb_voices_out(s, drv, 1); - audio_init_nb_voices_in(s, drv, 0); - s->drv =3D drv; + audio_init_nb_voices_out(d, drv, 1); + audio_init_nb_voices_in(d, drv, 0); + d->drv =3D drv; =20 - if (dev->timer_period <=3D 0) { - s->period_ticks =3D 1; + if (d->dev->timer_period <=3D 0) { + d->period_ticks =3D 1; } else { - s->period_ticks =3D dev->timer_period * (int64_t)SCALE_US; + d->period_ticks =3D d->dev->timer_period * (int64_t)SCALE_US; } =20 return true; @@ -1786,24 +1793,12 @@ void audio_create_default_audiodevs(void) */ static AudioBackend *audio_init(Audiodev *dev, Error **errp) { - int done =3D 0; - const char *drvname; - AudioMixengBackend *s; - struct audio_driver *driver; + AudioMixengBackend *d; =20 - s =3D AUDIO_MIXENG_BACKEND(object_new(TYPE_AUDIO_MIXENG_BACKEND)); - - if (dev) { - /* -audiodev option */ - s->dev =3D dev; - drvname =3D AudiodevDriver_str(dev->driver); - driver =3D audio_driver_lookup(drvname); - if (driver) { - done =3D audio_driver_do_init(s, driver, dev, errp); - } else { - error_setg(errp, "Unknown audio driver `%s'", drvname); - } - if (!done) { + d =3D AUDIO_MIXENG_BACKEND(object_new(TYPE_AUDIO_MIXENG_BACKEND)); + d->dev =3D dev; + if (d->dev) { + if (!audio_driver_do_init(d, errp)) { goto out; } } else { @@ -1814,27 +1809,24 @@ static AudioBackend *audio_init(Audiodev *dev, Erro= r **errp) error_setg(errp, "no default audio driver available"); goto out; } - s->dev =3D dev =3D e->dev; + d->dev =3D e->dev; QSIMPLEQ_REMOVE_HEAD(&default_audiodevs, next); g_free(e); - drvname =3D AudiodevDriver_str(dev->driver); - driver =3D audio_driver_lookup(drvname); - if (audio_driver_do_init(s, driver, dev, NULL)) { + if (audio_driver_do_init(d, NULL)) { break; } - qapi_free_Audiodev(dev); - s->dev =3D NULL; } } =20 - if (!object_property_try_add_child(get_audiodevs_root(), dev->id, OBJE= CT(s), errp)) { + if (!object_property_try_add_child(get_audiodevs_root(), + d->dev->id, OBJECT(d), errp)) { goto out; } - object_unref(s); - return AUDIO_BACKEND(s); + object_unref(d); + return AUDIO_BACKEND(d); =20 out: - object_unref(s); + object_unref(d); return NULL; } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242024; cv=none; d=zohomail.com; s=zohoarc; b=dFWuKhf60seNlagR5GPOofcUg98Of8R0L6GNCBlnpnKe/vH8DY2HFbXs3ygWGzE48THkFZH1IMoeIc9VDaygbs4DN8hZ7U2FVnVVD2iqFmHh3aXjIU7E1EJh+nxeyD8vZhaoI0XBwO0Kv1g50uVxWHUNN7PfdNTTryV6kqK+cVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242024; h=Content-Type: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=AA3lxWDKN6fj8RCvjWJJC53DLJ6ppqmB5kXOtPh2bPM=; b=J+I9ITwU/+ff/4XfRSnB+laFamdGPg8mD2D3N1NAxPmSXKyna6HLFsSqQ6voPDd/k8YkUtiS36wMhLK//6nzn+uSwGbEdMxvdaWZSDdPF70KlsP1wyEQY+6i+xJqgbj8hp+nXu+Kz7T3GrrjPuxTHOfHiiR4l45SX0PYm6JQs7Q= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242024802746.7362893123192; Mon, 16 Feb 2026 03:40:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweC-0002O6-MZ; Mon, 16 Feb 2026 06:20:12 -0500 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 1vrwb3-0005Or-M3 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwav-0007Uc-P8 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:52 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-85-Nwu4VdMTOmqNas4xj5svkg-1; Mon, 16 Feb 2026 06:16:44 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D11D81800282; Mon, 16 Feb 2026 11:16:42 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1B64718004BB; Mon, 16 Feb 2026 11:16:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AA3lxWDKN6fj8RCvjWJJC53DLJ6ppqmB5kXOtPh2bPM=; b=Yqd6QqBN8MQsZ6CB0Lzufw10WvVUJd/025CDNKqQmJ6MRTnvX6SnZ9XlUpVNF2Kq09b5jp TAYUSODpKw0Efh1PHU2KRmw2OWBPPBIezB84+Qj9BGZ/Ky2vSQcex5xnpECBL9iZXm5uXP jtZEGmsOQ3hflewHQnpwD7xUi8e85gE= X-MC-Unique: Nwu4VdMTOmqNas4xj5svkg-1 X-Mimecast-MFC-AGG-ID: Nwu4VdMTOmqNas4xj5svkg_1771240602 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:12 +0100 Subject: [PATCH 23/85] audio: move object creation to audio_driver_init() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-23-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=4342; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=HTKMvSjc/4XPdb/4s6NCPW0/EkVuqOhfHJStjWnzcjk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPz5VW5lOSxGEpnZlvzF17vfUyl74FC18X3 +VLKiVQzC2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5UUOD/wMJoiMr4h2D7BQYAYyb7p4mQFUp/eg70XYwexnJNOmGP0h5u4eWXj65EmxkfwHHLhKabf Kg6HmXS8OI6/mOE55RQkROZ2zFyxxBWs7paMIanQ1RHPERtR4Vtv7ITkeAC1Nl2pZmcrvKbHdGd gcP+X3+Kj1/EofghbhUa9nrOnL2tVx4dTEAa7IaZXQqnbItEiU/kz6vq2HrKFNRctVhOtqBvwcN br4/3Xb8aiZ//72NqTEwZCT9W6tylwcordwAC3PDT6b/869jm7NEdFDFu1XhihZMP0eq6UymagE EKrzIc8C1xXzOccsVLY/UGKhOyDeT2+vg/tA/SX3/4uDZl5eBy8c08AcRDTodrroR31/dLhZtTg R3Pw+6O31wEuwA5CnjaMJh4rbYjoUqNNkb1oD4utSoyANP1zk3yzAGMPHQ2mNvEmP9U6Z9c5LFw xKGOIyeZr8N+RM4wndfOHmnT7FcJ0Y6CTWorlnMbHbWbzR7g4keDo7efU8uqTrJ65lF1Dtf50tv 52C+ZM36adHJJbV30rOAurXNC9sR/Eo1QjjL7l3KWZE5Yg9MEswVjQIZ/xSSUlPvmBsSli0xkgz ElzgWl2xxvvhH2ex1DUrRHVw9LKU/1HDx3c+FSUifMsbMLEZMboC5Rjj5vScbjkZNFH1sD2a4CT s1iXasmM8sT6G0w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771242026971158500 As we will allow other kind of AudioBackend objects to be instantiated, move the object allocation to a audio_driver_init() and rename it audio_be_new(). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio.c | 65 +++++++++++++++++++++++++++++++------------------------= ---- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 10e32bcbb1a..3e1cd988852 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1562,19 +1562,24 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf,= size_t size) return total; } =20 -static bool audio_driver_do_init(AudioMixengBackend *d, Error **errp) +static AudioBackend *audio_be_new(Audiodev *dev, Error **errp) { - const char *drvname =3D AudiodevDriver_str(d->dev->driver); + const char *drvname =3D AudiodevDriver_str(dev->driver); struct audio_driver *drv =3D audio_driver_lookup(drvname); =20 if (!drv) { error_setg(errp, "Unknown audio driver `%s'", drvname); - return false; + qapi_free_Audiodev(dev); + return NULL; } =20 - d->drv_opaque =3D drv->init(d->dev, errp); - if (!d->drv_opaque) { - return false; + AudioMixengBackend *be =3D AUDIO_MIXENG_BACKEND(object_new(TYPE_AUDIO_= MIXENG_BACKEND)); + be->dev =3D dev; + + be->drv_opaque =3D drv->init(be->dev, errp); + if (!be->drv_opaque) { + object_unref(OBJECT(be)); + return NULL; } =20 if (!drv->pcm_ops->get_buffer_in) { @@ -1586,17 +1591,17 @@ static bool audio_driver_do_init(AudioMixengBackend= *d, Error **errp) drv->pcm_ops->put_buffer_out =3D audio_generic_put_buffer_out; } =20 - audio_init_nb_voices_out(d, drv, 1); - audio_init_nb_voices_in(d, drv, 0); - d->drv =3D drv; + audio_init_nb_voices_out(be, drv, 1); + audio_init_nb_voices_in(be, drv, 0); + be->drv =3D drv; =20 - if (d->dev->timer_period <=3D 0) { - d->period_ticks =3D 1; + if (be->dev->timer_period <=3D 0) { + be->period_ticks =3D 1; } else { - d->period_ticks =3D d->dev->timer_period * (int64_t)SCALE_US; + be->period_ticks =3D be->dev->timer_period * (int64_t)SCALE_US; } =20 - return true; + return AUDIO_BACKEND(be); } =20 static void audio_vm_change_state_handler (void *opaque, bool running, @@ -1793,41 +1798,39 @@ void audio_create_default_audiodevs(void) */ static AudioBackend *audio_init(Audiodev *dev, Error **errp) { - AudioMixengBackend *d; + AudioBackend *be; =20 - d =3D AUDIO_MIXENG_BACKEND(object_new(TYPE_AUDIO_MIXENG_BACKEND)); - d->dev =3D dev; - if (d->dev) { - if (!audio_driver_do_init(d, errp)) { - goto out; + if (dev) { + be =3D audio_be_new(dev, errp); + if (!be) { + return NULL; } } else { assert(!default_audio_be); for (;;) { AudiodevListEntry *e =3D QSIMPLEQ_FIRST(&default_audiodevs); + if (!e) { error_setg(errp, "no default audio driver available"); - goto out; + return NULL; } - d->dev =3D e->dev; + dev =3D e->dev; QSIMPLEQ_REMOVE_HEAD(&default_audiodevs, next); g_free(e); - if (audio_driver_do_init(d, NULL)) { + be =3D audio_be_new(dev, NULL); + if (be) { break; } } } =20 if (!object_property_try_add_child(get_audiodevs_root(), - d->dev->id, OBJECT(d), errp)) { - goto out; + audio_be_get_id(be), OBJECT(be), er= rp)) { + object_unref(be); + return NULL; } - object_unref(d); - return AUDIO_BACKEND(d); - -out: - object_unref(d); - return NULL; + object_unref(be); + return be; } =20 AudioBackend *audio_get_default_audio_be(Error **errp) @@ -2183,7 +2186,7 @@ void audio_init_audiodevs(void) AudiodevListEntry *e; =20 QSIMPLEQ_FOREACH(e, &audiodevs, next) { - audio_init(e->dev, &error_fatal); + audio_init(QAPI_CLONE(Audiodev, e->dev), &error_fatal); } } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771241759; cv=none; d=zohomail.com; s=zohoarc; b=jmAlfyKl4pfrXSZWdZZNBmx8rieM/6P2nJSa6wTCtFCInoGZXrSM6eedUIIhA6/ohUndoE/z550aqU2su5jvzzhQm9QdfO/orD5s6FpVBigXnDcP2OQJk/chstgfb7HaBaZdOMpUEtscVdVCUUTFJQS7q+CFjWa7avuvf0QCyGg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771241759; h=Content-Type: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=C74K2tWVcweB70dhChjxmvQkDVI4wpnqhJGfVEIQrd8=; b=khnfg1sYtlWT2+Wetf5gBIfPCDOHVjPh3VeUEhxbQPAlRuH4wylE5Mf9gOISuvB9CeiBYkRlXjARaL4fqLKSFdixpA/AlX9XH0rt06aRc0zKQuoDSY5xf44YqvbDxA8VqHrxCpN0CVPpzwPfGG3fqXL3kVkwAZReA13z5BRu5Lw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771241759000546.2298091146071; Mon, 16 Feb 2026 03:35:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwe8-0001ia-4T; Mon, 16 Feb 2026 06:20:08 -0500 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 1vrwb6-0005PC-8S for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwax-0007Uw-As for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:16:57 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-fsMAzxRkPpSluGQ62iCFzQ-1; Mon, 16 Feb 2026 06:16:47 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5CBCC1956067; Mon, 16 Feb 2026 11:16:45 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A515A19560A2; Mon, 16 Feb 2026 11:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C74K2tWVcweB70dhChjxmvQkDVI4wpnqhJGfVEIQrd8=; b=C8PdUXr1mLkfYRjz4MyMThTx0Hqo9ZGjGsXJFJHgpfLAvvMuTYWTGgvNy4PM9lSRLKfrXa P5aFOaoac4kLPutm/RueGn3FlYlUJqGTRHEkEurmHPaDP61GINLPyDC/FuAR2vGxJJmaFZ AlDwHXYICVA052xZRs4NAhT7Fp2utiA= X-MC-Unique: fsMAzxRkPpSluGQ62iCFzQ-1 X-Mimecast-MFC-AGG-ID: fsMAzxRkPpSluGQ62iCFzQ_1771240605 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:13 +0100 Subject: [PATCH 24/85] audio: add QOM module-objects for each backend MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-24-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=19909; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=smnEjBnrvBGsC98f664QS0l7ipklBxQwt/RhXOMoiw8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPgmoGCDHhKwkRMtrN3YVWkVdtmJKNibU/O y/Z7rSkvSKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5RL7EAC5cGq37SiM8tzzNb41iV3vydFXGj/zWzih5e0dgKaKJ3Wv2+HVTlLq/ZqblY5QiR5WJOF IsW0QfOk5JVBEuDAI13TzN3sdmBR6qMfWjqHMJFe5GY414+QbJvrGeXlVclH+8wXWXyyloWvOwj nR2nZzpCxP5NJOhr/ZKPIsHWF4+ppMyWOITA06w1x/9vV0w9SVcuDzE50PGVwoZd38AfSMxDycu ujaNifwFHlsh1ZlfPOCuNgdtIIXuW6BsNs8IwmsKFNqpRcal8Ys0jTHTfTOfXbRHUGYWINxRtFW 2nczp7kPynGDRUTy4deIo/wcRcaLz5ltEkUglavZZePD6RWD8N1p5dXgCAo8Mjdi2DUILX94IY5 Azo9S6sMAdj/1kihumV8ba167YRIVpzc55WNX7lMnxvwYwBhjpApFM5x8XfT+FL41Jxyoscs25V 7kl0KIC3iQew1QiwGJfjcLVs/HG8c55WE+/Vq+eBYNKhS0RhWQwdbkH/M3iD5HYU0IDDbEQCAKS iP6Zz8j178c57x8iZ+4x/ElohdcIBB29L7fYa/XO2tXy/Y2A4y1AKyXCznmU5Ijcq8HnT6vD96S AXBoBmNGY1xKF6MovdplBE9y/QpO6gMg0TSP/77XIIxg8lqwJ8XLzKgjvTYVS94u3WH68doXCfd IBd82zmdNt1tFmw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771241763419154100 This will allow to use QOM and the dynamic object module loading. The changes are done systematically, introducing an empty instance structure that will later be filled by state with further refactoring. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki Reviewed-by: Mark Cave-Ayland --- audio/audio_int.h | 2 ++ audio/alsaaudio.c | 27 +++++++++++++++++++++++++++ audio/dbusaudio.c | 26 ++++++++++++++++++++++++++ audio/dsoundaudio.c | 26 ++++++++++++++++++++++++++ audio/jackaudio.c | 26 ++++++++++++++++++++++++++ audio/noaudio.c | 26 ++++++++++++++++++++++++++ audio/ossaudio.c | 26 ++++++++++++++++++++++++++ audio/paaudio.c | 26 ++++++++++++++++++++++++++ audio/pwaudio.c | 26 ++++++++++++++++++++++++++ audio/sdlaudio.c | 26 ++++++++++++++++++++++++++ audio/sndioaudio.c | 26 ++++++++++++++++++++++++++ audio/spiceaudio.c | 26 ++++++++++++++++++++++++++ audio/wavaudio.c | 26 ++++++++++++++++++++++++++ audio/coreaudio.m | 26 ++++++++++++++++++++++++++ 14 files changed, 341 insertions(+) diff --git a/audio/audio_int.h b/audio/audio_int.h index 06f5160e8df..29f5864be69 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -241,6 +241,8 @@ struct SWVoiceCap { =20 struct AudioMixengBackendClass { AudioBackendClass parent_class; + + audio_driver *driver; }; =20 struct AudioMixengBackend { diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 814820e2864..ecc22d7c8f9 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -27,6 +27,7 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/audio.h" +#include "qom/object.h" #include "trace.h" =20 #pragma GCC diagnostic ignored "-Waddress" @@ -36,6 +37,22 @@ =20 #define DEBUG_ALSA 0 =20 +#define TYPE_AUDIO_ALSA "audio-alsa" +OBJECT_DECLARE_SIMPLE_TYPE(AudioALSA, AUDIO_ALSA) + +struct AudioALSA { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver alsa_audio_driver; + +static void audio_alsa_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &alsa_audio_driver; +} + struct pollhlp { snd_pcm_t *handle; struct pollfd *pfds; @@ -945,8 +962,18 @@ static struct audio_driver alsa_audio_driver =3D { .voice_size_in =3D sizeof (ALSAVoiceIn) }; =20 +static const TypeInfo audio_alsa_info =3D { + .name =3D TYPE_AUDIO_ALSA, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioALSA), + .class_init =3D audio_alsa_class_init, +}; + + static void register_audio_alsa(void) { audio_driver_register(&alsa_audio_driver); + type_register_static(&audio_alsa_info); } type_init(register_audio_alsa); +module_obj(TYPE_AUDIO_ALSA); diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 96d4fa3f471..4d62de6d72c 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -26,6 +26,7 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/dbus.h" +#include "qom/object.h" =20 #ifdef G_OS_UNIX #include @@ -44,6 +45,22 @@ =20 #define DBUS_DEFAULT_AUDIO_NSAMPLES 480 =20 +#define TYPE_AUDIO_DBUS "audio-dbus" +OBJECT_DECLARE_SIMPLE_TYPE(AudioDbus, AUDIO_DBUS) + +struct AudioDbus { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver dbus_audio_driver; + +static void audio_dbus_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &dbus_audio_driver; +} + typedef struct DBusAudio { Audiodev *dev; GDBusObjectManagerServer *server; @@ -711,10 +728,19 @@ static struct audio_driver dbus_audio_driver =3D { .voice_size_in =3D sizeof(DBusVoiceIn) }; =20 +static const TypeInfo audio_dbus_info =3D { + .name =3D TYPE_AUDIO_DBUS, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioDbus), + .class_init =3D audio_dbus_class_init, +}; + static void register_audio_dbus(void) { audio_driver_register(&dbus_audio_driver); + type_register_static(&audio_dbus_info); } type_init(register_audio_dbus); =20 module_dep("ui-dbus") +module_obj(TYPE_AUDIO_DBUS) diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 7a03d1dad86..91c83dec742 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -33,6 +33,7 @@ #include "audio_int.h" #include "qemu/module.h" #include "qapi/error.h" +#include "qom/object.h" =20 #include #include @@ -41,6 +42,22 @@ =20 #include "audio_win_int.h" =20 +#define TYPE_AUDIO_DSOUND "audio-dsound" +OBJECT_DECLARE_SIMPLE_TYPE(AudioDsound, AUDIO_DSOUND) + +struct AudioDsound { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver dsound_audio_driver; + +static void audio_dsound_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &dsound_audio_driver; +} + /* #define DEBUG_DSOUND */ =20 typedef struct { @@ -694,8 +711,17 @@ static struct audio_driver dsound_audio_driver =3D { .voice_size_in =3D sizeof (DSoundVoiceIn) }; =20 +static const TypeInfo audio_dsound_info =3D { + .name =3D TYPE_AUDIO_DSOUND, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioDsound), + .class_init =3D audio_dsound_class_init, +}; + static void register_audio_dsound(void) { audio_driver_register(&dsound_audio_driver); + type_register_static(&audio_dsound_info); } type_init(register_audio_dsound); +module_obj(TYPE_AUDIO_DSOUND); diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 7a3fcaedbae..7ed2e91fcc8 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -27,6 +27,7 @@ #include "qemu/atomic.h" #include "qemu/main-loop.h" #include "qemu/audio.h" +#include "qom/object.h" =20 #define AUDIO_CAP "jack" #include "audio_int.h" @@ -34,6 +35,22 @@ #include #include =20 +#define TYPE_AUDIO_JACK "audio-jack" +OBJECT_DECLARE_SIMPLE_TYPE(AudioJack, AUDIO_JACK) + +struct AudioJack { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver jack_driver; + +static void audio_jack_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &jack_driver; +} + struct QJack; =20 typedef enum QJackState { @@ -691,10 +708,18 @@ static void qjack_info(const char *msg) dolog("I: %s\n", msg); } =20 +static const TypeInfo audio_jack_info =3D { + .name =3D TYPE_AUDIO_JACK, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioJack), + .class_init =3D audio_jack_class_init, +}; + static void register_audio_jack(void) { qemu_mutex_init(&qjack_shutdown_lock); audio_driver_register(&jack_driver); + type_register_static(&audio_jack_info); #if !defined(WIN32) && defined(CONFIG_PTHREAD_SETNAME_NP_W_TID) jack_set_thread_creator(qjack_thread_creator); #endif @@ -702,3 +727,4 @@ static void register_audio_jack(void) jack_set_info_function(qjack_info); } type_init(register_audio_jack); +module_obj(TYPE_AUDIO_JACK); diff --git a/audio/noaudio.c b/audio/noaudio.c index 4ed9d2156c5..b3305480013 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -25,10 +25,27 @@ #include "qemu/osdep.h" #include "qemu/module.h" #include "qemu/audio.h" +#include "qom/object.h" =20 #define AUDIO_CAP "noaudio" #include "audio_int.h" =20 +#define TYPE_AUDIO_NONE "audio-none" +OBJECT_DECLARE_SIMPLE_TYPE(AudioNone, AUDIO_NONE) + +struct AudioNone { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver no_audio_driver; + +static void audio_none_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &no_audio_driver; +} + typedef struct NoVoiceOut { HWVoiceOut hw; RateCtl rate; @@ -138,8 +155,17 @@ static struct audio_driver no_audio_driver =3D { .voice_size_in =3D sizeof (NoVoiceIn) }; =20 +static const TypeInfo audio_none_info =3D { + .name =3D TYPE_AUDIO_NONE, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioNone), + .class_init =3D audio_none_class_init, +}; + static void register_audio_none(void) { audio_driver_register(&no_audio_driver); + type_register_static(&audio_none_info); } type_init(register_audio_none); +module_obj(TYPE_AUDIO_NONE); diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 6ad20ab1876..9697f4a0beb 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -30,11 +30,28 @@ #include "qemu/host-utils.h" #include "qapi/error.h" #include "qemu/audio.h" +#include "qom/object.h" #include "trace.h" =20 #define AUDIO_CAP "oss" #include "audio_int.h" =20 +#define TYPE_AUDIO_OSS "audio-oss" +OBJECT_DECLARE_SIMPLE_TYPE(AudioOss, AUDIO_OSS) + +struct AudioOss { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver oss_audio_driver; + +static void audio_oss_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &oss_audio_driver; +} + #if defined OSS_GETVERSION && defined SNDCTL_DSP_POLICY #define USE_DSP_POLICY #endif @@ -772,8 +789,17 @@ static struct audio_driver oss_audio_driver =3D { .voice_size_in =3D sizeof (OSSVoiceIn) }; =20 +static const TypeInfo audio_oss_info =3D { + .name =3D TYPE_AUDIO_OSS, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioOss), + .class_init =3D audio_oss_class_init, +}; + static void register_audio_oss(void) { audio_driver_register(&oss_audio_driver); + type_register_static(&audio_oss_info); } type_init(register_audio_oss); +module_obj(TYPE_AUDIO_OSS); diff --git a/audio/paaudio.c b/audio/paaudio.c index 0c06a397195..707a6d2fb23 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -4,12 +4,29 @@ #include "qemu/module.h" #include "qemu/audio.h" #include "qapi/error.h" +#include "qom/object.h" =20 #include =20 #define AUDIO_CAP "pulseaudio" #include "audio_int.h" =20 +#define TYPE_AUDIO_PA "audio-pa" +OBJECT_DECLARE_SIMPLE_TYPE(AudioPa, AUDIO_PA) + +struct AudioPa { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver pa_audio_driver; + +static void audio_pa_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &pa_audio_driver; +} + typedef struct PAConnection { char *server; int refcount; @@ -931,8 +948,17 @@ static struct audio_driver pa_audio_driver =3D { .voice_size_in =3D sizeof (PAVoiceIn), }; =20 +static const TypeInfo audio_pa_info =3D { + .name =3D TYPE_AUDIO_PA, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioPa), + .class_init =3D audio_pa_class_init, +}; + static void register_audio_pa(void) { audio_driver_register(&pa_audio_driver); + type_register_static(&audio_pa_info); } type_init(register_audio_pa); +module_obj(TYPE_AUDIO_PA); diff --git a/audio/pwaudio.c b/audio/pwaudio.c index 30f717ccacf..31f8899d1ed 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -13,6 +13,7 @@ #include "qemu/audio.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qom/object.h" #include #include #include @@ -27,6 +28,22 @@ =20 #include "audio_int.h" =20 +#define TYPE_AUDIO_PW "audio-pipewire" +OBJECT_DECLARE_SIMPLE_TYPE(AudioPw, AUDIO_PW) + +struct AudioPw { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver pw_audio_driver; + +static void audio_pw_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &pw_audio_driver; +} + typedef struct pwvolume { uint32_t channels; float values[SPA_AUDIO_MAX_CHANNELS]; @@ -847,10 +864,19 @@ static struct audio_driver pw_audio_driver =3D { .voice_size_in =3D sizeof(PWVoiceIn), }; =20 +static const TypeInfo audio_pw_info =3D { + .name =3D TYPE_AUDIO_PW, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioPw), + .class_init =3D audio_pw_class_init, +}; + static void register_audio_pw(void) { audio_driver_register(&pw_audio_driver); + type_register_static(&audio_pw_info); } =20 type_init(register_audio_pw); +module_obj(TYPE_AUDIO_PW); diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 707110973ac..5841e131cc0 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -28,6 +28,7 @@ #include "qemu/module.h" #include "qapi/error.h" #include "qemu/audio.h" +#include "qom/object.h" =20 #ifndef _WIN32 #ifdef __sun__ @@ -40,6 +41,22 @@ #define AUDIO_CAP "sdl" #include "audio_int.h" =20 +#define TYPE_AUDIO_SDL "audio-sdl" +OBJECT_DECLARE_SIMPLE_TYPE(AudioSdl, AUDIO_SDL) + +struct AudioSdl { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver sdl_audio_driver; + +static void audio_sdl_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &sdl_audio_driver; +} + typedef struct SDLVoiceOut { HWVoiceOut hw; int exit; @@ -491,8 +508,17 @@ static struct audio_driver sdl_audio_driver =3D { .voice_size_in =3D sizeof(SDLVoiceIn), }; =20 +static const TypeInfo audio_sdl_info =3D { + .name =3D TYPE_AUDIO_SDL, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioSdl), + .class_init =3D audio_sdl_class_init, +}; + static void register_audio_sdl(void) { audio_driver_register(&sdl_audio_driver); + type_register_static(&audio_sdl_info); } type_init(register_audio_sdl); +module_obj(TYPE_AUDIO_SDL); diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 8197b8b0b47..7f388b498f6 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -20,10 +20,27 @@ #include "qemu/main-loop.h" #include "qemu/audio.h" #include "trace.h" +#include "qom/object.h" =20 #define AUDIO_CAP "sndio" #include "audio_int.h" =20 +#define TYPE_AUDIO_SNDIO "audio-sndio" +OBJECT_DECLARE_SIMPLE_TYPE(AudioSndio, AUDIO_SNDIO) + +struct AudioSndio { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver sndio_audio_driver; + +static void audio_sndio_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &sndio_audio_driver; +} + /* default latency in microseconds if no option is set */ #define SNDIO_LATENCY_US 50000 =20 @@ -555,9 +572,18 @@ static struct audio_driver sndio_audio_driver =3D { .voice_size_in =3D sizeof(SndioVoice) }; =20 +static const TypeInfo audio_sndio_info =3D { + .name =3D TYPE_AUDIO_SNDIO, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioSndio), + .class_init =3D audio_sndio_class_init, +}; + static void register_audio_sndio(void) { audio_driver_register(&sndio_audio_driver); + type_register_static(&audio_sndio_info); } =20 type_init(register_audio_sndio); +module_obj(TYPE_AUDIO_SNDIO); diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 7db2d1f0dfd..d0bcc0836ad 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -24,11 +24,28 @@ #include "qemu/timer.h" #include "qapi/error.h" #include "ui/qemu-spice.h" +#include "qom/object.h" =20 #define AUDIO_CAP "spice" #include "qemu/audio.h" #include "audio_int.h" =20 +#define TYPE_AUDIO_SPICE "audio-spice" +OBJECT_DECLARE_SIMPLE_TYPE(AudioSpice, AUDIO_SPICE) + +struct AudioSpice { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver spice_audio_driver; + +static void audio_spice_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &spice_audio_driver; +} + #if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= =3D 3 #define LINE_OUT_SAMPLES (480 * 4) #else @@ -325,10 +342,19 @@ static struct audio_driver spice_audio_driver =3D { .voice_size_in =3D sizeof (SpiceVoiceIn), }; =20 +static const TypeInfo audio_spice_info =3D { + .name =3D TYPE_AUDIO_SPICE, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioSpice), + .class_init =3D audio_spice_class_init, +}; + static void register_audio_spice(void) { audio_driver_register(&spice_audio_driver); + type_register_static(&audio_spice_info); } type_init(register_audio_spice); +module_obj(TYPE_AUDIO_SPICE); =20 module_dep("ui-spice-core"); diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 46460a5d573..00cf110ecd7 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -25,10 +25,27 @@ #include "qemu/osdep.h" #include "qemu/module.h" #include "qemu/audio.h" +#include "qom/object.h" =20 #define AUDIO_CAP "wav" #include "audio_int.h" =20 +#define TYPE_AUDIO_WAV "audio-wav" +OBJECT_DECLARE_SIMPLE_TYPE(AudioWav, AUDIO_WAV) + +struct AudioWav { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver wav_audio_driver; + +static void audio_wav_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &wav_audio_driver; +} + typedef struct WAVVoiceOut { HWVoiceOut hw; FILE *f; @@ -214,8 +231,17 @@ static struct audio_driver wav_audio_driver =3D { .voice_size_in =3D 0 }; =20 +static const TypeInfo audio_wav_info =3D { + .name =3D TYPE_AUDIO_WAV, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioWav), + .class_init =3D audio_wav_class_init, +}; + static void register_audio_wav(void) { audio_driver_register(&wav_audio_driver); + type_register_static(&audio_wav_info); } type_init(register_audio_wav); +module_obj(TYPE_AUDIO_WAV); diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 997017a1e96..61333e9f2f9 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -29,10 +29,27 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/audio.h" +#include "qom/object.h" =20 #define AUDIO_CAP "coreaudio" #include "audio_int.h" =20 +#define TYPE_AUDIO_COREAUDIO "audio-coreaudio" +OBJECT_DECLARE_SIMPLE_TYPE(AudioCoreaudio, AUDIO_COREAUDIO) + +struct AudioCoreaudio { + AudioMixengBackend parent_obj; +}; + +static struct audio_driver coreaudio_audio_driver; + +static void audio_coreaudio_class_init(ObjectClass *klass, const void *dat= a) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &coreaudio_audio_driver; +} + typedef struct coreaudioVoiceOut { HWVoiceOut hw; pthread_mutex_t buf_mutex; @@ -673,8 +690,17 @@ static void coreaudio_audio_fini (void *opaque) .voice_size_in =3D 0 }; =20 +static const TypeInfo audio_coreaudio_info =3D { + .name =3D TYPE_AUDIO_COREAUDIO, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioCoreaudio), + .class_init =3D audio_coreaudio_class_init, +}; + static void register_audio_coreaudio(void) { audio_driver_register(&coreaudio_audio_driver); + type_register_static(&audio_coreaudio_info); } type_init(register_audio_coreaudio); +module_obj(TYPE_AUDIO_COREAUDIO); --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243747; cv=none; d=zohomail.com; s=zohoarc; b=TU25uFhdfe+5E3JhdmkyUx6tuJxW9OQxbHkbG+lB0vzLN6HFn32FAYobW3DsN5fmm1V4JsCXr313sTp3/R+7fxai6t/SIP/GtUwmcY2KuMWhuEV32u/Fl+kmnt0sMBu+f41GiopFwUvYd1uds6UveOjZRG3UHo4HZ7ETlQcULOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243747; h=Content-Type: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=MUsBjBksReZ1gaFRLPZuGSgyXvz6SSrNa1EyYK/h58o=; b=PZWjNeBQ4rvSWNhjkYxT4slrNDDfa0KIXj50Aw+XerRn4h+NLGG0a9mn5/wBthOAMxeKzjSRIJ3SVSQW+ZvUEzdIY0/BTPILu918vc0HiQWMun4wTb/tLOz72sQrL5H6Wkhp9Zd8NLLz7wlZZ+kXgH3pK/uLBqQRR1ZX0P8NeNg= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243747840613.8818799730036; Mon, 16 Feb 2026 04:09:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwda-0000oT-GG; Mon, 16 Feb 2026 06:19:36 -0500 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 1vrwb7-0005Pd-Qk for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwb4-0007Vn-5M for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:01 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-228-Rsf5jSByM_aMDxAiFpTD6Q-1; Mon, 16 Feb 2026 06:16:50 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 460DD1956094; Mon, 16 Feb 2026 11:16:48 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 526E130001A5; Mon, 16 Feb 2026 11:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MUsBjBksReZ1gaFRLPZuGSgyXvz6SSrNa1EyYK/h58o=; b=WHU0VmppVc2vxgYE76nQqeqAKMTl1zGBkIuTMv7WaK17Tc7PZxlpQFuBpzLXzlCHcx/5Rv +U4/gWW2LYTrlcqk2mpzShxwo4C1BpD25zohxNMQENY9z3ujb2jRAEqL1mUjroSOxfsLRZ RmAtccfBiIEK6IFy9PsyvGj0uRcxxHc= X-MC-Unique: Rsf5jSByM_aMDxAiFpTD6Q-1 X-Mimecast-MFC-AGG-ID: Rsf5jSByM_aMDxAiFpTD6Q_1771240608 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:14 +0100 Subject: [PATCH 25/85] audio: remove set_dbus_server from audio_driver MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-25-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=4292; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=dbOONFCzI/swxM9VY+S6bbCkaSc4yZrxA86hh54hOys=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPfP2bXM3hb4gPF8nqfgGOjVTVptgrC2Mqj KZK0TbdxwKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5d0RD/9hN+Gu4T9upe7I8RRO1rWs7WdRBo1JGUlaVLYfcEOaFzfAuyNqlxd9STApGJ4UTKy5I6g zl+1ytMpxE/nCZLTTgMi/xCZhwmnVwlRAEvR/5+sMXBYFbPkgoEQCKI+b6mCqQYCT70townLztb vKWqgBUhQ5b/0iyvVkQ67ni1//OyK5W90oZJABWGIiQbr+WHlVwK9JRhRFH9mw7fk/42JGS/aei w3TCpFhfU8D4SGsxLG818oQnqZWzuCq8/ZaTOH1xV+cckTgxc/2fGmNHKVW0LlvmRxXAnrL9owm T7VWbo6xnSrJ1RhToHjA5VPxmT3YBT+KrRcL5TulamHQ23laoAXdJZz4MEggmzeoTUOlFHT+Tm6 5L1cmBRmPV2arkLZ7Od5qwLUwevbUcQHwU8pPo0R4Ox7hMp+YggIwiIZFlvXO3LHuB2MYKMWP3q yMUgG/jFpMcCNDPGouS7zzWsNabxtyPjQtrnVkPqQqJgLWnmnf8MjurtA9mtCnr7BUGcFikey8N vnHSBTKCzYD14lfP9yJc1hxnERWvSo31fNaUQpNmwLdI3aMziQgKHnPQYjjVGpNbMSN3hE44RNB rdyFBUDQYzf7Sf3gMYZ8x2wy6XitImVk9GnvwAN2jahXkyIEcnN6icj1plhWMueucHBT0H+So3F uYvxZ33u1O1NaTA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243749282154100 Use the QOM class vtable only instead. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 10 ---------- audio/audio.c | 29 +++-------------------------- audio/dbusaudio.c | 17 +++++++++-------- 3 files changed, 12 insertions(+), 44 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 29f5864be69..0b97c8edee3 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -33,10 +33,6 @@ #include "qemu/audio-capture.h" #include "mixeng.h" =20 -#ifdef CONFIG_GIO -#include -#endif - void G_GNUC_PRINTF(2, 0) AUD_vlog(const char *cap, const char *fmt, va_list ap); =20 @@ -145,12 +141,6 @@ struct audio_driver { const char *name; void *(*init) (Audiodev *, Error **); void (*fini) (void *); -#ifdef CONFIG_GIO - bool (*set_dbus_server)(AudioBackend *be, - GDBusObjectManagerServer *manager, - bool p2p, - Error **errp); -#endif struct audio_pcm_ops *pcm_ops; int max_voices_out; int max_voices_in; diff --git a/audio/audio.c b/audio/audio.c index 3e1cd988852..5d0f5ad2145 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1640,31 +1640,11 @@ static const char *audio_mixeng_backend_get_id(Audi= oBackend *be) return AUDIO_MIXENG_BACKEND(be)->dev->id; } =20 -#ifdef CONFIG_GIO -static bool audio_mixeng_backend_set_dbus_server(AudioBackend *be, - GDBusObjectManagerServer = *manager, - bool p2p, - Error **errp) -{ - AudioMixengBackend *d =3D AUDIO_MIXENG_BACKEND(be); - - if (!d->drv->set_dbus_server) { - return false; - } - - return d->drv->set_dbus_server(be, manager, p2p, errp); -} - -#endif - static void audio_mixeng_backend_class_init(ObjectClass *klass, const void= *data) { AudioBackendClass *be =3D AUDIO_BACKEND_CLASS(klass); =20 be->get_id =3D audio_mixeng_backend_get_id; -#ifdef CONFIG_GIO - be->set_dbus_server =3D audio_mixeng_backend_set_dbus_server; -#endif } =20 static void audio_mixeng_backend_init(Object *obj) @@ -2264,12 +2244,9 @@ AudioBackend *audio_be_by_name(const char *name, Err= or **errp) #ifdef CONFIG_GIO bool audio_be_can_set_dbus_server(AudioBackend *be) { - /* - * TODO: - * AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - * return klass->set_dbus_server !=3D NULL; - */ - return AUDIO_MIXENG_BACKEND(be)->drv->set_dbus_server !=3D NULL; + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->set_dbus_server !=3D NULL; } =20 bool audio_be_set_dbus_server(AudioBackend *be, diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 4d62de6d72c..5a5752b8f33 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -54,13 +54,6 @@ struct AudioDbus { =20 static struct audio_driver dbus_audio_driver; =20 -static void audio_dbus_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &dbus_audio_driver; -} - typedef struct DBusAudio { Audiodev *dev; GDBusObjectManagerServer *server; @@ -720,7 +713,6 @@ static struct audio_driver dbus_audio_driver =3D { .name =3D "dbus", .init =3D dbus_audio_init, .fini =3D dbus_audio_fini, - .set_dbus_server =3D dbus_audio_set_server, .pcm_ops =3D &dbus_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, @@ -728,6 +720,15 @@ static struct audio_driver dbus_audio_driver =3D { .voice_size_in =3D sizeof(DBusVoiceIn) }; =20 +static void audio_dbus_class_init(ObjectClass *klass, const void *data) +{ + AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + b->set_dbus_server =3D dbus_audio_set_server; + k->driver =3D &dbus_audio_driver; +} + static const TypeInfo audio_dbus_info =3D { .name =3D TYPE_AUDIO_DBUS, .parent =3D TYPE_AUDIO_MIXENG_BACKEND, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771245938; cv=none; d=zohomail.com; s=zohoarc; b=kmP6QJc8JAXUZNFkqXVfKJmHwz1j2GH4NqN9utUbwr4dTkbXgRotBLz7qjbGDwgFYqyctb+t7NIhm66VgzWt3fvfZDPqINkzArl1AEB8fOpcKS4LZhrzEehV0FU6L5OJw3VbDYSqwmyJrtIj+jo8GxBbCJgSlegnEe7u+tMnM8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771245938; h=Content-Type: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=fPazC4ZZdFPqExfN3XudQnauOZaANg5Zk51udOOUWKE=; b=EakKCfYpqCNAoPg6+XFK/+SijpuY2KG2yHECEGRQeYoZNSr4ZZRCDbLj/EWyN6++0xBPm7ggQ4IxsZC1FcJZpNqBXNTVd+BIakNX1GaUUN01Mt5hgvxOzUVtcruPpmn/h8oZZeG6D/fejGA3IlVnKGB3Za8CGaIbn0r3/vgCimM= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771245938973602.7744477199883; Mon, 16 Feb 2026 04:45:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfN-0006Sw-6h; Mon, 16 Feb 2026 06:21:25 -0500 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 1vrwbK-0005Z7-6S for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwb6-0007Vx-0b for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:02 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-299-Up68Dq7XNzmTVOsVPnoyEA-1; Mon, 16 Feb 2026 06:16:52 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 915C41955D8C; Mon, 16 Feb 2026 11:16:50 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F3CD030001A5; Mon, 16 Feb 2026 11:16:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fPazC4ZZdFPqExfN3XudQnauOZaANg5Zk51udOOUWKE=; b=LIfxTjv3IXSyqSCnewdo2QoviqB+HZIL5k3ucLYUwGB3H613w38UMPnrPyrbPzV0RP0pmF fdYQ6iHDlHgrtF+9L8LvxKb3wxPnpnUuPaRfZcRHwBX49pJREsJpXrC/OCwtZXGqCWzNG0 xUBhI6d/2p4JAoOpnaQrGFMeHfZ1uuM= X-MC-Unique: Up68Dq7XNzmTVOsVPnoyEA-1 X-Mimecast-MFC-AGG-ID: Up68Dq7XNzmTVOsVPnoyEA_1771240610 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:15 +0100 Subject: [PATCH 26/85] audio: lookup "audio-" object types, and realize them MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-26-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3172; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=OJw6jsdt7wyQcbBsg8GjmVtm4QV1qTWG9rTVIVZxcO0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxP8FIJBr3CGLwm9OUTFfNLqhx5FpSXiHdHl PQZPf44SeWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5X/zD/0SfbgLLY+P5ZjBjQPEFjax6JUXRGp5ezDTcd2HMi4+O1EAF0XcWKnQQu9TED1z6tWO1VU G647nvGnA0gSbEHEU7Wla3ML/S0D+8KDmtxYBwOXcbSbiE0BtTQBUC7H91fqxmPsy5i2qpVmTI8 FxfVe7BAWq8K7y6KlxMFA9Nf3F8mS+0uVxem/wgTKiTTQauDzyA0watsd6cf1LhhzKgDxSt2Xu7 /6bKk6fTvQBpAsIUbHr6IeddJcY2gOFfFR9i2TnUHbEqCpaNQUw1QNwrICbweL5nSzVTnLfisk1 pP8zNnO7zTrCtbfimxyaKp4AAesmgw1Lo6uSM2awJ9BDOXmflHRzyeWw3q7g8lwikj6j4yhsLWh V4cd4Anx7aI7G+cKSlW6UkmL8hwCtFHyongTaIKgD+wGOwZA9jQmUeM8SFoEfrXsUXqETobARBT /Q4q98+qAb5ZXw82SFikQDxpUNsyLZHVqLo45+GiAK6BNgizejgtrEuV+GTGtIrybA+cTC0j62l lj7hvvCOqFzSfmC378fesbTjKdn0jaR8MjvFhe9ePt+DbbhpW/lxzCCtEyIS2iMn5Bzzyj0SM7I gPMUDjfA+gNpzVBmfINsB9eNiiiLKON7VZGSHgHMl7lYv0qojE4YeDiPuXuqIPjhtK8gjQ5efg0 d3LdVD3ZEBlY/cg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771245940038158500 Now "audio_driver" is a detail implementation of AudioMixengBackend and not required to implement an AudioBackend. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- include/qemu/audio.h | 1 + audio/audio.c | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/include/qemu/audio.h b/include/qemu/audio.h index 474d761f0be..1eeead2a722 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -51,6 +51,7 @@ typedef struct AudioBackend { typedef struct AudioBackendClass { ObjectClass parent_class; =20 + bool (*realize)(AudioBackend *be, Audiodev *dev, Error **errp); const char *(*get_id)(AudioBackend *be); #ifdef CONFIG_GIO bool (*set_dbus_server)(AudioBackend *be, diff --git a/audio/audio.c b/audio/audio.c index 5d0f5ad2145..72949fe27f5 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1562,24 +1562,16 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf,= size_t size) return total; } =20 -static AudioBackend *audio_be_new(Audiodev *dev, Error **errp) +static bool audio_mixeng_backend_realize(AudioBackend *abe, + Audiodev *dev, Error **errp) { - const char *drvname =3D AudiodevDriver_str(dev->driver); - struct audio_driver *drv =3D audio_driver_lookup(drvname); + AudioMixengBackend *be =3D AUDIO_MIXENG_BACKEND(abe); + audio_driver *drv =3D AUDIO_MIXENG_BACKEND_GET_CLASS(be)->driver; =20 - if (!drv) { - error_setg(errp, "Unknown audio driver `%s'", drvname); - qapi_free_Audiodev(dev); - return NULL; - } - - AudioMixengBackend *be =3D AUDIO_MIXENG_BACKEND(object_new(TYPE_AUDIO_= MIXENG_BACKEND)); be->dev =3D dev; - be->drv_opaque =3D drv->init(be->dev, errp); if (!be->drv_opaque) { - object_unref(OBJECT(be)); - return NULL; + return false; } =20 if (!drv->pcm_ops->get_buffer_in) { @@ -1601,7 +1593,26 @@ static AudioBackend *audio_be_new(Audiodev *dev, Err= or **errp) be->period_ticks =3D be->dev->timer_period * (int64_t)SCALE_US; } =20 - return AUDIO_BACKEND(be); + return true; +} + +static AudioBackend *audio_be_new(Audiodev *dev, Error **errp) +{ + const char *drvname =3D AudiodevDriver_str(dev->driver); + g_autofree char *type =3D g_strconcat("audio-", drvname, NULL); + AudioBackend *be =3D AUDIO_BACKEND(object_new(type)); + + if (!be) { + error_setg(errp, "Unknown audio driver `%s'", drvname); + return NULL; + } + + if (!AUDIO_BACKEND_GET_CLASS(be)->realize(be, dev, errp)) { + object_unref(OBJECT(be)); + return NULL; + } + + return be; } =20 static void audio_vm_change_state_handler (void *opaque, bool running, @@ -1644,6 +1655,7 @@ static void audio_mixeng_backend_class_init(ObjectCla= ss *klass, const void *data { AudioBackendClass *be =3D AUDIO_BACKEND_CLASS(klass); =20 + be->realize =3D audio_mixeng_backend_realize; be->get_id =3D audio_mixeng_backend_get_id; } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243766; cv=none; d=zohomail.com; s=zohoarc; b=nfBNFPFQouy6nKS6d4SKrbHLqpV/Nx6GdxZsKZVtE10lo4uyH6nrd9w6n+m+7ItfTgzsBTSxQbYh5auO6f2Xa97DgmcV303FdVMDmcnxEg0YOvwb5RgfVBtXjOCbgCCnhdcfD+n8mSzvhWWBUYkONjKWvrQKbAJz7f3ZgBp4oKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243766; h=Content-Type: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=3cfhdOzknAF9YO6j0QekhEL3lL807Fp77kyJj7wmWFs=; b=UjDpKAERe8qKU674mOji/kblBo48UX9g3dTZqyGwoXk9KqV+EglvwnhQr7hAhCt3Mk7Q+En3bmJKiQHKfXlKcHzfIXfjUPKGC3yU4kcDSi0nsZ3er+h1bv/LCFjklX1R/+vqFFG/p5fAoqwwL/znSI1g/W+DMY4nr84I19KVsZw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177124376652930.052660168788407; Mon, 16 Feb 2026 04:09:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfa-0008Mo-H0; Mon, 16 Feb 2026 06:21:38 -0500 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 1vrwbK-0005Z5-5y for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwb6-0007Ys-8R for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:03 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-348-dgIVvDxQONKLDdsJPAnelA-1; Mon, 16 Feb 2026 06:16:55 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6AFFD180057E; Mon, 16 Feb 2026 11:16:53 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8890718003F5; Mon, 16 Feb 2026 11:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3cfhdOzknAF9YO6j0QekhEL3lL807Fp77kyJj7wmWFs=; b=K1UBGNUMMJaQpsj8z61J6/KbzA5OtGmRtWXYOmezW33uA9tddcE7sAd1sSV8igu9Toh3he lGf8LLJPg1cJ6JQSI1REEbaQLZWJrsAO/nQy0T51C+btzNwGxpizOdM98YNj9C9R+Eayst yxsRrVmSkyrBWgHlHX5VarkY0hp0c5o= X-MC-Unique: dgIVvDxQONKLDdsJPAnelA-1 X-Mimecast-MFC-AGG-ID: dgIVvDxQONKLDdsJPAnelA_1771240613 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:16 +0100 Subject: [PATCH 27/85] audio: drop audio driver registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-27-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=8757; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=azrrD2hSQuvPvUHhEWUcKcpNNPTuuiUl6Tzb3Fh3kL4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPrPWbFGVfXMLpQzg2rNHWeAk8rDnBWOLKJ MI7Pwx3sR+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5UzND/9jBaKwuuWl3L5VRzoK3j1iU17UCb6YvE4L4/UcsDkDtZ4/86Jw+3bAZIkLwXE0J3fJOob 0dPXDwTECFZWh4kEVTenIYuRqBXUHaKahAcBxX6YE8h0As8qiC/gFrebUptUP96T7TzplBhexvJ 3A4V1XymaIpzTzFCQudAgEO3wbjPK9FsvD+7k2svnkddvAm+pzHbF+JHKcCqIARZjTsxtYGna/M 3C+s2x79E5rSYRWNy4L01KfzzOeyoyxnts1LHvrYtgMZTtCpA/zo7DTnJKyAjdxAU+uqJODFUbe mI6Ykhd8b5mJqqn17RKf713KekVxXiXxWDpyoumaqK3QGDR3iVXZsld94lXFwjDBwHXIs6hxc6H 5jnOg9f/GbdVaCLuWQqnw7l/ZSyLoLt7zkY3HUeRBvGHlBYsQEA5A0kFoouB0FXCI8D0uneoIVG /HxerlCKAYbP4OU8yONP83PIQoKrRm6/raRgR62yBniJ7znOj1MEVKD5omK1YEChapSTybdLJ2l IhFANRG23ZIUIr3sCsRZMxz/3l1I1aIIRQkM12vt9UB/ANWzcBri7q6dmmqT5EvvNXWjWsPseKy ztnr0WY1Y+ooVmMG/BH87UobAPL5+6uLiQ7/1VQu5UUCYIYz4GjBHB4OfJffLLW8AST6zCSqNTo yyBypsdfZ0RTFxg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243769651154100 module_object_class_by_name() handles loading the module providing the requested object. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki Reviewed-by: Mark Cave-Ayland --- audio/audio_int.h | 2 -- audio/alsaaudio.c | 1 - audio/audio.c | 43 +++++++++++++------------------------------ audio/dbusaudio.c | 1 - audio/dsoundaudio.c | 1 - audio/jackaudio.c | 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/spiceaudio.c | 1 - audio/wavaudio.c | 1 - audio/coreaudio.m | 1 - 15 files changed, 13 insertions(+), 45 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 0b97c8edee3..446ba1d52c6 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -259,8 +259,6 @@ extern const struct mixeng_volume nominal_volume; =20 extern const char *audio_prio_list[]; =20 -void audio_driver_register(audio_driver *drv); - void audio_pcm_init_info (struct audio_pcm_info *info, const struct audset= tings *as); void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int= len); =20 diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index ecc22d7c8f9..7200777ad82 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -972,7 +972,6 @@ static const TypeInfo audio_alsa_info =3D { =20 static void register_audio_alsa(void) { - audio_driver_register(&alsa_audio_driver); type_register_static(&audio_alsa_info); } type_init(register_audio_alsa); diff --git a/audio/audio.c b/audio/audio.c index 72949fe27f5..16edc57e5f0 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -68,40 +68,21 @@ const char *audio_prio_list[] =3D { NULL }; =20 -static QLIST_HEAD(, audio_driver) audio_drivers; static AudiodevListHead audiodevs =3D QSIMPLEQ_HEAD_INITIALIZER(audiodevs); static AudiodevListHead default_audiodevs =3D QSIMPLEQ_HEAD_INITIALIZER(default_audiodevs); =20 - -void audio_driver_register(audio_driver *drv) -{ - QLIST_INSERT_HEAD(&audio_drivers, drv, next); -} - -static audio_driver *audio_driver_lookup(const char *name) +static AudioBackendClass *audio_be_class_by_name(const char *name) { - struct audio_driver *d; - Error *local_err =3D NULL; - int rv; + g_autofree char *tname =3D g_strconcat("audio-", name, NULL); + ObjectClass *oc =3D module_object_class_by_name(tname); =20 - QLIST_FOREACH(d, &audio_drivers, next) { - if (strcmp(name, d->name) =3D=3D 0) { - return d; - } - } - rv =3D audio_module_load(name, &local_err); - if (rv > 0) { - QLIST_FOREACH(d, &audio_drivers, next) { - if (strcmp(name, d->name) =3D=3D 0) { - return d; - } - } - } else if (rv < 0) { - error_report_err(local_err); + if (!oc || !object_class_dynamic_cast(oc, TYPE_AUDIO_BACKEND)) { + return NULL; } - return NULL; + + return AUDIO_BACKEND_CLASS(oc); } =20 static AudioBackend *default_audio_be; @@ -1764,7 +1745,7 @@ static const VMStateDescription vmstate_audio =3D { void audio_create_default_audiodevs(void) { for (int i =3D 0; audio_prio_list[i]; i++) { - if (audio_driver_lookup(audio_prio_list[i])) { + if (audio_be_class_by_name(audio_prio_list[i]) !=3D NULL) { QDict *dict =3D qdict_new(); Audiodev *dev =3D NULL; Visitor *v; @@ -2129,9 +2110,11 @@ void audio_help(void) printf("Available audio drivers:\n"); =20 for (i =3D 0; i < AUDIODEV_DRIVER__MAX; i++) { - audio_driver *driver =3D audio_driver_lookup(AudiodevDriver_str(i)= ); - if (driver) { - printf("%s\n", driver->name); + const char *name =3D AudiodevDriver_str(i); + AudioBackendClass *be =3D audio_be_class_by_name(name); + + if (be) { + printf("%s\n", name); } } } diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 5a5752b8f33..48c9078d80e 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -738,7 +738,6 @@ static const TypeInfo audio_dbus_info =3D { =20 static void register_audio_dbus(void) { - audio_driver_register(&dbus_audio_driver); type_register_static(&audio_dbus_info); } type_init(register_audio_dbus); diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 91c83dec742..6d213899660 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -720,7 +720,6 @@ static const TypeInfo audio_dsound_info =3D { =20 static void register_audio_dsound(void) { - audio_driver_register(&dsound_audio_driver); type_register_static(&audio_dsound_info); } type_init(register_audio_dsound); diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 7ed2e91fcc8..bfce4cb0b4c 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -718,7 +718,6 @@ static const TypeInfo audio_jack_info =3D { static void register_audio_jack(void) { qemu_mutex_init(&qjack_shutdown_lock); - audio_driver_register(&jack_driver); type_register_static(&audio_jack_info); #if !defined(WIN32) && defined(CONFIG_PTHREAD_SETNAME_NP_W_TID) jack_set_thread_creator(qjack_thread_creator); diff --git a/audio/noaudio.c b/audio/noaudio.c index b3305480013..8b5ebd71bf6 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -164,7 +164,6 @@ static const TypeInfo audio_none_info =3D { =20 static void register_audio_none(void) { - audio_driver_register(&no_audio_driver); type_register_static(&audio_none_info); } type_init(register_audio_none); diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 9697f4a0beb..b8e26b17ed7 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -798,7 +798,6 @@ static const TypeInfo audio_oss_info =3D { =20 static void register_audio_oss(void) { - audio_driver_register(&oss_audio_driver); type_register_static(&audio_oss_info); } type_init(register_audio_oss); diff --git a/audio/paaudio.c b/audio/paaudio.c index 707a6d2fb23..adaeb2af807 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -957,7 +957,6 @@ static const TypeInfo audio_pa_info =3D { =20 static void register_audio_pa(void) { - audio_driver_register(&pa_audio_driver); type_register_static(&audio_pa_info); } type_init(register_audio_pa); diff --git a/audio/pwaudio.c b/audio/pwaudio.c index 31f8899d1ed..facd166052c 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -874,7 +874,6 @@ static const TypeInfo audio_pw_info =3D { static void register_audio_pw(void) { - audio_driver_register(&pw_audio_driver); type_register_static(&audio_pw_info); } =20 diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 5841e131cc0..c00f1366d17 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -517,7 +517,6 @@ static const TypeInfo audio_sdl_info =3D { =20 static void register_audio_sdl(void) { - audio_driver_register(&sdl_audio_driver); type_register_static(&audio_sdl_info); } type_init(register_audio_sdl); diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 7f388b498f6..c8310b1fa37 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -581,7 +581,6 @@ static const TypeInfo audio_sndio_info =3D { =20 static void register_audio_sndio(void) { - audio_driver_register(&sndio_audio_driver); type_register_static(&audio_sndio_info); } =20 diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index d0bcc0836ad..d1bb318b6b7 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -351,7 +351,6 @@ static const TypeInfo audio_spice_info =3D { =20 static void register_audio_spice(void) { - audio_driver_register(&spice_audio_driver); type_register_static(&audio_spice_info); } type_init(register_audio_spice); diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 00cf110ecd7..12d4108ffad 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -240,7 +240,6 @@ static const TypeInfo audio_wav_info =3D { =20 static void register_audio_wav(void) { - audio_driver_register(&wav_audio_driver); type_register_static(&audio_wav_info); } type_init(register_audio_wav); diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 61333e9f2f9..5efd16df7c4 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -699,7 +699,6 @@ static void coreaudio_audio_fini (void *opaque) =20 static void register_audio_coreaudio(void) { - audio_driver_register(&coreaudio_audio_driver); type_register_static(&audio_coreaudio_info); } type_init(register_audio_coreaudio); --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243054; cv=none; d=zohomail.com; s=zohoarc; b=bhV5sDx2TE2KyQ3AjKe5sy8LK/lQbRD/a4rc6v+sSpJO9/np35Lk52TrDaI5vShjiaJSJQEwjczGkxU1CADdTng2YhLhIG0YVLR8tLG1DFK24SvSo0GyillgK8LH7jjOEni1KQ4x+A98vZ1mGuNR6DUFNE3BMshd9HstzXUwZuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243054; h=Content-Type: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=oCvtiKHuMNHGGGyZh38jZ7AWFLiBWPGcC09Xtri+dZc=; b=kJ3srkoU/iI1wVi+hL3/4ZQzbKIAlRTGxQD57wqeXFZ8nkbX1aExRhDIc+pNDDXZZRk3wEgXVV/p3qhGOH8/IiG+3fwTkQtrE3sxaopOIWdL8ynkYhTJWzktdgS4Z6R7IY3xkHWcf3wf8C3rI+ImDodxvCIgrJ00M7yQzXwOJZ4= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243054872868.5406379825647; Mon, 16 Feb 2026 03:57:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfS-0007Bw-Bj; Mon, 16 Feb 2026 06:21:30 -0500 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 1vrwbK-0005ag-Mm for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwb7-0007dA-Sb for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:04 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-520-1xnOWLLlOmOPIbnDMqituA-1; Mon, 16 Feb 2026 06:16:58 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 404DD1956053; Mon, 16 Feb 2026 11:16:56 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1D5241800464; Mon, 16 Feb 2026 11:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240621; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oCvtiKHuMNHGGGyZh38jZ7AWFLiBWPGcC09Xtri+dZc=; b=RfxemQF2HB9Nm071CjbiZIfS8yl4/s2w78fZkZuDAUM3RYEawaGjHfZJ/LKBfvpAapRCaR VHQWoDSph4iLUwZTUwg5a4p0QAiEdxmnBNu8cnGNeBZAgKqcnXdIF94jjzwp1mNveL51Q3 ZMKpiaV4LRosixwvGZ0eGOr2zoXnEhI= X-MC-Unique: 1xnOWLLlOmOPIbnDMqituA-1 X-Mimecast-MFC-AGG-ID: 1xnOWLLlOmOPIbnDMqituA_1771240616 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:17 +0100 Subject: [PATCH 28/85] module: remove audio module support MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-28-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1350; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=xo7WcFF7K5qpRxKZuwsYck3lIjO818VAyiQpuJT+ksg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPYH2LVSDfFtszpts1e0wJZTFXoNQ0TAXdp myy7dZCIGeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5agPEACSNMLPLuFrMBRyR/zdSmNr/TBTd/1Jl8hYbgWfANPkOxiQPXmB37YPucBLD783m1lv20N DL/3NHPix53uFQLMjHwryeBx0XgO7WldwB4ahMC8SZGSSZIKux4O85n9z79Wfsen42YYXkBbMhu 4d8D3+e+JSQFLHEGQTyg14XXinI8439zrXjRljPMNGkh5oTpn76PoiimcFG8jEdq1lH15dBHcCk cKBjdQpM8jHNe8WEgGfymOtRLDRYCe/7G6g60ZYi77dypboiwtalzovZoy2xgANPA9CXifx5J4r BfGEON09lm4fzfaAL+iW7flLp7j1+cZQv9D3E+9elhPXJ3fh/G+FET99L44hw26utxLjfA9QjjS wl8e+hASIXD8KDqGnJMERRN7ne/UqZi9ecdk6vNhb8NFwRx2KdEvc6BZPc1EkNXM4ocADW+P7dT jSHaIsYq2KbYjDCAcR02YibaWq/+pvob8Ro/775np9fx9eJs10ep7hNevS6ReZPFNTQ5bJokpUm ArkLfyQ4xI8mWePWJrt4A4JaN5mJPXe9sP8tU/c/K2p73omKwJJuYfJ9wtHfgRlYRCJ6b1QYpzY pNdYtEaXmoXblGuWapn/LP9cS0U/0pPUJuFZrmUYQDRG9Os6ezuUHai7XoXi0t+HniqhbGYeQCD NRqdyBHUBs/8vuw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243056658154100 It relies on dynamic object loading support instead. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- include/qemu/module.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/qemu/module.h b/include/qemu/module.h index c37ce74b16f..9885ac9afb3 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -63,7 +63,6 @@ typedef enum { #define migration_init(function) module_init(function, MODULE_INIT_MIGRATI= ON) #define block_module_load(lib, errp) module_load("block-", lib, errp) #define ui_module_load(lib, errp) module_load("ui-", lib, errp) -#define audio_module_load(lib, errp) module_load("audio-", lib, errp) =20 void register_module_init(void (*fn)(void), module_init_type type); void register_dso_module_init(void (*fn)(void), module_init_type type); @@ -78,7 +77,7 @@ void module_call_init(module_init_type type); * - get_relocated_path(CONFIG_QEMU_MODDIR); * - /var/run/qemu/${version_dir} * - * prefix: a subsystem prefix, or the empty string ("audio-", ...,= "") + * prefix: a subsystem prefix, or the empty string ("ui-", ..., "") * name: name of the module * errp: error to set in case the module is found, but load fail= ed. * --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244763; cv=none; d=zohomail.com; s=zohoarc; b=VF+IPvroSf/N6hlbUAfpYKgP1FC/34Xtcg53rsOmEArdidNbn9q4/n5lEMx249akLwk5goDOrXA4JBqh2L5twMXJsutsLYfTF6GTeqWLqPvPHpxxGgjHv/XnFH5BiiUFPA2C1ugBFyjzInf7fETCYC7DZmvkkSubB20Tvt99JnQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244763; h=Content-Type: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=U0bHWW5dgK+/HJjVU+OAOt9u9O6Cx3FhrDkXc/laulI=; b=IXOppkQ0Z8b1x8aCZoRu2M1goBdm8RAzJ5rXqk4cvjx8Hi+OpvEH/J6BIQ+Xt6WyXM98WtGqrh4vhPf9vWOyhUz2e/Mo69pc2Cy2zPqEAzA9wvRW8fNUQTbg7MFzRzOVMaRtOBebYXKnWSGkwbzCcuB8Ff5v9fiiXQYJc4Yc3jw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244763510764.2594903214693; Mon, 16 Feb 2026 04:26:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwe4-0001Me-5g; Mon, 16 Feb 2026 06:20:04 -0500 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 1vrwbO-0005c9-QE for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbJ-0007hT-Uv for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:17 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-97-TVTG2A9MMSOzqy6JBVlDGQ-1; Mon, 16 Feb 2026 06:17:01 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 57EA119560B2; Mon, 16 Feb 2026 11:16:59 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 13AB130001B9; Mon, 16 Feb 2026 11:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U0bHWW5dgK+/HJjVU+OAOt9u9O6Cx3FhrDkXc/laulI=; b=D9AUBAToeDykvv5IQOg+DEJ9Z4Qg1ldgfY1oR7AVGVTZ29v6ZADKxmTVBFs2oxT/uU3K93 gF36TUPMVY5QQDgiYIuDoyW9TiYygMwzK6YnuoYZRZZYxlkrZTmB1RDBH7WMtiBx1kZdOs ZeVrRQvuOwPawbXDVGxCpujbXyz13Z0= X-MC-Unique: TVTG2A9MMSOzqy6JBVlDGQ-1 X-Mimecast-MFC-AGG-ID: TVTG2A9MMSOzqy6JBVlDGQ_1771240619 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:18 +0100 Subject: [PATCH 29/85] audio: replace type_init() with DEFINE_TYPES MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-29-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=12925; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/OclfmP5XewpxJNnSJDp4/Un0I4vQMcL2p0K7RiWt4g=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPzq1tH1Qld4toiGW9FYMLYpn54fKwAT0rU t4x/7ROkeuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5XZ5D/92BWDs6BYjDg87G45/PgA62LTJsOjfYla3IWwsajkwczYlhI7uPJ5UromLxFIX8caU8hY 0qcuok4XsErMv0/pP6E7mpiwpnwwdUPPIBZQjTtM6RKte3xpcVFbNqDZ81RE13vrC4sajh4r71+ Pf7s0lvB5r59HOEW5qxQOlolKDyfHxofNWHdhYH08vwlAg/2fpRl8SCtgZqQ1urSEZgX1WjrQig ZytPyiyuc9NY1vgwMCZebFPcA8tCYRVW1LUaYeMswPG2i4VYwUOFhwjYbnKntDk8M4xBOCx1+5f w4wHmFYqFAxo0h0KwL9jB9aJpiOf0bQXw6OBZe7EO6y/pM5fwNS2oe1Vr0YVcQgS+aa0CPkVv5C w2Wkl2scangyq9W54eKBhu+y2FD96PYVUEBaFGUABj3pMhzADEOsRvzwTNBKgaHpbgC1xACt3FH EDpY1BstbEyMR/w97IzuzUdPPdtsd4oFLvkTe4sRVtXz1zxCml5qJbbff5fGbjZnIL5uWZZxn8i RmjH0upZzn9bWl+ud5hPXMyId3OJ+OyBIXaqZ8D1boiuVU3Jp2On0u/txT1Ad069DRr+3FOZfvs gEJxDqEJpzuLtDQC7dQGQ5VUTkf3Xd8BnLqg9z5E1M5Sx2Jai9jpO0OM/Dvj5lrEpi+q1TzTwqW FUG5mus6sXQUtGg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771244764322158500 Use the convenience macro to register types. Note that jack backend was using the type registration to initialize some globals. Use a ctor function instead. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki --- audio/alsaaudio.c | 19 ++++++++----------- audio/dbusaudio.c | 18 ++++++++---------- audio/dsoundaudio.c | 18 ++++++++---------- audio/jackaudio.c | 18 ++++++++++-------- audio/noaudio.c | 18 ++++++++---------- audio/ossaudio.c | 18 ++++++++---------- audio/paaudio.c | 18 ++++++++---------- audio/pwaudio.c | 20 ++++++++------------ audio/sdlaudio.c | 18 ++++++++---------- audio/sndioaudio.c | 19 ++++++++----------- audio/spiceaudio.c | 18 ++++++++---------- audio/wavaudio.c | 18 ++++++++---------- audio/coreaudio.m | 18 ++++++++---------- 13 files changed, 106 insertions(+), 132 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 7200777ad82..ae1cec6a36e 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -962,17 +962,14 @@ static struct audio_driver alsa_audio_driver =3D { .voice_size_in =3D sizeof (ALSAVoiceIn) }; =20 -static const TypeInfo audio_alsa_info =3D { - .name =3D TYPE_AUDIO_ALSA, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioALSA), - .class_init =3D audio_alsa_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_ALSA, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioALSA), + .class_init =3D audio_alsa_class_init, + }, }; =20 - -static void register_audio_alsa(void) -{ - type_register_static(&audio_alsa_info); -} -type_init(register_audio_alsa); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_ALSA); diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 48c9078d80e..269db7877b6 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -729,18 +729,16 @@ static void audio_dbus_class_init(ObjectClass *klass,= const void *data) k->driver =3D &dbus_audio_driver; } =20 -static const TypeInfo audio_dbus_info =3D { - .name =3D TYPE_AUDIO_DBUS, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioDbus), - .class_init =3D audio_dbus_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_DBUS, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioDbus), + .class_init =3D audio_dbus_class_init, + }, }; =20 -static void register_audio_dbus(void) -{ - type_register_static(&audio_dbus_info); -} -type_init(register_audio_dbus); +DEFINE_TYPES(audio_types) =20 module_dep("ui-dbus") module_obj(TYPE_AUDIO_DBUS) diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 6d213899660..462d09e02af 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -711,16 +711,14 @@ static struct audio_driver dsound_audio_driver =3D { .voice_size_in =3D sizeof (DSoundVoiceIn) }; =20 -static const TypeInfo audio_dsound_info =3D { - .name =3D TYPE_AUDIO_DSOUND, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioDsound), - .class_init =3D audio_dsound_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_DSOUND, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioDsound), + .class_init =3D audio_dsound_class_init, + }, }; =20 -static void register_audio_dsound(void) -{ - type_register_static(&audio_dsound_info); -} -type_init(register_audio_dsound); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_DSOUND); diff --git a/audio/jackaudio.c b/audio/jackaudio.c index bfce4cb0b4c..972b158f023 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -708,22 +708,24 @@ static void qjack_info(const char *msg) dolog("I: %s\n", msg); } =20 -static const TypeInfo audio_jack_info =3D { - .name =3D TYPE_AUDIO_JACK, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioJack), - .class_init =3D audio_jack_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_JACK, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioJack), + .class_init =3D audio_jack_class_init, + }, }; =20 -static void register_audio_jack(void) +static void __attribute__((__constructor__)) audio_jack_init(void) { qemu_mutex_init(&qjack_shutdown_lock); - type_register_static(&audio_jack_info); #if !defined(WIN32) && defined(CONFIG_PTHREAD_SETNAME_NP_W_TID) jack_set_thread_creator(qjack_thread_creator); #endif jack_set_error_function(qjack_error); jack_set_info_function(qjack_info); } -type_init(register_audio_jack); + +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_JACK); diff --git a/audio/noaudio.c b/audio/noaudio.c index 8b5ebd71bf6..65679b8b13d 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -155,16 +155,14 @@ static struct audio_driver no_audio_driver =3D { .voice_size_in =3D sizeof (NoVoiceIn) }; =20 -static const TypeInfo audio_none_info =3D { - .name =3D TYPE_AUDIO_NONE, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioNone), - .class_init =3D audio_none_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_NONE, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioNone), + .class_init =3D audio_none_class_init, + }, }; =20 -static void register_audio_none(void) -{ - type_register_static(&audio_none_info); -} -type_init(register_audio_none); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_NONE); diff --git a/audio/ossaudio.c b/audio/ossaudio.c index b8e26b17ed7..f64c564e345 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -789,16 +789,14 @@ static struct audio_driver oss_audio_driver =3D { .voice_size_in =3D sizeof (OSSVoiceIn) }; =20 -static const TypeInfo audio_oss_info =3D { - .name =3D TYPE_AUDIO_OSS, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioOss), - .class_init =3D audio_oss_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_OSS, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioOss), + .class_init =3D audio_oss_class_init, + }, }; =20 -static void register_audio_oss(void) -{ - type_register_static(&audio_oss_info); -} -type_init(register_audio_oss); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_OSS); diff --git a/audio/paaudio.c b/audio/paaudio.c index adaeb2af807..331da4f2ed6 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -948,16 +948,14 @@ static struct audio_driver pa_audio_driver =3D { .voice_size_in =3D sizeof (PAVoiceIn), }; =20 -static const TypeInfo audio_pa_info =3D { - .name =3D TYPE_AUDIO_PA, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioPa), - .class_init =3D audio_pa_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_PA, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioPa), + .class_init =3D audio_pa_class_init, + }, }; =20 -static void register_audio_pa(void) -{ - type_register_static(&audio_pa_info); -} -type_init(register_audio_pa); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_PA); diff --git a/audio/pwaudio.c b/audio/pwaudio.c index facd166052c..3b524dfea5a 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -864,18 +864,14 @@ static struct audio_driver pw_audio_driver =3D { .voice_size_in =3D sizeof(PWVoiceIn), }; =20 -static const TypeInfo audio_pw_info =3D { - .name =3D TYPE_AUDIO_PW, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioPw), - .class_init =3D audio_pw_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_PW, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioPw), + .class_init =3D audio_pw_class_init, + }, }; =20 -static void -register_audio_pw(void) -{ - type_register_static(&audio_pw_info); -} - -type_init(register_audio_pw); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_PW); diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index c00f1366d17..a60b1629da0 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -508,16 +508,14 @@ static struct audio_driver sdl_audio_driver =3D { .voice_size_in =3D sizeof(SDLVoiceIn), }; =20 -static const TypeInfo audio_sdl_info =3D { - .name =3D TYPE_AUDIO_SDL, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioSdl), - .class_init =3D audio_sdl_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_SDL, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioSdl), + .class_init =3D audio_sdl_class_init, + }, }; =20 -static void register_audio_sdl(void) -{ - type_register_static(&audio_sdl_info); -} -type_init(register_audio_sdl); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_SDL); diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index c8310b1fa37..2a9ae42992b 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -572,17 +572,14 @@ static struct audio_driver sndio_audio_driver =3D { .voice_size_in =3D sizeof(SndioVoice) }; =20 -static const TypeInfo audio_sndio_info =3D { - .name =3D TYPE_AUDIO_SNDIO, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioSndio), - .class_init =3D audio_sndio_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_SNDIO, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioSndio), + .class_init =3D audio_sndio_class_init, + }, }; =20 -static void register_audio_sndio(void) -{ - type_register_static(&audio_sndio_info); -} - -type_init(register_audio_sndio); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_SNDIO); diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index d1bb318b6b7..ad7cb69673b 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -342,18 +342,16 @@ static struct audio_driver spice_audio_driver =3D { .voice_size_in =3D sizeof (SpiceVoiceIn), }; =20 -static const TypeInfo audio_spice_info =3D { - .name =3D TYPE_AUDIO_SPICE, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioSpice), - .class_init =3D audio_spice_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_SPICE, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioSpice), + .class_init =3D audio_spice_class_init, + }, }; =20 -static void register_audio_spice(void) -{ - type_register_static(&audio_spice_info); -} -type_init(register_audio_spice); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_SPICE); =20 module_dep("ui-spice-core"); diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 12d4108ffad..cd2ceffd42b 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -231,16 +231,14 @@ static struct audio_driver wav_audio_driver =3D { .voice_size_in =3D 0 }; =20 -static const TypeInfo audio_wav_info =3D { - .name =3D TYPE_AUDIO_WAV, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioWav), - .class_init =3D audio_wav_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_WAV, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioWav), + .class_init =3D audio_wav_class_init, + } }; =20 -static void register_audio_wav(void) -{ - type_register_static(&audio_wav_info); -} -type_init(register_audio_wav); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_WAV); diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 5efd16df7c4..862cb9dd9b0 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -690,16 +690,14 @@ static void coreaudio_audio_fini (void *opaque) .voice_size_in =3D 0 }; =20 -static const TypeInfo audio_coreaudio_info =3D { - .name =3D TYPE_AUDIO_COREAUDIO, - .parent =3D TYPE_AUDIO_MIXENG_BACKEND, - .instance_size =3D sizeof(AudioCoreaudio), - .class_init =3D audio_coreaudio_class_init, +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_COREAUDIO, + .parent =3D TYPE_AUDIO_MIXENG_BACKEND, + .instance_size =3D sizeof(AudioCoreaudio), + .class_init =3D audio_coreaudio_class_init, + }, }; =20 -static void register_audio_coreaudio(void) -{ - type_register_static(&audio_coreaudio_info); -} -type_init(register_audio_coreaudio); +DEFINE_TYPES(audio_types) module_obj(TYPE_AUDIO_COREAUDIO); --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242449; cv=none; d=zohomail.com; s=zohoarc; b=RaAjiLn6P+j0foVSDti7r9wcfkdcJwZZH1yDnK/0JrONza1KYQ/Sx+cv+a9RmnAEOW20okQTqSO6DG1AtpBCXXGJdgpeDfail00ycMwgW+CkmIfeL4lKNsLKOGH1RrGTatyrUaDkhQEd88/x+qPRUNpvwhYHMJWaBXLmAQEPLOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242449; h=Content-Type: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=DqjVCvkYq0CnOFlMb4lk6iKs2Q8rG2tOtpRbxTNBD88=; b=IpGIVzUKPiqk8lsVMqUGfAnlUOzqZe2EcHyRGwkvbi60Pewi2Th8JCgQhVNBogWYJP0DrfId58DDnCFOShK1DMjjBJGME9j6dC9tUELG+zREVrgH936YW7nYZywcOMgeVzVC87LbdNlfWhQeki8v/65R6q4Lo7QlkETwiQaPbgg= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242449273465.21442047202504; Mon, 16 Feb 2026 03:47:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweE-0002iT-TF; Mon, 16 Feb 2026 06:20:14 -0500 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 1vrwbR-0005ep-Nk for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbL-0007jM-J3 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:18 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-m-MpTFXUMRe-ryKWk1KUUg-1; Mon, 16 Feb 2026 06:17:03 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AC38A1955D80; Mon, 16 Feb 2026 11:17:01 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0E8AC30001B9; Mon, 16 Feb 2026 11:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240627; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DqjVCvkYq0CnOFlMb4lk6iKs2Q8rG2tOtpRbxTNBD88=; b=URwOuUP23y3wuQTVphFC+p0HTL4Rj5pvBkQcZYb9TBcOsmBV80PlPMz5OA4hZsUTrNIbv7 w8KWNeZHqCtzKI0T/QT6X0e036RmnTu9NWK3VYXR3tY4X86uO94M7d1vsTrE2gkUNQ77Vu DnMJkl+aVJ7k1tWE/JbsXJnAymqsyqA= X-MC-Unique: m-MpTFXUMRe-ryKWk1KUUg-1 X-Mimecast-MFC-AGG-ID: m-MpTFXUMRe-ryKWk1KUUg_1771240621 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:19 +0100 Subject: [PATCH 30/85] audio: keep a strong reference on the backend MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-30-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2152; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=j2F0g3ta9yfDCkXiVp5Fmy/cGNEHqdhYISO5JqmAXcg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPIK7Ptx6NOV4c/yjxXVCio1QtyWaBS06Mx 6Fnq6zEKoaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5fcNEACKgcbXrWgakQ8Z15q72T7ophiX9Uu7+hd2m/Xe96tMLXScVS/lDaVNIe9SKlvh8XMPArb 2ugRGKYmA/Sq+IWgTcR1k+NOZiRluMTWTDtt2bTAqB+fB+1qP4mgb0agGWEJvR8MMh/KpY12Ja3 I0Wx+EJr1GKPZiJmZgkljA2/VQ7x3PMp5TNiiXmc/UAnuSxN1GFLafY82pLfF9Bcic2rr/s4kMN cjuaVlfSYCY0JH8DGZkc1+nqyfDOe0UOi0QQmQlC/p42JiblOYWYEMKCuPBaTMpJhJqvRkMVsfA D0FJAnNvoGT21iNZ2KUjg3+/LtUIC7RTjUdxNsGURXvGynBZpZRpvMp3lW0Zi2FxE1uLLDyTSf5 8WDXUQKuunIWyfOewQoB3qbvaAis+I0sOPODzh80zHY8xrS+9hus+Oo3gaMrQiOETVOGVasT9Nk D4UaqO7o7o7zQ1paL+LXTQPPhmHymdIIVpSCmpys2LjcU4bFVkeM/rXehKHw2sl6d7/GVKpQZf4 iZ5IM51clSsBwYP6100G4Rm7d0p7U85QOCE2jWrcCE3bXbsHhT44bYnTOEOHzVzAPN/OhbMoiBB yP1SelUi7ra37Ox2AEg6VKO5hKJXN8H/s0qRX4VxLxyU0jl5x5cRjt/nO0gWupXNm2SLBev4EUL Gt0LWtDg6B3gIgw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242451552158500 Since we are going to convert audio_driver-based backends, we need to properly handle reference counting to allow for a different order of class finalization (for example, pulse class before base driver class). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki --- audio/audio_template.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index a1f78d8748b..512abbfe22f 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -231,6 +231,7 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) glue(hw->pcm_ops->fini_, TYPE) (hw); glue(s->nb_hw_voices_, TYPE) +=3D 1; glue(audio_pcm_hw_free_resources_ , TYPE) (hw); + object_unref(hw->s); g_free(hw); *hwp =3D NULL; } @@ -287,7 +288,7 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixen= gBackend *s, * is guaranteed to be !=3D 0. See the audio_init_nb_voices_* function= s. */ hw =3D g_malloc0(glue(drv->voice_size_, TYPE)); - hw->s =3D s; + hw->s =3D AUDIO_MIXENG_BACKEND(object_ref(s)); hw->pcm_ops =3D drv->pcm_ops; =20 QLIST_INIT (&hw->sw_head); @@ -335,6 +336,7 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixen= gBackend *s, err1: glue (hw->pcm_ops->fini_, TYPE) (hw); err0: + object_unref(hw->s); g_free (hw); return NULL; } @@ -441,7 +443,7 @@ static SW *glue(audio_pcm_create_voice_pair_, TYPE)( } =20 sw =3D g_new0(SW, 1); - sw->s =3D s; + sw->s =3D AUDIO_MIXENG_BACKEND(object_ref(s)); =20 hw =3D glue(audio_pcm_hw_add_, TYPE)(s, &hw_as); if (!hw) { @@ -461,6 +463,7 @@ err2: glue (audio_pcm_hw_del_sw_, TYPE) (sw); glue (audio_pcm_hw_gc_, TYPE) (&hw); err1: + object_unref(sw->s); g_free(sw); return NULL; } @@ -470,6 +473,8 @@ static void glue (audio_close_, TYPE) (SW *sw) glue (audio_pcm_sw_fini_, TYPE) (sw); glue (audio_pcm_hw_del_sw_, TYPE) (sw); glue (audio_pcm_hw_gc_, TYPE) (&sw->hw); + + object_unref(sw->s); g_free (sw); } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244617; cv=none; d=zohomail.com; s=zohoarc; b=gAuYP1Cs6EYZHDgWN/3RHc8hSQmATt4CXU5m2Hl7ur47KP3Ls78BTxlA/W/cacanwjWUlbCnGKFcnpxkNTdU8patWNpLZOVYYnrbuNFUXR812FgkWyJ+86OcWjCMMa4bEqfrbzCCKzunU0oP3gGGtsMKhUDrZ2zqmgnnZKP9bxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244617; h=Content-Type: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=CUR/Qh5VElhqx+dlU/QcjMGK/JC9E2Y0q1Y0TBtw86Y=; b=AelrZH/YoJzTrzKvalxlxVpwl0X52A+SS+7GqSQ2MR+f6nr3UlPh87R+ZaX9uTXx3BNmttwmJbgVVlbeZ5yHgLyIQRrHYtofvsTLo+ZTKb6wphKygtcnTcjcKAPWZj41z9eUjW9AuulQ03Wzg6JYeSXY+FBzTODEvSG7ocPvbxg= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244617193679.7465936795395; Mon, 16 Feb 2026 04:23:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfX-0007qA-5k; Mon, 16 Feb 2026 06:21:35 -0500 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 1vrwbR-0005es-Od for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbM-0007mP-D5 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:18 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-179-uGj9T4LKMwi9cs5ywmLsHQ-1; Mon, 16 Feb 2026 06:17:06 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 449DF1956089; Mon, 16 Feb 2026 11:17:04 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B03AF1800465; Mon, 16 Feb 2026 11:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CUR/Qh5VElhqx+dlU/QcjMGK/JC9E2Y0q1Y0TBtw86Y=; b=d4W4humeI9SuUSWybLncMVdk6qzyNQq3mKwhkg9l7ZFtZ8im+e5hFbcFBc3l+e3Qy4+ZSd Dq/gGE/QMXluV9glswqZwJ8fM560cEaxvQqJyY7Ck3qRWolsczGb0+EnfQH6QvN12sabQn dvjWJKcx6DPdMHMNOiRklvfJuyAA9JU= X-MC-Unique: uGj9T4LKMwi9cs5ywmLsHQ-1 X-Mimecast-MFC-AGG-ID: uGj9T4LKMwi9cs5ywmLsHQ_1771240624 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:20 +0100 Subject: [PATCH 31/85] audio: make list type declaration private MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-31-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1475; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2kDmF9W/174LJH9v2mKEvg3l3Ghu44HGzScFDsS19Gc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPSMqURui8yqz3+MKm/SEJaOPnYEIPspCu/ fXnPJhg/4CJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5Q95D/0VVVL5Nho7x/iz0ldbhnuWVTaVp8dakdsqCwoL9/Ni1R7AVnLIa5MpBElnP1Hh1SVzMaI +wDiaC/CLNvJthC2n3rwEeX0JJQ9k8hjdzcCUZTf50wt0hIY7WsxOw4RbckdjZKWHa1xVDHhABY jw4tUp7flSzuLFNGHsd3DT0e6dBJPH3OdFEV1wfKpUXX8Qi1AyA012bPg6aiztD8JI/D0r8B48o sZpsAfUPmvwSXTo+auJDOaVHuv++ThH4HYjt15OxXcNgyRCmBS6OahGkVRpMJWRd5RlQgVBKFgk L7HuS++fkEekJkZzMldZOm/x3d6giFimEew0mOl7wBKy8M+M6mbjbWkkdEZ8vnvtdoSVMQxQ621 1xfpM4FKnDCenaEmfjU6Yw28SNiy/s6F2HrjxSIjPjWvvjF2OoJLYBXeKD2dJs0Gh6SQsjd24Dn fdl7Li940Hb4Wm02zep4Ay4bfsatqhgJbNDAA+eZmoqkvyJtjCuMyaUoPNZ6nEXkX0wz1TJNrmi u8lpMTuhsOMXSCzF+GQRPIK1OxnDWoxWS5r9HbtYhizVh2aJAXADdMARUzet93roo4tcST3XAbF zlTok08dxH7J1cyEVeoLp1fzRlmzaxIwy4IhX0Fn7cWeM9SOGozvvTuAslYKOwbZXV+qsDQCZJ6 gvJ9QQvAHMEkcfg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244618553154100 No need to share in a common header. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 7 ------- audio/audio.c | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 446ba1d52c6..08d07b17557 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -306,13 +306,6 @@ static inline size_t audio_ring_posb(size_t pos, size_= t dist, size_t len) #define ldebug(fmt, ...) (void)0 #endif =20 -typedef struct AudiodevListEntry { - Audiodev *dev; - QSIMPLEQ_ENTRY(AudiodevListEntry) next; -} AudiodevListEntry; - -typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead; - void audio_create_pdos(Audiodev *dev); AudiodevPerDirectionOptions *audio_get_pdo_in(Audiodev *dev); AudiodevPerDirectionOptions *audio_get_pdo_out(Audiodev *dev); diff --git a/audio/audio.c b/audio/audio.c index 16edc57e5f0..d8a54548274 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -68,6 +68,13 @@ const char *audio_prio_list[] =3D { NULL }; =20 +typedef struct AudiodevListEntry { + Audiodev *dev; + QSIMPLEQ_ENTRY(AudiodevListEntry) next; +} AudiodevListEntry; + +typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead; + static AudiodevListHead audiodevs =3D QSIMPLEQ_HEAD_INITIALIZER(audiodevs); static AudiodevListHead default_audiodevs =3D --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244661; cv=none; d=zohomail.com; s=zohoarc; b=L29SdfsAyLSz3wdaf68J/YY5PmW01UYgpF5fL3M9P+cTjafOi3DvkK3l66NBpxvPE3YFBRaN/4mG4km5G4vczHDNAPaOMuNLNS3Ty00lwkvzdukhYUCKu4KOoL45s5rav2DRJfgDXyzZKkaJUy73yrJQn00nIDuI0I9rItz9d7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244661; h=Content-Type: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=fFl76fF+LZJe4gLSTLwCv0jScavNDWDyMsNrvmMBYlo=; b=ZhZnoqU/uVe1XDIqclST5NSmWDuO2TFwmvYXENjoC+nNzSHYhn7UuR8hR7Y6XSUbqrLMWHfty+Ngu6wI4welU5/sQWpOC3REjUbKUR0yZQcsHv5tcnFapIGsRhpxmBIMBHiBgcauwid4wFQ7w0D4+sRCz8z4ey9SgsRaDXfkWcU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177124466181966.3430060268563; Mon, 16 Feb 2026 04:24:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweK-0003Mw-81; Mon, 16 Feb 2026 06:20:20 -0500 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 1vrwbR-0005eu-PU for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbM-0007pX-Hc for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:19 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-361-xSmBGvwFON2yAcO6V4PJ5A-1; Mon, 16 Feb 2026 06:17:08 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E24CB1955DDF; Mon, 16 Feb 2026 11:17:06 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 44C5E30001A5; Mon, 16 Feb 2026 11:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fFl76fF+LZJe4gLSTLwCv0jScavNDWDyMsNrvmMBYlo=; b=WFTGT8B6PednQw/+2kKVekQ6GFVni349nYnoX69JrO/uB4X3N/2PyWzMMKkICTbOwBgiRx +/U4yQOufkVJ+OxOvrJ3bqSdlxKYRxafpX7F2DihzcjeWgyx9m1Sr+oWNzfMCLDNzSVw/3 uQ+H/hRdzHLwJyj4XIlmpNbU3vtpojc= X-MC-Unique: xSmBGvwFON2yAcO6V4PJ5A-1 X-Mimecast-MFC-AGG-ID: xSmBGvwFON2yAcO6V4PJ5A_1771240627 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:21 +0100 Subject: [PATCH 32/85] audio: make create_pdos() private MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-32-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1126; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=18BzEdvVM6Wo1L4EnoV0PhPLC4dtiCH9jACEhFQvbdg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPV8PiDGBHjO+tvxDUJ106QEznKRJTxxFt5 cEhFV1drwuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5Y2JD/9Tap+sJcU1pGCa9TcegcUnv4Q9P8rlu5iZ4L6xNHDK81NKAQfFc/KiKs+bCv48xwRmdNF 3sWx41Ch1t0XS+7KPPKwvd3uBCJbU0XvgFSxvqdK3YURfa2HVR7Ov8NCZ02x3qLXQY8/CWEWNoE iz7l8OSrujuFznuJULt3LX3BC4U4o7ON/fQPkXNJubNI+n9HaGYF8z/pM/hXrBX2+sjqGhoFCw+ sV2eek0jlBNI77QbSzFzfxVnSzc0ruShzX5KEZVqWk0noJMr2237XsNtXML7cAZwtjqAAekVXna QcV3L3pftPBgoWNo0br9snRQBN8kbW43pkznjcET8pnL6kNHVXwq6zUNkB6IaTjZd9s65CSo5ij GrMpRcbDCXGLZ/ci15TU6jaM2TOPwY81kxD93sgAihpEmyhyXc0G9b4gZ4WktpTvftfOUZV3SdC LU4+zkTrJUIZsi01icjzCvrtiMfzU9owvc8TSGtgwIoXw2hdrcB763VpyXjIVKC6yK6yVNUH94H c051BYdwK29/r0qiMEAFQOtRzXvBKQP9SvSZ1WszM0NUm6Qt1OW6Uv/UXbyuQGz393gA1gAOwzl 3dnCZemZb9S0h8L8SfvfvknvwfqGSYlhM0rNIJlnXM+TDuu6LgHvMA7DwmFf79jEyE8u68rNCqw EFbvjSTZnXYS8EA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244663977158500 Clean up. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 1 - audio/audio.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 08d07b17557..e1f9fa333ba 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -306,7 +306,6 @@ static inline size_t audio_ring_posb(size_t pos, size_t= dist, size_t len) #define ldebug(fmt, ...) (void)0 #endif =20 -void audio_create_pdos(Audiodev *dev); AudiodevPerDirectionOptions *audio_get_pdo_in(Audiodev *dev); AudiodevPerDirectionOptions *audio_get_pdo_out(Audiodev *dev); =20 diff --git a/audio/audio.c b/audio/audio.c index d8a54548274..1fa63ee0421 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1990,7 +1990,7 @@ void AUD_set_volume_in(SWVoiceIn *sw, Volume *vol) } } =20 -void audio_create_pdos(Audiodev *dev) +static void audio_create_pdos(Audiodev *dev) { switch (dev->driver) { #define CASE(DRIVER, driver, pdo_name) \ --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244579; cv=none; d=zohomail.com; s=zohoarc; b=bBjuZc+Ke8AXpvlPPHgVZLm+fE3W0lnEWR/qx2OHxaCP9moLRH+5NKUoNRxNwPccGbuqhvRFhdZLwSAib7TlXzC1gk897WWMYibvo20hUMfSuZsbWqgSsbHNQ5519a9gNxrTznl1Ol4Am9FQuEBJv4/e/W2Ny6VWHLW6HIQfFNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244579; h=Content-Type: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=3xeWvMvqtuFhrWKD3XFf59Ut7UelIyxTytDe1bEinLs=; b=nyAFtqAimUTUidTwEsZSpT7slgpDWFOuLNS160RY8h0CZtqZQN6apkAPGEt6CtJzAO45ffYqm33TJjJIgJS56QOKNCFMY5fkjNal8kwXejeb4S12wTf56VBoIArlJiAjsu4rcDxMfCmdJncR/PXKWWMdJGLdgkPp7iS/2v0Yd5A= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244579301738.1491373844874; Mon, 16 Feb 2026 04:22:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweB-0002H2-MI; Mon, 16 Feb 2026 06:20:11 -0500 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 1vrwbT-0005fC-6a for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbM-0007pb-Ir for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:20 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-640-8t5AbWi2OoWD2baAfHEgnw-1; Mon, 16 Feb 2026 06:17:12 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7643B1956061; Mon, 16 Feb 2026 11:17:10 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E696719560A2; Mon, 16 Feb 2026 11:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3xeWvMvqtuFhrWKD3XFf59Ut7UelIyxTytDe1bEinLs=; b=EUnqt2B7zgPG+0HrUPXCbiadHTnmppL3vYhTIohB9XEmm0nLNdAanh7Dth3twuuqqfQvfX JOLzaLb2x0NcDA2IuLPkcWDhRNwmqWfGovWnrE+I2AarvAQdQTRArZkxfBNg7/WsqcGRNp GcFaWedIAaW67t8o+cGqQOY5p0uJfzU= X-MC-Unique: 8t5AbWi2OoWD2baAfHEgnw-1 X-Mimecast-MFC-AGG-ID: 8t5AbWi2OoWD2baAfHEgnw_1771240630 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:22 +0100 Subject: [PATCH 33/85] replay: remove dependency on audio/ MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-33-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=10064; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yYN0P5+55ydAfUsgTwVah+g7J0MKZlpuHaNWhwjdvxc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPkSir1VCgrDwANDcB3W/10y+GU5RHkdawC 9KiXszkRCKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5e9sEACFTWvfUH2QNSKpxj1c/AV90HkIuaB7JEDE65qMyanr+kH7TFsWu9yNaemcnnAHz1tnqnc sMDe6CRuKBOabLT0hrOsoSZV1++9sUsnTtqtEhkxH+ui7xMb/TIM6FPmJe/zClXnrDNP2x0LL2R tL14pLnkvZisn77R6zxfeBWyd3fFmcFe5wuMWXpOvPc1BygBC3wyzBbX5pxpPIraZtHQS56QdwP c42JxVP2SlV/QBEd12Ypzuo30VIWU+JEgaRKjZAJc8BT0+/p9NP07o0tGUuy3grKr6qspQkZT25 kXNjeOm32NDJ7yk21GpYssZPZVoNFwF3SVaK+7YliDWLBUJHtqhgxeNkoUwobhrkLFtLqL1rTCz ayKWzXdVm3pHtnn4SzjEUyOZCYQ0s2+nYnv9Ssz1HPWCXSe1mh0bEPWe074BZPzRSBJ0RDhMaOl dLW3GlZ3DwQL+hUAC4/M+WbF+jqT9Q1evDT9WfdB0ztwVL6s/pWQmoLACNRu3zwlLtEhRT029wv S+qIawFUdYgTdO1Aia2D+8DR8HqALEyoBC6H/T5TFg4gLZEb9vgHuXQZcI10OI4Uf75OclL1b1l 1GXuUcRt0koWhC49bkcYbuQtq9oAPiJJoWkixdLUPkdNtwDKq64mNl63lshlRgDdV8PoI8Wv8/E ynDBhNDRcxPVkCw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244581078158500 The replay infrastructure shouldn't depend on internals of audio/. (st_sample is an internal implementation detail and could be different) Let audio drive the audio samples recording/replaying. Notice also we don't need to save & restore the internal ring "wpos", all replay should care about is the number of samples and the samples. Bump the replay version. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 5 +++++ include/qemu/audio.h | 5 ----- include/system/replay.h | 11 ++++++++-- replay/replay-internal.h | 2 ++ audio/audio.c | 23 +++++++++++++++++++-- replay/replay-audio.c | 51 ++++++++++++++++++++++++++++---------------= ---- replay/replay.c | 2 +- replay/stubs-system.c | 8 +++++++- tests/audio/audio-stubs.c | 13 +++++++++--- 9 files changed, 85 insertions(+), 35 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index e1f9fa333ba..250fd45238d 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -309,6 +309,11 @@ static inline size_t audio_ring_posb(size_t pos, size_= t dist, size_t len) AudiodevPerDirectionOptions *audio_get_pdo_in(Audiodev *dev); AudiodevPerDirectionOptions *audio_get_pdo_out(Audiodev *dev); =20 +void audio_sample_to_uint64(const st_sample *sample, int pos, + uint64_t *left, uint64_t *right); +void audio_sample_from_uint64(st_sample *sample, int pos, + uint64_t left, uint64_t right); + #define TYPE_AUDIO_MIXENG_BACKEND "audio-mixeng-backend" OBJECT_DECLARE_TYPE(AudioMixengBackend, AudioMixengBackendClass, AUDIO_MIX= ENG_BACKEND) =20 diff --git a/include/qemu/audio.h b/include/qemu/audio.h index 1eeead2a722..03ce9adbc88 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -120,11 +120,6 @@ void audio_cleanup(void); =20 typedef struct st_sample st_sample; =20 -void audio_sample_to_uint64(const st_sample *sample, int pos, - uint64_t *left, uint64_t *right); -void audio_sample_from_uint64(st_sample *sample, int pos, - uint64_t left, uint64_t right); - void audio_add_audiodev(Audiodev *audio); void audio_add_default_audiodev(Audiodev *dev, Error **errp); void audio_parse_option(const char *opt); diff --git a/include/system/replay.h b/include/system/replay.h index f8715ca9feb..19fb6dbb396 100644 --- a/include/system/replay.h +++ b/include/system/replay.h @@ -165,8 +165,15 @@ void replay_net_packet_event(ReplayNetState *rns, unsi= gned flags, =20 /*! Saves/restores number of played samples of audio out operation. */ void replay_audio_out(size_t *played); -/*! Saves/restores recorded samples of audio in operation. */ -void replay_audio_in(size_t *recorded, st_sample *samples, size_t *wpos, s= ize_t size); +/* + * Start saves/restores recorded samples of audio in operation. + * Must be called before replay_audio_in_sample_lr(). + */ +void replay_audio_in_start(size_t *recorded); +/* Saves/restores recorded samples. */ +void replay_audio_in_sample_lr(uint64_t *left, uint64_t *right); +/* Finish saves/restores recorded samples. */ +void replay_audio_in_finish(void); =20 /* VM state operations */ =20 diff --git a/replay/replay-internal.h b/replay/replay-internal.h index 75249b76936..643b357da12 100644 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -85,6 +85,7 @@ enum ReplayEvents { * @file_offset: offset into replay log at replay snapshot * @block_request_id: current serialised block request id * @read_event_id: current async read event id + * @n_audio_samples: expected audio samples */ typedef struct ReplayState { int64_t cached_clock[REPLAY_CLOCK_COUNT]; @@ -96,6 +97,7 @@ typedef struct ReplayState { uint64_t file_offset; uint64_t block_request_id; uint64_t read_event_id; + size_t n_audio_samples; } ReplayState; extern ReplayState replay_state; =20 diff --git a/audio/audio.c b/audio/audio.c index 1fa63ee0421..3e16b719399 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1301,13 +1301,32 @@ static void audio_run_in(AudioMixengBackend *s) while ((hw =3D audio_pcm_hw_find_any_enabled_in(s, hw))) { SWVoiceIn *sw; size_t captured =3D 0, min; + int pos; =20 if (replay_mode !=3D REPLAY_MODE_PLAY) { captured =3D audio_pcm_hw_run_in( hw, hw->conv_buf.size - audio_pcm_hw_get_live_in(hw)); } - replay_audio_in(&captured, hw->conv_buf.buffer, &hw->conv_buf.pos, - hw->conv_buf.size); + + replay_audio_in_start(&captured); + assert(captured <=3D hw->conv_buf.size); + if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + hw->conv_buf.pos =3D (hw->conv_buf.pos + captured) % hw->conv_= buf.size; + } + for (pos =3D (hw->conv_buf.pos - captured + hw->conv_buf.size) % h= w->conv_buf.size; + pos !=3D hw->conv_buf.pos; + pos =3D (pos + 1) % hw->conv_buf.size) { + uint64_t left, right; + + if (replay_mode =3D=3D REPLAY_MODE_RECORD) { + audio_sample_to_uint64(hw->conv_buf.buffer, pos, &left= , &right); + } + replay_audio_in_sample_lr(&left, &right); + if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + audio_sample_from_uint64(hw->conv_buf.buffer, pos, lef= t, right); + } + } + replay_audio_in_finish(); =20 min =3D audio_pcm_hw_find_min_in (hw); hw->total_samples_captured +=3D captured - min; diff --git a/replay/replay-audio.c b/replay/replay-audio.c index 1b614f41379..7d20ae9110c 100644 --- a/replay/replay-audio.c +++ b/replay/replay-audio.c @@ -13,7 +13,6 @@ #include "qemu/error-report.h" #include "system/replay.h" #include "replay-internal.h" -#include "qemu/audio.h" =20 void replay_audio_out(size_t *played) { @@ -35,38 +34,48 @@ void replay_audio_out(size_t *played) } } =20 -void replay_audio_in(size_t *recorded, st_sample *samples, size_t *wpos, s= ize_t size) +void replay_audio_in_start(size_t *nsamples) { - int pos; - uint64_t left, right; if (replay_mode =3D=3D REPLAY_MODE_RECORD) { g_assert(replay_mutex_locked()); replay_save_instructions(); replay_put_event(EVENT_AUDIO_IN); - replay_put_qword(*recorded); - replay_put_qword(*wpos); - for (pos =3D (*wpos - *recorded + size) % size ; pos !=3D *wpos - ; pos =3D (pos + 1) % size) { - audio_sample_to_uint64(samples, pos, &left, &right); - replay_put_qword(left); - replay_put_qword(right); - } + replay_put_qword(*nsamples); + replay_state.n_audio_samples =3D *nsamples; } else if (replay_mode =3D=3D REPLAY_MODE_PLAY) { g_assert(replay_mutex_locked()); replay_account_executed_instructions(); if (replay_next_event_is(EVENT_AUDIO_IN)) { - *recorded =3D replay_get_qword(); - *wpos =3D replay_get_qword(); - for (pos =3D (*wpos - *recorded + size) % size ; pos !=3D *wpos - ; pos =3D (pos + 1) % size) { - left =3D replay_get_qword(); - right =3D replay_get_qword(); - audio_sample_from_uint64(samples, pos, left, right); - } - replay_finish_event(); + *nsamples =3D replay_get_qword(); + replay_state.n_audio_samples =3D *nsamples; } else { error_report("Missing audio in event in the replay log"); abort(); } } } + +void replay_audio_in_sample_lr(uint64_t *left, uint64_t *right) +{ + if (replay_mode =3D=3D REPLAY_MODE_RECORD) { + replay_put_qword(*left); + replay_put_qword(*right); + } else if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + *left =3D replay_get_qword(); + *right =3D replay_get_qword(); + } else { + return; + } + + assert(replay_state.n_audio_samples > 0); + replay_state.n_audio_samples--; +} + +void replay_audio_in_finish(void) +{ + assert(replay_state.n_audio_samples =3D=3D 0); + + if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + replay_finish_event(); + } +} diff --git a/replay/replay.c b/replay/replay.c index b2121788c1d..2e5c6fa82ea 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -22,7 +22,7 @@ =20 /* Current version of the replay mechanism. Increase it when file format changes. */ -#define REPLAY_VERSION 0xe0200c +#define REPLAY_VERSION 0xe0200d /* Size of replay log header */ #define HEADER_SIZE (sizeof(uint32_t) + sizeof(uint64_t)) =20 diff --git a/replay/stubs-system.c b/replay/stubs-system.c index 7f85764936f..b2c52bc4043 100644 --- a/replay/stubs-system.c +++ b/replay/stubs-system.c @@ -15,7 +15,13 @@ void replay_input_sync_event(void) void replay_add_blocker(const char *feature) { } -void replay_audio_in(size_t *recorded, st_sample *samples, size_t *wpos, s= ize_t size) +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/tests/audio/audio-stubs.c b/tests/audio/audio-stubs.c index dd7f635d460..2c19dfa7d6b 100644 --- a/tests/audio/audio-stubs.c +++ b/tests/audio/audio-stubs.c @@ -35,12 +35,19 @@ dbus_win32_import_socket(GDBusMethodInvocation *invocat= ion, } #endif =20 -void replay_audio_in(size_t *recorded, st_sample *samples, - size_t *wpos, size_t size) +void replay_audio_out(size_t *played) { } =20 -void replay_audio_out(size_t *played) +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) { } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244779; cv=none; d=zohomail.com; s=zohoarc; b=Oy3c7XDXWWwo+Ofk8xwuHeTyBCartQ+5X85y13iv4i2Pcs7W5h7OqbBBrlJkzQVO4hRUvaflsH/iV7bN0/Wvb3nzjfCrUIjw4d1lGY+hw5aaJk/VzjLSmcVzim98esF3HftnQC/o/dekz1GOQYncF1veTgjq5j4Wr7ugrJkDnog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244779; h=Content-Type: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=Rt+HPOyuJm7qletTT+ss/T1sC+DVrQFoaFt7vssnDDQ=; b=kxiGZwSGDOcUSliMtg0mqLSYRpeLrQCXR2huzzq1FSbRQddW+HgxqvW2B9I42eZBEc3SVduMcWY7NNW+DCMp/D/HZfR0Tt0HKyqpCcGrNPkcEiXlaoo8fb1T5ohDuLcRTf7YEzShWuTsuzDh1taE7EEda5uJQSf7ogG/TguNJas= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244779756849.7524846456382; Mon, 16 Feb 2026 04:26:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwf4-00054N-LR; Mon, 16 Feb 2026 06:21:08 -0500 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 1vrwbZ-0005hB-43 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbT-0007r4-08 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:28 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-oFU-FyazNrGmyManVaKbXw-1; Mon, 16 Feb 2026 06:17:15 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7837F19560A7; Mon, 16 Feb 2026 11:17:13 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 653A930001A5; Mon, 16 Feb 2026 11:17:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rt+HPOyuJm7qletTT+ss/T1sC+DVrQFoaFt7vssnDDQ=; b=AzUsPrus02zB5EqEcZcSVA/jnlmkcy/A0tqLjYKDmnDKjEBaRM/Zs6oPK/YjLJAB17Mf9P P237XW5UxFRh3cmsLrP0INFN+yjeb8+Y38LeYqzyM7b1wXRYWna83ySqw1ihcmaMMOpFpy UlEgjTSu21VvqeUlxZJeHUz+C1HBSXI= X-MC-Unique: oFU-FyazNrGmyManVaKbXw-1 X-Mimecast-MFC-AGG-ID: oFU-FyazNrGmyManVaKbXw_1771240633 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:23 +0100 Subject: [PATCH 34/85] audio: make all the backend-specific APIs take the be MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-34-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=52311; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/rRhVM+jDRi5sDzXlLAJN7ZBGNIfJJy6PtlyFMA/eVY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPTKONenw+26ne3Kj4vEVwN5s10qeKbQXqR FMkuv0oFSWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5bj2D/4pusGQI2RsT0zZMWqXSXBk13Vf8KIlkz++H4ygjjUeWeJWHkC/7Cmxj2iZyrYGKh6gnTs ESuiE1KpzGisPpBvEqCy/MlOYRQKdWEl0PUzIqW+m5k+1BT0/8rXaFHr+tuhzpNcT3GZMx+03NJ MYpMh3zhQvpHxtnY8a1nFQ0CeM+XL7/BBQ0ox61DtaqKiFHomjx+yOxgrcqjvGelj++zddcW2WW xPEbKtcqH2bVHvnOjIns2oq4fg3ItZfpEApbxZjABX7Ucw+KJ8X+B2MRHh8vbY/XJLxHolAQZjM 2tuPv02PDYmisGPqZcu7la/ey25Q9igp9MvGiIfLHvsQzWZZS4bmcB8X3wLXVGTj0uLZ/8I9Teb 3E2uSg3SKFDe6SaG+aRl/QtSYAnWoG2cKsWmSmddVUbnWQGdKgnihY906V+XYGIC5nLMsobz+AL ecPBihN7cxWGw5nJ4f2K4GfRV/Ptzb0A8F3+JLpR8KnTCC/Q5Fpx1k1s2Kso5IWP4mGRX2Qjxnk azNOAPwlY0qiomKIIkaRuKD/UmgeSel0ANHbXczYagChngxd/sCLQIvKY7FchiXQ15M5E+6jfiR +l6U2nvH24EfVqWSdpeNoqfsaQuAgHSWLL/8OySnj1pvF6CbWc0UVIQOtElxie6sEjIczM5ERyt qyDgO/spQ0yLegA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244780346158500 This will allow to dispatch to different implementations next. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_template.h | 2 +- include/qemu/audio-capture.h | 9 +++-- include/qemu/audio.h | 34 ++++++++++-------- audio/audio.c | 18 +++++----- audio/wavcapture.c | 7 ++-- hw/audio/ac97.c | 24 ++++++------- hw/audio/adlib.c | 9 ++--- hw/audio/asc.c | 16 ++++----- hw/audio/cs4231a.c | 16 ++++----- hw/audio/es1370.c | 12 +++---- hw/audio/gus.c | 9 ++--- hw/audio/hda-codec.c | 20 ++++++----- hw/audio/lm4549.c | 12 +++---- hw/audio/pcspk.c | 4 +-- hw/audio/sb16.c | 14 ++++---- hw/audio/via-ac97.c | 14 ++++---- hw/audio/virtio-snd.c | 14 ++++---- hw/audio/wm8750.c | 24 ++++++------- hw/display/xlnx_dp.c | 10 +++--- hw/usb/dev-audio.c | 12 +++---- tests/audio/test-audio.c | 83 ++++++++++++++++++++++------------------= ---- ui/vnc.c | 2 +- 22 files changed, 192 insertions(+), 173 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index 512abbfe22f..33f2ff432eb 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -569,7 +569,7 @@ SW *glue (AUD_open_, TYPE) ( return NULL; } =20 -bool glue(AUD_is_active_, TYPE)(SW *sw) +bool glue(AUD_is_active_, TYPE)(AudioBackend *be, SW *sw) { return sw ? sw->active : 0; } diff --git a/include/qemu/audio-capture.h b/include/qemu/audio-capture.h index a07412db857..f500b0a7f8c 100644 --- a/include/qemu/audio-capture.h +++ b/include/qemu/audio-capture.h @@ -36,8 +36,11 @@ CaptureVoiceOut *AUD_add_capture( AudioBackend *be, struct audsettings *as, struct audio_capture_ops *ops, - void *opaque - ); -void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); + void *opaque); + +void AUD_del_capture( + AudioBackend *be, + CaptureVoiceOut *cap, + void *cb_opaque); =20 #endif /* QEMU_AUDIO_CAPTURE_H */ diff --git a/include/qemu/audio.h b/include/qemu/audio.h index 03ce9adbc88..e87708e3d1e 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -63,7 +63,7 @@ typedef struct AudioBackendClass { =20 bool AUD_backend_check(AudioBackend **be, Error **errp); =20 -SWVoiceOut *AUD_open_out ( +SWVoiceOut *AUD_open_out( AudioBackend *be, SWVoiceOut *sw, const char *name, @@ -72,11 +72,11 @@ SWVoiceOut *AUD_open_out ( const struct audsettings *settings ); =20 -void AUD_close_out (AudioBackend *be, SWVoiceOut *sw); -size_t AUD_write (SWVoiceOut *sw, void *pcm_buf, size_t size); -int AUD_get_buffer_size_out (SWVoiceOut *sw); -void AUD_set_active_out(SWVoiceOut *sw, bool on); -bool AUD_is_active_out(SWVoiceOut *sw); +void AUD_close_out(AudioBackend *be, SWVoiceOut *sw); +size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void *pcm_buf, size_t s= ize); +int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw); +void AUD_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on); +bool AUD_is_active_out(AudioBackend *be, SWVoiceOut *sw); =20 #define AUDIO_MAX_CHANNELS 16 typedef struct Volume { @@ -85,19 +85,23 @@ typedef struct Volume { uint8_t vol[AUDIO_MAX_CHANNELS]; } Volume; =20 -void AUD_set_volume_out(SWVoiceOut *sw, Volume *vol); -void AUD_set_volume_in(SWVoiceIn *sw, Volume *vol); +void AUD_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol); +void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol); =20 static inline void -AUD_set_volume_out_lr(SWVoiceOut *sw, bool mut, uint8_t lvol, uint8_t rvol= ) { - AUD_set_volume_out(sw, &(Volume) { +AUD_set_volume_out_lr(AudioBackend *be, SWVoiceOut *sw, + bool mut, uint8_t lvol, uint8_t rvol) +{ + AUD_set_volume_out(be, sw, &(Volume) { .mute =3D mut, .channels =3D 2, .vol =3D { lvol, rvol } }); } =20 static inline void -AUD_set_volume_in_lr(SWVoiceIn *sw, bool mut, uint8_t lvol, uint8_t rvol) { - AUD_set_volume_in(sw, &(Volume) { +AUD_set_volume_in_lr(AudioBackend *be, SWVoiceIn *sw, + bool mut, uint8_t lvol, uint8_t rvol) +{ + AUD_set_volume_in(be, sw, &(Volume) { .mute =3D mut, .channels =3D 2, .vol =3D { lvol, rvol } }); } @@ -112,9 +116,9 @@ SWVoiceIn *AUD_open_in( ); =20 void AUD_close_in(AudioBackend *be, SWVoiceIn *sw); -size_t AUD_read (SWVoiceIn *sw, void *pcm_buf, size_t size); -void AUD_set_active_in(SWVoiceIn *sw, bool on); -bool AUD_is_active_in(SWVoiceIn *sw); +size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void *pcm_buf, size_t siz= e); +void AUD_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on); +bool AUD_is_active_in(AudioBackend *be, SWVoiceIn *sw); =20 void audio_cleanup(void); =20 diff --git a/audio/audio.c b/audio/audio.c index 3e16b719399..320035c0484 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -847,7 +847,7 @@ static void audio_timer (void *opaque) /* * Public API */ -size_t AUD_write(SWVoiceOut *sw, void *buf, size_t size) +size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void *buf, size_t size) { HWVoiceOut *hw; =20 @@ -869,7 +869,7 @@ size_t AUD_write(SWVoiceOut *sw, void *buf, size_t size) } } =20 -size_t AUD_read(SWVoiceIn *sw, void *buf, size_t size) +size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void *buf, size_t size) { HWVoiceIn *hw; =20 @@ -891,7 +891,7 @@ size_t AUD_read(SWVoiceIn *sw, void *buf, size_t size) } } =20 -int AUD_get_buffer_size_out(SWVoiceOut *sw) +int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw) { if (!sw) { return 0; @@ -904,7 +904,7 @@ int AUD_get_buffer_size_out(SWVoiceOut *sw) return sw->hw->samples * sw->hw->info.bytes_per_frame; } =20 -void AUD_set_active_out(SWVoiceOut *sw, bool on) +void AUD_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on) { HWVoiceOut *hw; =20 @@ -952,7 +952,7 @@ void AUD_set_active_out(SWVoiceOut *sw, bool on) } } =20 -void AUD_set_active_in(SWVoiceIn *sw, bool on) +void AUD_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on) { HWVoiceIn *hw; =20 @@ -997,7 +997,7 @@ void AUD_set_active_in(SWVoiceIn *sw, bool on) } } =20 -static size_t audio_get_avail (SWVoiceIn *sw) +static size_t audio_get_avail(SWVoiceIn *sw) { size_t live; =20 @@ -1938,7 +1938,7 @@ CaptureVoiceOut *AUD_add_capture( return cap; } =20 -void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque) +void AUD_del_capture(AudioBackend *be, CaptureVoiceOut *cap, void *cb_opaq= ue) { struct capture_callback *cb; =20 @@ -1977,7 +1977,7 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_= opaque) } } =20 -void AUD_set_volume_out(SWVoiceOut *sw, Volume *vol) +void AUD_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol) { if (sw) { HWVoiceOut *hw =3D sw->hw; @@ -1993,7 +1993,7 @@ void AUD_set_volume_out(SWVoiceOut *sw, Volume *vol) } } =20 -void AUD_set_volume_in(SWVoiceIn *sw, Volume *vol) +void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol) { if (sw) { HWVoiceIn *hw =3D sw->hw; diff --git a/audio/wavcapture.c b/audio/wavcapture.c index b33a38ff45b..2950ceaf242 100644 --- a/audio/wavcapture.c +++ b/audio/wavcapture.c @@ -1,4 +1,5 @@ #include "qemu/osdep.h" +#include "qemu/audio.h" #include "qemu/qemu-print.h" #include "qemu/error-report.h" #include "audio_int.h" @@ -10,6 +11,7 @@ typedef struct { int freq; int bits; int nchannels; + AudioBackend *audio_be; CaptureVoiceOut *cap; } WAVState; =20 @@ -84,7 +86,7 @@ static void wav_capture_destroy (void *opaque) { WAVState *wav =3D opaque; =20 - AUD_del_capture (wav->cap, wav); + AUD_del_capture(wav->audio_be, wav->cap, wav); g_free (wav); } =20 @@ -159,6 +161,7 @@ int wav_start_capture(AudioBackend *state, CaptureState= *s, const char *path, return -1; } =20 + wav->audio_be =3D state; wav->path =3D g_strdup (path); wav->bits =3D bits; wav->nchannels =3D nchannels; @@ -169,7 +172,7 @@ int wav_start_capture(AudioBackend *state, CaptureState= *s, const char *path, goto error_free; } =20 - cap =3D AUD_add_capture(state, &as, &ops, wav); + cap =3D AUD_add_capture(wav->audio_be, &as, &ops, wav); if (!cap) { error_report("Failed to add audio capture"); goto error_free; diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 0694f0adf9c..65a4141b8af 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -246,15 +246,15 @@ static void voice_set_active(AC97LinkState *s, int bm= _index, int on) { switch (bm_index) { case PI_INDEX: - AUD_set_active_in(s->voice_pi, on); + AUD_set_active_in(s->audio_be, s->voice_pi, on); break; =20 case PO_INDEX: - AUD_set_active_out(s->voice_po, on); + AUD_set_active_out(s->audio_be, s->voice_po, on); break; =20 case MC_INDEX: - AUD_set_active_in(s->voice_mc, on); + AUD_set_active_in(s->audio_be, s->voice_mc, on); break; =20 default: @@ -378,15 +378,15 @@ static void reset_voices(AC97LinkState *s, uint8_t ac= tive[LAST_INDEX]) =20 freq =3D mixer_load(s, AC97_PCM_LR_ADC_Rate); open_voice(s, PI_INDEX, freq); - AUD_set_active_in(s->voice_pi, active[PI_INDEX]); + AUD_set_active_in(s->audio_be, s->voice_pi, active[PI_INDEX]); =20 freq =3D mixer_load(s, AC97_PCM_Front_DAC_Rate); open_voice(s, PO_INDEX, freq); - AUD_set_active_out(s->voice_po, active[PO_INDEX]); + AUD_set_active_out(s->audio_be, s->voice_po, active[PO_INDEX]); =20 freq =3D mixer_load(s, AC97_MIC_ADC_Rate); open_voice(s, MC_INDEX, freq); - AUD_set_active_in(s->voice_mc, active[MC_INDEX]); + AUD_set_active_in(s->audio_be, s->voice_mc, active[MC_INDEX]); } =20 static void get_volume(uint16_t vol, uint16_t mask, int inverse, @@ -416,7 +416,7 @@ static void update_combined_volume_out(AC97LinkState *s) lvol =3D (lvol * plvol) / 255; rvol =3D (rvol * prvol) / 255; =20 - AUD_set_volume_out_lr(s->voice_po, mute, lvol, rvol); + AUD_set_volume_out_lr(s->audio_be, s->voice_po, mute, lvol, rvol); } =20 static void update_volume_in(AC97LinkState *s) @@ -427,7 +427,7 @@ static void update_volume_in(AC97LinkState *s) get_volume(mixer_load(s, AC97_Record_Gain_Mute), 0x0f, 0, &mute, &lvol, &rvol); =20 - AUD_set_volume_in_lr(s->voice_pi, mute, lvol, rvol); + AUD_set_volume_in_lr(s->audio_be, s->voice_pi, mute, lvol, rvol); } =20 static void set_volume(AC97LinkState *s, int index, uint32_t val) @@ -904,7 +904,7 @@ static int write_audio(AC97LinkState *s, AC97BusMasterR= egs *r, int copied; to_copy =3D MIN(temp, sizeof(tmpbuf)); pci_dma_read(&s->dev, addr, tmpbuf, to_copy); - copied =3D AUD_write(s->voice_po, tmpbuf, to_copy); + copied =3D AUD_write(s->audio_be, s->voice_po, tmpbuf, to_copy); dolog("write_audio max=3D%x to_copy=3D%x copied=3D%x", max, to_copy, copied); if (!copied) { @@ -948,7 +948,7 @@ static void write_bup(AC97LinkState *s, int elapsed) while (elapsed) { int temp =3D MIN(elapsed, sizeof(s->silence)); while (temp) { - int copied =3D AUD_write(s->voice_po, s->silence, temp); + int copied =3D AUD_write(s->audio_be, s->voice_po, s->silence,= temp); if (!copied) { return; } @@ -978,7 +978,7 @@ static int read_audio(AC97LinkState *s, AC97BusMasterRe= gs *r, while (temp) { int acquired; to_copy =3D MIN(temp, sizeof(tmpbuf)); - acquired =3D AUD_read(voice, tmpbuf, to_copy); + acquired =3D AUD_read(s->audio_be, voice, tmpbuf, to_copy); if (!acquired) { *stop =3D 1; break; @@ -1275,7 +1275,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp) AC97LinkState *s =3D AC97(dev); uint8_t *c =3D s->dev.config; =20 - if (!AUD_backend_check (&s->audio_be, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index f79654627f5..dd5d9cf6772 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -95,7 +95,7 @@ static void adlib_write(void *opaque, uint32_t nport, uin= t32_t val) int a =3D nport & 3; =20 s->active =3D 1; - AUD_set_active_out (s->voice, 1); + AUD_set_active_out(s->audio_be, s->voice, 1); =20 adlib_kill_timers (s); =20 @@ -143,7 +143,8 @@ static int write_audio (AdlibState *s, int samples) int nbytes, wbytes, wsampl; =20 nbytes =3D samples << SHIFT; - wbytes =3D AUD_write ( + wbytes =3D AUD_write( + s->audio_be, s->voice, s->mixbuf + (pos << (SHIFT - 1)), nbytes @@ -255,7 +256,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D HOST_BIG_ENDIAN; =20 - s->voice =3D AUD_open_out ( + s->voice =3D AUD_open_out( s->audio_be, s->voice, "adlib", @@ -269,7 +270,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) return; } =20 - s->samples =3D AUD_get_buffer_size_out (s->voice) >> SHIFT; + s->samples =3D AUD_get_buffer_size_out(s->audio_be, s->voice) >> SHIFT; s->mixbuf =3D g_malloc0 (s->samples << SHIFT); =20 adlib_portio_list[0].offset =3D s->port; diff --git a/hw/audio/asc.c b/hw/audio/asc.c index a934c2e82c0..43cd51939a3 100644 --- a/hw/audio/asc.c +++ b/hw/audio/asc.c @@ -355,12 +355,12 @@ static void asc_out_cb(void *opaque, int free_b) * loop because the FIFO has run out of data, and the driver * reuses the stale content in its circular audio buffer. */ - AUD_write(s->voice, s->silentbuf, samples << s->shift); + AUD_write(s->audio_be, s->voice, s->silentbuf, samples << s->s= hift); } return; } =20 - AUD_write(s->voice, s->mixbuf, generated << s->shift); + AUD_write(s->audio_be, s->voice, s->mixbuf, generated << s->shift); } =20 static uint64_t asc_fifo_read(void *opaque, hwaddr addr, @@ -470,9 +470,9 @@ static void asc_write(void *opaque, hwaddr addr, uint64= _t value, asc_fifo_reset(&s->fifos[1]); asc_lower_irq(s); if (value !=3D 0) { - AUD_set_active_out(s->voice, 1); + AUD_set_active_out(s->audio_be, s->voice, 1); } else { - AUD_set_active_out(s->voice, 0); + AUD_set_active_out(s->audio_be, s->voice, 0); } } break; @@ -489,7 +489,7 @@ static void asc_write(void *opaque, hwaddr addr, uint64= _t value, { int vol =3D (value & 0xe0); =20 - AUD_set_volume_out_lr(s->voice, 0, vol, vol); + AUD_set_volume_out_lr(s->audio_be, s->voice, 0, vol, vol); break; } } @@ -545,7 +545,7 @@ static int asc_post_load(void *opaque, int version) ASCState *s =3D ASC(opaque); =20 if (s->regs[ASC_MODE] !=3D 0) { - AUD_set_active_out(s->voice, 1); + AUD_set_active_out(s->audio_be, s->voice, 1); } =20 return 0; @@ -614,7 +614,7 @@ static void asc_reset_hold(Object *obj, ResetType type) { ASCState *s =3D ASC(obj); =20 - AUD_set_active_out(s->voice, 0); + AUD_set_active_out(s->audio_be, s->voice, 0); =20 memset(s->regs, 0, sizeof(s->regs)); asc_fifo_reset(&s->fifos[0]); @@ -658,7 +658,7 @@ static void asc_realize(DeviceState *dev, Error **errp) } =20 s->shift =3D 1; - s->samples =3D AUD_get_buffer_size_out(s->voice) >> s->shift; + s->samples =3D AUD_get_buffer_size_out(s->audio_be, s->voice) >> s->sh= ift; s->mixbuf =3D g_malloc0(s->samples << s->shift); =20 s->silentbuf =3D g_malloc(s->samples << s->shift); diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 7489cf42b7d..3b8ed092fe4 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -327,7 +327,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) goto error; } =20 - s->voice =3D AUD_open_out ( + s->voice =3D AUD_open_out( s->audio_be, s->voice, "cs4231a", @@ -339,7 +339,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) if (s->dregs[Interface_Configuration] & PEN) { if (!s->dma_running) { k->hold_DREQ(s->isa_dma, s->dma); - AUD_set_active_out (s->voice, 1); + AUD_set_active_out(s->audio_be, s->voice, 1); s->transferred =3D 0; } s->dma_running =3D 1; @@ -347,7 +347,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) else { if (s->dma_running) { k->release_DREQ(s->isa_dma, s->dma); - AUD_set_active_out (s->voice, 0); + AUD_set_active_out(s->audio_be, s->voice, 0); } s->dma_running =3D 0; } @@ -356,7 +356,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) error: if (s->dma_running) { k->release_DREQ(s->isa_dma, s->dma); - AUD_set_active_out (s->voice, 0); + AUD_set_active_out(s->audio_be, s->voice, 0); } } =20 @@ -465,7 +465,7 @@ static void cs_write (void *opaque, hwaddr addr, if (s->dma_running) { IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); k->release_DREQ(s->isa_dma, s->dma); - AUD_set_active_out (s->voice, 0); + AUD_set_active_out(s->audio_be, s->voice, 0); s->dma_running =3D 0; } } @@ -551,11 +551,11 @@ static int cs_write_audio (CSState *s, int nchan, int= dma_pos, =20 for (i =3D 0; i < copied; ++i) linbuf[i] =3D s->tab[tmpbuf[i]]; - copied =3D AUD_write (s->voice, linbuf, copied << 1); + copied =3D AUD_write(s->audio_be, s->voice, linbuf, copied << = 1); copied >>=3D 1; } else { - copied =3D AUD_write (s->voice, tmpbuf, copied); + copied =3D AUD_write(s->audio_be, s->voice, tmpbuf, copied); } =20 temp -=3D copied; @@ -614,7 +614,7 @@ static int cs4231a_pre_load (void *opaque) if (s->dma_running) { IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); k->release_DREQ(s->isa_dma, s->dma); - AUD_set_active_out (s->voice, 0); + AUD_set_active_out(s->audio_be, s->voice, 0); } s->dma_running =3D 0; return 0; diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 566f93f1eae..44b204730b5 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -411,7 +411,7 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) =20 if (i =3D=3D ADC_CHANNEL) { s->adc_voice =3D - AUD_open_in ( + AUD_open_in( s->audio_be, s->adc_voice, "es1370.adc", @@ -421,7 +421,7 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) ); } else { s->dac_voice[i] =3D - AUD_open_out ( + AUD_open_out( s->audio_be, s->dac_voice[i], i ? "es1370.dac2" : "es1370.dac1", @@ -438,9 +438,9 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) int on =3D (ctl & b->ctl_en) && !(sctl & b->sctl_pause); =20 if (i =3D=3D ADC_CHANNEL) { - AUD_set_active_in (s->adc_voice, on); + AUD_set_active_in(s->audio_be, s->adc_voice, on); } else { - AUD_set_active_out (s->dac_voice[i], on); + AUD_set_active_out(s->audio_be, s->dac_voice[i], on); } } } @@ -627,7 +627,7 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, int acquired, to_copy; =20 to_copy =3D MIN(to_transfer, sizeof(tmpbuf)); - acquired =3D AUD_read (s->adc_voice, tmpbuf, to_copy); + acquired =3D AUD_read(s->audio_be, s->adc_voice, tmpbuf, to_co= py); if (!acquired) { break; } @@ -646,7 +646,7 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, =20 to_copy =3D MIN(to_transfer, sizeof(tmpbuf)); pci_dma_read (&s->dev, addr, tmpbuf, to_copy); - copied =3D AUD_write (voice, tmpbuf, to_copy); + copied =3D AUD_write(s->audio_be, voice, tmpbuf, to_copy); if (!copied) { break; } diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 69ddc419191..1ede1c4a51d 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -87,7 +87,8 @@ static int write_audio (GUSState *s, int samples) int nbytes, wbytes, wsampl; =20 nbytes =3D samples << s->shift; - wbytes =3D AUD_write ( + wbytes =3D AUD_write( + s->audio_be, s->voice, s->mixbuf + (pos << (s->shift - 1)), nbytes @@ -257,7 +258,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D HOST_BIG_ENDIAN; =20 - s->voice =3D AUD_open_out ( + s->voice =3D AUD_open_out( s->audio_be, NULL, "gus", @@ -272,7 +273,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) } =20 s->shift =3D 2; - s->samples =3D AUD_get_buffer_size_out (s->voice) >> s->shift; + s->samples =3D AUD_get_buffer_size_out(s->audio_be, s->voice) >> s->sh= ift; s->mixbuf =3D g_malloc0 (s->samples << s->shift); =20 isa_register_portio_list(d, &s->portio_list1, s->port, @@ -287,7 +288,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) s->emu.opaque =3D s; s->pic =3D isa_bus_get_irq(bus, s->emu.gusirq); =20 - AUD_set_active_out (s->voice, 1); + AUD_set_active_out(s->audio_be, s->voice, 1); } =20 static const Property gus_properties[] =3D { diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index 6445d227594..0373d2f7271 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -275,7 +275,8 @@ static void hda_audio_input_cb(void *opaque, int avail) while (to_transfer) { uint32_t start =3D (uint32_t) (wpos & B_MASK); uint32_t chunk =3D (uint32_t) MIN(B_SIZE - start, to_transfer); - uint32_t read =3D AUD_read(st->voice.in, st->buf + start, chunk); + uint32_t read =3D AUD_read(st->state->audio_be, st->voice.in, + st->buf + start, chunk); wpos +=3D read; to_transfer -=3D read; st->wpos +=3D read; @@ -354,7 +355,8 @@ static void hda_audio_output_cb(void *opaque, int avail) while (to_transfer) { uint32_t start =3D (uint32_t) (rpos & B_MASK); uint32_t chunk =3D (uint32_t) MIN(B_SIZE - start, to_transfer); - uint32_t written =3D AUD_write(st->voice.out, st->buf + start, chu= nk); + uint32_t written =3D AUD_write(st->state->audio_be, st->voice.out, + st->buf + start, chunk); rpos +=3D written; to_transfer -=3D written; st->rpos +=3D written; @@ -375,7 +377,8 @@ static void hda_audio_compat_input_cb(void *opaque, int= avail) =20 while (avail - recv >=3D sizeof(st->compat_buf)) { if (st->compat_bpos !=3D sizeof(st->compat_buf)) { - len =3D AUD_read(st->voice.in, st->compat_buf + st->compat_bpo= s, + len =3D AUD_read(st->state->audio_be, st->voice.in, + st->compat_buf + st->compat_bpos, sizeof(st->compat_buf) - st->compat_bpos); st->compat_bpos +=3D len; recv +=3D len; @@ -408,7 +411,8 @@ static void hda_audio_compat_output_cb(void *opaque, in= t avail) } st->compat_bpos =3D 0; } - len =3D AUD_write(st->voice.out, st->compat_buf + st->compat_bpos, + len =3D AUD_write(st->state->audio_be, st->voice.out, + st->compat_buf + st->compat_bpos, sizeof(st->compat_buf) - st->compat_bpos); st->compat_bpos +=3D len; sent +=3D len; @@ -440,9 +444,9 @@ static void hda_audio_set_running(HDAAudioStream *st, b= ool running) } } if (st->output) { - AUD_set_active_out(st->voice.out, st->running); + AUD_set_active_out(st->state->audio_be, st->voice.out, st->running= ); } else { - AUD_set_active_in(st->voice.in, st->running); + AUD_set_active_in(st->state->audio_be, st->voice.in, st->running); } } =20 @@ -466,9 +470,9 @@ static void hda_audio_set_amp(HDAAudioStream *st) return; } if (st->output) { - AUD_set_volume_out_lr(st->voice.out, muted, left, right); + AUD_set_volume_out_lr(st->state->audio_be, st->voice.out, muted, l= eft, right); } else { - AUD_set_volume_in_lr(st->voice.in, muted, left, right); + AUD_set_volume_in_lr(st->state->audio_be, st->voice.in, muted, lef= t, right); } } =20 diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index f85226d1ac5..b875e83d454 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -101,11 +101,11 @@ static void lm4549_audio_transfer(lm4549_state *s) uint32_t i; =20 /* Activate the voice */ - AUD_set_active_out(s->voice, 1); + AUD_set_active_out(s->audio_be, s->voice, 1); s->voice_is_active =3D 1; =20 /* Try to write the buffer content */ - written_bytes =3D AUD_write(s->voice, s->buffer, + written_bytes =3D AUD_write(s->audio_be, s->voice, s->buffer, s->buffer_level * sizeof(uint16_t)); written_samples =3D written_bytes >> 1; =20 @@ -129,14 +129,14 @@ static void lm4549_audio_out_callback(void *opaque, i= nt free) static uint32_t prev_buffer_level; =20 #ifdef LM4549_DEBUG - int size =3D AUD_get_buffer_size_out(s->voice); + int size =3D AUD_get_buffer_size_out(s->audio_be, s->voice); DPRINTF("audio_out_callback size =3D %i free =3D %i\n", size, free); #endif =20 /* Detect that no data are consumed =3D> disable the voice */ if (s->buffer_level =3D=3D prev_buffer_level) { - AUD_set_active_out(s->voice, 0); + AUD_set_active_out(s->audio_be, s->voice, 0); s->voice_is_active =3D 0; } prev_buffer_level =3D s->buffer_level; @@ -285,7 +285,7 @@ static int lm4549_post_load(void *opaque, int version_i= d) =20 /* Request data */ if (s->voice_is_active =3D=3D 1) { - lm4549_audio_out_callback(s, AUD_get_buffer_size_out(s->voice)); + lm4549_audio_out_callback(s, AUD_get_buffer_size_out(s->audio_be, = s->voice)); } =20 return 0; @@ -323,7 +323,7 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_= req_cb, void* opaque, &as ); =20 - AUD_set_volume_out_lr(s->voice, 0, 255, 255); + AUD_set_volume_out_lr(s->audio_be, s->voice, 0, 255, 255); =20 s->voice_is_active =3D 0; =20 diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 0b01544941c..07ebfcfccf6 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -105,7 +105,7 @@ static void pcspk_callback(void *opaque, int free) =20 while (free > 0) { n =3D MIN(s->samples - s->play_pos, (unsigned int)free); - n =3D AUD_write(s->voice, &s->sample_buf[s->play_pos], n); + n =3D AUD_write(s->audio_be, s->voice, &s->sample_buf[s->play_pos]= , n); if (!n) break; s->play_pos =3D (s->play_pos + n) % s->samples; @@ -163,7 +163,7 @@ static void pcspk_io_write(void *opaque, hwaddr addr, u= int64_t val, if (s->voice) { if (gate) /* restart */ s->play_pos =3D 0; - AUD_set_active_out(s->voice, gate & s->data_on); + AUD_set_active_out(s->audio_be, s->voice, gate & s->data_on); } } =20 diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 3c5beb9dfa3..da0c33ea41b 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -185,11 +185,11 @@ static void control (SB16State *s, int hold) =20 if (hold) { k->hold_DREQ(isa_dma, dma); - AUD_set_active_out (s->voice, 1); + AUD_set_active_out(s->audio_be, s->voice, 1); } else { k->release_DREQ(isa_dma, dma); - AUD_set_active_out (s->voice, 0); + AUD_set_active_out(s->audio_be, s->voice, 0); } } =20 @@ -215,7 +215,7 @@ static void continue_dma8 (SB16State *s) as.fmt =3D s->fmt; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out ( + s->voice =3D AUD_open_out( s->audio_be, s->voice, "sb16", @@ -378,7 +378,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t= d0, int dma_len) as.fmt =3D s->fmt; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out ( + s->voice =3D AUD_open_out( s->audio_be, s->voice, "sb16", @@ -879,7 +879,7 @@ static void legacy_reset (SB16State *s) as.fmt =3D AUDIO_FORMAT_U8; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out ( + s->voice =3D AUD_open_out( s->audio_be, s->voice, "sb16", @@ -1196,7 +1196,7 @@ static int write_audio (SB16State *s, int nchan, int = dma_pos, } =20 copied =3D k->read_memory(isa_dma, nchan, tmpbuf, dma_pos, to_copy= ); - copied =3D AUD_write (s->voice, tmpbuf, copied); + copied =3D AUD_write(s->audio_be, s->voice, tmpbuf, copied); =20 temp -=3D copied; dma_pos =3D (dma_pos + copied) % dma_len; @@ -1302,7 +1302,7 @@ static int sb16_post_load (void *opaque, int version_= id) as.fmt =3D s->fmt; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out ( + s->voice =3D AUD_open_out( s->audio_be, s->voice, "sb16", diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c index 019d2968534..5b344d7a0fc 100644 --- a/hw/audio/via-ac97.c +++ b/hw/audio/via-ac97.c @@ -53,7 +53,7 @@ static void codec_volume_set_out(ViaAC97State *s) rvol /=3D 255; mute =3D CODEC_REG(s, AC97_Master_Volume_Mute) >> MUTE_SHIFT; mute |=3D CODEC_REG(s, AC97_PCM_Out_Volume_Mute) >> MUTE_SHIFT; - AUD_set_volume_out_lr(s->vo, mute, lvol, rvol); + AUD_set_volume_out_lr(s->audio_be, s->vo, mute, lvol, rvol); } =20 static void codec_reset(ViaAC97State *s) @@ -189,7 +189,7 @@ static void out_cb(void *opaque, int avail) while (temp) { to_copy =3D MIN(temp, sizeof(tmpbuf)); pci_dma_read(&s->dev, c->addr, tmpbuf, to_copy); - copied =3D AUD_write(s->vo, tmpbuf, to_copy); + copied =3D AUD_write(s->audio_be, s->vo, tmpbuf, to_copy); if (!copied) { stop =3D true; break; @@ -208,7 +208,7 @@ static void out_cb(void *opaque, int avail) c->stat |=3D STAT_PAUSED; } else { c->stat &=3D ~STAT_ACTIVE; - AUD_set_active_out(s->vo, 0); + AUD_set_active_out(s->audio_be, s->vo, 0); } if (c->type & STAT_EOL) { via_isa_set_irq(&s->dev, 0, 1); @@ -317,20 +317,20 @@ static void sgd_write(void *opaque, hwaddr addr, uint= 64_t val, unsigned size) break; case 1: if (val & CNTL_START) { - AUD_set_active_out(s->vo, 1); + AUD_set_active_out(s->audio_be, s->vo, 1); s->aur.stat =3D STAT_ACTIVE; } if (val & CNTL_TERM) { - AUD_set_active_out(s->vo, 0); + AUD_set_active_out(s->audio_be, s->vo, 0); s->aur.stat &=3D ~(STAT_ACTIVE | STAT_PAUSED); s->aur.clen =3D 0; } if (val & CNTL_PAUSE) { - AUD_set_active_out(s->vo, 0); + AUD_set_active_out(s->audio_be, s->vo, 0); s->aur.stat &=3D ~STAT_ACTIVE; s->aur.stat |=3D STAT_PAUSED; } else if (!(val & CNTL_PAUSE) && (s->aur.stat & STAT_PAUSED)) { - AUD_set_active_out(s->vo, 1); + AUD_set_active_out(s->audio_be, s->vo, 1); s->aur.stat |=3D STAT_ACTIVE; s->aur.stat &=3D ~STAT_PAUSED; } diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c index 9101560f387..47fef61af88 100644 --- a/hw/audio/virtio-snd.c +++ b/hw/audio/virtio-snd.c @@ -463,7 +463,7 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s, = uint32_t stream_id) stream, virtio_snd_pcm_out_cb, &as); - AUD_set_volume_out_lr(stream->voice.out, 0, 255, 255); + AUD_set_volume_out_lr(s->audio_be, stream->voice.out, 0, 255, 255); } else { stream->voice.in =3D AUD_open_in(s->audio_be, stream->voice.in, @@ -471,7 +471,7 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s, = uint32_t stream_id) stream, virtio_snd_pcm_in_cb, &as); - AUD_set_volume_in_lr(stream->voice.in, 0, 255, 255); + AUD_set_volume_in_lr(s->audio_be, stream->voice.in, 0, 255, 255); } =20 return cpu_to_le32(VIRTIO_SND_S_OK); @@ -561,9 +561,9 @@ static void virtio_snd_handle_pcm_start_stop(VirtIOSoun= d *s, stream->active =3D start; } if (stream->info.direction =3D=3D VIRTIO_SND_D_OUTPUT) { - AUD_set_active_out(stream->voice.out, start); + AUD_set_active_out(s->audio_be, stream->voice.out, start); } else { - AUD_set_active_in(stream->voice.in, start); + AUD_set_active_in(s->audio_be, stream->voice.in, start); } } else { error_report("Invalid stream id: %"PRIu32, stream_id); @@ -1166,7 +1166,8 @@ static void virtio_snd_pcm_out_cb(void *data, int ava= ilable) buffer->populated =3D true; } for (;;) { - size =3D AUD_write(stream->voice.out, + size =3D AUD_write(stream->s->audio_be, + stream->voice.out, buffer->data + buffer->offset, MIN(buffer->size, available)); assert(size <=3D MIN(buffer->size, available)); @@ -1258,7 +1259,8 @@ static void virtio_snd_pcm_in_cb(void *data, int avai= lable) return_rx_buffer(stream, buffer); break; } - size =3D AUD_read(stream->voice.in, + size =3D AUD_read(stream->s->audio_be, + stream->voice.in, buffer->data + buffer->size, MIN(available, (stream->params.period_bytes - buffer->size))); diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index 336fb6d20bd..bc347fe5376 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -72,7 +72,7 @@ static inline void wm8750_in_load(WM8750State *s) if (s->idx_in + s->req_in <=3D sizeof(s->data_in)) return; s->idx_in =3D MAX(0, (int) sizeof(s->data_in) - s->req_in); - AUD_read(*s->in[0], s->data_in + s->idx_in, + AUD_read(s->audio_be, *s->in[0], s->data_in + s->idx_in, sizeof(s->data_in) - s->idx_in); } =20 @@ -80,7 +80,7 @@ static inline void wm8750_out_flush(WM8750State *s) { int sent =3D 0; while (sent < s->idx_out) - sent +=3D AUD_write(*s->out[0], s->data_out + sent, s->idx_out - s= ent) + sent +=3D AUD_write(s->audio_be, *s->out[0], s->data_out + sent, s= ->idx_out - sent) ?: s->idx_out; s->idx_out =3D 0; } @@ -145,30 +145,30 @@ static void wm8750_vol_update(WM8750State *s) { /* FIXME: multiply all volumes by s->invol[2], s->invol[3] */ =20 - AUD_set_volume_in_lr(s->adc_voice[0], s->mute, + AUD_set_volume_in_lr(s->audio_be, s->adc_voice[0], s->mute, s->inmute[0] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[0]), s->inmute[1] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[1])= ); - AUD_set_volume_in_lr(s->adc_voice[1], s->mute, + AUD_set_volume_in_lr(s->audio_be, s->adc_voice[1], s->mute, s->inmute[0] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[0]), s->inmute[1] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[1])= ); - AUD_set_volume_in_lr(s->adc_voice[2], s->mute, + AUD_set_volume_in_lr(s->audio_be, s->adc_voice[2], s->mute, s->inmute[0] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[0]), s->inmute[1] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[1])= ); =20 /* FIXME: multiply all volumes by s->outvol[0], s->outvol[1] */ =20 /* Speaker: LOUT2VOL ROUT2VOL */ - AUD_set_volume_out_lr(s->dac_voice[0], s->mute, + AUD_set_volume_out_lr(s->audio_be, s->dac_voice[0], s->mute, s->outmute[0] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 4]), s->outmute[1] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 5])); =20 /* Headphone: LOUT1VOL ROUT1VOL */ - AUD_set_volume_out_lr(s->dac_voice[1], s->mute, + AUD_set_volume_out_lr(s->audio_be, s->dac_voice[1], s->mute, s->outmute[0] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 2]), s->outmute[1] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 3])); =20 /* MONOOUT: MONOVOL MONOVOL */ - AUD_set_volume_out_lr(s->dac_voice[2], s->mute, + AUD_set_volume_out_lr(s->audio_be, s->dac_voice[2], s->mute, s->outmute[0] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 6]), s->outmute[1] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 6])); } @@ -182,9 +182,9 @@ static void wm8750_set_format(WM8750State *s) wm8750_out_flush(s); =20 if (s->in[0] && *s->in[0]) - AUD_set_active_in(*s->in[0], 0); + AUD_set_active_in(s->audio_be, *s->in[0], 0); if (s->out[0] && *s->out[0]) - AUD_set_active_out(*s->out[0], 0); + AUD_set_active_out(s->audio_be, *s->out[0], 0); =20 for (i =3D 0; i < IN_PORT_N; i ++) if (s->adc_voice[i]) { @@ -235,9 +235,9 @@ static void wm8750_set_format(WM8750State *s) * for mixing or combining paths to different ports, so we * connect both channels to where the left channel is routed. */ if (s->in[0] && *s->in[0]) - AUD_set_active_in(*s->in[0], 1); + AUD_set_active_in(s->audio_be, *s->in[0], 1); if (s->out[0] && *s->out[0]) - AUD_set_active_out(*s->out[0], 1); + AUD_set_active_out(s->audio_be, *s->out[0], 1); } =20 static void wm8750_clk_update(WM8750State *s, int ext) diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index a24e95f0a73..deda7efe15d 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -331,7 +331,7 @@ static inline void xlnx_dp_audio_activate(XlnxDPState *= s) { bool activated =3D ((s->core_registers[DP_TX_AUDIO_CONTROL] & DP_TX_AUD_CTRL) !=3D 0); - AUD_set_active_out(s->amixer_output_stream, activated); + AUD_set_active_out(s->audio_be, s->amixer_output_stream, activated); xlnx_dpdma_set_host_data_location(s->dpdma, DP_AUDIO_DMA_CHANNEL(0), &s->audio_buffer_0); xlnx_dpdma_set_host_data_location(s->dpdma, DP_AUDIO_DMA_CHANNEL(1), @@ -401,7 +401,7 @@ static void xlnx_dp_audio_callback(void *opaque, int av= ail) /* Send the buffer through the audio. */ if (s->byte_left <=3D MAX_QEMU_BUFFER_SIZE) { if (s->byte_left !=3D 0) { - written =3D AUD_write(s->amixer_output_stream, + written =3D AUD_write(s->audio_be, s->amixer_output_stream, &s->out_buffer[s->data_ptr], s->byte_left); } else { int len_to_copy; @@ -413,12 +413,12 @@ static void xlnx_dp_audio_callback(void *opaque, int = avail) while (avail) { len_to_copy =3D MIN(AUD_CHBUF_MAX_DEPTH, avail); memset(s->out_buffer, 0, len_to_copy); - avail -=3D AUD_write(s->amixer_output_stream, s->out_buffe= r, + avail -=3D AUD_write(s->audio_be, s->amixer_output_stream,= s->out_buffer, len_to_copy); } } } else { - written =3D AUD_write(s->amixer_output_stream, + written =3D AUD_write(s->audio_be, s->amixer_output_stream, &s->out_buffer[s->data_ptr], MAX_QEMU_BUFFER_S= IZE); } s->byte_left -=3D written; @@ -1401,7 +1401,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error *= *errp) s, xlnx_dp_audio_callback, &as); - AUD_set_volume_out_lr(s->amixer_output_stream, 0, 255, 255); + AUD_set_volume_out_lr(s->audio_be, s->amixer_output_stream, 0, 255, 25= 5); xlnx_dp_audio_activate(s); s->vblank =3D ptimer_init(vblank_hit, s, DP_VBLANK_PTIMER_POLICY); ptimer_transaction_begin(s->vblank); diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index dfda2dccc04..0f36587fc6f 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -669,7 +669,7 @@ static void output_callback(void *opaque, int avail) return; } =20 - written =3D AUD_write(s->out.voice, data, len); + written =3D AUD_write(s->audio_be, s->out.voice, data, len); avail -=3D written; s->out.buf.cons +=3D written; =20 @@ -683,7 +683,7 @@ static int usb_audio_set_output_altset(USBAudioState *s= , int altset) { switch (altset) { case ALTSET_OFF: - AUD_set_active_out(s->out.voice, false); + AUD_set_active_out(s->audio_be, s->out.voice, false); break; case ALTSET_STEREO: case ALTSET_51: @@ -692,7 +692,7 @@ static int usb_audio_set_output_altset(USBAudioState *s= , int altset) usb_audio_reinit(USB_DEVICE(s), altset_channels[altset]); } streambuf_init(&s->out.buf, s->buffer, s->out.channels); - AUD_set_active_out(s->out.voice, true); + AUD_set_active_out(s->audio_be, s->out.voice, true); break; default: return -1; @@ -805,7 +805,7 @@ static int usb_audio_set_control(USBAudioState *s, uint= 8_t attrib, } fprintf(stderr, "\n"); } - AUD_set_volume_out(s->out.voice, &s->out.vol); + AUD_set_volume_out(s->audio_be, s->out.voice, &s->out.vol); } =20 return ret; @@ -980,8 +980,8 @@ static void usb_audio_reinit(USBDevice *dev, unsigned c= hannels) =20 s->out.voice =3D AUD_open_out(s->audio_be, s->out.voice, TYPE_USB_AUDI= O, s, output_callback, &s->out.as); - AUD_set_volume_out(s->out.voice, &s->out.vol); - AUD_set_active_out(s->out.voice, 0); + AUD_set_volume_out(s->audio_be, s->out.voice, &s->out.vol); + AUD_set_active_out(s->audio_be, s->out.voice, 0); } =20 static const VMStateDescription vmstate_usb_audio =3D { diff --git a/tests/audio/test-audio.c b/tests/audio/test-audio.c index 66693f0fbfd..6c182ee7c60 100644 --- a/tests/audio/test-audio.c +++ b/tests/audio/test-audio.c @@ -142,7 +142,7 @@ static void test_sine_callback(void *opaque, int avail) =20 generate_sine_samples(buffer, frames_to_write, s->frames_written); =20 - bytes_written =3D AUD_write(s->voice, buffer, + bytes_written =3D AUD_write(s->be, s->voice, buffer, frames_to_write * sizeof(int16_t) * CHANNELS= ); s->frames_written +=3D bytes_written / (sizeof(int16_t) * CHANNELS); } @@ -163,7 +163,7 @@ static void test_audio_out_sine_wave(void) &state, test_sine_callback); =20 g_test_message("Playing 440Hz sine wave for %d seconds...", DURATION_S= ECS); - AUD_set_active_out(state.voice, true); + AUD_set_active_out(state.be, state.voice, true); =20 /* * Run the audio subsystem until all frames are written or timeout. @@ -188,7 +188,7 @@ static void test_audio_out_sine_wave(void) =20 g_assert_cmpint(state.frames_written, =3D=3D, state.total_frames); =20 - AUD_set_active_out(state.voice, false); + AUD_set_active_out(state.be, state.voice, false); AUD_close_out(state.be, state.voice); } =20 @@ -224,13 +224,13 @@ static void test_audio_out_active_state(void) be =3D get_test_audio_backend(); voice =3D open_test_voice_out(be, "test-active", NULL, dummy_audio_cal= lback); =20 - g_assert_false(AUD_is_active_out(voice)); + g_assert_false(AUD_is_active_out(be, voice)); =20 - AUD_set_active_out(voice, true); - g_assert_true(AUD_is_active_out(voice)); + AUD_set_active_out(be, voice, true); + g_assert_true(AUD_is_active_out(be, voice)); =20 - AUD_set_active_out(voice, false); - g_assert_false(AUD_is_active_out(voice)); + AUD_set_active_out(be, voice, false); + g_assert_false(AUD_is_active_out(be, voice)); =20 AUD_close_out(be, voice); } @@ -244,13 +244,13 @@ static void test_audio_out_buffer_size(void) be =3D get_test_audio_backend(); voice =3D open_test_voice_out(be, "test-buffer", NULL, dummy_audio_cal= lback); =20 - buffer_size =3D AUD_get_buffer_size_out(voice); + buffer_size =3D AUD_get_buffer_size_out(be, voice); g_test_message("Buffer size: %d bytes", buffer_size); g_assert_cmpint(buffer_size, >, 0); =20 AUD_close_out(be, voice); =20 - g_assert_cmpint(AUD_get_buffer_size_out(NULL), =3D=3D, 0); + g_assert_cmpint(AUD_get_buffer_size_out(NULL, NULL), =3D=3D, 0); } =20 static void test_audio_out_volume(void) @@ -263,13 +263,13 @@ static void test_audio_out_volume(void) voice =3D open_test_voice_out(be, "test-volume", NULL, dummy_audio_cal= lback); =20 vol =3D (Volume){ .mute =3D false, .channels =3D 2, .vol =3D {255, 255= } }; - AUD_set_volume_out(voice, &vol); + AUD_set_volume_out(be, voice, &vol); =20 vol =3D (Volume){ .mute =3D true, .channels =3D 2, .vol =3D {255, 255}= }; - AUD_set_volume_out(voice, &vol); + AUD_set_volume_out(be, voice, &vol); =20 vol =3D (Volume){ .mute =3D false, .channels =3D 2, .vol =3D {128, 128= } }; - AUD_set_volume_out(voice, &vol); + AUD_set_volume_out(be, voice, &vol); =20 AUD_close_out(be, voice); } @@ -286,13 +286,13 @@ static void test_audio_in_active_state(void) return; } =20 - g_assert_false(AUD_is_active_in(voice)); + g_assert_false(AUD_is_active_in(be, voice)); =20 - AUD_set_active_in(voice, true); - g_assert_true(AUD_is_active_in(voice)); + AUD_set_active_in(be, voice, true); + g_assert_true(AUD_is_active_in(be, voice)); =20 - AUD_set_active_in(voice, false); - g_assert_false(AUD_is_active_in(voice)); + AUD_set_active_in(be, voice, false); + g_assert_false(AUD_is_active_in(be, voice)); =20 AUD_close_in(be, voice); } @@ -311,10 +311,10 @@ static void test_audio_in_volume(void) } =20 vol =3D (Volume){ .mute =3D false, .channels =3D 2, .vol =3D {255, 255= } }; - AUD_set_volume_in(voice, &vol); + AUD_set_volume_in(be, voice, &vol); =20 vol =3D (Volume){ .mute =3D true, .channels =3D 2, .vol =3D {255, 255}= }; - AUD_set_volume_in(voice, &vol); + AUD_set_volume_in(be, voice, &vol); =20 AUD_close_in(be, voice); } @@ -427,7 +427,7 @@ static void test_audio_capture(void) &sine_state, test_sine_callback); sine_state.voice =3D voice; =20 - AUD_set_active_out(voice, true); + AUD_set_active_out(be, voice, true); =20 start_time =3D g_get_monotonic_time(); while (sine_state.frames_written < sine_state.total_frames || @@ -472,10 +472,10 @@ static void test_audio_capture(void) g_assert_cmpfloat(match_ratio, >=3D, 0.9); } =20 - AUD_set_active_out(voice, false); + AUD_set_active_out(be, voice, false); AUD_close_out(be, voice); =20 - AUD_del_capture(cap, &state); + AUD_del_capture(be, cap, &state); g_assert_true(state.destroy_called); =20 g_free(state.captured_samples); @@ -483,26 +483,27 @@ static void test_audio_capture(void) =20 static void test_audio_null_handling(void) { + AudioBackend *be =3D get_test_audio_backend(); uint8_t buffer[64]; =20 /* AUD_is_active_out/in(NULL) should return false */ - g_assert_false(AUD_is_active_out(NULL)); - g_assert_false(AUD_is_active_in(NULL)); + g_assert_false(AUD_is_active_out(be, NULL)); + g_assert_false(AUD_is_active_in(be, NULL)); =20 /* AUD_get_buffer_size_out(NULL) should return 0 */ - g_assert_cmpint(AUD_get_buffer_size_out(NULL), =3D=3D, 0); + g_assert_cmpint(AUD_get_buffer_size_out(be, NULL), =3D=3D, 0); =20 /* AUD_write/read(NULL, ...) should return size (no-op) */ - g_assert_cmpuint(AUD_write(NULL, buffer, sizeof(buffer)), =3D=3D, + g_assert_cmpuint(AUD_write(be, NULL, buffer, sizeof(buffer)), =3D=3D, sizeof(buffer)); - g_assert_cmpuint(AUD_read(NULL, buffer, sizeof(buffer)), =3D=3D, + g_assert_cmpuint(AUD_read(be, NULL, buffer, sizeof(buffer)), =3D=3D, sizeof(buffer)); =20 /* These should not crash */ - AUD_set_active_out(NULL, true); - AUD_set_active_out(NULL, false); - AUD_set_active_in(NULL, true); - AUD_set_active_in(NULL, false); + AUD_set_active_out(be, NULL, true); + AUD_set_active_out(be, NULL, false); + AUD_set_active_in(be, NULL, true); + AUD_set_active_in(be, NULL, false); } =20 static void test_audio_multiple_voices(void) @@ -516,19 +517,19 @@ static void test_audio_multiple_voices(void) out2 =3D open_test_voice_out(be, "test-multi-out2", NULL, dummy_audio_= callback); in1 =3D open_test_voice_in(be, "test-multi-in1", NULL, dummy_audio_cal= lback); =20 - AUD_set_active_out(out1, true); - AUD_set_active_out(out2, true); - AUD_set_active_in(in1, true); + AUD_set_active_out(be, out1, true); + AUD_set_active_out(be, out2, true); + AUD_set_active_in(be, in1, true); =20 - g_assert_true(AUD_is_active_out(out1)); - g_assert_true(AUD_is_active_out(out2)); + g_assert_true(AUD_is_active_out(be, out1)); + g_assert_true(AUD_is_active_out(be, out2)); if (in1) { - g_assert_true(AUD_is_active_in(in1)); + g_assert_true(AUD_is_active_in(be, in1)); } =20 - AUD_set_active_out(out1, false); - AUD_set_active_out(out2, false); - AUD_set_active_in(in1, false); + AUD_set_active_out(be, out1, false); + AUD_set_active_out(be, out2, false); + AUD_set_active_in(be, in1, false); =20 AUD_close_in(be, in1); AUD_close_out(be, out2); diff --git a/ui/vnc.c b/ui/vnc.c index a61a4f937d6..c142d9fc7c0 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1289,7 +1289,7 @@ static void audio_add(VncState *vs) static void audio_del(VncState *vs) { if (vs->audio_cap) { - AUD_del_capture(vs->audio_cap, vs); + AUD_del_capture(vs->vd->audio_be, vs->audio_cap, vs); vs->audio_cap =3D NULL; } } --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771245881; cv=none; d=zohomail.com; s=zohoarc; b=YNkDDZ8C0fLLu47O4qMPSz69g9hmOhXbNpSaLVNNHVmZlk+XFxfrueohYErLX+GQ1y0UDOH+Plmt6lb9t9a1xP1jtilD+Zgy1mJmIaE5NQptlUkLSTxCavEQa4gXQHbS7ILC0IpYYtqW7mIYVRIDHCEIRYyMQ63/MmOKt//02ZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771245881; h=Content-Type: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=hkWryIjuSHmr0bwEziyOBTp5DFea2r/ueaDp4dOe6mM=; b=P5Mf71KbDw1aBsCtVr+HKCHQPN5pm4A5NdenYyWguHLUTGfWZAuHqZgWLDWruVBtrHc6EuyfoKUmlnPipD+SledSS17yDik3iStWDLM8DfsPm27vqMOwKBvckG78f1O6dIsK80NcVyInDEHPYgaBS+ladAEcjWLemfaNpL/BE3E= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17712458818111007.16803061861; Mon, 16 Feb 2026 04:44:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweN-0003qH-An; Mon, 16 Feb 2026 06:20:23 -0500 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 1vrwbX-0005fs-RG for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbT-0007tX-H6 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:26 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-649-UqaeIxcwOYuQUWTFGgcaKg-1; Mon, 16 Feb 2026 06:17:18 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 606E11800352; Mon, 16 Feb 2026 11:17:16 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2BB511800465; Mon, 16 Feb 2026 11:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hkWryIjuSHmr0bwEziyOBTp5DFea2r/ueaDp4dOe6mM=; b=TknKFMh3eyfMaUna1501g40sELVLpreCCIJ13pUNlwGjgiBEQEaoCHo9pQu2GXoQ+eiRNW bpE3IugggMFHEU6CpRkCrH7I0S6noSY0h/5LuMEVGLn37UIINZvVKPUk4PoNWOKkN+4NKL 8U89TVsedk1wrMC5yauoS4y9eXFRhfM= X-MC-Unique: UqaeIxcwOYuQUWTFGgcaKg-1 X-Mimecast-MFC-AGG-ID: UqaeIxcwOYuQUWTFGgcaKg_1771240636 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:24 +0100 Subject: [PATCH 35/85] audio: make AudioBackend truly abstract MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-35-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=15723; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=e9fl1yiCeU+X0vumgeQ8TB7z7p3VBLjNMWmpzAK3nek=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPKcoUc2shWSYxqvj00cb6oQkqtTRvUBIDg 8taVMCOsQuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5Rj0EACbutn6dNwbp1Is5/qPIpfuAigPYe9YEhIwjV8wfW4EIOy5DxkLmyOjBIxXSTOKlQn4eD6 vyEPWdhOMJChFR/h+du05m2nyN98Sj9TRdZuniTmxb7P8CfEWY+H4jePXvGS1cxKPHO1nXEHtGv 7dCIn5AoeERp3V60bTQBjUKZjDbyP7qvHGtgMgyBNk93/mskp/8gKPsTmxfgpWZw99rgzZwe+i8 lhyEeYS4avvNiKtLteKVMgt1Lk2inCcmE0iP2i1ybrg4/m1RuPgkO4bONUigZiYwasDYLQ1ouTt U7n+TPKWWe4XntBk+/vvt3Ql4Y1KTCVL0yVjDqM4kWZaPCckRJ6TXPcfHEXSWMCZuZhwZ/YkOnH atThSW0zplyNwrDoy8TbHRMEOxj8tAi3DGAHI3BU24XqRWaOI87DXA0NtYGTiwU99fR1pov5D98 4UHxHOgxxwqEeY9vjrlEdpgtSruy3/awzXHfFmaekbFIieWvxjPVEK/MFEWbByY6V7k8LV4uZzC Ck8NCxKVdOeDC0cGe0nW3pHm7leWNDgfqoTj1VdDw/+xT8bhKqbag/3pqfzf8PtSNqqhdOxneuM CgfAa+EYYm8bHwu3JTwqNhGZSbYSEfe86HORl9v5Rcf/TmhSX2s661IvGcRC8/wqiFeSWBz5mkW 4cSRtupI6Jxilkg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771245884408158500 Add virtual methods to be implemented by concrete classes, like AudioMixengBackendClass. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_template.h | 9 +-- include/qemu/audio-capture.h | 13 --- include/qemu/audio.h | 58 +++++++++++--- audio/audio.c | 187 +++++++++++++++++++++++++++++++++++++++= +--- 4 files changed, 227 insertions(+), 40 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index 33f2ff432eb..a7733f9e1d9 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -478,7 +478,7 @@ static void glue (audio_close_, TYPE) (SW *sw) g_free (sw); } =20 -void glue(AUD_close_, TYPE)(AudioBackend *be, SW *sw) +static void glue(audio_mixeng_backend_close_, TYPE)(AudioBackend *be, SW *= sw) { if (sw) { if (audio_bug(__func__, !be)) { @@ -490,14 +490,13 @@ void glue(AUD_close_, TYPE)(AudioBackend *be, SW *sw) } } =20 -SW *glue (AUD_open_, TYPE) ( +static SW *glue(audio_mixeng_backend_open_, TYPE) ( AudioBackend *be, SW *sw, const char *name, void *callback_opaque , audio_callback_fn callback_fn, - const struct audsettings *as - ) + const struct audsettings *as) { AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(be); AudiodevPerDirectionOptions *pdo; @@ -569,7 +568,7 @@ SW *glue (AUD_open_, TYPE) ( return NULL; } =20 -bool glue(AUD_is_active_, TYPE)(AudioBackend *be, SW *sw) +static bool glue(audio_mixeng_backend_is_active_, TYPE)(AudioBackend *be, = SW *sw) { return sw ? sw->active : 0; } diff --git a/include/qemu/audio-capture.h b/include/qemu/audio-capture.h index f500b0a7f8c..5bfbdd02985 100644 --- a/include/qemu/audio-capture.h +++ b/include/qemu/audio-capture.h @@ -8,19 +8,6 @@ =20 #include "audio.h" =20 -typedef struct CaptureVoiceOut CaptureVoiceOut; - -typedef enum { - AUD_CNOTIFY_ENABLE, - AUD_CNOTIFY_DISABLE -} audcnotification_e; - -struct audio_capture_ops { - void (*notify) (void *opaque, audcnotification_e cmd); - void (*capture) (void *opaque, const void *buf, int size); - void (*destroy) (void *opaque); -}; - struct capture_ops { void (*info) (void *opaque); void (*destroy) (void *opaque); diff --git a/include/qemu/audio.h b/include/qemu/audio.h index e87708e3d1e..4fae48886ba 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -43,6 +43,25 @@ typedef struct audsettings { =20 typedef struct SWVoiceOut SWVoiceOut; typedef struct SWVoiceIn SWVoiceIn; +typedef struct CaptureVoiceOut CaptureVoiceOut; + +typedef enum { + AUD_CNOTIFY_ENABLE, + AUD_CNOTIFY_DISABLE +} audcnotification_e; + +struct audio_capture_ops { + void (*notify) (void *opaque, audcnotification_e cmd); + void (*capture) (void *opaque, const void *buf, int size); + void (*destroy) (void *opaque); +}; + +#define AUDIO_MAX_CHANNELS 16 +typedef struct Volume { + bool mute; + int channels; + uint8_t vol[AUDIO_MAX_CHANNELS]; +} Volume; =20 typedef struct AudioBackend { Object parent_obj; @@ -53,6 +72,35 @@ typedef struct AudioBackendClass { =20 bool (*realize)(AudioBackend *be, Audiodev *dev, Error **errp); const char *(*get_id)(AudioBackend *be); + SWVoiceOut *(*open_out)(AudioBackend *be, + SWVoiceOut *sw, + const char *name, + void *callback_opaque, + audio_callback_fn callback_fn, + const struct audsettings *as); + SWVoiceIn *(*open_in)(AudioBackend *be, + SWVoiceIn *sw, + const char *name, + void *callback_opaque, + audio_callback_fn callback_fn, + const struct audsettings *as); + void (*close_out)(AudioBackend *be, SWVoiceOut *sw); + void (*close_in)(AudioBackend *be, SWVoiceIn *sw); + bool (*is_active_out)(AudioBackend *be, SWVoiceOut *sw); + bool (*is_active_in)(AudioBackend *be, SWVoiceIn *sw); + void (*set_active_out)(AudioBackend *be, SWVoiceOut *sw, bool on); + void (*set_active_in)(AudioBackend *be, SWVoiceIn *sw, bool on); + void (*set_volume_out)(AudioBackend *be, SWVoiceOut *sw, Volume *vol); + void (*set_volume_in)(AudioBackend *be, SWVoiceIn *sw, Volume *vol); + size_t (*write)(AudioBackend *be, SWVoiceOut *sw, void *buf, size_t si= ze); + size_t (*read)(AudioBackend *be, SWVoiceIn *sw, void *buf, size_t size= ); + int (*get_buffer_size_out)(AudioBackend *be, SWVoiceOut *sw); + CaptureVoiceOut *(*add_capture)(AudioBackend *be, + struct audsettings *as, + struct audio_capture_ops *ops, + void *cb_opaque); + void (*del_capture)(AudioBackend *be, CaptureVoiceOut *cap, void *cb_o= paque); + #ifdef CONFIG_GIO bool (*set_dbus_server)(AudioBackend *be, GDBusObjectManagerServer *manager, @@ -69,8 +117,7 @@ SWVoiceOut *AUD_open_out( const char *name, void *callback_opaque, audio_callback_fn callback_fn, - const struct audsettings *settings - ); + const struct audsettings *settings); =20 void AUD_close_out(AudioBackend *be, SWVoiceOut *sw); size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void *pcm_buf, size_t s= ize); @@ -78,13 +125,6 @@ int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceO= ut *sw); void AUD_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on); bool AUD_is_active_out(AudioBackend *be, SWVoiceOut *sw); =20 -#define AUDIO_MAX_CHANNELS 16 -typedef struct Volume { - bool mute; - int channels; - uint8_t vol[AUDIO_MAX_CHANNELS]; -} Volume; - void AUD_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol); void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol); =20 diff --git a/audio/audio.c b/audio/audio.c index 320035c0484..32b2b882f80 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -847,7 +847,8 @@ static void audio_timer (void *opaque) /* * Public API */ -size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void *buf, size_t size) +static size_t audio_mixeng_backend_write(AudioBackend *be, SWVoiceOut *sw, + void *buf, size_t size) { HWVoiceOut *hw; =20 @@ -858,7 +859,7 @@ size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void= *buf, size_t size) hw =3D sw->hw; =20 if (!hw->enabled) { - dolog ("Writing to disabled voice %s\n", SW_NAME (sw)); + dolog("Writing to disabled voice %s\n", SW_NAME(sw)); return 0; } =20 @@ -869,7 +870,15 @@ size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, voi= d *buf, size_t size) } } =20 -size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void *buf, size_t size) +size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void *buf, size_t size) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->write(be, sw, buf, size); +} + +static size_t audio_mixeng_backend_read(AudioBackend *be, SWVoiceIn *sw, + void *buf, size_t size) { HWVoiceIn *hw; =20 @@ -880,7 +889,7 @@ size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void *= buf, size_t size) hw =3D sw->hw; =20 if (!hw->enabled) { - dolog ("Reading from disabled voice %s\n", SW_NAME (sw)); + dolog("Reading from disabled voice %s\n", SW_NAME(sw)); return 0; } =20 @@ -889,9 +898,17 @@ size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void = *buf, size_t size) } else { return hw->pcm_ops->read(hw, buf, size); } + } =20 -int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw) +size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void *buf, size_t size) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->read(be, sw, buf, size); +} + +static int audio_mixeng_backend_get_buffer_size_out(AudioBackend *be, SWVo= iceOut *sw) { if (!sw) { return 0; @@ -904,7 +921,15 @@ int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceO= ut *sw) return sw->hw->samples * sw->hw->info.bytes_per_frame; } =20 -void AUD_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on) +int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->get_buffer_size_out(be, sw); +} + +static void audio_mixeng_backend_set_active_out(AudioBackend *be, SWVoiceO= ut *sw, + bool on) { HWVoiceOut *hw; =20 @@ -950,9 +975,17 @@ void AUD_set_active_out(AudioBackend *be, SWVoiceOut *= sw, bool on) } sw->active =3D on; } + } =20 -void AUD_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on) +void AUD_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->set_active_out(be, sw, on); +} + +static void audio_mixeng_backend_set_active_in(AudioBackend *be, SWVoiceIn= *sw, bool on) { HWVoiceIn *hw; =20 @@ -997,6 +1030,13 @@ void AUD_set_active_in(AudioBackend *be, SWVoiceIn *s= w, bool on) } } =20 +void AUD_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->set_active_in(be, sw, on); +} + static size_t audio_get_avail(SWVoiceIn *sw) { size_t live; @@ -1658,12 +1698,97 @@ static const char *audio_mixeng_backend_get_id(Audi= oBackend *be) return AUDIO_MIXENG_BACKEND(be)->dev->id; } =20 +static CaptureVoiceOut *audio_mixeng_backend_add_capture( + AudioBackend *be, + struct audsettings *as, + struct audio_capture_ops *ops, + void *cb_opaque); + +static void audio_mixeng_backend_del_capture( + AudioBackend *be, + CaptureVoiceOut *cap, + void *cb_opaque); + +static void audio_mixeng_backend_set_volume_out(AudioBackend *be, SWVoiceO= ut *sw, + Volume *vol); +static void audio_mixeng_backend_set_volume_in(AudioBackend *be, SWVoiceIn= *sw, + Volume *vol); + +SWVoiceOut *AUD_open_out( + AudioBackend *be, + SWVoiceOut *sw, + const char *name, + void *callback_opaque, + audio_callback_fn callback_fn, + const struct audsettings *as) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->open_out(be, sw, name, callback_opaque, callback_fn, as); +} + +SWVoiceIn *AUD_open_in( + AudioBackend *be, + SWVoiceIn *sw, + const char *name, + void *callback_opaque, + audio_callback_fn callback_fn, + const struct audsettings *as) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->open_in(be, sw, name, callback_opaque, callback_fn, as); +} + +void AUD_close_out(AudioBackend *be, SWVoiceOut *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->close_out(be, sw); +} + +void AUD_close_in(AudioBackend *be, SWVoiceIn *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->close_in(be, sw); +} + +bool AUD_is_active_out(AudioBackend *be, SWVoiceOut *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->is_active_out(be, sw); +} + +bool AUD_is_active_in(AudioBackend *be, SWVoiceIn *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->is_active_in(be, sw); +} + static void audio_mixeng_backend_class_init(ObjectClass *klass, const void= *data) { AudioBackendClass *be =3D AUDIO_BACKEND_CLASS(klass); =20 be->realize =3D audio_mixeng_backend_realize; be->get_id =3D audio_mixeng_backend_get_id; + be->open_in =3D audio_mixeng_backend_open_in; + be->open_out =3D audio_mixeng_backend_open_out; + be->close_in =3D audio_mixeng_backend_close_in; + be->close_out =3D audio_mixeng_backend_close_out; + be->is_active_out =3D audio_mixeng_backend_is_active_out; + be->is_active_in =3D audio_mixeng_backend_is_active_in; + be->set_active_out =3D audio_mixeng_backend_set_active_out; + be->set_active_in =3D audio_mixeng_backend_set_active_in; + be->set_volume_out =3D audio_mixeng_backend_set_volume_out; + be->set_volume_in =3D audio_mixeng_backend_set_volume_in; + be->read =3D audio_mixeng_backend_read; + be->write =3D audio_mixeng_backend_write; + be->get_buffer_size_out =3D audio_mixeng_backend_get_buffer_size_out; + be->add_capture =3D audio_mixeng_backend_add_capture; + be->del_capture =3D audio_mixeng_backend_del_capture; } =20 static void audio_mixeng_backend_init(Object *obj) @@ -1863,12 +1988,11 @@ bool AUD_backend_check(AudioBackend **be, Error **e= rrp) =20 static struct audio_pcm_ops capture_pcm_ops; =20 -CaptureVoiceOut *AUD_add_capture( +static CaptureVoiceOut *audio_mixeng_backend_add_capture( AudioBackend *be, struct audsettings *as, struct audio_capture_ops *ops, - void *cb_opaque - ) + void *cb_opaque) { AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(be); CaptureVoiceOut *cap; @@ -1938,7 +2062,21 @@ CaptureVoiceOut *AUD_add_capture( return cap; } =20 -void AUD_del_capture(AudioBackend *be, CaptureVoiceOut *cap, void *cb_opaq= ue) +CaptureVoiceOut *AUD_add_capture( + AudioBackend *be, + struct audsettings *as, + struct audio_capture_ops *ops, + void *cb_opaque) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->add_capture(be, as, ops, cb_opaque); +} + +static void audio_mixeng_backend_del_capture( + AudioBackend *be, + CaptureVoiceOut *cap, + void *cb_opaque) { struct capture_callback *cb; =20 @@ -1977,7 +2115,15 @@ void AUD_del_capture(AudioBackend *be, CaptureVoiceO= ut *cap, void *cb_opaque) } } =20 -void AUD_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol) +void AUD_del_capture(AudioBackend *be, CaptureVoiceOut *cap, void *cb_opaq= ue) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + klass->del_capture(be, cap, cb_opaque); +} + +static void audio_mixeng_backend_set_volume_out(AudioBackend *be, SWVoiceO= ut *sw, + Volume *vol) { if (sw) { HWVoiceOut *hw =3D sw->hw; @@ -1993,7 +2139,15 @@ void AUD_set_volume_out(AudioBackend *be, SWVoiceOut= *sw, Volume *vol) } } =20 -void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol) +void AUD_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + klass->set_volume_out(be, sw, vol); +} + +static void audio_mixeng_backend_set_volume_in(AudioBackend *be, SWVoiceIn= *sw, + Volume *vol) { if (sw) { HWVoiceIn *hw =3D sw->hw; @@ -2009,6 +2163,13 @@ void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *= sw, Volume *vol) } } =20 +void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + klass->set_volume_in(be, sw, vol); +} + static void audio_create_pdos(Audiodev *dev) { switch (dev->driver) { --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243304; cv=none; d=zohomail.com; s=zohoarc; b=HzkQogpnu8oMu1nwW/7H5oPhzDh4yj4rp98kaEbc20vuS0BrsyTmpW6QszLUn8/MrrRFCc3moC/4s9G6YB90u3h7NQfmApA1D/ne8rmwpdjcRqY6ioiq0EO3VFBr7v4oLGSXH0DFa7l+RciAPU23UngcPcodzPE4+ZA5X5+3GqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243304; h=Content-Type: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=8+nrp9qBSi6zwojCZeyXirIcfPIy3aiCAysKZAQazqs=; b=d5+uWcP3DChTGEDEMLffgOZq6a3qPhU6VIsgx6ftTNLlBrsvHxCaluMaYGFxxMeR8Sq60F4inexHYthq1NKdJR7/wrgdPeR+6x7KBdOR9A6U5spkWNeoSVwZrj/a8rfSJJE2nRKrGM7vhLRsMErC1fQyVDNVZy44c71ddU7UjA4= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177124330492458.256494693082686; Mon, 16 Feb 2026 04:01:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwdT-0008R4-V8; Mon, 16 Feb 2026 06:19:29 -0500 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 1vrwbX-0005fj-Pe for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbT-0007tZ-H9 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:26 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-d0kVv8e4M0-F4X4nNSFX1Q-1; Mon, 16 Feb 2026 06:17:21 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D181E195608A; Mon, 16 Feb 2026 11:17:18 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3FEB11800465; Mon, 16 Feb 2026 11:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8+nrp9qBSi6zwojCZeyXirIcfPIy3aiCAysKZAQazqs=; b=PpgHGZk3IlHHoBSk2+QIbKhL4T0SoH+lxQLx0oQhxHFZPJXr5pW5DVNT+ZzBZnknM/x/Vp 44n6t0FxKlT8NbhNwK+LVeEyWXaVXNeOI5P9rrFfR6j5KWxbtLdPb/maA0GmFvDkzB6k4L x1c96ggi+Gj6I9EP403XLtZeIh+nnqw= X-MC-Unique: d0kVv8e4M0-F4X4nNSFX1Q-1 X-Mimecast-MFC-AGG-ID: d0kVv8e4M0-F4X4nNSFX1Q_1771240639 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:25 +0100 Subject: [PATCH 36/85] audio: split AudioBackend MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-36-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=16069; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=VahWk8EyqYcNksac0aGnGbnCMMzcEu89NuQd+pfGwDM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxPitklu/qLDYihp68whkOhYB5aLOys9hM1K HhCyrm0pguJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8TwAKCRDa6OEJdZac 5ULwD/0eKChYSEmxjt7lq3k1T7N9EBMcHr+GmfYBKcGJExrRA8nKjqfnPQiIN/X9kriLbA0PJM/ qum5kJT8e8ts7S88GSkWzyVvd29AxbbaWhRYS4bdPpw3KjH7m3TD838xA3LVPhF1vukR2t34gYx GvHBxppt3VWkTGz5QS0OvkTUK/pExUQoWxfxI69ncFXIDuM9+PqiBSisC8La6NzT9n3l3UPzGx8 cnUWoRGFYMIj2L1ICtBhZCTZg9tHD4Z6oMwAkL9CqI0305oaGeQDHZxZfEPKtQEp5ndlxyiMWbZ CLfAn59p84vXrYeaWzLe4QjoODZevgBK+4B34hpSAc0p3Ix868eVuTlMvomzFw7kZnDToztISQx o94VxV7PsFJpFhiAutWuGb68hS3kRybf8bolWE4nV5SaJQ8R/jUT/57u9CEtuXJOKRpdc/GiGw8 QVA+eytC4hLUawYjfQS/RzVEpsZhAPIqzI7QIGEIHl/8lXFzCwkoAbLABMrOb4TSrJx+RuBjUGb f+Xx5F03MgulEnw+TQtyZvaMOe5aO+48XlK27hRJYROsO+kBiEIedDQn5SEosLzw92nQH3la+S3 Ed6TO2TV1CQDcLtmX35W16SZtRjE95U7IcDSz/d3+PreBpNMmk9eMVwaB8O+YtL3AKyw1X56pFu rzx1cUTudk1XS1w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243306962154100 Code clean-up, to allow building bare abstract class separately. The original file is MIT-licensed. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- include/qemu/audio.h | 2 + audio/audio-be.c | 206 +++++++++++++++++++++++++++++++++++++++++++++++= +++ audio/audio.c | 209 +----------------------------------------------= ---- audio/meson.build | 1 + 4 files changed, 211 insertions(+), 207 deletions(-) diff --git a/include/qemu/audio.h b/include/qemu/audio.h index 4fae48886ba..9f85c6316a8 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -111,6 +111,8 @@ typedef struct AudioBackendClass { =20 bool AUD_backend_check(AudioBackend **be, Error **errp); =20 +AudioBackend *audio_be_new(Audiodev *dev, Error **errp); + SWVoiceOut *AUD_open_out( AudioBackend *be, SWVoiceOut *sw, diff --git a/audio/audio-be.c b/audio/audio-be.c new file mode 100644 index 00000000000..51fb124026a --- /dev/null +++ b/audio/audio-be.c @@ -0,0 +1,206 @@ +/* SPDX-License-Identifier: MIT */ + +#include "qemu/osdep.h" +#include "qemu/audio.h" +#include "qemu/audio-capture.h" +#include "qapi/error.h" + +bool AUD_backend_check(AudioBackend **be, Error **errp) +{ + assert(be !=3D NULL); + + if (!*be) { + *be =3D audio_get_default_audio_be(errp); + if (!*be) { + return false; + } + } + + return true; +} + +SWVoiceIn *AUD_open_in( + AudioBackend *be, + SWVoiceIn *sw, + const char *name, + void *callback_opaque, + audio_callback_fn callback_fn, + const struct audsettings *as) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->open_in(be, sw, name, callback_opaque, callback_fn, as); +} + +SWVoiceOut *AUD_open_out( + AudioBackend *be, + SWVoiceOut *sw, + const char *name, + void *callback_opaque, + audio_callback_fn callback_fn, + const struct audsettings *as) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->open_out(be, sw, name, callback_opaque, callback_fn, as); +} + +void AUD_close_out(AudioBackend *be, SWVoiceOut *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->close_out(be, sw); +} + +void AUD_close_in(AudioBackend *be, SWVoiceIn *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->close_in(be, sw); +} + +bool AUD_is_active_out(AudioBackend *be, SWVoiceOut *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->is_active_out(be, sw); +} + +bool AUD_is_active_in(AudioBackend *be, SWVoiceIn *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->is_active_in(be, sw); +} + +size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void *buf, size_t size) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->write(be, sw, buf, size); +} + +size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void *buf, size_t size) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->read(be, sw, buf, size); +} + +int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->get_buffer_size_out(be, sw); +} + +void AUD_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->set_active_out(be, sw, on); +} + +void AUD_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->set_active_in(be, sw, on); +} + +void AUD_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + klass->set_volume_out(be, sw, vol); +} + +void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + klass->set_volume_in(be, sw, vol); +} + +CaptureVoiceOut *AUD_add_capture( + AudioBackend *be, + struct audsettings *as, + struct audio_capture_ops *ops, + void *cb_opaque) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->add_capture(be, as, ops, cb_opaque); +} + +void AUD_del_capture(AudioBackend *be, CaptureVoiceOut *cap, void *cb_opaq= ue) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + klass->del_capture(be, cap, cb_opaque); +} + +#ifdef CONFIG_GIO +bool audio_be_can_set_dbus_server(AudioBackend *be) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + return klass->set_dbus_server !=3D NULL; +} + +bool audio_be_set_dbus_server(AudioBackend *be, + GDBusObjectManagerServer *server, + bool p2p, + Error **errp) +{ + AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); + + if (!audio_be_can_set_dbus_server(be)) { + error_setg(errp, "Audiodev '%s' is not compatible with DBus", + audio_be_get_id(be)); + return false; + } + + return klass->set_dbus_server(be, server, p2p, errp); +} +#endif + +const char *audio_be_get_id(AudioBackend *be) +{ + if (be) { + return AUDIO_BACKEND_GET_CLASS(be)->get_id(be); + } else { + return ""; + } +} + +AudioBackend *audio_be_new(Audiodev *dev, Error **errp) +{ + const char *drvname =3D AudiodevDriver_str(dev->driver); + g_autofree char *type =3D g_strconcat("audio-", drvname, NULL); + AudioBackend *be =3D AUDIO_BACKEND(object_new(type)); + + if (!be) { + error_setg(errp, "Unknown audio driver `%s'", drvname); + return NULL; + } + + if (!AUDIO_BACKEND_GET_CLASS(be)->realize(be, dev, errp)) { + object_unref(OBJECT(be)); + return NULL; + } + + return be; +} + +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_BACKEND, + .parent =3D TYPE_OBJECT, + .instance_size =3D sizeof(AudioBackend), + .abstract =3D true, + .class_size =3D sizeof(AudioBackendClass), + }, +}; + +DEFINE_TYPES(audio_types) diff --git a/audio/audio.c b/audio/audio.c index 32b2b882f80..22e55ac9758 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -870,15 +870,8 @@ static size_t audio_mixeng_backend_write(AudioBackend = *be, SWVoiceOut *sw, } } =20 -size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void *buf, size_t size) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->write(be, sw, buf, size); -} - -static size_t audio_mixeng_backend_read(AudioBackend *be, SWVoiceIn *sw, - void *buf, size_t size) +static size_t audio_mixeng_backend_read(AudioBackend *be, + SWVoiceIn *sw, void *buf, size_t s= ize) { HWVoiceIn *hw; =20 @@ -901,13 +894,6 @@ static size_t audio_mixeng_backend_read(AudioBackend *= be, SWVoiceIn *sw, =20 } =20 -size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void *buf, size_t size) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->read(be, sw, buf, size); -} - static int audio_mixeng_backend_get_buffer_size_out(AudioBackend *be, SWVo= iceOut *sw) { if (!sw) { @@ -921,13 +907,6 @@ static int audio_mixeng_backend_get_buffer_size_out(Au= dioBackend *be, SWVoiceOut return sw->hw->samples * sw->hw->info.bytes_per_frame; } =20 -int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->get_buffer_size_out(be, sw); -} - static void audio_mixeng_backend_set_active_out(AudioBackend *be, SWVoiceO= ut *sw, bool on) { @@ -978,13 +957,6 @@ static void audio_mixeng_backend_set_active_out(AudioB= ackend *be, SWVoiceOut *sw =20 } =20 -void AUD_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->set_active_out(be, sw, on); -} - static void audio_mixeng_backend_set_active_in(AudioBackend *be, SWVoiceIn= *sw, bool on) { HWVoiceIn *hw; @@ -1030,13 +1002,6 @@ static void audio_mixeng_backend_set_active_in(Audio= Backend *be, SWVoiceIn *sw, } } =20 -void AUD_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->set_active_in(be, sw, on); -} - static size_t audio_get_avail(SWVoiceIn *sw) { size_t live; @@ -1643,25 +1608,6 @@ static bool audio_mixeng_backend_realize(AudioBacken= d *abe, return true; } =20 -static AudioBackend *audio_be_new(Audiodev *dev, Error **errp) -{ - const char *drvname =3D AudiodevDriver_str(dev->driver); - g_autofree char *type =3D g_strconcat("audio-", drvname, NULL); - AudioBackend *be =3D AUDIO_BACKEND(object_new(type)); - - if (!be) { - error_setg(errp, "Unknown audio driver `%s'", drvname); - return NULL; - } - - if (!AUDIO_BACKEND_GET_CLASS(be)->realize(be, dev, errp)) { - object_unref(OBJECT(be)); - return NULL; - } - - return be; -} - static void audio_vm_change_state_handler (void *opaque, bool running, RunState state) { @@ -1685,14 +1631,6 @@ static void audio_vm_change_state_handler (void *opa= que, bool running, =20 static const VMStateDescription vmstate_audio; =20 -static void audio_be_init(Object *obj) -{ -} - -static void audio_be_finalize(Object *obj) -{ -} - static const char *audio_mixeng_backend_get_id(AudioBackend *be) { return AUDIO_MIXENG_BACKEND(be)->dev->id; @@ -1714,60 +1652,6 @@ static void audio_mixeng_backend_set_volume_out(Audi= oBackend *be, SWVoiceOut *sw static void audio_mixeng_backend_set_volume_in(AudioBackend *be, SWVoiceIn= *sw, Volume *vol); =20 -SWVoiceOut *AUD_open_out( - AudioBackend *be, - SWVoiceOut *sw, - const char *name, - void *callback_opaque, - audio_callback_fn callback_fn, - const struct audsettings *as) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->open_out(be, sw, name, callback_opaque, callback_fn, as); -} - -SWVoiceIn *AUD_open_in( - AudioBackend *be, - SWVoiceIn *sw, - const char *name, - void *callback_opaque, - audio_callback_fn callback_fn, - const struct audsettings *as) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->open_in(be, sw, name, callback_opaque, callback_fn, as); -} - -void AUD_close_out(AudioBackend *be, SWVoiceOut *sw) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->close_out(be, sw); -} - -void AUD_close_in(AudioBackend *be, SWVoiceIn *sw) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->close_in(be, sw); -} - -bool AUD_is_active_out(AudioBackend *be, SWVoiceOut *sw) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->is_active_out(be, sw); -} - -bool AUD_is_active_in(AudioBackend *be, SWVoiceIn *sw) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->is_active_in(be, sw); -} - static void audio_mixeng_backend_class_init(ObjectClass *klass, const void= *data) { AudioBackendClass *be =3D AUDIO_BACKEND_CLASS(klass); @@ -1972,20 +1856,6 @@ AudioBackend *audio_get_default_audio_be(Error **err= p) return default_audio_be; } =20 -bool AUD_backend_check(AudioBackend **be, Error **errp) -{ - assert(be !=3D NULL); - - if (!*be) { - *be =3D audio_get_default_audio_be(errp); - if (!*be) { - return false; - } - } - - return true; -} - static struct audio_pcm_ops capture_pcm_ops; =20 static CaptureVoiceOut *audio_mixeng_backend_add_capture( @@ -2062,17 +1932,6 @@ static CaptureVoiceOut *audio_mixeng_backend_add_cap= ture( return cap; } =20 -CaptureVoiceOut *AUD_add_capture( - AudioBackend *be, - struct audsettings *as, - struct audio_capture_ops *ops, - void *cb_opaque) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->add_capture(be, as, ops, cb_opaque); -} - static void audio_mixeng_backend_del_capture( AudioBackend *be, CaptureVoiceOut *cap, @@ -2115,13 +1974,6 @@ static void audio_mixeng_backend_del_capture( } } =20 -void AUD_del_capture(AudioBackend *be, CaptureVoiceOut *cap, void *cb_opaq= ue) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - klass->del_capture(be, cap, cb_opaque); -} - static void audio_mixeng_backend_set_volume_out(AudioBackend *be, SWVoiceO= ut *sw, Volume *vol) { @@ -2139,13 +1991,6 @@ static void audio_mixeng_backend_set_volume_out(Audi= oBackend *be, SWVoiceOut *sw } } =20 -void AUD_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - klass->set_volume_out(be, sw, vol); -} - static void audio_mixeng_backend_set_volume_in(AudioBackend *be, SWVoiceIn= *sw, Volume *vol) { @@ -2163,13 +2008,6 @@ static void audio_mixeng_backend_set_volume_in(Audio= Backend *be, SWVoiceIn *sw, } } =20 -void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - klass->set_volume_in(be, sw, vol); -} - static void audio_create_pdos(Audiodev *dev) { switch (dev->driver) { @@ -2423,40 +2261,6 @@ AudioBackend *audio_be_by_name(const char *name, Err= or **errp) } } =20 -#ifdef CONFIG_GIO -bool audio_be_can_set_dbus_server(AudioBackend *be) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - return klass->set_dbus_server !=3D NULL; -} - -bool audio_be_set_dbus_server(AudioBackend *be, - GDBusObjectManagerServer *server, - bool p2p, - Error **errp) -{ - AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); - - if (!audio_be_can_set_dbus_server(be)) { - error_setg(errp, "Audiodev '%s' is not compatible with DBus", - audio_be_get_id(be)); - return false; - } - - return klass->set_dbus_server(be, server, p2p, errp); -} -#endif - -const char *audio_be_get_id(AudioBackend *be) -{ - if (be) { - return AUDIO_BACKEND_GET_CLASS(be)->get_id(be); - } else { - return ""; - } -} - const char *audio_application_name(void) { const char *vm_name; @@ -2521,15 +2325,6 @@ AudiodevList *qmp_query_audiodevs(Error **errp) } =20 static const TypeInfo audio_types[] =3D { - { - .name =3D TYPE_AUDIO_BACKEND, - .parent =3D TYPE_OBJECT, - .instance_size =3D sizeof(AudioBackend), - .instance_init =3D audio_be_init, - .instance_finalize =3D audio_be_finalize, - .abstract =3D true, - .class_size =3D sizeof(AudioBackendClass), - }, { .name =3D TYPE_AUDIO_MIXENG_BACKEND, .parent =3D TYPE_AUDIO_BACKEND, diff --git a/audio/meson.build b/audio/meson.build index 55ee0bfc865..17f58369c20 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -1,6 +1,7 @@ audio_ss =3D ss.source_set() audio_ss.add(files( 'audio.c', + 'audio-be.c', 'mixeng.c', 'noaudio.c', 'wavaudio.c', --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244533; cv=none; d=zohomail.com; s=zohoarc; b=kyq8haL4PyionUCPo8bgYXKccz/679FyY01YQPRSiPSrUn92QrOiVKRkrQ3fCTGMCVv0C9XBIBxxyb6dqFMEckW0jRPQDQVE8M7jhKAbuvGMYGZDvyOpyHz6cpr/zPwaj8IfwT2S+Dazn/cjhMqtNRwCO9X2bbh8r56EXhMevWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244533; h=Content-Type: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=ap0S4LWJvucVKeZmrmzMkcAQf2pEpTk0m/36qIAyWl8=; b=iYkwYdvVc6mvWBAe5Fvy9neSDjXWQ53/v+mBXYuxoz5TpSjdI99rJLHEatLn9e3GkYA5wBLsDgpP94qL5FcOZxxlPpBiO78o3yT/XF5bAruGTvgT4fY/NbBmPq0B1G9sCsCA20/W/y5vtUSBf5kyWYU6v6slAUPLWc/QeXuQU0k= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244533770229.1212709601864; Mon, 16 Feb 2026 04:22:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweB-00028Z-4b; Mon, 16 Feb 2026 06:20:11 -0500 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 1vrwbd-0005mQ-BK for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbY-0007y9-T5 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:33 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-AV3b09vbMyqYLKG3FayO9Q-1; Mon, 16 Feb 2026 06:17:23 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 947471956060; Mon, 16 Feb 2026 11:17:21 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 96C4E19560AD; Mon, 16 Feb 2026 11:17:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240647; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ap0S4LWJvucVKeZmrmzMkcAQf2pEpTk0m/36qIAyWl8=; b=fMCjT1T+zQuJNZWiAXaqwRrQUHSrR00+NUIaGQON1Rw7VKk4c0t46/cBn4REOf43lzuq4Y PzWqcYBwMiGo7MVzjHXMug0+WC2Ii4CM73H3nutdydUvbpNnJhIo0ZGdJ4xv5GaoGqulco FuD+5MqVmUxZV0V+Ly/KZotjv2rvcuA= X-MC-Unique: AV3b09vbMyqYLKG3FayO9Q-1 X-Mimecast-MFC-AGG-ID: AV3b09vbMyqYLKG3FayO9Q_1771240641 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:26 +0100 Subject: [PATCH 37/85] audio: AUD_ -> audio_be_ MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-37-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=76724; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=t6Sh08OfeLc4FMHkmtlZtOKlLH2/E9kYSD7JJlCLSEw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQfBoE70xLIia133zE4n7nrDEcmwf/NndSo dGFI/4pOpyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5ZuED/wNb3mgce7oTV+d+2sJe/ofmeKLf6hjd0m/m+gVDalwXiw8XlcFJg0mTw+8wBtGfNGaxf5 YwpbtSg4rm4H5pNLw97CeZJtNZDGCy9PgrVSuPTNntEPpNONvUAJnQjb1SPuQr12GCuXGnWhmKe WqF1ITxVS2SyE94O2miUSGRSoFjyCTgJboamKgMPoL+8JeGqu4aFtENYn2emJzybHZ0M+YRdJP8 lcdiDYCLfS12mE7wDVnRD3C0sGZV84mP181QOT/HSL2E5vS6wwi3bv+9n/souzzftImrOpquLKa a/nDOgb2Ovc9uTEcc3iit1Hi4j2O4EYOY8bwX/EJtRqL4Cg5OzySwqBDvEK0pSy15AKT2gbkqsd z287gro+kbEbW7svRNVLNMxNG+IsLtTNW/dkaLp0X4RfEGa0uX+JM/Zllc/G4c5r4DO8BMQHZON 2sg8iFxIn//6a3v70ZCQMOsy2kb5+adR4uCkQeEFELSD45xczvph0Az9Ea2T2FkKDyjs82iSTkL dj9gS4b34EdTQf1I6iauao8f1+PWAklZPxs/ahFKYdNc5Myn97663ce48noLAdNezvOPgcDhGTX 78/a+TzhjGbpEVVMOgaGs3q6rF1tqzi+iaHTbN5K0V/FFksvf8tm7nDaZntLnLJsJ2WWfFdzeIa 54xm0Q6y2Hd+j6A== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 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 @redhat.com) X-ZM-MESSAGEID: 1771244535655154100 Use the associate AudioBackend prefix for readability. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_template.h | 4 +- include/qemu/audio-capture.h | 4 +- include/qemu/audio.h | 43 ++++++++-------- audio/audio-be.c | 32 ++++++------ audio/wavcapture.c | 4 +- hw/audio/ac97.c | 42 ++++++++-------- hw/audio/adlib.c | 10 ++-- hw/audio/asc.c | 20 ++++---- hw/audio/cs4231a.c | 18 +++---- hw/audio/es1370.c | 26 +++++----- hw/audio/gus.c | 10 ++-- hw/audio/hda-codec.c | 40 ++++++++------- hw/audio/lm4549.c | 20 ++++---- hw/audio/pcspk.c | 8 +-- hw/audio/sb16.c | 22 ++++---- hw/audio/via-ac97.c | 20 ++++---- hw/audio/virtio-snd.c | 34 ++++++------- hw/audio/wm8750.c | 43 ++++++++-------- hw/display/xlnx_dp.c | 16 +++--- hw/usb/dev-audio.c | 18 +++---- tests/audio/test-audio.c | 116 +++++++++++++++++++++------------------= ---- ui/vnc.c | 4 +- 22 files changed, 278 insertions(+), 276 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index a7733f9e1d9..77a70d6e56a 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -527,7 +527,7 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( } =20 if (!pdo->fixed_settings && sw) { - glue(AUD_close_, TYPE)(be, sw); + glue(audio_be_close_, TYPE)(be, sw); sw =3D NULL; } =20 @@ -564,7 +564,7 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( return sw; =20 fail: - glue(AUD_close_, TYPE)(be, sw); + glue(audio_be_close_, TYPE)(be, sw); return NULL; } =20 diff --git a/include/qemu/audio-capture.h b/include/qemu/audio-capture.h index 5bfbdd02985..d7998232243 100644 --- a/include/qemu/audio-capture.h +++ b/include/qemu/audio-capture.h @@ -19,13 +19,13 @@ typedef struct CaptureState { QLIST_ENTRY(CaptureState) entries; } CaptureState; =20 -CaptureVoiceOut *AUD_add_capture( +CaptureVoiceOut *audio_be_add_capture( AudioBackend *be, struct audsettings *as, struct audio_capture_ops *ops, void *opaque); =20 -void AUD_del_capture( +void audio_be_del_capture( AudioBackend *be, CaptureVoiceOut *cap, void *cb_opaque); diff --git a/include/qemu/audio.h b/include/qemu/audio.h index 9f85c6316a8..42f97f732a6 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -109,11 +109,11 @@ typedef struct AudioBackendClass { #endif } AudioBackendClass; =20 -bool AUD_backend_check(AudioBackend **be, Error **errp); +bool audio_be_check(AudioBackend **be, Error **errp); =20 AudioBackend *audio_be_new(Audiodev *dev, Error **errp); =20 -SWVoiceOut *AUD_open_out( +SWVoiceOut *audio_be_open_out( AudioBackend *be, SWVoiceOut *sw, const char *name, @@ -121,34 +121,33 @@ SWVoiceOut *AUD_open_out( audio_callback_fn callback_fn, const struct audsettings *settings); =20 -void AUD_close_out(AudioBackend *be, SWVoiceOut *sw); -size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void *pcm_buf, size_t s= ize); -int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw); -void AUD_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on); -bool AUD_is_active_out(AudioBackend *be, SWVoiceOut *sw); +void audio_be_close_out(AudioBackend *be, SWVoiceOut *sw); +size_t audio_be_write(AudioBackend *be, SWVoiceOut *sw, void *pcm_buf, siz= e_t size); +int audio_be_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw); +void audio_be_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on); +bool audio_be_is_active_out(AudioBackend *be, SWVoiceOut *sw); =20 -void AUD_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol); -void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol); + +void audio_be_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol= ); +void audio_be_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol); =20 static inline void -AUD_set_volume_out_lr(AudioBackend *be, SWVoiceOut *sw, - bool mut, uint8_t lvol, uint8_t rvol) -{ - AUD_set_volume_out(be, sw, &(Volume) { +audio_be_set_volume_out_lr(AudioBackend *be, SWVoiceOut *sw, + bool mut, uint8_t lvol, uint8_t rvol) { + audio_be_set_volume_out(be, sw, &(Volume) { .mute =3D mut, .channels =3D 2, .vol =3D { lvol, rvol } }); } =20 static inline void -AUD_set_volume_in_lr(AudioBackend *be, SWVoiceIn *sw, - bool mut, uint8_t lvol, uint8_t rvol) -{ - AUD_set_volume_in(be, sw, &(Volume) { +audio_be_set_volume_in_lr(AudioBackend *be, SWVoiceIn *sw, + bool mut, uint8_t lvol, uint8_t rvol) { + audio_be_set_volume_in(be, sw, &(Volume) { .mute =3D mut, .channels =3D 2, .vol =3D { lvol, rvol } }); } =20 -SWVoiceIn *AUD_open_in( +SWVoiceIn *audio_be_open_in( AudioBackend *be, SWVoiceIn *sw, const char *name, @@ -157,10 +156,10 @@ SWVoiceIn *AUD_open_in( const struct audsettings *settings ); =20 -void AUD_close_in(AudioBackend *be, SWVoiceIn *sw); -size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void *pcm_buf, size_t siz= e); -void AUD_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on); -bool AUD_is_active_in(AudioBackend *be, SWVoiceIn *sw); +void audio_be_close_in(AudioBackend *be, SWVoiceIn *sw); +size_t audio_be_read(AudioBackend *be, SWVoiceIn *sw, void *pcm_buf, size_= t size); +void audio_be_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on); +bool audio_be_is_active_in(AudioBackend *be, SWVoiceIn *sw); =20 void audio_cleanup(void); =20 diff --git a/audio/audio-be.c b/audio/audio-be.c index 51fb124026a..4d3b1e2bafd 100644 --- a/audio/audio-be.c +++ b/audio/audio-be.c @@ -5,7 +5,7 @@ #include "qemu/audio-capture.h" #include "qapi/error.h" =20 -bool AUD_backend_check(AudioBackend **be, Error **errp) +bool audio_be_check(AudioBackend **be, Error **errp) { assert(be !=3D NULL); =20 @@ -19,7 +19,7 @@ bool AUD_backend_check(AudioBackend **be, Error **errp) return true; } =20 -SWVoiceIn *AUD_open_in( +SWVoiceIn *audio_be_open_in( AudioBackend *be, SWVoiceIn *sw, const char *name, @@ -32,7 +32,7 @@ SWVoiceIn *AUD_open_in( return klass->open_in(be, sw, name, callback_opaque, callback_fn, as); } =20 -SWVoiceOut *AUD_open_out( +SWVoiceOut *audio_be_open_out( AudioBackend *be, SWVoiceOut *sw, const char *name, @@ -45,84 +45,84 @@ SWVoiceOut *AUD_open_out( return klass->open_out(be, sw, name, callback_opaque, callback_fn, as); } =20 -void AUD_close_out(AudioBackend *be, SWVoiceOut *sw) +void audio_be_close_out(AudioBackend *be, SWVoiceOut *sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 return klass->close_out(be, sw); } =20 -void AUD_close_in(AudioBackend *be, SWVoiceIn *sw) +void audio_be_close_in(AudioBackend *be, SWVoiceIn *sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 return klass->close_in(be, sw); } =20 -bool AUD_is_active_out(AudioBackend *be, SWVoiceOut *sw) +bool audio_be_is_active_out(AudioBackend *be, SWVoiceOut *sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 return klass->is_active_out(be, sw); } =20 -bool AUD_is_active_in(AudioBackend *be, SWVoiceIn *sw) +bool audio_be_is_active_in(AudioBackend *be, SWVoiceIn *sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 return klass->is_active_in(be, sw); } =20 -size_t AUD_write(AudioBackend *be, SWVoiceOut *sw, void *buf, size_t size) +size_t audio_be_write(AudioBackend *be, SWVoiceOut *sw, void *buf, size_t = size) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 return klass->write(be, sw, buf, size); } =20 -size_t AUD_read(AudioBackend *be, SWVoiceIn *sw, void *buf, size_t size) +size_t audio_be_read(AudioBackend *be, SWVoiceIn *sw, void *buf, size_t si= ze) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 return klass->read(be, sw, buf, size); } =20 -int AUD_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw) +int audio_be_get_buffer_size_out(AudioBackend *be, SWVoiceOut *sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 return klass->get_buffer_size_out(be, sw); } =20 -void AUD_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on) +void audio_be_set_active_out(AudioBackend *be, SWVoiceOut *sw, bool on) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 return klass->set_active_out(be, sw, on); } =20 -void AUD_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on) +void audio_be_set_active_in(AudioBackend *be, SWVoiceIn *sw, bool on) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 return klass->set_active_in(be, sw, on); } =20 -void AUD_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol) +void audio_be_set_volume_out(AudioBackend *be, SWVoiceOut *sw, Volume *vol) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 klass->set_volume_out(be, sw, vol); } =20 -void AUD_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol) +void audio_be_set_volume_in(AudioBackend *be, SWVoiceIn *sw, Volume *vol) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 klass->set_volume_in(be, sw, vol); } =20 -CaptureVoiceOut *AUD_add_capture( +CaptureVoiceOut *audio_be_add_capture( AudioBackend *be, struct audsettings *as, struct audio_capture_ops *ops, @@ -133,7 +133,7 @@ CaptureVoiceOut *AUD_add_capture( return klass->add_capture(be, as, ops, cb_opaque); } =20 -void AUD_del_capture(AudioBackend *be, CaptureVoiceOut *cap, void *cb_opaq= ue) +void audio_be_del_capture(AudioBackend *be, CaptureVoiceOut *cap, void *cb= _opaque) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 diff --git a/audio/wavcapture.c b/audio/wavcapture.c index 2950ceaf242..69aa91e35f6 100644 --- a/audio/wavcapture.c +++ b/audio/wavcapture.c @@ -86,7 +86,7 @@ static void wav_capture_destroy (void *opaque) { WAVState *wav =3D opaque; =20 - AUD_del_capture(wav->audio_be, wav->cap, wav); + audio_be_del_capture(wav->audio_be, wav->cap, wav); g_free (wav); } =20 @@ -172,7 +172,7 @@ int wav_start_capture(AudioBackend *state, CaptureState= *s, const char *path, goto error_free; } =20 - cap =3D AUD_add_capture(wav->audio_be, &as, &ops, wav); + cap =3D audio_be_add_capture(wav->audio_be, &as, &ops, wav); if (!cap) { error_report("Failed to add audio capture"); goto error_free; diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 65a4141b8af..5d442b7e067 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -246,15 +246,15 @@ static void voice_set_active(AC97LinkState *s, int bm= _index, int on) { switch (bm_index) { case PI_INDEX: - AUD_set_active_in(s->audio_be, s->voice_pi, on); + audio_be_set_active_in(s->audio_be, s->voice_pi, on); break; =20 case PO_INDEX: - AUD_set_active_out(s->audio_be, s->voice_po, on); + audio_be_set_active_out(s->audio_be, s->voice_po, on); break; =20 case MC_INDEX: - AUD_set_active_in(s->audio_be, s->voice_mc, on); + audio_be_set_active_in(s->audio_be, s->voice_mc, on); break; =20 default: @@ -319,7 +319,7 @@ static void open_voice(AC97LinkState *s, int index, int= freq) s->invalid_freq[index] =3D 0; switch (index) { case PI_INDEX: - s->voice_pi =3D AUD_open_in( + s->voice_pi =3D audio_be_open_in( s->audio_be, s->voice_pi, "ac97.pi", @@ -330,7 +330,7 @@ static void open_voice(AC97LinkState *s, int index, int= freq) break; =20 case PO_INDEX: - s->voice_po =3D AUD_open_out( + s->voice_po =3D audio_be_open_out( s->audio_be, s->voice_po, "ac97.po", @@ -341,7 +341,7 @@ static void open_voice(AC97LinkState *s, int index, int= freq) break; =20 case MC_INDEX: - s->voice_mc =3D AUD_open_in( + s->voice_mc =3D audio_be_open_in( s->audio_be, s->voice_mc, "ac97.mc", @@ -355,17 +355,17 @@ static void open_voice(AC97LinkState *s, int index, i= nt freq) s->invalid_freq[index] =3D freq; switch (index) { case PI_INDEX: - AUD_close_in(s->audio_be, s->voice_pi); + audio_be_close_in(s->audio_be, s->voice_pi); s->voice_pi =3D NULL; break; =20 case PO_INDEX: - AUD_close_out(s->audio_be, s->voice_po); + audio_be_close_out(s->audio_be, s->voice_po); s->voice_po =3D NULL; break; =20 case MC_INDEX: - AUD_close_in(s->audio_be, s->voice_mc); + audio_be_close_in(s->audio_be, s->voice_mc); s->voice_mc =3D NULL; break; } @@ -378,15 +378,15 @@ static void reset_voices(AC97LinkState *s, uint8_t ac= tive[LAST_INDEX]) =20 freq =3D mixer_load(s, AC97_PCM_LR_ADC_Rate); open_voice(s, PI_INDEX, freq); - AUD_set_active_in(s->audio_be, s->voice_pi, active[PI_INDEX]); + audio_be_set_active_in(s->audio_be, s->voice_pi, active[PI_INDEX]); =20 freq =3D mixer_load(s, AC97_PCM_Front_DAC_Rate); open_voice(s, PO_INDEX, freq); - AUD_set_active_out(s->audio_be, s->voice_po, active[PO_INDEX]); + audio_be_set_active_out(s->audio_be, s->voice_po, active[PO_INDEX]); =20 freq =3D mixer_load(s, AC97_MIC_ADC_Rate); open_voice(s, MC_INDEX, freq); - AUD_set_active_in(s->audio_be, s->voice_mc, active[MC_INDEX]); + audio_be_set_active_in(s->audio_be, s->voice_mc, active[MC_INDEX]); } =20 static void get_volume(uint16_t vol, uint16_t mask, int inverse, @@ -416,7 +416,7 @@ static void update_combined_volume_out(AC97LinkState *s) lvol =3D (lvol * plvol) / 255; rvol =3D (rvol * prvol) / 255; =20 - AUD_set_volume_out_lr(s->audio_be, s->voice_po, mute, lvol, rvol); + audio_be_set_volume_out_lr(s->audio_be, s->voice_po, mute, lvol, rvol); } =20 static void update_volume_in(AC97LinkState *s) @@ -427,7 +427,7 @@ static void update_volume_in(AC97LinkState *s) get_volume(mixer_load(s, AC97_Record_Gain_Mute), 0x0f, 0, &mute, &lvol, &rvol); =20 - AUD_set_volume_in_lr(s->audio_be, s->voice_pi, mute, lvol, rvol); + audio_be_set_volume_in_lr(s->audio_be, s->voice_pi, mute, lvol, rvol); } =20 static void set_volume(AC97LinkState *s, int index, uint32_t val) @@ -904,7 +904,7 @@ static int write_audio(AC97LinkState *s, AC97BusMasterR= egs *r, int copied; to_copy =3D MIN(temp, sizeof(tmpbuf)); pci_dma_read(&s->dev, addr, tmpbuf, to_copy); - copied =3D AUD_write(s->audio_be, s->voice_po, tmpbuf, to_copy); + copied =3D audio_be_write(s->audio_be, s->voice_po, tmpbuf, to_cop= y); dolog("write_audio max=3D%x to_copy=3D%x copied=3D%x", max, to_copy, copied); if (!copied) { @@ -948,7 +948,7 @@ static void write_bup(AC97LinkState *s, int elapsed) while (elapsed) { int temp =3D MIN(elapsed, sizeof(s->silence)); while (temp) { - int copied =3D AUD_write(s->audio_be, s->voice_po, s->silence,= temp); + int copied =3D audio_be_write(s->audio_be, s->voice_po, s->sil= ence, temp); if (!copied) { return; } @@ -978,7 +978,7 @@ static int read_audio(AC97LinkState *s, AC97BusMasterRe= gs *r, while (temp) { int acquired; to_copy =3D MIN(temp, sizeof(tmpbuf)); - acquired =3D AUD_read(s->audio_be, voice, tmpbuf, to_copy); + acquired =3D audio_be_read(s->audio_be, voice, tmpbuf, to_copy); if (!acquired) { *stop =3D 1; break; @@ -1275,7 +1275,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp) AC97LinkState *s =3D AC97(dev); uint8_t *c =3D s->dev.config; =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 @@ -1301,9 +1301,9 @@ static void ac97_exit(PCIDevice *dev) { AC97LinkState *s =3D AC97(dev); =20 - AUD_close_in(s->audio_be, s->voice_pi); - AUD_close_out(s->audio_be, s->voice_po); - AUD_close_in(s->audio_be, s->voice_mc); + audio_be_close_in(s->audio_be, s->voice_pi); + audio_be_close_out(s->audio_be, s->voice_po); + audio_be_close_in(s->audio_be, s->voice_mc); } =20 static const Property ac97_properties[] =3D { diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index dd5d9cf6772..ce17e21d5fd 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -95,7 +95,7 @@ static void adlib_write(void *opaque, uint32_t nport, uin= t32_t val) int a =3D nport & 3; =20 s->active =3D 1; - AUD_set_active_out(s->audio_be, s->voice, 1); + audio_be_set_active_out(s->audio_be, s->voice, 1); =20 adlib_kill_timers (s); =20 @@ -143,7 +143,7 @@ static int write_audio (AdlibState *s, int samples) int nbytes, wbytes, wsampl; =20 nbytes =3D samples << SHIFT; - wbytes =3D AUD_write( + wbytes =3D audio_be_write( s->audio_be, s->voice, s->mixbuf + (pos << (SHIFT - 1)), @@ -237,7 +237,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) AdlibState *s =3D ADLIB(dev); struct audsettings as; =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 @@ -256,7 +256,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D HOST_BIG_ENDIAN; =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, s->voice, "adlib", @@ -270,7 +270,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) return; } =20 - s->samples =3D AUD_get_buffer_size_out(s->audio_be, s->voice) >> SHIFT; + s->samples =3D audio_be_get_buffer_size_out(s->audio_be, s->voice) >> = SHIFT; s->mixbuf =3D g_malloc0 (s->samples << SHIFT); =20 adlib_portio_list[0].offset =3D s->port; diff --git a/hw/audio/asc.c b/hw/audio/asc.c index 43cd51939a3..35c7b5750d6 100644 --- a/hw/audio/asc.c +++ b/hw/audio/asc.c @@ -355,12 +355,12 @@ static void asc_out_cb(void *opaque, int free_b) * loop because the FIFO has run out of data, and the driver * reuses the stale content in its circular audio buffer. */ - AUD_write(s->audio_be, s->voice, s->silentbuf, samples << s->s= hift); + audio_be_write(s->audio_be, s->voice, s->silentbuf, samples <<= s->shift); } return; } =20 - AUD_write(s->audio_be, s->voice, s->mixbuf, generated << s->shift); + audio_be_write(s->audio_be, s->voice, s->mixbuf, generated << s->shift= ); } =20 static uint64_t asc_fifo_read(void *opaque, hwaddr addr, @@ -470,9 +470,9 @@ static void asc_write(void *opaque, hwaddr addr, uint64= _t value, asc_fifo_reset(&s->fifos[1]); asc_lower_irq(s); if (value !=3D 0) { - AUD_set_active_out(s->audio_be, s->voice, 1); + audio_be_set_active_out(s->audio_be, s->voice, 1); } else { - AUD_set_active_out(s->audio_be, s->voice, 0); + audio_be_set_active_out(s->audio_be, s->voice, 0); } } break; @@ -489,7 +489,7 @@ static void asc_write(void *opaque, hwaddr addr, uint64= _t value, { int vol =3D (value & 0xe0); =20 - AUD_set_volume_out_lr(s->audio_be, s->voice, 0, vol, vol); + audio_be_set_volume_out_lr(s->audio_be, s->voice, 0, vol, vol); break; } } @@ -545,7 +545,7 @@ static int asc_post_load(void *opaque, int version) ASCState *s =3D ASC(opaque); =20 if (s->regs[ASC_MODE] !=3D 0) { - AUD_set_active_out(s->audio_be, s->voice, 1); + audio_be_set_active_out(s->audio_be, s->voice, 1); } =20 return 0; @@ -614,7 +614,7 @@ static void asc_reset_hold(Object *obj, ResetType type) { ASCState *s =3D ASC(obj); =20 - AUD_set_active_out(s->audio_be, s->voice, 0); + audio_be_set_active_out(s->audio_be, s->voice, 0); =20 memset(s->regs, 0, sizeof(s->regs)); asc_fifo_reset(&s->fifos[0]); @@ -641,7 +641,7 @@ static void asc_realize(DeviceState *dev, Error **errp) ASCState *s =3D ASC(dev); struct audsettings as; =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 @@ -650,7 +650,7 @@ static void asc_realize(DeviceState *dev, Error **errp) as.fmt =3D AUDIO_FORMAT_U8; as.endianness =3D HOST_BIG_ENDIAN; =20 - s->voice =3D AUD_open_out(s->audio_be, s->voice, "asc.out", s, asc_out= _cb, + s->voice =3D audio_be_open_out(s->audio_be, s->voice, "asc.out", s, as= c_out_cb, &as); if (!s->voice) { error_setg(errp, "Initializing audio stream failed"); @@ -658,7 +658,7 @@ static void asc_realize(DeviceState *dev, Error **errp) } =20 s->shift =3D 1; - s->samples =3D AUD_get_buffer_size_out(s->audio_be, s->voice) >> s->sh= ift; + s->samples =3D audio_be_get_buffer_size_out(s->audio_be, s->voice) >> = s->shift; s->mixbuf =3D g_malloc0(s->samples << s->shift); =20 s->silentbuf =3D g_malloc(s->samples << s->shift); diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 3b8ed092fe4..e6cae9c988e 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -327,7 +327,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) goto error; } =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, s->voice, "cs4231a", @@ -339,7 +339,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) if (s->dregs[Interface_Configuration] & PEN) { if (!s->dma_running) { k->hold_DREQ(s->isa_dma, s->dma); - AUD_set_active_out(s->audio_be, s->voice, 1); + audio_be_set_active_out(s->audio_be, s->voice, 1); s->transferred =3D 0; } s->dma_running =3D 1; @@ -347,7 +347,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) else { if (s->dma_running) { k->release_DREQ(s->isa_dma, s->dma); - AUD_set_active_out(s->audio_be, s->voice, 0); + audio_be_set_active_out(s->audio_be, s->voice, 0); } s->dma_running =3D 0; } @@ -356,7 +356,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) error: if (s->dma_running) { k->release_DREQ(s->isa_dma, s->dma); - AUD_set_active_out(s->audio_be, s->voice, 0); + audio_be_set_active_out(s->audio_be, s->voice, 0); } } =20 @@ -465,7 +465,7 @@ static void cs_write (void *opaque, hwaddr addr, if (s->dma_running) { IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); k->release_DREQ(s->isa_dma, s->dma); - AUD_set_active_out(s->audio_be, s->voice, 0); + audio_be_set_active_out(s->audio_be, s->voice, 0); s->dma_running =3D 0; } } @@ -551,11 +551,11 @@ static int cs_write_audio (CSState *s, int nchan, int= dma_pos, =20 for (i =3D 0; i < copied; ++i) linbuf[i] =3D s->tab[tmpbuf[i]]; - copied =3D AUD_write(s->audio_be, s->voice, linbuf, copied << = 1); + copied =3D audio_be_write(s->audio_be, s->voice, linbuf, copie= d << 1); copied >>=3D 1; } else { - copied =3D AUD_write(s->audio_be, s->voice, tmpbuf, copied); + copied =3D audio_be_write(s->audio_be, s->voice, tmpbuf, copie= d); } =20 temp -=3D copied; @@ -614,7 +614,7 @@ static int cs4231a_pre_load (void *opaque) if (s->dma_running) { IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); k->release_DREQ(s->isa_dma, s->dma); - AUD_set_active_out(s->audio_be, s->voice, 0); + audio_be_set_active_out(s->audio_be, s->voice, 0); } s->dma_running =3D 0; return 0; @@ -678,7 +678,7 @@ static void cs4231a_realizefn (DeviceState *dev, Error = **errp) return; } =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 44b204730b5..e1658393c6a 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -330,10 +330,10 @@ static void es1370_reset (ES1370State *s) d->scount =3D 0; d->leftover =3D 0; if (i =3D=3D ADC_CHANNEL) { - AUD_close_in(s->audio_be, s->adc_voice); + audio_be_close_in(s->audio_be, s->adc_voice); s->adc_voice =3D NULL; } else { - AUD_close_out(s->audio_be, s->dac_voice[i]); + audio_be_close_out(s->audio_be, s->dac_voice[i]); s->dac_voice[i] =3D NULL; } } @@ -411,7 +411,7 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) =20 if (i =3D=3D ADC_CHANNEL) { s->adc_voice =3D - AUD_open_in( + audio_be_open_in( s->audio_be, s->adc_voice, "es1370.adc", @@ -421,7 +421,7 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) ); } else { s->dac_voice[i] =3D - AUD_open_out( + audio_be_open_out( s->audio_be, s->dac_voice[i], i ? "es1370.dac2" : "es1370.dac1", @@ -438,9 +438,9 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) int on =3D (ctl & b->ctl_en) && !(sctl & b->sctl_pause); =20 if (i =3D=3D ADC_CHANNEL) { - AUD_set_active_in(s->audio_be, s->adc_voice, on); + audio_be_set_active_in(s->audio_be, s->adc_voice, on); } else { - AUD_set_active_out(s->audio_be, s->dac_voice[i], on); + audio_be_set_active_out(s->audio_be, s->dac_voice[i], on); } } } @@ -627,7 +627,7 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, int acquired, to_copy; =20 to_copy =3D MIN(to_transfer, sizeof(tmpbuf)); - acquired =3D AUD_read(s->audio_be, s->adc_voice, tmpbuf, to_co= py); + acquired =3D audio_be_read(s->audio_be, s->adc_voice, tmpbuf, = to_copy); if (!acquired) { break; } @@ -646,7 +646,7 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, =20 to_copy =3D MIN(to_transfer, sizeof(tmpbuf)); pci_dma_read (&s->dev, addr, tmpbuf, to_copy); - copied =3D AUD_write(s->audio_be, voice, tmpbuf, to_copy); + copied =3D audio_be_write(s->audio_be, voice, tmpbuf, to_copy); if (!copied) { break; } @@ -784,12 +784,12 @@ static int es1370_post_load (void *opaque, int versio= n_id) for (i =3D 0; i < NB_CHANNELS; ++i) { if (i =3D=3D ADC_CHANNEL) { if (s->adc_voice) { - AUD_close_in(s->audio_be, s->adc_voice); + audio_be_close_in(s->audio_be, s->adc_voice); s->adc_voice =3D NULL; } } else { if (s->dac_voice[i]) { - AUD_close_out(s->audio_be, s->dac_voice[i]); + audio_be_close_out(s->audio_be, s->dac_voice[i]); s->dac_voice[i] =3D NULL; } } @@ -833,7 +833,7 @@ static void es1370_realize(PCIDevice *dev, Error **errp) ES1370State *s =3D ES1370(dev); uint8_t *c =3D s->dev.config; =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 @@ -861,10 +861,10 @@ static void es1370_exit(PCIDevice *dev) int i; =20 for (i =3D 0; i < 2; ++i) { - AUD_close_out(s->audio_be, s->dac_voice[i]); + audio_be_close_out(s->audio_be, s->dac_voice[i]); } =20 - AUD_close_in(s->audio_be, s->adc_voice); + audio_be_close_in(s->audio_be, s->adc_voice); } =20 static const Property es1370_properties[] =3D { diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 1ede1c4a51d..5c2a34c09d2 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -87,7 +87,7 @@ static int write_audio (GUSState *s, int samples) int nbytes, wbytes, wsampl; =20 nbytes =3D samples << s->shift; - wbytes =3D AUD_write( + wbytes =3D audio_be_write( s->audio_be, s->voice, s->mixbuf + (pos << (s->shift - 1)), @@ -243,7 +243,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) IsaDmaClass *k; struct audsettings as; =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 @@ -258,7 +258,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D HOST_BIG_ENDIAN; =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, NULL, "gus", @@ -273,7 +273,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) } =20 s->shift =3D 2; - s->samples =3D AUD_get_buffer_size_out(s->audio_be, s->voice) >> s->sh= ift; + s->samples =3D audio_be_get_buffer_size_out(s->audio_be, s->voice) >> = s->shift; s->mixbuf =3D g_malloc0 (s->samples << s->shift); =20 isa_register_portio_list(d, &s->portio_list1, s->port, @@ -288,7 +288,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) s->emu.opaque =3D s; s->pic =3D isa_bus_get_irq(bus, s->emu.gusirq); =20 - AUD_set_active_out(s->audio_be, s->voice, 1); + audio_be_set_active_out(s->audio_be, s->voice, 1); } =20 static const Property gus_properties[] =3D { diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index 0373d2f7271..984029a8db1 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -275,8 +275,8 @@ static void hda_audio_input_cb(void *opaque, int avail) while (to_transfer) { uint32_t start =3D (uint32_t) (wpos & B_MASK); uint32_t chunk =3D (uint32_t) MIN(B_SIZE - start, to_transfer); - uint32_t read =3D AUD_read(st->state->audio_be, st->voice.in, - st->buf + start, chunk); + uint32_t read =3D audio_be_read(st->state->audio_be, st->voice.in, + st->buf + start, chunk); wpos +=3D read; to_transfer -=3D read; st->wpos +=3D read; @@ -355,8 +355,8 @@ static void hda_audio_output_cb(void *opaque, int avail) while (to_transfer) { uint32_t start =3D (uint32_t) (rpos & B_MASK); uint32_t chunk =3D (uint32_t) MIN(B_SIZE - start, to_transfer); - uint32_t written =3D AUD_write(st->state->audio_be, st->voice.out, - st->buf + start, chunk); + uint32_t written =3D audio_be_write(st->state->audio_be, st->voice= .out, + st->buf + start, chunk); rpos +=3D written; to_transfer -=3D written; st->rpos +=3D written; @@ -377,9 +377,9 @@ static void hda_audio_compat_input_cb(void *opaque, int= avail) =20 while (avail - recv >=3D sizeof(st->compat_buf)) { if (st->compat_bpos !=3D sizeof(st->compat_buf)) { - len =3D AUD_read(st->state->audio_be, st->voice.in, - st->compat_buf + st->compat_bpos, - sizeof(st->compat_buf) - st->compat_bpos); + len =3D audio_be_read(st->state->audio_be, st->voice.in, + st->compat_buf + st->compat_bpos, + sizeof(st->compat_buf) - st->compat_bpos); st->compat_bpos +=3D len; recv +=3D len; if (st->compat_bpos !=3D sizeof(st->compat_buf)) { @@ -411,9 +411,9 @@ static void hda_audio_compat_output_cb(void *opaque, in= t avail) } st->compat_bpos =3D 0; } - len =3D AUD_write(st->state->audio_be, st->voice.out, - st->compat_buf + st->compat_bpos, - sizeof(st->compat_buf) - st->compat_bpos); + len =3D audio_be_write(st->state->audio_be, st->voice.out, + st->compat_buf + st->compat_bpos, + sizeof(st->compat_buf) - st->compat_bpos); st->compat_bpos +=3D len; sent +=3D len; if (st->compat_bpos !=3D sizeof(st->compat_buf)) { @@ -444,9 +444,9 @@ static void hda_audio_set_running(HDAAudioStream *st, b= ool running) } } if (st->output) { - AUD_set_active_out(st->state->audio_be, st->voice.out, st->running= ); + audio_be_set_active_out(st->state->audio_be, st->voice.out, st->ru= nning); } else { - AUD_set_active_in(st->state->audio_be, st->voice.in, st->running); + audio_be_set_active_in(st->state->audio_be, st->voice.in, st->runn= ing); } } =20 @@ -470,9 +470,11 @@ static void hda_audio_set_amp(HDAAudioStream *st) return; } if (st->output) { - AUD_set_volume_out_lr(st->state->audio_be, st->voice.out, muted, l= eft, right); + audio_be_set_volume_out_lr(st->state->audio_be, st->voice.out, + muted, left, right); } else { - AUD_set_volume_in_lr(st->state->audio_be, st->voice.in, muted, lef= t, right); + audio_be_set_volume_in_lr(st->state->audio_be, st->voice.in, + muted, left, right); } } =20 @@ -495,7 +497,7 @@ static void hda_audio_setup(HDAAudioStream *st) } else { cb =3D hda_audio_compat_output_cb; } - st->voice.out =3D AUD_open_out(st->state->audio_be, st->voice.out, + st->voice.out =3D audio_be_open_out(st->state->audio_be, st->voice= .out, st->node->name, st, cb, &st->as); } else { if (use_timer) { @@ -504,7 +506,7 @@ static void hda_audio_setup(HDAAudioStream *st) } else { cb =3D hda_audio_compat_input_cb; } - st->voice.in =3D AUD_open_in(st->state->audio_be, st->voice.in, + st->voice.in =3D audio_be_open_in(st->state->audio_be, st->voice.i= n, st->node->name, st, cb, &st->as); } } @@ -700,7 +702,7 @@ static void hda_audio_init(HDACodecDevice *hda, const desc_param *param; uint32_t i, type; =20 - if (!AUD_backend_check(&a->audio_be, errp)) { + if (!audio_be_check(&a->audio_be, errp)) { return; } =20 @@ -758,9 +760,9 @@ static void hda_audio_exit(HDACodecDevice *hda) } timer_free(st->buft); if (st->output) { - AUD_close_out(a->audio_be, st->voice.out); + audio_be_close_out(a->audio_be, st->voice.out); } else { - AUD_close_in(a->audio_be, st->voice.in); + audio_be_close_in(a->audio_be, st->voice.in); } } } diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index b875e83d454..14e15a844ba 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -101,11 +101,11 @@ static void lm4549_audio_transfer(lm4549_state *s) uint32_t i; =20 /* Activate the voice */ - AUD_set_active_out(s->audio_be, s->voice, 1); + audio_be_set_active_out(s->audio_be, s->voice, 1); s->voice_is_active =3D 1; =20 /* Try to write the buffer content */ - written_bytes =3D AUD_write(s->audio_be, s->voice, s->buffer, + written_bytes =3D audio_be_write(s->audio_be, s->voice, s->buffer, s->buffer_level * sizeof(uint16_t)); written_samples =3D written_bytes >> 1; =20 @@ -129,14 +129,14 @@ static void lm4549_audio_out_callback(void *opaque, i= nt free) static uint32_t prev_buffer_level; =20 #ifdef LM4549_DEBUG - int size =3D AUD_get_buffer_size_out(s->audio_be, s->voice); + int size =3D audio_be_get_buffer_size_out(s->audio_be, s->voice); DPRINTF("audio_out_callback size =3D %i free =3D %i\n", size, free); #endif =20 /* Detect that no data are consumed =3D> disable the voice */ if (s->buffer_level =3D=3D prev_buffer_level) { - AUD_set_active_out(s->audio_be, s->voice, 0); + audio_be_set_active_out(s->audio_be, s->voice, 0); s->voice_is_active =3D 0; } prev_buffer_level =3D s->buffer_level; @@ -204,7 +204,7 @@ void lm4549_write(lm4549_state *s, as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, s->voice, "lm4549.out", @@ -274,7 +274,7 @@ static int lm4549_post_load(void *opaque, int version_i= d) as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, s->voice, "lm4549.out", @@ -285,7 +285,7 @@ static int lm4549_post_load(void *opaque, int version_i= d) =20 /* Request data */ if (s->voice_is_active =3D=3D 1) { - lm4549_audio_out_callback(s, AUD_get_buffer_size_out(s->audio_be, = s->voice)); + lm4549_audio_out_callback(s, audio_be_get_buffer_size_out(s->audio= _be, s->voice)); } =20 return 0; @@ -297,7 +297,7 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_= req_cb, void* opaque, struct audsettings as; =20 /* Register an audio card */ - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 @@ -314,7 +314,7 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_= req_cb, void* opaque, as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, s->voice, "lm4549.out", @@ -323,7 +323,7 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_= req_cb, void* opaque, &as ); =20 - AUD_set_volume_out_lr(s->audio_be, s->voice, 0, 255, 255); + audio_be_set_volume_out_lr(s->audio_be, s->voice, 0, 255, 255); =20 s->voice_is_active =3D 0; =20 diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 07ebfcfccf6..6b826507ce3 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -105,7 +105,7 @@ static void pcspk_callback(void *opaque, int free) =20 while (free > 0) { n =3D MIN(s->samples - s->play_pos, (unsigned int)free); - n =3D AUD_write(s->audio_be, s->voice, &s->sample_buf[s->play_pos]= , n); + n =3D audio_be_write(s->audio_be, s->voice, &s->sample_buf[s->play= _pos], n); if (!n) break; s->play_pos =3D (s->play_pos + n) % s->samples; @@ -122,7 +122,7 @@ static int pcspk_audio_init(PCSpkState *s) return 0; } =20 - s->voice =3D AUD_open_out(s->audio_be, s->voice, s_spk, s, pcspk_callb= ack, &as); + s->voice =3D audio_be_open_out(s->audio_be, s->voice, s_spk, s, pcspk_= callback, &as); if (!s->voice) { error_report("pcspk: Could not open voice"); return -1; @@ -163,7 +163,7 @@ static void pcspk_io_write(void *opaque, hwaddr addr, u= int64_t val, if (s->voice) { if (gate) /* restart */ s->play_pos =3D 0; - AUD_set_active_out(s->audio_be, s->voice, gate & s->data_on); + audio_be_set_active_out(s->audio_be, s->voice, gate & s->data_on); } } =20 @@ -195,7 +195,7 @@ static void pcspk_realizefn(DeviceState *dev, Error **e= rrp) =20 isa_register_ioport(isadev, &s->ioport, s->iobase); =20 - if (s->audio_be && AUD_backend_check(&s->audio_be, errp)) { + if (s->audio_be && audio_be_check(&s->audio_be, errp)) { pcspk_audio_init(s); return; } diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index da0c33ea41b..c8fc7df8b44 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -171,7 +171,7 @@ static void log_dsp (SB16State *dsp) static void speaker (SB16State *s, int on) { s->speaker =3D on; - /* AUD_enable (s->voice, on); */ + /* audio_be_enable (s->voice, on); */ } =20 static void control (SB16State *s, int hold) @@ -185,11 +185,11 @@ static void control (SB16State *s, int hold) =20 if (hold) { k->hold_DREQ(isa_dma, dma); - AUD_set_active_out(s->audio_be, s->voice, 1); + audio_be_set_active_out(s->audio_be, s->voice, 1); } else { k->release_DREQ(isa_dma, dma); - AUD_set_active_out(s->audio_be, s->voice, 0); + audio_be_set_active_out(s->audio_be, s->voice, 0); } } =20 @@ -215,7 +215,7 @@ static void continue_dma8 (SB16State *s) as.fmt =3D s->fmt; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, s->voice, "sb16", @@ -378,7 +378,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t= d0, int dma_len) as.fmt =3D s->fmt; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, s->voice, "sb16", @@ -879,7 +879,7 @@ static void legacy_reset (SB16State *s) as.fmt =3D AUDIO_FORMAT_U8; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, s->voice, "sb16", @@ -889,7 +889,7 @@ static void legacy_reset (SB16State *s) ); =20 /* Not sure about that... */ - /* AUD_set_active_out (s->voice, 1); */ + /* audio_be_set_active_out (s->voice, 1); */ } =20 static void reset (SB16State *s) @@ -1196,7 +1196,7 @@ static int write_audio (SB16State *s, int nchan, int = dma_pos, } =20 copied =3D k->read_memory(isa_dma, nchan, tmpbuf, dma_pos, to_copy= ); - copied =3D AUD_write(s->audio_be, s->voice, tmpbuf, copied); + copied =3D audio_be_write(s->audio_be, s->voice, tmpbuf, copied); =20 temp -=3D copied; dma_pos =3D (dma_pos + copied) % dma_len; @@ -1287,7 +1287,7 @@ static int sb16_post_load (void *opaque, int version_= id) SB16State *s =3D opaque; =20 if (s->voice) { - AUD_close_out(s->audio_be, s->voice); + audio_be_close_out(s->audio_be, s->voice); s->voice =3D NULL; } =20 @@ -1302,7 +1302,7 @@ static int sb16_post_load (void *opaque, int version_= id) as.fmt =3D s->fmt; as.endianness =3D 0; =20 - s->voice =3D AUD_open_out( + s->voice =3D audio_be_open_out( s->audio_be, s->voice, "sb16", @@ -1401,7 +1401,7 @@ static void sb16_realizefn (DeviceState *dev, Error *= *errp) SB16State *s =3D SB16 (dev); IsaDmaClass *k; =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c index 5b344d7a0fc..84d137b41a3 100644 --- a/hw/audio/via-ac97.c +++ b/hw/audio/via-ac97.c @@ -53,7 +53,7 @@ static void codec_volume_set_out(ViaAC97State *s) rvol /=3D 255; mute =3D CODEC_REG(s, AC97_Master_Volume_Mute) >> MUTE_SHIFT; mute |=3D CODEC_REG(s, AC97_PCM_Out_Volume_Mute) >> MUTE_SHIFT; - AUD_set_volume_out_lr(s->audio_be, s->vo, mute, lvol, rvol); + audio_be_set_volume_out_lr(s->audio_be, s->vo, mute, lvol, rvol); } =20 static void codec_reset(ViaAC97State *s) @@ -189,7 +189,7 @@ static void out_cb(void *opaque, int avail) while (temp) { to_copy =3D MIN(temp, sizeof(tmpbuf)); pci_dma_read(&s->dev, c->addr, tmpbuf, to_copy); - copied =3D AUD_write(s->audio_be, s->vo, tmpbuf, to_copy); + copied =3D audio_be_write(s->audio_be, s->vo, tmpbuf, to_copy); if (!copied) { stop =3D true; break; @@ -208,7 +208,7 @@ static void out_cb(void *opaque, int avail) c->stat |=3D STAT_PAUSED; } else { c->stat &=3D ~STAT_ACTIVE; - AUD_set_active_out(s->audio_be, s->vo, 0); + audio_be_set_active_out(s->audio_be, s->vo, 0); } if (c->type & STAT_EOL) { via_isa_set_irq(&s->dev, 0, 1); @@ -239,7 +239,7 @@ static void open_voice_out(ViaAC97State *s) .fmt =3D s->aur.type & BIT(5) ? AUDIO_FORMAT_S16 : AUDIO_FORMAT_S8, .endianness =3D 0, }; - s->vo =3D AUD_open_out(s->audio_be, s->vo, "via-ac97.out", s, out_cb, = &as); + s->vo =3D audio_be_open_out(s->audio_be, s->vo, "via-ac97.out", s, out= _cb, &as); } =20 static uint64_t sgd_read(void *opaque, hwaddr addr, unsigned size) @@ -317,20 +317,20 @@ static void sgd_write(void *opaque, hwaddr addr, uint= 64_t val, unsigned size) break; case 1: if (val & CNTL_START) { - AUD_set_active_out(s->audio_be, s->vo, 1); + audio_be_set_active_out(s->audio_be, s->vo, 1); s->aur.stat =3D STAT_ACTIVE; } if (val & CNTL_TERM) { - AUD_set_active_out(s->audio_be, s->vo, 0); + audio_be_set_active_out(s->audio_be, s->vo, 0); s->aur.stat &=3D ~(STAT_ACTIVE | STAT_PAUSED); s->aur.clen =3D 0; } if (val & CNTL_PAUSE) { - AUD_set_active_out(s->audio_be, s->vo, 0); + audio_be_set_active_out(s->audio_be, s->vo, 0); s->aur.stat &=3D ~STAT_ACTIVE; s->aur.stat |=3D STAT_PAUSED; } else if (!(val & CNTL_PAUSE) && (s->aur.stat & STAT_PAUSED)) { - AUD_set_active_out(s->audio_be, s->vo, 1); + audio_be_set_active_out(s->audio_be, s->vo, 1); s->aur.stat |=3D STAT_ACTIVE; s->aur.stat &=3D ~STAT_PAUSED; } @@ -426,7 +426,7 @@ static void via_ac97_realize(PCIDevice *pci_dev, Error = **errp) ViaAC97State *s =3D VIA_AC97(pci_dev); Object *o =3D OBJECT(s); =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 @@ -455,7 +455,7 @@ static void via_ac97_exit(PCIDevice *dev) { ViaAC97State *s =3D VIA_AC97(dev); =20 - AUD_close_out(s->audio_be, s->vo); + audio_be_close_out(s->audio_be, s->vo); } =20 static const Property via_ac97_properties[] =3D { diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c index 47fef61af88..89e24c0a8e0 100644 --- a/hw/audio/virtio-snd.c +++ b/hw/audio/virtio-snd.c @@ -391,10 +391,10 @@ static void virtio_snd_pcm_close(VirtIOSoundPCMStream= *stream) if (stream) { virtio_snd_pcm_flush(stream); if (stream->info.direction =3D=3D VIRTIO_SND_D_OUTPUT) { - AUD_close_out(stream->pcm->snd->audio_be, stream->voice.out); + audio_be_close_out(stream->pcm->snd->audio_be, stream->voice.o= ut); stream->voice.out =3D NULL; } else if (stream->info.direction =3D=3D VIRTIO_SND_D_INPUT) { - AUD_close_in(stream->pcm->snd->audio_be, stream->voice.in); + audio_be_close_in(stream->pcm->snd->audio_be, stream->voice.in= ); stream->voice.in =3D NULL; } } @@ -457,21 +457,21 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s= , uint32_t stream_id) stream->as =3D as; =20 if (stream->info.direction =3D=3D VIRTIO_SND_D_OUTPUT) { - stream->voice.out =3D AUD_open_out(s->audio_be, + stream->voice.out =3D audio_be_open_out(s->audio_be, stream->voice.out, "virtio-sound.out", stream, virtio_snd_pcm_out_cb, &as); - AUD_set_volume_out_lr(s->audio_be, stream->voice.out, 0, 255, 255); + audio_be_set_volume_out_lr(s->audio_be, stream->voice.out, 0, 255,= 255); } else { - stream->voice.in =3D AUD_open_in(s->audio_be, + stream->voice.in =3D audio_be_open_in(s->audio_be, stream->voice.in, "virtio-sound.in", stream, virtio_snd_pcm_in_cb, &as); - AUD_set_volume_in_lr(s->audio_be, stream->voice.in, 0, 255, 255); + audio_be_set_volume_in_lr(s->audio_be, stream->voice.in, 0, 255, 2= 55); } =20 return cpu_to_le32(VIRTIO_SND_S_OK); @@ -561,9 +561,9 @@ static void virtio_snd_handle_pcm_start_stop(VirtIOSoun= d *s, stream->active =3D start; } if (stream->info.direction =3D=3D VIRTIO_SND_D_OUTPUT) { - AUD_set_active_out(s->audio_be, stream->voice.out, start); + audio_be_set_active_out(s->audio_be, stream->voice.out, start); } else { - AUD_set_active_in(s->audio_be, stream->voice.in, start); + audio_be_set_active_in(s->audio_be, stream->voice.in, start); } } else { error_report("Invalid stream id: %"PRIu32, stream_id); @@ -1053,7 +1053,7 @@ static void virtio_snd_realize(DeviceState *dev, Erro= r **errp) return; } =20 - if (!AUD_backend_check(&vsnd->audio_be, errp)) { + if (!audio_be_check(&vsnd->audio_be, errp)) { return; } =20 @@ -1135,10 +1135,10 @@ static inline void return_tx_buffer(VirtIOSoundPCMS= tream *stream, } =20 /* - * AUD_* output callback. + * audio_be_* output callback. * * @data: VirtIOSoundPCMStream stream - * @available: number of bytes that can be written with AUD_write() + * @available: number of bytes that can be written with audio_be_write() */ static void virtio_snd_pcm_out_cb(void *data, int available) { @@ -1153,7 +1153,7 @@ static void virtio_snd_pcm_out_cb(void *data, int ava= ilable) return; } if (!stream->active) { - /* Stream has stopped, so do not perform AUD_write. */ + /* Stream has stopped, so do not perform audio_be_write. */ return_tx_buffer(stream, buffer); continue; } @@ -1166,7 +1166,7 @@ static void virtio_snd_pcm_out_cb(void *data, int ava= ilable) buffer->populated =3D true; } for (;;) { - size =3D AUD_write(stream->s->audio_be, + size =3D audio_be_write(stream->s->audio_be, stream->voice.out, buffer->data + buffer->offset, MIN(buffer->size, available)); @@ -1230,10 +1230,10 @@ static inline void return_rx_buffer(VirtIOSoundPCMS= tream *stream, =20 =20 /* - * AUD_* input callback. + * audio_be_* input callback. * * @data: VirtIOSoundPCMStream stream - * @available: number of bytes that can be read with AUD_read() + * @available: number of bytes that can be read with audio_be_read() */ static void virtio_snd_pcm_in_cb(void *data, int available) { @@ -1248,7 +1248,7 @@ static void virtio_snd_pcm_in_cb(void *data, int avai= lable) return; } if (!stream->active) { - /* Stream has stopped, so do not perform AUD_read. */ + /* Stream has stopped, so do not perform audio_be_read. */ return_rx_buffer(stream, buffer); continue; } @@ -1259,7 +1259,7 @@ static void virtio_snd_pcm_in_cb(void *data, int avai= lable) return_rx_buffer(stream, buffer); break; } - size =3D AUD_read(stream->s->audio_be, + size =3D audio_be_read(stream->s->audio_be, stream->voice.in, buffer->data + buffer->size, MIN(available, (stream->params.period_bytes - diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index bc347fe5376..2a286515b14 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -72,7 +72,7 @@ static inline void wm8750_in_load(WM8750State *s) if (s->idx_in + s->req_in <=3D sizeof(s->data_in)) return; s->idx_in =3D MAX(0, (int) sizeof(s->data_in) - s->req_in); - AUD_read(s->audio_be, *s->in[0], s->data_in + s->idx_in, + audio_be_read(s->audio_be, *s->in[0], s->data_in + s->idx_in, sizeof(s->data_in) - s->idx_in); } =20 @@ -80,7 +80,8 @@ static inline void wm8750_out_flush(WM8750State *s) { int sent =3D 0; while (sent < s->idx_out) - sent +=3D AUD_write(s->audio_be, *s->out[0], s->data_out + sent, s= ->idx_out - sent) + sent +=3D audio_be_write(s->audio_be, *s->out[0], + s->data_out + sent, s->idx_out - sent) ?: s->idx_out; s->idx_out =3D 0; } @@ -145,30 +146,30 @@ static void wm8750_vol_update(WM8750State *s) { /* FIXME: multiply all volumes by s->invol[2], s->invol[3] */ =20 - AUD_set_volume_in_lr(s->audio_be, s->adc_voice[0], s->mute, + audio_be_set_volume_in_lr(s->audio_be, s->adc_voice[0], s->mute, s->inmute[0] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[0]), s->inmute[1] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[1])= ); - AUD_set_volume_in_lr(s->audio_be, s->adc_voice[1], s->mute, + audio_be_set_volume_in_lr(s->audio_be, s->adc_voice[1], s->mute, s->inmute[0] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[0]), s->inmute[1] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[1])= ); - AUD_set_volume_in_lr(s->audio_be, s->adc_voice[2], s->mute, + audio_be_set_volume_in_lr(s->audio_be, s->adc_voice[2], s->mute, s->inmute[0] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[0]), s->inmute[1] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[1])= ); =20 /* FIXME: multiply all volumes by s->outvol[0], s->outvol[1] */ =20 /* Speaker: LOUT2VOL ROUT2VOL */ - AUD_set_volume_out_lr(s->audio_be, s->dac_voice[0], s->mute, + audio_be_set_volume_out_lr(s->audio_be, s->dac_voice[0], s->mute, s->outmute[0] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 4]), s->outmute[1] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 5])); =20 /* Headphone: LOUT1VOL ROUT1VOL */ - AUD_set_volume_out_lr(s->audio_be, s->dac_voice[1], s->mute, + audio_be_set_volume_out_lr(s->audio_be, s->dac_voice[1], s->mute, s->outmute[0] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 2]), s->outmute[1] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 3])); =20 /* MONOOUT: MONOVOL MONOVOL */ - AUD_set_volume_out_lr(s->audio_be, s->dac_voice[2], s->mute, + audio_be_set_volume_out_lr(s->audio_be, s->dac_voice[2], s->mute, s->outmute[0] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 6]), s->outmute[1] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 6])); } @@ -182,18 +183,18 @@ static void wm8750_set_format(WM8750State *s) wm8750_out_flush(s); =20 if (s->in[0] && *s->in[0]) - AUD_set_active_in(s->audio_be, *s->in[0], 0); + audio_be_set_active_in(s->audio_be, *s->in[0], 0); if (s->out[0] && *s->out[0]) - AUD_set_active_out(s->audio_be, *s->out[0], 0); + audio_be_set_active_out(s->audio_be, *s->out[0], 0); =20 for (i =3D 0; i < IN_PORT_N; i ++) if (s->adc_voice[i]) { - AUD_close_in(s->audio_be, s->adc_voice[i]); + audio_be_close_in(s->audio_be, s->adc_voice[i]); s->adc_voice[i] =3D NULL; } for (i =3D 0; i < OUT_PORT_N; i ++) if (s->dac_voice[i]) { - AUD_close_out(s->audio_be, s->dac_voice[i]); + audio_be_close_out(s->audio_be, s->dac_voice[i]); s->dac_voice[i] =3D NULL; } =20 @@ -206,11 +207,11 @@ static void wm8750_set_format(WM8750State *s) in_fmt.freq =3D s->adc_hz; in_fmt.fmt =3D AUDIO_FORMAT_S16; =20 - s->adc_voice[0] =3D AUD_open_in(s->audio_be, s->adc_voice[0], + s->adc_voice[0] =3D audio_be_open_in(s->audio_be, s->adc_voice[0], CODEC ".input1", s, wm8750_audio_in_cb, &in_fmt); - s->adc_voice[1] =3D AUD_open_in(s->audio_be, s->adc_voice[1], + s->adc_voice[1] =3D audio_be_open_in(s->audio_be, s->adc_voice[1], CODEC ".input2", s, wm8750_audio_in_cb, &in_fmt); - s->adc_voice[2] =3D AUD_open_in(s->audio_be, s->adc_voice[2], + s->adc_voice[2] =3D audio_be_open_in(s->audio_be, s->adc_voice[2], CODEC ".input3", s, wm8750_audio_in_cb, &in_fmt); =20 /* Setup output */ @@ -219,12 +220,12 @@ static void wm8750_set_format(WM8750State *s) out_fmt.freq =3D s->dac_hz; out_fmt.fmt =3D AUDIO_FORMAT_S16; =20 - s->dac_voice[0] =3D AUD_open_out(s->audio_be, s->dac_voice[0], + s->dac_voice[0] =3D audio_be_open_out(s->audio_be, s->dac_voice[0], CODEC ".speaker", s, wm8750_audio_out_cb, &out_fmt); - s->dac_voice[1] =3D AUD_open_out(s->audio_be, s->dac_voice[1], + s->dac_voice[1] =3D audio_be_open_out(s->audio_be, s->dac_voice[1], CODEC ".headphone", s, wm8750_audio_out_cb, &out_fmt); /* MONOMIX is also in stereo for simplicity */ - s->dac_voice[2] =3D AUD_open_out(s->audio_be, s->dac_voice[2], + s->dac_voice[2] =3D audio_be_open_out(s->audio_be, s->dac_voice[2], CODEC ".monomix", s, wm8750_audio_out_cb, &out_fmt); /* no sense emulating OUT3 which is a mix of other outputs */ =20 @@ -235,9 +236,9 @@ static void wm8750_set_format(WM8750State *s) * for mixing or combining paths to different ports, so we * connect both channels to where the left channel is routed. */ if (s->in[0] && *s->in[0]) - AUD_set_active_in(s->audio_be, *s->in[0], 1); + audio_be_set_active_in(s->audio_be, *s->in[0], 1); if (s->out[0] && *s->out[0]) - AUD_set_active_out(s->audio_be, *s->out[0], 1); + audio_be_set_active_out(s->audio_be, *s->out[0], 1); } =20 static void wm8750_clk_update(WM8750State *s, int ext) @@ -624,7 +625,7 @@ static void wm8750_realize(DeviceState *dev, Error **er= rp) { WM8750State *s =3D WM8750(dev); =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index deda7efe15d..9aa4709b411 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -331,7 +331,7 @@ static inline void xlnx_dp_audio_activate(XlnxDPState *= s) { bool activated =3D ((s->core_registers[DP_TX_AUDIO_CONTROL] & DP_TX_AUD_CTRL) !=3D 0); - AUD_set_active_out(s->audio_be, s->amixer_output_stream, activated); + audio_be_set_active_out(s->audio_be, s->amixer_output_stream, activate= d); xlnx_dpdma_set_host_data_location(s->dpdma, DP_AUDIO_DMA_CHANNEL(0), &s->audio_buffer_0); xlnx_dpdma_set_host_data_location(s->dpdma, DP_AUDIO_DMA_CHANNEL(1), @@ -401,7 +401,7 @@ static void xlnx_dp_audio_callback(void *opaque, int av= ail) /* Send the buffer through the audio. */ if (s->byte_left <=3D MAX_QEMU_BUFFER_SIZE) { if (s->byte_left !=3D 0) { - written =3D AUD_write(s->audio_be, s->amixer_output_stream, + written =3D audio_be_write(s->audio_be, s->amixer_output_strea= m, &s->out_buffer[s->data_ptr], s->byte_left); } else { int len_to_copy; @@ -413,12 +413,12 @@ static void xlnx_dp_audio_callback(void *opaque, int = avail) while (avail) { len_to_copy =3D MIN(AUD_CHBUF_MAX_DEPTH, avail); memset(s->out_buffer, 0, len_to_copy); - avail -=3D AUD_write(s->audio_be, s->amixer_output_stream,= s->out_buffer, - len_to_copy); + avail -=3D audio_be_write(s->audio_be, s->amixer_output_st= ream, + s->out_buffer, len_to_copy); } } } else { - written =3D AUD_write(s->audio_be, s->amixer_output_stream, + written =3D audio_be_write(s->audio_be, s->amixer_output_stream, &s->out_buffer[s->data_ptr], MAX_QEMU_BUFFER_S= IZE); } s->byte_left -=3D written; @@ -1373,7 +1373,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error *= *errp) DisplaySurface *surface; struct audsettings as; =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 @@ -1395,13 +1395,13 @@ static void xlnx_dp_realize(DeviceState *dev, Error= **errp) as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D 0; =20 - s->amixer_output_stream =3D AUD_open_out(s->audio_be, + s->amixer_output_stream =3D audio_be_open_out(s->audio_be, s->amixer_output_stream, "xlnx_dp.audio.out", s, xlnx_dp_audio_callback, &as); - AUD_set_volume_out_lr(s->audio_be, s->amixer_output_stream, 0, 255, 25= 5); + audio_be_set_volume_out_lr(s->audio_be, s->amixer_output_stream, 0, 25= 5, 255); xlnx_dp_audio_activate(s); s->vblank =3D ptimer_init(vblank_hit, s, DP_VBLANK_PTIMER_POLICY); ptimer_transaction_begin(s->vblank); diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 0f36587fc6f..7b758718c12 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -669,7 +669,7 @@ static void output_callback(void *opaque, int avail) return; } =20 - written =3D AUD_write(s->audio_be, s->out.voice, data, len); + written =3D audio_be_write(s->audio_be, s->out.voice, data, len); avail -=3D written; s->out.buf.cons +=3D written; =20 @@ -683,7 +683,7 @@ static int usb_audio_set_output_altset(USBAudioState *s= , int altset) { switch (altset) { case ALTSET_OFF: - AUD_set_active_out(s->audio_be, s->out.voice, false); + audio_be_set_active_out(s->audio_be, s->out.voice, false); break; case ALTSET_STEREO: case ALTSET_51: @@ -692,7 +692,7 @@ static int usb_audio_set_output_altset(USBAudioState *s= , int altset) usb_audio_reinit(USB_DEVICE(s), altset_channels[altset]); } streambuf_init(&s->out.buf, s->buffer, s->out.channels); - AUD_set_active_out(s->audio_be, s->out.voice, true); + audio_be_set_active_out(s->audio_be, s->out.voice, true); break; default: return -1; @@ -805,7 +805,7 @@ static int usb_audio_set_control(USBAudioState *s, uint= 8_t attrib, } fprintf(stderr, "\n"); } - AUD_set_volume_out(s->audio_be, s->out.voice, &s->out.vol); + audio_be_set_volume_out(s->audio_be, s->out.voice, &s->out.vol); } =20 return ret; @@ -931,7 +931,7 @@ static void usb_audio_unrealize(USBDevice *dev) } =20 usb_audio_set_output_altset(s, ALTSET_OFF); - AUD_close_out(s->audio_be, s->out.voice); + audio_be_close_out(s->audio_be, s->out.voice); =20 streambuf_fini(&s->out.buf); } @@ -941,7 +941,7 @@ static void usb_audio_realize(USBDevice *dev, Error **e= rrp) USBAudioState *s =3D USB_AUDIO(dev); int i; =20 - if (!AUD_backend_check(&s->audio_be, errp)) { + if (!audio_be_check(&s->audio_be, errp)) { return; } =20 @@ -978,10 +978,10 @@ static void usb_audio_reinit(USBDevice *dev, unsigned= channels) s->out.as.endianness =3D 0; streambuf_init(&s->out.buf, s->buffer, s->out.channels); =20 - s->out.voice =3D AUD_open_out(s->audio_be, s->out.voice, TYPE_USB_AUDI= O, + s->out.voice =3D audio_be_open_out(s->audio_be, s->out.voice, TYPE_USB= _AUDIO, s, output_callback, &s->out.as); - AUD_set_volume_out(s->audio_be, s->out.voice, &s->out.vol); - AUD_set_active_out(s->audio_be, s->out.voice, 0); + audio_be_set_volume_out(s->audio_be, s->out.voice, &s->out.vol); + audio_be_set_active_out(s->audio_be, s->out.voice, 0); } =20 static const VMStateDescription vmstate_usb_audio =3D { diff --git a/tests/audio/test-audio.c b/tests/audio/test-audio.c index 6c182ee7c60..1827c084ac8 100644 --- a/tests/audio/test-audio.c +++ b/tests/audio/test-audio.c @@ -94,7 +94,7 @@ static SWVoiceOut *open_test_voice_out(AudioBackend *be, = const char *name, struct audsettings as =3D default_test_settings; SWVoiceOut *voice; =20 - voice =3D AUD_open_out(be, NULL, name, opaque, cb, &as); + voice =3D audio_be_open_out(be, NULL, name, opaque, cb, &as); g_assert_nonnull(voice); return voice; } @@ -104,7 +104,7 @@ static SWVoiceIn *open_test_voice_in(AudioBackend *be, = const char *name, { struct audsettings as =3D default_test_settings; =20 - return AUD_open_in(be, NULL, name, opaque, cb, &as); + return audio_be_open_in(be, NULL, name, opaque, cb, &as); } =20 /* @@ -142,8 +142,8 @@ static void test_sine_callback(void *opaque, int avail) =20 generate_sine_samples(buffer, frames_to_write, s->frames_written); =20 - bytes_written =3D AUD_write(s->be, s->voice, buffer, - frames_to_write * sizeof(int16_t) * CHANNELS= ); + bytes_written =3D audio_be_write(s->be, s->voice, buffer, + frames_to_write * sizeof(int16_t) * CHA= NNELS); s->frames_written +=3D bytes_written / (sizeof(int16_t) * CHANNELS); } =20 @@ -163,7 +163,7 @@ static void test_audio_out_sine_wave(void) &state, test_sine_callback); =20 g_test_message("Playing 440Hz sine wave for %d seconds...", DURATION_S= ECS); - AUD_set_active_out(state.be, state.voice, true); + audio_be_set_active_out(state.be, state.voice, true); =20 /* * Run the audio subsystem until all frames are written or timeout. @@ -188,8 +188,8 @@ static void test_audio_out_sine_wave(void) =20 g_assert_cmpint(state.frames_written, =3D=3D, state.total_frames); =20 - AUD_set_active_out(state.be, state.voice, false); - AUD_close_out(state.be, state.voice); + audio_be_set_active_out(state.be, state.voice, false); + audio_be_close_out(state.be, state.voice); } =20 static void test_audio_prio_list(void) @@ -224,15 +224,15 @@ static void test_audio_out_active_state(void) be =3D get_test_audio_backend(); voice =3D open_test_voice_out(be, "test-active", NULL, dummy_audio_cal= lback); =20 - g_assert_false(AUD_is_active_out(be, voice)); + g_assert_false(audio_be_is_active_out(be, voice)); =20 - AUD_set_active_out(be, voice, true); - g_assert_true(AUD_is_active_out(be, voice)); + audio_be_set_active_out(be, voice, true); + g_assert_true(audio_be_is_active_out(be, voice)); =20 - AUD_set_active_out(be, voice, false); - g_assert_false(AUD_is_active_out(be, voice)); + audio_be_set_active_out(be, voice, false); + g_assert_false(audio_be_is_active_out(be, voice)); =20 - AUD_close_out(be, voice); + audio_be_close_out(be, voice); } =20 static void test_audio_out_buffer_size(void) @@ -244,13 +244,13 @@ static void test_audio_out_buffer_size(void) be =3D get_test_audio_backend(); voice =3D open_test_voice_out(be, "test-buffer", NULL, dummy_audio_cal= lback); =20 - buffer_size =3D AUD_get_buffer_size_out(be, voice); + buffer_size =3D audio_be_get_buffer_size_out(be, voice); g_test_message("Buffer size: %d bytes", buffer_size); g_assert_cmpint(buffer_size, >, 0); =20 - AUD_close_out(be, voice); + audio_be_close_out(be, voice); =20 - g_assert_cmpint(AUD_get_buffer_size_out(NULL, NULL), =3D=3D, 0); + g_assert_cmpint(audio_be_get_buffer_size_out(be, NULL), =3D=3D, 0); } =20 static void test_audio_out_volume(void) @@ -263,15 +263,15 @@ static void test_audio_out_volume(void) voice =3D open_test_voice_out(be, "test-volume", NULL, dummy_audio_cal= lback); =20 vol =3D (Volume){ .mute =3D false, .channels =3D 2, .vol =3D {255, 255= } }; - AUD_set_volume_out(be, voice, &vol); + audio_be_set_volume_out(be, voice, &vol); =20 vol =3D (Volume){ .mute =3D true, .channels =3D 2, .vol =3D {255, 255}= }; - AUD_set_volume_out(be, voice, &vol); + audio_be_set_volume_out(be, voice, &vol); =20 vol =3D (Volume){ .mute =3D false, .channels =3D 2, .vol =3D {128, 128= } }; - AUD_set_volume_out(be, voice, &vol); + audio_be_set_volume_out(be, voice, &vol); =20 - AUD_close_out(be, voice); + audio_be_close_out(be, voice); } =20 static void test_audio_in_active_state(void) @@ -286,15 +286,15 @@ static void test_audio_in_active_state(void) return; } =20 - g_assert_false(AUD_is_active_in(be, voice)); + g_assert_false(audio_be_is_active_in(be, voice)); =20 - AUD_set_active_in(be, voice, true); - g_assert_true(AUD_is_active_in(be, voice)); + audio_be_set_active_in(be, voice, true); + g_assert_true(audio_be_is_active_in(be, voice)); =20 - AUD_set_active_in(be, voice, false); - g_assert_false(AUD_is_active_in(be, voice)); + audio_be_set_active_in(be, voice, false); + g_assert_false(audio_be_is_active_in(be, voice)); =20 - AUD_close_in(be, voice); + audio_be_close_in(be, voice); } =20 static void test_audio_in_volume(void) @@ -311,12 +311,12 @@ static void test_audio_in_volume(void) } =20 vol =3D (Volume){ .mute =3D false, .channels =3D 2, .vol =3D {255, 255= } }; - AUD_set_volume_in(be, voice, &vol); + audio_be_set_volume_in(be, voice, &vol); =20 vol =3D (Volume){ .mute =3D true, .channels =3D 2, .vol =3D {255, 255}= }; - AUD_set_volume_in(be, voice, &vol); + audio_be_set_volume_in(be, voice, &vol); =20 - AUD_close_in(be, voice); + audio_be_close_in(be, voice); } =20 =20 @@ -416,7 +416,7 @@ static void test_audio_capture(void) state.captured_bytes =3D 0; state.capture_buffer_size =3D CAPTURE_BUFFER_SIZE; =20 - cap =3D AUD_add_capture(be, &as, &ops, &state); + cap =3D audio_be_add_capture(be, &as, &ops, &state); g_assert_nonnull(cap); =20 sine_state.be =3D be; @@ -427,7 +427,7 @@ static void test_audio_capture(void) &sine_state, test_sine_callback); sine_state.voice =3D voice; =20 - AUD_set_active_out(be, voice, true); + audio_be_set_active_out(be, voice, true); =20 start_time =3D g_get_monotonic_time(); while (sine_state.frames_written < sine_state.total_frames || @@ -472,10 +472,10 @@ static void test_audio_capture(void) g_assert_cmpfloat(match_ratio, >=3D, 0.9); } =20 - AUD_set_active_out(be, voice, false); - AUD_close_out(be, voice); + audio_be_set_active_out(be, voice, false); + audio_be_close_out(be, voice); =20 - AUD_del_capture(be, cap, &state); + audio_be_del_capture(be, cap, &state); g_assert_true(state.destroy_called); =20 g_free(state.captured_samples); @@ -486,24 +486,24 @@ static void test_audio_null_handling(void) AudioBackend *be =3D get_test_audio_backend(); uint8_t buffer[64]; =20 - /* AUD_is_active_out/in(NULL) should return false */ - g_assert_false(AUD_is_active_out(be, NULL)); - g_assert_false(AUD_is_active_in(be, NULL)); + /* audio_be_is_active_out/in(NULL) should return false */ + g_assert_false(audio_be_is_active_out(be, NULL)); + g_assert_false(audio_be_is_active_in(be, NULL)); =20 - /* AUD_get_buffer_size_out(NULL) should return 0 */ - g_assert_cmpint(AUD_get_buffer_size_out(be, NULL), =3D=3D, 0); + /* audio_be_get_buffer_size_out(NULL) should return 0 */ + g_assert_cmpint(audio_be_get_buffer_size_out(be, NULL), =3D=3D, 0); =20 - /* AUD_write/read(NULL, ...) should return size (no-op) */ - g_assert_cmpuint(AUD_write(be, NULL, buffer, sizeof(buffer)), =3D=3D, + /* audio_be_write/read(NULL, ...) should return size (no-op) */ + g_assert_cmpuint(audio_be_write(be, NULL, buffer, sizeof(buffer)), =3D= =3D, sizeof(buffer)); - g_assert_cmpuint(AUD_read(be, NULL, buffer, sizeof(buffer)), =3D=3D, + g_assert_cmpuint(audio_be_read(be, NULL, buffer, sizeof(buffer)), =3D= =3D, sizeof(buffer)); =20 /* These should not crash */ - AUD_set_active_out(be, NULL, true); - AUD_set_active_out(be, NULL, false); - AUD_set_active_in(be, NULL, true); - AUD_set_active_in(be, NULL, false); + audio_be_set_active_out(be, NULL, true); + audio_be_set_active_out(be, NULL, false); + audio_be_set_active_in(be, NULL, true); + audio_be_set_active_in(be, NULL, false); } =20 static void test_audio_multiple_voices(void) @@ -517,23 +517,23 @@ static void test_audio_multiple_voices(void) out2 =3D open_test_voice_out(be, "test-multi-out2", NULL, dummy_audio_= callback); in1 =3D open_test_voice_in(be, "test-multi-in1", NULL, dummy_audio_cal= lback); =20 - AUD_set_active_out(be, out1, true); - AUD_set_active_out(be, out2, true); - AUD_set_active_in(be, in1, true); + audio_be_set_active_out(be, out1, true); + audio_be_set_active_out(be, out2, true); + audio_be_set_active_in(be, in1, true); =20 - g_assert_true(AUD_is_active_out(be, out1)); - g_assert_true(AUD_is_active_out(be, out2)); + g_assert_true(audio_be_is_active_out(be, out1)); + g_assert_true(audio_be_is_active_out(be, out2)); if (in1) { - g_assert_true(AUD_is_active_in(be, in1)); + g_assert_true(audio_be_is_active_in(be, in1)); } =20 - AUD_set_active_out(be, out1, false); - AUD_set_active_out(be, out2, false); - AUD_set_active_in(be, in1, false); + audio_be_set_active_out(be, out1, false); + audio_be_set_active_out(be, out2, false); + audio_be_set_active_in(be, in1, false); =20 - AUD_close_in(be, in1); - AUD_close_out(be, out2); - AUD_close_out(be, out1); + audio_be_close_in(be, in1); + audio_be_close_out(be, out2); + audio_be_close_out(be, out1); } =20 int main(int argc, char **argv) diff --git a/ui/vnc.c b/ui/vnc.c index c142d9fc7c0..d56fe2c180e 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1280,7 +1280,7 @@ static void audio_add(VncState *vs) ops.destroy =3D audio_capture_destroy; ops.capture =3D audio_capture; =20 - vs->audio_cap =3D AUD_add_capture(vs->vd->audio_be, &vs->as, &ops, vs); + vs->audio_cap =3D audio_be_add_capture(vs->vd->audio_be, &vs->as, &ops= , vs); if (!vs->audio_cap) { error_report("Failed to add audio capture"); } @@ -1289,7 +1289,7 @@ static void audio_add(VncState *vs) static void audio_del(VncState *vs) { if (vs->audio_cap) { - AUD_del_capture(vs->vd->audio_be, vs->audio_cap, vs); + audio_be_del_capture(vs->vd->audio_be, vs->audio_cap, vs); vs->audio_cap =3D NULL; } } --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244113; cv=none; d=zohomail.com; s=zohoarc; b=kY42Y1Rjdwpqp2vCK0IxTnRdYMRattd+/B8GmiWJqZbz/lcLES4nVd4YMzrIy7QUpnMXvvisxCI9f+mDYtv7L+wQGIdF8VsCfqRpuuEHrYTC3Ey9aSvFz2O9vNUBmoXmmQ162n5A5WcShIJ3XssjN5jxpEUQJq/WDe5TXxfQWkk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244113; h=Content-Type: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=14KtznUlIjxeUhZQ3HJFjn608eAk9OXV5ZTi/HQfe2w=; b=O2BIXu13goMgImSeVI+3vX3kxnvD1SSZv1Ecqg6hNbwdwhBWbXJtPWr/F78t8sQjd1cQYWAFaOkGhlyFKkcWdPvMxZ4N/KKz1Cy9p2HtRLB7/pCsgOC/P2GUmaqi8uIDsc2OFPz1bLIht3XflREXUU/HgICCLBWfk2NMdrIcltE= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244113721872.5732747747736; Mon, 16 Feb 2026 04:15:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweQ-0004LD-LP; Mon, 16 Feb 2026 06:20:27 -0500 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 1vrwbb-0005ki-61 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbZ-0007zb-Et for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:30 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-423-9uq7PT2NMZmkYNLkkLBUlQ-1; Mon, 16 Feb 2026 06:17:26 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8791F1956058; Mon, 16 Feb 2026 11:17:24 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8F3671800464; Mon, 16 Feb 2026 11:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=14KtznUlIjxeUhZQ3HJFjn608eAk9OXV5ZTi/HQfe2w=; b=BAj+uHrClYAJ+ZmOfuCWgYg2SMrWNHDiHXw1KiQ6o8/Usapkjn392xNwN1vdMKgFoEsxLK 4+1Xtu+5s1yuqMKAIwgW6nGAmn7eyJltWPbUCvUzndqBIsUm/DQkPVnwm9LFPBqPnyQ1l3 3D2+YBMOYzdvRnZKJA+2QjhLZVLXVcE= X-MC-Unique: 9uq7PT2NMZmkYNLkkLBUlQ-1 X-Mimecast-MFC-AGG-ID: 9uq7PT2NMZmkYNLkkLBUlQ_1771240644 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:27 +0100 Subject: [PATCH 38/85] audio-be: add common pre-conditions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-38-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=6032; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=zXuDMfkjGAD2e+OunENZs2O7GncbAFbykUUyFo44jys=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQfwdZmV+cpyVDheiWV5K7XQjwx6FCLGFQC ngi9xRbxFeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5XQMD/9v89KN9GZbrcrzh/XCa9j3+bB/YHhyc1rytSaKDjw/9NGnAfu2vKs1T9J4AeFR3k+CbK7 ZnvyKqL/1i0VxFQJtcqU22rw7hb77VVmLG1KLRghlneMYUohOsnVgQ7iSic5WbHViL84g+/GCc7 QkhwiAadUNhTmWCqjRJG/zCKlDWcDop1wxuDPoODEjyi8OAQsIL/7kszvpXahKHrPVJ0eyo41Sv 2EHUSC6nEyjsBAudwJB8OQ26x4OTaLl+suBuA2xVhQBVNrHfd8Tl1AOjHGCmXZM/i0qWwudR9Bv b8wmkpVOO874YP0rZDJlBPAvcMf9XJLtOucDTiVdI7N+ySroCv3eLfS98dDb88Kvn/a5IUeQWi6 Hh/U9Y/Ts3XyekcJVnUJwVfpSbeDI4UG2DkCIGhWFIF7D0ieN8DYFB/HzVwRqbuVSlhR0JSLRtc AHVAow7SR0j0VILmj5lXCYDC8805xpRfl8uJsr0UfiPvvMr7m05k+UO3qzg5I35cSOaC8zIf9Yn 76l1QJ4a/fbKg1PNzNYUGJBpMrlx/+Q2V/q2do/OF0tSkG7x6ppADgb9ZCePJgUugoua/KedDbw jdX6eNSNcdQmOZ66omCUyaZJnGRDxQouXQT4Sy5CuYjCnpRO/ZQsCkEYyZcmEpB1E7mCTyNd9AO gHRmv1iBh/OhCcg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771244115057154100 assert() on valid values, and handle acceptable NULL arguments gracefully. Note audio_driver_write() and audio_driver_read() used to return size (with a "XXX: Consider options") when sw was NULL. Imho, it is more correct to not pretend to have read/written anything by default in the AudioBackend base abstract class. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio-be.c | 61 ++++++++++++++++++++++++++++++++++++++++++++= ++++ tests/audio/test-audio.c | 8 +++---- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/audio/audio-be.c b/audio/audio-be.c index 4d3b1e2bafd..719dd8cac12 100644 --- a/audio/audio-be.c +++ b/audio/audio-be.c @@ -29,6 +29,10 @@ SWVoiceIn *audio_be_open_in( { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + assert(name !=3D NULL); + assert(callback_fn !=3D NULL); + assert(as !=3D NULL); + return klass->open_in(be, sw, name, callback_opaque, callback_fn, as); } =20 @@ -42,6 +46,10 @@ SWVoiceOut *audio_be_open_out( { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + assert(name !=3D NULL); + assert(callback_fn !=3D NULL); + assert(as !=3D NULL); + return klass->open_out(be, sw, name, callback_opaque, callback_fn, as); } =20 @@ -49,6 +57,10 @@ void audio_be_close_out(AudioBackend *be, SWVoiceOut *sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return; + } + return klass->close_out(be, sw); } =20 @@ -56,6 +68,10 @@ void audio_be_close_in(AudioBackend *be, SWVoiceIn *sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return; + } + return klass->close_in(be, sw); } =20 @@ -63,6 +79,10 @@ bool audio_be_is_active_out(AudioBackend *be, SWVoiceOut= *sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return false; + } + return klass->is_active_out(be, sw); } =20 @@ -70,6 +90,10 @@ bool audio_be_is_active_in(AudioBackend *be, SWVoiceIn *= sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return false; + } + return klass->is_active_in(be, sw); } =20 @@ -77,6 +101,10 @@ size_t audio_be_write(AudioBackend *be, SWVoiceOut *sw,= void *buf, size_t size) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return 0; + } + return klass->write(be, sw, buf, size); } =20 @@ -84,6 +112,10 @@ size_t audio_be_read(AudioBackend *be, SWVoiceIn *sw, v= oid *buf, size_t size) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return 0; + } + return klass->read(be, sw, buf, size); } =20 @@ -91,6 +123,10 @@ int audio_be_get_buffer_size_out(AudioBackend *be, SWVo= iceOut *sw) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return 0; + } + return klass->get_buffer_size_out(be, sw); } =20 @@ -98,6 +134,10 @@ void audio_be_set_active_out(AudioBackend *be, SWVoiceO= ut *sw, bool on) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return; + } + return klass->set_active_out(be, sw, on); } =20 @@ -105,6 +145,10 @@ void audio_be_set_active_in(AudioBackend *be, SWVoiceI= n *sw, bool on) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return; + } + return klass->set_active_in(be, sw, on); } =20 @@ -112,6 +156,10 @@ void audio_be_set_volume_out(AudioBackend *be, SWVoice= Out *sw, Volume *vol) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return; + } + klass->set_volume_out(be, sw, vol); } =20 @@ -119,6 +167,10 @@ void audio_be_set_volume_in(AudioBackend *be, SWVoiceI= n *sw, Volume *vol) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!sw) { + return; + } + klass->set_volume_in(be, sw, vol); } =20 @@ -130,6 +182,9 @@ CaptureVoiceOut *audio_be_add_capture( { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + assert(as !=3D NULL); + assert(ops !=3D NULL); + return klass->add_capture(be, as, ops, cb_opaque); } =20 @@ -137,6 +192,10 @@ void audio_be_del_capture(AudioBackend *be, CaptureVoi= ceOut *cap, void *cb_opaqu { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + if (!cap) { + return; + } + klass->del_capture(be, cap, cb_opaque); } =20 @@ -155,6 +214,8 @@ bool audio_be_set_dbus_server(AudioBackend *be, { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + assert(server !=3D NULL); + if (!audio_be_can_set_dbus_server(be)) { error_setg(errp, "Audiodev '%s' is not compatible with DBus", audio_be_get_id(be)); diff --git a/tests/audio/test-audio.c b/tests/audio/test-audio.c index 1827c084ac8..90d96ae0575 100644 --- a/tests/audio/test-audio.c +++ b/tests/audio/test-audio.c @@ -493,11 +493,9 @@ static void test_audio_null_handling(void) /* audio_be_get_buffer_size_out(NULL) should return 0 */ g_assert_cmpint(audio_be_get_buffer_size_out(be, NULL), =3D=3D, 0); =20 - /* audio_be_write/read(NULL, ...) should return size (no-op) */ - g_assert_cmpuint(audio_be_write(be, NULL, buffer, sizeof(buffer)), =3D= =3D, - sizeof(buffer)); - g_assert_cmpuint(audio_be_read(be, NULL, buffer, sizeof(buffer)), =3D= =3D, - sizeof(buffer)); + /* audio_be_write/read(NULL, ...) should return 0 */ + g_assert_cmpuint(audio_be_write(be, NULL, buffer, sizeof(buffer)), =3D= =3D, 0); + g_assert_cmpuint(audio_be_read(be, NULL, buffer, sizeof(buffer)), =3D= =3D, 0); =20 /* These should not crash */ audio_be_set_active_out(be, NULL, true); --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244568; cv=none; d=zohomail.com; s=zohoarc; b=FIMVD9Bs/hXL9GHR0AiHyAdAL2H7qW5z8o5hWy6C0FyL/ugbFLXBupbJGCjJwfHeEIPQ4F4HjbMNVnv0r4VAzKcQak2SkmO9i0L1sxjHddL2cqzW1o0ur1GaM+uKH1Kw6x5DoPlfdsdnlaH4eek23jmnGOufKdth9LAqfzeg9/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244568; h=Content-Type: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=wAPlRNPKdeWquLi18FJ2oBHPOgXeFeTuRgnXP8s7MNw=; b=NkksyJ+cosAubH4U7q8pdEUREsJO1+aommAmCUvuD/AhKSUhouXs8spL2/8dCqoZuJ5PRDJzXh40738b4SK4pywlG4A7/5MXWaPPhuOBh2pYH40hMdVWlEThyk4yjizwa5pMSJcqOBcxweP0z5J9vSaTHaqrIhpul0ZWC4lY9ys= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244568090849.4181052140538; Mon, 16 Feb 2026 04:22:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwdX-0000L0-Dj; Mon, 16 Feb 2026 06:19:31 -0500 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 1vrwbe-0005ok-Kx for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbd-00084X-2a for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:34 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-cd9xv65uOfOsBhC4iBoU3g-1; Mon, 16 Feb 2026 06:17:29 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 22C141800454; Mon, 16 Feb 2026 11:17:27 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3D47530001A5; Mon, 16 Feb 2026 11:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wAPlRNPKdeWquLi18FJ2oBHPOgXeFeTuRgnXP8s7MNw=; b=DsgVnK8wzxB+3CQNSjKbHNHHb30z9FVOkgIm4t23dCQQLIHS/EPnYZGRpX6sBEKlJGLeYO l8/1pMfFMxl+fbfc1nvyUNR8bQcSyPdCOlD+1q5bwgBV3IcazYiqSIsv3sKCXSctgNtrAf SfbXYZsTn98eg1jxxhh3BBt0rOEUHiM= X-MC-Unique: cd9xv65uOfOsBhC4iBoU3g-1 X-Mimecast-MFC-AGG-ID: cd9xv65uOfOsBhC4iBoU3g_1771240647 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:28 +0100 Subject: [PATCH 39/85] audio-be: add some state trace for debugging MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-39-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1629; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=kMAYRkuXfPx/cZR8FpZgmCzTRG5cT4t64cUDglhy7GI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQixfbluWJqT7ahwdfeB1Q28ST2iQZa5i/8 na0PnKQsTuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5eJWEACLsK+PAoy7lMvERRTwLTizbY1kaUHb0+0vZJtbIeLdK5tgiAwkedV20WdImXC5RDxZxKM 7BYTcjQQZWMCWagBaERbfdS/K8sucAIQ+Es0g375snfHgpaJDujrP/u8WpidG6x0uhpA8lmByUU ZVVVc8U0AzbF8wcZQ1OizVge7F5MIGULxtp7R0X/7Dtg7VP9Q167MiHv3r3pGVBWVg11Uo/J7qb vY6ijHcBySCTC10ZO8CxG+piCXKhDHR6u1pbiZy971YeazNyrCpEjN/4VWZ7nhIK1jdt9CZ5vMs 9Xiy3P956JKOBPCxBC5/9yIVyxF37V3rC4K2vEr7+/G0ogEnfms0IeRFL8AAFt4c0SOyAUrVEpT MWUVdiIPp5qRczRWWPizhiMTuE0C85YpxS5dOaj0okkoh1YVaLMJElPMmxurOFka4djJ0jylapT FBF4q2bRUoymSVvtfoNCKgSPOIHIOqXlyHSuFyhzdwH9BZvbd31s6NcI9kkrFHdyfiel6Mi9gGO zEREegwgG2D1TvcbVHC4umG31k/s1k4k2k16iKeWRvR96CfHKvJohogqe8SGuKIniP35Eovtyhe NtQIVoc/KpcmYapa1QiwFdHnSTkUTAUl6Lzpl8L7Q7dIZkt4jRrI02X1SRq7Z5Bf0+IjsDAm5O3 8MVZO3MYwN5b3Cw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771244571245158500 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio-be.c | 5 +++++ audio/trace-events | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/audio/audio-be.c b/audio/audio-be.c index 719dd8cac12..3203bb80e05 100644 --- a/audio/audio-be.c +++ b/audio/audio-be.c @@ -4,6 +4,7 @@ #include "qemu/audio.h" #include "qemu/audio-capture.h" #include "qapi/error.h" +#include "trace.h" =20 bool audio_be_check(AudioBackend **be, Error **errp) { @@ -134,6 +135,8 @@ void audio_be_set_active_out(AudioBackend *be, SWVoiceO= ut *sw, bool on) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + trace_audio_be_set_active_out(sw, on); + if (!sw) { return; } @@ -145,6 +148,8 @@ void audio_be_set_active_in(AudioBackend *be, SWVoiceIn= *sw, bool on) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); =20 + trace_audio_be_set_active_in(sw, on); + if (!sw) { return; } diff --git a/audio/trace-events b/audio/trace-events index 7e3f1593c81..f7f639d9605 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -26,6 +26,10 @@ pw_vol(const char *ret) "set volume: %s" pw_period(uint64_t quantum, uint32_t rate) "period =3D%" PRIu64 "/%u" pw_audio_init(void) "Initialize PipeWire context" =20 +# audio-be.c +audio_be_set_active_in(void *sw, bool on) "sw=3D%p, on=3D%d" +audio_be_set_active_out(void *sw, bool on) "sw=3D%p, on=3D%d" + # audio.c audio_timer_start(int interval) "interval %d ms" audio_timer_stop(void) "" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771241723; cv=none; d=zohomail.com; s=zohoarc; b=NxlXAr+rpDt4CFgqnwX+fT6IEpTKmZQadrmF5TlWiJlJJrTjSSPxlUqzhjWj9SzUcfXdQ02glzDjPH4fpz/az55MUEh+4AIK8HGsYdl4LITf5JjggktDlBTLjc3YD/O+m8Cd6sAtIB1PASmdaH+0dE82B2piecSPIb7okOPvPt8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771241723; h=Content-Type: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=II/peA+q82xMlUb9oma13QrmJYqBB9KQPJ/lpc1p7P4=; b=Spq1MZnD9In1qqXYJSvL2wUwwD+Cx62o5zQDQMciZNjud2kIyGrHUVRtNDIjLJhEcNeuP0HL3J+WhRA1UYmOonjwtBR3r3Hg4+GmUfoUrvXBvqQxlZOOYSiy7g5mAzyIF8WJF73NJ0huYe37M4biKOK8kfhdNnf64ghCthz1BtE= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177124172316311.622886000466451; Mon, 16 Feb 2026 03:35:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweH-000321-Uc; Mon, 16 Feb 2026 06:20:18 -0500 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 1vrwbt-00066N-6F for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbn-00085a-Uv for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:48 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-dCZx-Z68PK2mogcB9TQqZw-1; Mon, 16 Feb 2026 06:17:32 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7F78819560B2; Mon, 16 Feb 2026 11:17:30 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 00BBA18004AD; Mon, 16 Feb 2026 11:17:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240656; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=II/peA+q82xMlUb9oma13QrmJYqBB9KQPJ/lpc1p7P4=; b=afs/Byeasl9qq6Sf1goRtl91LEO2Gp+P/YU+SEaGzkR1nW4ljE8UJVBZ8pZt+ihDUbs1qK czZHdswDq9eSRmPfSs6kPhdDLlN8xmT1HiC3oIahr5U+A4qIM+EoAmlov7h0xowNyzSPHi J14QwlPyiAid5JfwmmvdsOlstgSdRfo= X-MC-Unique: dCZx-Z68PK2mogcB9TQqZw-1 X-Mimecast-MFC-AGG-ID: dCZx-Z68PK2mogcB9TQqZw_1771240650 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:29 +0100 Subject: [PATCH 40/85] audio: split AudioMixengBackend code in audio-mixeng-be.c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-40-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=129255; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SYwwr9Fv/ErOF8w3ompPE10xHRSMs0ku9X6Rs2Ehs6A=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQTD463Yp8QBtSLnkm4/6SBt8F22XjZYSyF /ZgarWBmQGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5U67D/4vu0Wva0slaEFvvhM/f6Uw8lBafldZJFqLdI7riSLvqNSsKNSq0CNmgp09cvlPnwZohcM cmqDARptiopkoUk+AUUmfWNasw2N7+irK8WYGP0DOMTWmLnk+s5Nao0bx/jIcoaL455myBtbZ6B g893XYU8KPe8+Q/dGWE+uTt78dCe61Ok3ZnqFX+tl+h+2f9QbxF//cbjiWSBJ0A5oAIx8pFPwQ7 s+tcAypQARLiCOK+gRaTFlfKSs8M2qfzjXiPszyo26w6dLGvnBZToNDGjjJl+WQM6fA54qZb64j y7Fiv4eNdPB/RW7lm+hh68Hg9XWt6NKtzqhRcXuzMHyPtkjcwuDPAnuRHiE/4uc+fYgi+NQ7yfR Qu5WRtGHaq2SRkc6FoWXJWOImBT7LmMy1JXjwu8Yzm9dpjglNFzPYPuHYa5S2Kt/sjVQq7OFlfp YJ3lPFYPI+0YOsfderMMjwNNU76HQ+BuRCwGAHRBaBRCW0vBsMk5fvgXxoWJ3s61JZFuh8yg6Te Gv2l75X9ZN853a+HX+gXSCtDj1dJmctkktw6lax1dKKmXP7Geers8VQTDrmHy2apuHM+gVzj+2/ ZkHhetkPrD8RasWP2cXES8jCzBuDoodUnL4F+eNkR93XYMeTaYiEcHOTBmiooJ6OyPn116hnDt0 oFj8N1+Kh+1qPCw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771241726022158500 Allow to build the audio/ base classes without the resampling/mixing/queuing code. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 2 - include/qemu/audio.h | 2 + audio/audio-be.c | 2 + audio/audio-mixeng-be.c | 1976 +++++++++++++++++++++++++++++++++++++++++ audio/audio.c | 2223 ++++---------------------------------------= ---- audio/meson.build | 1 + 6 files changed, 2158 insertions(+), 2048 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 250fd45238d..6ecd75c4fbf 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -266,8 +266,6 @@ int audio_bug (const char *funcname, int cond); =20 void audio_run(AudioMixengBackend *s, const char *msg); =20 -const char *audio_application_name(void); - typedef struct RateCtl { int64_t start_ticks; int64_t bytes_sent; diff --git a/include/qemu/audio.h b/include/qemu/audio.h index 42f97f732a6..dfe247ab8c4 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -183,6 +183,8 @@ bool audio_be_set_dbus_server(AudioBackend *be, Error **errp); #endif =20 +const char *audio_application_name(void); + #define DEFINE_AUDIO_PROPERTIES(_s, _f) \ DEFINE_PROP_AUDIODEV("audiodev", _s, _f) =20 diff --git a/audio/audio-be.c b/audio/audio-be.c index 3203bb80e05..8094a3196c7 100644 --- a/audio/audio-be.c +++ b/audio/audio-be.c @@ -5,6 +5,7 @@ #include "qemu/audio-capture.h" #include "qapi/error.h" #include "trace.h" +#include "qapi-types-audio.h" =20 bool audio_be_check(AudioBackend **be, Error **errp) { @@ -248,6 +249,7 @@ AudioBackend *audio_be_new(Audiodev *dev, Error **errp) =20 if (!be) { error_setg(errp, "Unknown audio driver `%s'", drvname); + qapi_free_Audiodev(dev); return NULL; } =20 diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c new file mode 100644 index 00000000000..f906c84bf7c --- /dev/null +++ b/audio/audio-mixeng-be.c @@ -0,0 +1,1976 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright (c) 2003-2005 Vassili Karpov (malc) + */ + +#include "qemu/osdep.h" +#include "qemu/audio.h" +#include "migration/vmstate.h" +#include "qemu/bswap.h" +#include "qemu/timer.h" +#include "qapi/error.h" +#include "qapi/clone-visitor.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/qapi-visit-audio.h" +#include "qapi/qapi-commands-audio.h" +#include "qobject/qdict.h" +#include "qemu/error-report.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "qemu/help_option.h" +#include "qom/object.h" +#include "system/system.h" +#include "system/replay.h" +#include "system/runstate.h" +#include "trace.h" + +#define AUDIO_CAP "audio" +#include "audio_int.h" + +/* #define DEBUG_OUT */ +/* #define DEBUG_CAPTURE */ +/* #define DEBUG_POLL */ + +#define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" + +const struct mixeng_volume nominal_volume =3D { + .mute =3D 0, +#ifdef FLOAT_MIXENG + .r =3D 1.0, + .l =3D 1.0, +#else + .r =3D 1ULL << 32, + .l =3D 1ULL << 32, +#endif +}; + +int audio_bug (const char *funcname, int cond) +{ + if (cond) { + static int shown; + + AUD_log (NULL, "A bug was just triggered in %s\n", funcname); + if (!shown) { + shown =3D 1; + AUD_log (NULL, "Save all your work and restart without audio\n= "); + AUD_log (NULL, "I am sorry\n"); + } + AUD_log (NULL, "Context:\n"); + } + + return cond; +} + +static inline int audio_bits_to_index (int bits) +{ + switch (bits) { + case 8: + return 0; + + case 16: + return 1; + + case 32: + return 2; + + default: + audio_bug ("bits_to_index", 1); + AUD_log (NULL, "invalid bits %d\n", bits); + return 0; + } +} + +void AUD_vlog (const char *cap, const char *fmt, va_list ap) +{ + if (cap) { + fprintf(stderr, "%s: ", cap); + } + + vfprintf(stderr, fmt, ap); +} + +void AUD_log (const char *cap, const char *fmt, ...) +{ + va_list ap; + + va_start (ap, fmt); + AUD_vlog (cap, fmt, ap); + va_end (ap); +} + +static void audio_print_settings (const struct audsettings *as) +{ + dolog ("frequency=3D%d nchannels=3D%d fmt=3D", as->freq, as->nchannels= ); + + switch (as->fmt) { + case AUDIO_FORMAT_S8: + AUD_log (NULL, "S8"); + break; + case AUDIO_FORMAT_U8: + AUD_log (NULL, "U8"); + break; + case AUDIO_FORMAT_S16: + AUD_log (NULL, "S16"); + break; + case AUDIO_FORMAT_U16: + AUD_log (NULL, "U16"); + break; + case AUDIO_FORMAT_S32: + AUD_log (NULL, "S32"); + break; + case AUDIO_FORMAT_U32: + AUD_log (NULL, "U32"); + break; + case AUDIO_FORMAT_F32: + AUD_log (NULL, "F32"); + break; + default: + AUD_log (NULL, "invalid(%d)", as->fmt); + break; + } + + AUD_log (NULL, " endianness=3D"); + switch (as->endianness) { + case 0: + AUD_log (NULL, "little"); + break; + case 1: + AUD_log (NULL, "big"); + break; + default: + AUD_log (NULL, "invalid"); + break; + } + AUD_log (NULL, "\n"); +} + +static int audio_validate_settings (const struct audsettings *as) +{ + int invalid; + + invalid =3D as->nchannels < 1; + invalid |=3D as->endianness !=3D 0 && as->endianness !=3D 1; + + switch (as->fmt) { + case AUDIO_FORMAT_S8: + case AUDIO_FORMAT_U8: + case AUDIO_FORMAT_S16: + case AUDIO_FORMAT_U16: + case AUDIO_FORMAT_S32: + case AUDIO_FORMAT_U32: + case AUDIO_FORMAT_F32: + break; + default: + invalid =3D 1; + break; + } + + invalid |=3D as->freq <=3D 0; + return invalid ? -1 : 0; +} + +static int audio_pcm_info_eq (struct audio_pcm_info *info, const struct au= dsettings *as) +{ + int bits =3D 8; + bool is_signed =3D false, is_float =3D false; + + switch (as->fmt) { + case AUDIO_FORMAT_S8: + is_signed =3D true; + /* fall through */ + case AUDIO_FORMAT_U8: + break; + + case AUDIO_FORMAT_S16: + is_signed =3D true; + /* fall through */ + case AUDIO_FORMAT_U16: + bits =3D 16; + break; + + case AUDIO_FORMAT_F32: + is_float =3D true; + /* fall through */ + case AUDIO_FORMAT_S32: + is_signed =3D true; + /* fall through */ + case AUDIO_FORMAT_U32: + bits =3D 32; + break; + + default: + abort(); + } + return info->freq =3D=3D as->freq + && info->nchannels =3D=3D as->nchannels + && info->is_signed =3D=3D is_signed + && info->is_float =3D=3D is_float + && info->bits =3D=3D bits + && info->swap_endianness =3D=3D (as->endianness !=3D HOST_BIG_ENDI= AN); +} + +void audio_pcm_init_info (struct audio_pcm_info *info, const struct audset= tings *as) +{ + int bits =3D 8, mul; + bool is_signed =3D false, is_float =3D false; + + switch (as->fmt) { + case AUDIO_FORMAT_S8: + is_signed =3D true; + /* fall through */ + case AUDIO_FORMAT_U8: + mul =3D 1; + break; + + case AUDIO_FORMAT_S16: + is_signed =3D true; + /* fall through */ + case AUDIO_FORMAT_U16: + bits =3D 16; + mul =3D 2; + break; + + case AUDIO_FORMAT_F32: + is_float =3D true; + /* fall through */ + case AUDIO_FORMAT_S32: + is_signed =3D true; + /* fall through */ + case AUDIO_FORMAT_U32: + bits =3D 32; + mul =3D 4; + break; + + default: + abort(); + } + + info->freq =3D as->freq; + info->bits =3D bits; + info->is_signed =3D is_signed; + info->is_float =3D is_float; + info->nchannels =3D as->nchannels; + info->bytes_per_frame =3D as->nchannels * mul; + info->bytes_per_second =3D info->freq * info->bytes_per_frame; + info->swap_endianness =3D (as->endianness !=3D HOST_BIG_ENDIAN); +} + +void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int= len) +{ + if (!len) { + return; + } + + if (info->is_signed || info->is_float) { + memset(buf, 0x00, len * info->bytes_per_frame); + } else { + switch (info->bits) { + case 8: + memset(buf, 0x80, len * info->bytes_per_frame); + break; + + case 16: + { + int i; + uint16_t *p =3D buf; + short s =3D INT16_MAX; + + if (info->swap_endianness) { + s =3D bswap16 (s); + } + + for (i =3D 0; i < len * info->nchannels; i++) { + p[i] =3D s; + } + } + break; + + case 32: + { + int i; + uint32_t *p =3D buf; + int32_t s =3D INT32_MAX; + + if (info->swap_endianness) { + s =3D bswap32 (s); + } + + for (i =3D 0; i < len * info->nchannels; i++) { + p[i] =3D s; + } + } + break; + + default: + AUD_log (NULL, "audio_pcm_info_clear_buf: invalid bits %d\n", + info->bits); + break; + } + } +} + +/* + * Capture + */ +static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioMixengBackend= *s, + struct audsettings= *as) +{ + CaptureVoiceOut *cap; + + for (cap =3D s->cap_head.lh_first; cap; cap =3D cap->entries.le_next) { + if (audio_pcm_info_eq (&cap->hw.info, as)) { + return cap; + } + } + return NULL; +} + +static void audio_notify_capture (CaptureVoiceOut *cap, audcnotification_e= cmd) +{ + struct capture_callback *cb; + +#ifdef DEBUG_CAPTURE + dolog ("notification %d sent\n", cmd); +#endif + for (cb =3D cap->cb_head.lh_first; cb; cb =3D cb->entries.le_next) { + cb->ops.notify (cb->opaque, cmd); + } +} + +static void audio_capture_maybe_changed(CaptureVoiceOut *cap, bool enabled) +{ + if (cap->hw.enabled !=3D enabled) { + audcnotification_e cmd; + cap->hw.enabled =3D enabled; + cmd =3D enabled ? AUD_CNOTIFY_ENABLE : AUD_CNOTIFY_DISABLE; + audio_notify_capture (cap, cmd); + } +} + +static void audio_recalc_and_notify_capture (CaptureVoiceOut *cap) +{ + HWVoiceOut *hw =3D &cap->hw; + SWVoiceOut *sw; + bool enabled =3D false; + + for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { + if (sw->active) { + enabled =3D true; + break; + } + } + audio_capture_maybe_changed (cap, enabled); +} + +static void audio_detach_capture (HWVoiceOut *hw) +{ + SWVoiceCap *sc =3D hw->cap_head.lh_first; + + while (sc) { + SWVoiceCap *sc1 =3D sc->entries.le_next; + SWVoiceOut *sw =3D &sc->sw; + CaptureVoiceOut *cap =3D sc->cap; + int was_active =3D sw->active; + + if (sw->rate) { + st_rate_stop (sw->rate); + sw->rate =3D NULL; + } + + QLIST_REMOVE (sw, entries); + QLIST_REMOVE (sc, entries); + g_free (sc); + if (was_active) { + /* We have removed soft voice from the capture: + this might have changed the overall status of the capture + since this might have been the only active voice */ + audio_recalc_and_notify_capture (cap); + } + sc =3D sc1; + } +} + +static int audio_attach_capture (HWVoiceOut *hw) +{ + AudioMixengBackend *s =3D hw->s; + CaptureVoiceOut *cap; + + audio_detach_capture (hw); + for (cap =3D s->cap_head.lh_first; cap; cap =3D cap->entries.le_next) { + SWVoiceCap *sc; + SWVoiceOut *sw; + HWVoiceOut *hw_cap =3D &cap->hw; + + sc =3D g_malloc0(sizeof(*sc)); + + sc->cap =3D cap; + sw =3D &sc->sw; + sw->hw =3D hw_cap; + sw->info =3D hw->info; + sw->empty =3D true; + sw->active =3D hw->enabled; + sw->vol =3D nominal_volume; + sw->rate =3D st_rate_start (sw->info.freq, hw_cap->info.freq); + QLIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); + QLIST_INSERT_HEAD (&hw->cap_head, sc, entries); +#ifdef DEBUG_CAPTURE + sw->name =3D g_strdup_printf ("for %p %d,%d,%d", + hw, sw->info.freq, sw->info.bits, + sw->info.nchannels); + dolog ("Added %s active =3D %d\n", sw->name, sw->active); +#endif + if (sw->active) { + audio_capture_maybe_changed (cap, 1); + } + } + return 0; +} + +/* + * Hard voice (capture) + */ +static size_t audio_pcm_hw_find_min_in (HWVoiceIn *hw) +{ + SWVoiceIn *sw; + size_t m =3D hw->total_samples_captured; + + for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { + if (sw->active) { + m =3D MIN (m, sw->total_hw_samples_acquired); + } + } + return m; +} + +static size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw) +{ + size_t live =3D hw->total_samples_captured - audio_pcm_hw_find_min_in = (hw); + if (audio_bug(__func__, live > hw->conv_buf.size)) { + dolog("live=3D%zu hw->conv_buf.size=3D%zu\n", live, hw->conv_buf.s= ize); + return 0; + } + return live; +} + +static size_t audio_pcm_hw_conv_in(HWVoiceIn *hw, void *pcm_buf, size_t sa= mples) +{ + size_t conv =3D 0; + STSampleBuffer *conv_buf =3D &hw->conv_buf; + + while (samples) { + uint8_t *src =3D advance(pcm_buf, conv * hw->info.bytes_per_frame); + size_t proc =3D MIN(samples, conv_buf->size - conv_buf->pos); + + hw->conv(conv_buf->buffer + conv_buf->pos, src, proc); + conv_buf->pos =3D (conv_buf->pos + proc) % conv_buf->size; + samples -=3D proc; + conv +=3D proc; + } + + return conv; +} + +/* + * Soft voice (capture) + */ +static void audio_pcm_sw_resample_in(SWVoiceIn *sw, + size_t frames_in_max, size_t frames_out_max, + size_t *total_in, size_t *total_out) +{ + HWVoiceIn *hw =3D sw->hw; + struct st_sample *src, *dst; + size_t live, rpos, frames_in, frames_out; + + live =3D hw->total_samples_captured - sw->total_hw_samples_acquired; + rpos =3D audio_ring_posb(hw->conv_buf.pos, live, hw->conv_buf.size); + + /* resample conv_buf from rpos to end of buffer */ + src =3D hw->conv_buf.buffer + rpos; + frames_in =3D MIN(frames_in_max, hw->conv_buf.size - rpos); + dst =3D sw->resample_buf.buffer; + frames_out =3D frames_out_max; + st_rate_flow(sw->rate, src, dst, &frames_in, &frames_out); + rpos +=3D frames_in; + *total_in =3D frames_in; + *total_out =3D frames_out; + + /* resample conv_buf from start of buffer if there are input frames le= ft */ + if (frames_in_max - frames_in && rpos =3D=3D hw->conv_buf.size) { + src =3D hw->conv_buf.buffer; + frames_in =3D frames_in_max - frames_in; + dst +=3D frames_out; + frames_out =3D frames_out_max - frames_out; + st_rate_flow(sw->rate, src, dst, &frames_in, &frames_out); + *total_in +=3D frames_in; + *total_out +=3D frames_out; + } +} + +static size_t audio_pcm_sw_read(SWVoiceIn *sw, void *buf, size_t buf_len) +{ + HWVoiceIn *hw =3D sw->hw; + size_t live, frames_out_max, total_in, total_out; + + live =3D hw->total_samples_captured - sw->total_hw_samples_acquired; + if (!live) { + return 0; + } + if (audio_bug(__func__, live > hw->conv_buf.size)) { + dolog("live_in=3D%zu hw->conv_buf.size=3D%zu\n", live, hw->conv_bu= f.size); + return 0; + } + + frames_out_max =3D MIN(buf_len / sw->info.bytes_per_frame, + sw->resample_buf.size); + + audio_pcm_sw_resample_in(sw, live, frames_out_max, &total_in, &total_o= ut); + + if (!hw->pcm_ops->volume_in) { + mixeng_volume(sw->resample_buf.buffer, total_out, &sw->vol); + } + sw->clip(buf, sw->resample_buf.buffer, total_out); + + sw->total_hw_samples_acquired +=3D total_in; + return total_out * sw->info.bytes_per_frame; +} + +/* + * Hard voice (playback) + */ +static size_t audio_pcm_hw_find_min_out (HWVoiceOut *hw, int *nb_livep) +{ + SWVoiceOut *sw; + size_t m =3D SIZE_MAX; + int nb_live =3D 0; + + for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { + if (sw->active || !sw->empty) { + m =3D MIN (m, sw->total_hw_samples_mixed); + nb_live +=3D 1; + } + } + + *nb_livep =3D nb_live; + return m; +} + +static size_t audio_pcm_hw_get_live_out (HWVoiceOut *hw, int *nb_live) +{ + size_t smin; + int nb_live1; + + smin =3D audio_pcm_hw_find_min_out (hw, &nb_live1); + if (nb_live) { + *nb_live =3D nb_live1; + } + + if (nb_live1) { + size_t live =3D smin; + + if (audio_bug(__func__, live > hw->mix_buf.size)) { + dolog("live=3D%zu hw->mix_buf.size=3D%zu\n", live, hw->mix_buf= .size); + return 0; + } + return live; + } + return 0; +} + +static size_t audio_pcm_hw_get_free(HWVoiceOut *hw) +{ + return (hw->pcm_ops->buffer_get_free ? hw->pcm_ops->buffer_get_free(hw= ) : + INT_MAX) / hw->info.bytes_per_frame; +} + +static void audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf, size_t le= n) +{ + size_t clipped =3D 0; + size_t pos =3D hw->mix_buf.pos; + + while (len) { + st_sample *src =3D hw->mix_buf.buffer + pos; + uint8_t *dst =3D advance(pcm_buf, clipped * hw->info.bytes_per_fra= me); + size_t samples_till_end_of_buf =3D hw->mix_buf.size - pos; + size_t samples_to_clip =3D MIN(len, samples_till_end_of_buf); + + hw->clip(dst, src, samples_to_clip); + + pos =3D (pos + samples_to_clip) % hw->mix_buf.size; + len -=3D samples_to_clip; + clipped +=3D samples_to_clip; + } +} + +/* + * Soft voice (playback) + */ +static void audio_pcm_sw_resample_out(SWVoiceOut *sw, + size_t frames_in_max, size_t frames_out_max, + size_t *total_in, size_t *total_out) +{ + HWVoiceOut *hw =3D sw->hw; + struct st_sample *src, *dst; + size_t live, wpos, frames_in, frames_out; + + live =3D sw->total_hw_samples_mixed; + wpos =3D (hw->mix_buf.pos + live) % hw->mix_buf.size; + + /* write to mix_buf from wpos to end of buffer */ + src =3D sw->resample_buf.buffer; + frames_in =3D frames_in_max; + dst =3D hw->mix_buf.buffer + wpos; + frames_out =3D MIN(frames_out_max, hw->mix_buf.size - wpos); + st_rate_flow_mix(sw->rate, src, dst, &frames_in, &frames_out); + wpos +=3D frames_out; + *total_in =3D frames_in; + *total_out =3D frames_out; + + /* write to mix_buf from start of buffer if there are input frames lef= t */ + if (frames_in_max - frames_in > 0 && wpos =3D=3D hw->mix_buf.size) { + src +=3D frames_in; + frames_in =3D frames_in_max - frames_in; + dst =3D hw->mix_buf.buffer; + frames_out =3D frames_out_max - frames_out; + st_rate_flow_mix(sw->rate, src, dst, &frames_in, &frames_out); + *total_in +=3D frames_in; + *total_out +=3D frames_out; + } +} + +static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *buf, size_t buf_len) +{ + HWVoiceOut *hw =3D sw->hw; + size_t live, dead, hw_free, sw_max, fe_max; + size_t frames_in_max, frames_out_max, total_in, total_out; + + live =3D sw->total_hw_samples_mixed; + if (audio_bug(__func__, live > hw->mix_buf.size)) { + dolog("live=3D%zu hw->mix_buf.size=3D%zu\n", live, hw->mix_buf.siz= e); + return 0; + } + + if (live =3D=3D hw->mix_buf.size) { +#ifdef DEBUG_OUT + dolog ("%s is full %zu\n", sw->name, live); +#endif + return 0; + } + + dead =3D hw->mix_buf.size - live; + hw_free =3D audio_pcm_hw_get_free(hw); + hw_free =3D hw_free > live ? hw_free - live : 0; + frames_out_max =3D MIN(dead, hw_free); + sw_max =3D st_rate_frames_in(sw->rate, frames_out_max); + fe_max =3D MIN(buf_len / sw->info.bytes_per_frame + sw->resample_buf.p= os, + sw->resample_buf.size); + frames_in_max =3D MIN(sw_max, fe_max); + + if (!frames_in_max) { + return 0; + } + + if (frames_in_max > sw->resample_buf.pos) { + sw->conv(sw->resample_buf.buffer + sw->resample_buf.pos, + buf, frames_in_max - sw->resample_buf.pos); + if (!sw->hw->pcm_ops->volume_out) { + mixeng_volume(sw->resample_buf.buffer + sw->resample_buf.pos, + frames_in_max - sw->resample_buf.pos, &sw->vol); + } + } + + audio_pcm_sw_resample_out(sw, frames_in_max, frames_out_max, + &total_in, &total_out); + + sw->total_hw_samples_mixed +=3D total_out; + sw->empty =3D sw->total_hw_samples_mixed =3D=3D 0; + + /* + * Upsampling may leave one audio frame in the resample buffer. Decrem= ent + * total_in by one if there was a leftover frame from the previous res= ample + * pass in the resample buffer. Increment total_in by one if the curre= nt + * resample pass left one frame in the resample buffer. + */ + if (frames_in_max - total_in =3D=3D 1) { + /* copy one leftover audio frame to the beginning of the buffer */ + *sw->resample_buf.buffer =3D *(sw->resample_buf.buffer + total_in); + total_in +=3D 1 - sw->resample_buf.pos; + sw->resample_buf.pos =3D 1; + } else if (total_in >=3D sw->resample_buf.pos) { + total_in -=3D sw->resample_buf.pos; + sw->resample_buf.pos =3D 0; + } + +#ifdef DEBUG_OUT + dolog ( + "%s: write size %zu written %zu total mixed %zu\n", + SW_NAME(sw), + buf_len / sw->info.bytes_per_frame, + total_in, + sw->total_hw_samples_mixed + ); +#endif + + return total_in * sw->info.bytes_per_frame; +} + +#ifdef DEBUG_AUDIO +static void audio_pcm_print_info (const char *cap, struct audio_pcm_info *= info) +{ + dolog("%s: bits %d, sign %d, float %d, freq %d, nchan %d\n", + cap, info->bits, info->is_signed, info->is_float, info->freq, + info->nchannels); +} +#endif + +#define DAC +#include "audio_template.h" +#undef DAC +#include "audio_template.h" + +/* + * Timer + */ +static int audio_is_timer_needed(AudioMixengBackend *s) +{ + HWVoiceIn *hwi =3D NULL; + HWVoiceOut *hwo =3D NULL; + + while ((hwo =3D audio_pcm_hw_find_any_enabled_out(s, hwo))) { + if (!hwo->poll_mode) { + return 1; + } + } + while ((hwi =3D audio_pcm_hw_find_any_enabled_in(s, hwi))) { + if (!hwi->poll_mode) { + return 1; + } + } + return 0; +} + +static void audio_reset_timer(AudioMixengBackend *s) +{ + if (audio_is_timer_needed(s)) { + timer_mod_anticipate_ns(s->ts, + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + s->period_ticks); + if (!s->timer_running) { + s->timer_running =3D true; + s->timer_last =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + trace_audio_timer_start(s->period_ticks / SCALE_MS); + } + } else { + timer_del(s->ts); + if (s->timer_running) { + s->timer_running =3D false; + trace_audio_timer_stop(); + } + } +} + +static void audio_timer (void *opaque) +{ + int64_t now, diff; + AudioMixengBackend *s =3D opaque; + + now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + diff =3D now - s->timer_last; + if (diff > s->period_ticks * 3 / 2) { + trace_audio_timer_delayed(diff / SCALE_MS); + } + s->timer_last =3D now; + + audio_run(s, "timer"); + audio_reset_timer(s); +} + +/* + * Public API + */ +static size_t audio_mixeng_backend_write(AudioBackend *be, SWVoiceOut *sw, + void *buf, size_t size) +{ + HWVoiceOut *hw; + + if (!sw) { + /* XXX: Consider options */ + return size; + } + hw =3D sw->hw; + + if (!hw->enabled) { + dolog("Writing to disabled voice %s\n", SW_NAME(sw)); + return 0; + } + + if (audio_get_pdo_out(hw->s->dev)->mixing_engine) { + return audio_pcm_sw_write(sw, buf, size); + } else { + return hw->pcm_ops->write(hw, buf, size); + } +} + +static size_t audio_mixeng_backend_read(AudioBackend *be, + SWVoiceIn *sw, void *buf, size_t s= ize) +{ + HWVoiceIn *hw; + + if (!sw) { + /* XXX: Consider options */ + return size; + } + hw =3D sw->hw; + + if (!hw->enabled) { + dolog("Reading from disabled voice %s\n", SW_NAME(sw)); + return 0; + } + + if (audio_get_pdo_in(hw->s->dev)->mixing_engine) { + return audio_pcm_sw_read(sw, buf, size); + } else { + return hw->pcm_ops->read(hw, buf, size); + } + +} + +static int audio_mixeng_backend_get_buffer_size_out(AudioBackend *be, SWVo= iceOut *sw) +{ + if (!sw) { + return 0; + } + + if (audio_get_pdo_out(sw->s->dev)->mixing_engine) { + return sw->resample_buf.size * sw->info.bytes_per_frame; + } + + return sw->hw->samples * sw->hw->info.bytes_per_frame; +} + +static void audio_mixeng_backend_set_active_out(AudioBackend *be, SWVoiceO= ut *sw, + bool on) +{ + HWVoiceOut *hw; + + if (!sw) { + return; + } + + hw =3D sw->hw; + if (sw->active !=3D on) { + AudioMixengBackend *s =3D sw->s; + SWVoiceOut *temp_sw; + SWVoiceCap *sc; + + if (on) { + hw->pending_disable =3D 0; + if (!hw->enabled) { + hw->enabled =3D true; + if (runstate_is_running()) { + if (hw->pcm_ops->enable_out) { + hw->pcm_ops->enable_out(hw, true); + } + audio_reset_timer (s); + } + } + } else { + if (hw->enabled) { + int nb_active =3D 0; + + for (temp_sw =3D hw->sw_head.lh_first; temp_sw; + temp_sw =3D temp_sw->entries.le_next) { + nb_active +=3D temp_sw->active !=3D 0; + } + + hw->pending_disable =3D nb_active =3D=3D 1; + } + } + + for (sc =3D hw->cap_head.lh_first; sc; sc =3D sc->entries.le_next)= { + sc->sw.active =3D hw->enabled; + if (hw->enabled) { + audio_capture_maybe_changed (sc->cap, 1); + } + } + sw->active =3D on; + } + +} + +static void audio_mixeng_backend_set_active_in(AudioBackend *be, SWVoiceIn= *sw, bool on) +{ + HWVoiceIn *hw; + + if (!sw) { + return; + } + + hw =3D sw->hw; + if (sw->active !=3D on) { + AudioMixengBackend *s =3D sw->s; + SWVoiceIn *temp_sw; + + if (on) { + if (!hw->enabled) { + hw->enabled =3D true; + if (runstate_is_running()) { + if (hw->pcm_ops->enable_in) { + hw->pcm_ops->enable_in(hw, true); + } + audio_reset_timer (s); + } + } + sw->total_hw_samples_acquired =3D hw->total_samples_captured; + } else { + if (hw->enabled) { + int nb_active =3D 0; + + for (temp_sw =3D hw->sw_head.lh_first; temp_sw; + temp_sw =3D temp_sw->entries.le_next) { + nb_active +=3D temp_sw->active !=3D 0; + } + + if (nb_active =3D=3D 1) { + hw->enabled =3D false; + if (hw->pcm_ops->enable_in) { + hw->pcm_ops->enable_in(hw, false); + } + } + } + } + sw->active =3D on; + } +} + +static size_t audio_get_avail(SWVoiceIn *sw) +{ + size_t live; + + if (!sw) { + return 0; + } + + live =3D sw->hw->total_samples_captured - sw->total_hw_samples_acquire= d; + if (audio_bug(__func__, live > sw->hw->conv_buf.size)) { + dolog("live=3D%zu sw->hw->conv_buf.size=3D%zu\n", live, + sw->hw->conv_buf.size); + return 0; + } + + ldebug ( + "%s: get_avail live %zu frontend frames %u\n", + SW_NAME (sw), + live, st_rate_frames_out(sw->rate, live) + ); + + return live; +} + +static size_t audio_get_free(SWVoiceOut *sw) +{ + size_t live, dead; + + if (!sw) { + return 0; + } + + live =3D sw->total_hw_samples_mixed; + + if (audio_bug(__func__, live > sw->hw->mix_buf.size)) { + dolog("live=3D%zu sw->hw->mix_buf.size=3D%zu\n", live, + sw->hw->mix_buf.size); + return 0; + } + + dead =3D sw->hw->mix_buf.size - live; + +#ifdef DEBUG_OUT + dolog("%s: get_free live %zu dead %zu frontend frames %u\n", + SW_NAME(sw), live, dead, st_rate_frames_in(sw->rate, dead)); +#endif + + return dead; +} + +static void audio_capture_mix_and_clear(HWVoiceOut *hw, size_t rpos, + size_t samples) +{ + size_t n; + + if (hw->enabled) { + SWVoiceCap *sc; + + for (sc =3D hw->cap_head.lh_first; sc; sc =3D sc->entries.le_next)= { + SWVoiceOut *sw =3D &sc->sw; + size_t rpos2 =3D rpos; + + n =3D samples; + while (n) { + size_t till_end_of_hw =3D hw->mix_buf.size - rpos2; + size_t to_read =3D MIN(till_end_of_hw, n); + size_t live, frames_in, frames_out; + + sw->resample_buf.buffer =3D hw->mix_buf.buffer + rpos2; + sw->resample_buf.size =3D to_read; + live =3D sw->total_hw_samples_mixed; + + audio_pcm_sw_resample_out(sw, + to_read, sw->hw->mix_buf.size - = live, + &frames_in, &frames_out); + + sw->total_hw_samples_mixed +=3D frames_out; + sw->empty =3D sw->total_hw_samples_mixed =3D=3D 0; + + if (to_read - frames_in) { + dolog("Could not mix %zu frames into a capture " + "buffer, mixed %zu\n", + to_read, frames_in); + break; + } + n -=3D to_read; + rpos2 =3D (rpos2 + to_read) % hw->mix_buf.size; + } + } + } + + n =3D MIN(samples, hw->mix_buf.size - rpos); + mixeng_clear(hw->mix_buf.buffer + rpos, n); + mixeng_clear(hw->mix_buf.buffer, samples - n); +} + +static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live) +{ + size_t clipped =3D 0; + + while (live) { + size_t size =3D live * hw->info.bytes_per_frame; + size_t decr, proc; + void *buf =3D hw->pcm_ops->get_buffer_out(hw, &size); + + if (size =3D=3D 0) { + break; + } + + decr =3D MIN(size / hw->info.bytes_per_frame, live); + if (buf) { + audio_pcm_hw_clip_out(hw, buf, decr); + } + proc =3D hw->pcm_ops->put_buffer_out(hw, buf, + decr * hw->info.bytes_per_frame= ) / + hw->info.bytes_per_frame; + + live -=3D proc; + clipped +=3D proc; + hw->mix_buf.pos =3D (hw->mix_buf.pos + proc) % hw->mix_buf.size; + + if (proc =3D=3D 0 || proc < decr) { + break; + } + } + + if (hw->pcm_ops->run_buffer_out) { + hw->pcm_ops->run_buffer_out(hw); + } + + return clipped; +} + +static void audio_run_out(AudioMixengBackend *s) +{ + HWVoiceOut *hw =3D NULL; + SWVoiceOut *sw; + + while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) { + size_t played, live, prev_rpos; + size_t hw_free =3D audio_pcm_hw_get_free(hw); + int nb_live; + + if (!audio_get_pdo_out(s->dev)->mixing_engine) { + /* there is exactly 1 sw for each hw with no mixeng */ + sw =3D hw->sw_head.lh_first; + + if (hw->pending_disable) { + hw->enabled =3D false; + hw->pending_disable =3D false; + if (hw->pcm_ops->enable_out) { + hw->pcm_ops->enable_out(hw, false); + } + } + + if (sw->active) { + sw->callback.fn(sw->callback.opaque, + hw_free * sw->info.bytes_per_frame); + } + + if (hw->pcm_ops->run_buffer_out) { + hw->pcm_ops->run_buffer_out(hw); + } + + continue; + } + + for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { + if (sw->active) { + size_t sw_free =3D audio_get_free(sw); + size_t free; + + if (hw_free > sw->total_hw_samples_mixed) { + free =3D st_rate_frames_in(sw->rate, + MIN(sw_free, hw_free - sw->total_hw_samples_mixed)= ); + } else { + free =3D 0; + } + if (free > sw->resample_buf.pos) { + free =3D MIN(free, sw->resample_buf.size) + - sw->resample_buf.pos; + sw->callback.fn(sw->callback.opaque, + free * sw->info.bytes_per_frame); + } + } + } + + live =3D audio_pcm_hw_get_live_out (hw, &nb_live); + if (!nb_live) { + live =3D 0; + } + + if (audio_bug(__func__, live > hw->mix_buf.size)) { + dolog("live=3D%zu hw->mix_buf.size=3D%zu\n", live, hw->mix_buf= .size); + continue; + } + + if (hw->pending_disable && !nb_live) { + SWVoiceCap *sc; +#ifdef DEBUG_OUT + dolog ("Disabling voice\n"); +#endif + hw->enabled =3D false; + hw->pending_disable =3D false; + if (hw->pcm_ops->enable_out) { + hw->pcm_ops->enable_out(hw, false); + } + for (sc =3D hw->cap_head.lh_first; sc; sc =3D sc->entries.le_n= ext) { + sc->sw.active =3D false; + audio_recalc_and_notify_capture (sc->cap); + } + continue; + } + + if (!live) { + if (hw->pcm_ops->run_buffer_out) { + hw->pcm_ops->run_buffer_out(hw); + } + continue; + } + + prev_rpos =3D hw->mix_buf.pos; + played =3D audio_pcm_hw_run_out(hw, live); + replay_audio_out(&played); + if (audio_bug(__func__, hw->mix_buf.pos >=3D hw->mix_buf.size)) { + dolog("hw->mix_buf.pos=3D%zu hw->mix_buf.size=3D%zu played=3D%= zu\n", + hw->mix_buf.pos, hw->mix_buf.size, played); + hw->mix_buf.pos =3D 0; + } + +#ifdef DEBUG_OUT + dolog("played=3D%zu\n", played); +#endif + + if (played) { + audio_capture_mix_and_clear (hw, prev_rpos, played); + } + + for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { + if (!sw->active && sw->empty) { + continue; + } + + if (audio_bug(__func__, played > sw->total_hw_samples_mixed)) { + dolog("played=3D%zu sw->total_hw_samples_mixed=3D%zu\n", + played, sw->total_hw_samples_mixed); + played =3D sw->total_hw_samples_mixed; + } + + sw->total_hw_samples_mixed -=3D played; + + if (!sw->total_hw_samples_mixed) { + sw->empty =3D true; + } + } + } +} + +static size_t audio_pcm_hw_run_in(HWVoiceIn *hw, size_t samples) +{ + size_t conv =3D 0; + + if (hw->pcm_ops->run_buffer_in) { + hw->pcm_ops->run_buffer_in(hw); + } + + while (samples) { + size_t proc; + size_t size =3D samples * hw->info.bytes_per_frame; + void *buf =3D hw->pcm_ops->get_buffer_in(hw, &size); + + assert(size % hw->info.bytes_per_frame =3D=3D 0); + if (size =3D=3D 0) { + break; + } + + proc =3D audio_pcm_hw_conv_in(hw, buf, size / hw->info.bytes_per_f= rame); + + samples -=3D proc; + conv +=3D proc; + hw->pcm_ops->put_buffer_in(hw, buf, proc * hw->info.bytes_per_fram= e); + } + + return conv; +} + +static void audio_run_in(AudioMixengBackend *s) +{ + HWVoiceIn *hw =3D NULL; + + if (!audio_get_pdo_in(s->dev)->mixing_engine) { + while ((hw =3D audio_pcm_hw_find_any_enabled_in(s, hw))) { + /* there is exactly 1 sw for each hw with no mixeng */ + SWVoiceIn *sw =3D hw->sw_head.lh_first; + if (sw->active) { + sw->callback.fn(sw->callback.opaque, INT_MAX); + } + } + return; + } + + while ((hw =3D audio_pcm_hw_find_any_enabled_in(s, hw))) { + SWVoiceIn *sw; + size_t captured =3D 0, min; + int pos; + + if (replay_mode !=3D REPLAY_MODE_PLAY) { + captured =3D audio_pcm_hw_run_in( + hw, hw->conv_buf.size - audio_pcm_hw_get_live_in(hw)); + } + + replay_audio_in_start(&captured); + assert(captured <=3D hw->conv_buf.size); + if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + hw->conv_buf.pos =3D (hw->conv_buf.pos + captured) % hw->conv_= buf.size; + } + for (pos =3D (hw->conv_buf.pos - captured + hw->conv_buf.size) % h= w->conv_buf.size; + pos !=3D hw->conv_buf.pos; + pos =3D (pos + 1) % hw->conv_buf.size) { + uint64_t left, right; + + if (replay_mode =3D=3D REPLAY_MODE_RECORD) { + audio_sample_to_uint64(hw->conv_buf.buffer, pos, &left= , &right); + } + replay_audio_in_sample_lr(&left, &right); + if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + audio_sample_from_uint64(hw->conv_buf.buffer, pos, lef= t, right); + } + } + replay_audio_in_finish(); + + min =3D audio_pcm_hw_find_min_in (hw); + hw->total_samples_captured +=3D captured - min; + + for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { + sw->total_hw_samples_acquired -=3D min; + + if (sw->active) { + size_t sw_avail =3D audio_get_avail(sw); + size_t avail; + + avail =3D st_rate_frames_out(sw->rate, sw_avail); + if (avail > 0) { + avail =3D MIN(avail, sw->resample_buf.size); + sw->callback.fn(sw->callback.opaque, + avail * sw->info.bytes_per_frame); + } + } + } + } +} + +static void audio_run_capture(AudioMixengBackend *s) +{ + CaptureVoiceOut *cap; + + for (cap =3D s->cap_head.lh_first; cap; cap =3D cap->entries.le_next) { + size_t live, rpos, captured; + HWVoiceOut *hw =3D &cap->hw; + SWVoiceOut *sw; + + captured =3D live =3D audio_pcm_hw_get_live_out (hw, NULL); + rpos =3D hw->mix_buf.pos; + while (live) { + size_t left =3D hw->mix_buf.size - rpos; + size_t to_capture =3D MIN(live, left); + struct st_sample *src; + struct capture_callback *cb; + + src =3D hw->mix_buf.buffer + rpos; + hw->clip (cap->buf, src, to_capture); + mixeng_clear (src, to_capture); + + for (cb =3D cap->cb_head.lh_first; cb; cb =3D cb->entries.le_n= ext) { + cb->ops.capture (cb->opaque, cap->buf, + to_capture * hw->info.bytes_per_frame); + } + rpos =3D (rpos + to_capture) % hw->mix_buf.size; + live -=3D to_capture; + } + hw->mix_buf.pos =3D rpos; + + for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { + if (!sw->active && sw->empty) { + continue; + } + + if (audio_bug(__func__, captured > sw->total_hw_samples_mixed)= ) { + dolog("captured=3D%zu sw->total_hw_samples_mixed=3D%zu\n", + captured, sw->total_hw_samples_mixed); + captured =3D sw->total_hw_samples_mixed; + } + + sw->total_hw_samples_mixed -=3D captured; + sw->empty =3D sw->total_hw_samples_mixed =3D=3D 0; + } + } +} + +void audio_run(AudioMixengBackend *s, const char *msg) +{ + audio_run_out(s); + audio_run_in(s); + audio_run_capture(s); + +#ifdef DEBUG_POLL + { + static double prevtime; + double currtime; + struct timeval tv; + + if (gettimeofday (&tv, NULL)) { + perror ("audio_run: gettimeofday"); + return; + } + + currtime =3D tv.tv_sec + tv.tv_usec * 1e-6; + dolog ("Elapsed since last %s: %f\n", msg, currtime - prevtime); + prevtime =3D currtime; + } +#endif +} + +void audio_generic_run_buffer_in(HWVoiceIn *hw) +{ + if (unlikely(!hw->buf_emul)) { + hw->size_emul =3D hw->samples * hw->info.bytes_per_frame; + hw->buf_emul =3D g_malloc(hw->size_emul); + hw->pos_emul =3D hw->pending_emul =3D 0; + } + + while (hw->pending_emul < hw->size_emul) { + size_t read_len =3D MIN(hw->size_emul - hw->pos_emul, + hw->size_emul - hw->pending_emul); + size_t read =3D hw->pcm_ops->read(hw, hw->buf_emul + hw->pos_emul, + read_len); + hw->pending_emul +=3D read; + hw->pos_emul =3D (hw->pos_emul + read) % hw->size_emul; + if (read < read_len) { + break; + } + } +} + +void *audio_generic_get_buffer_in(HWVoiceIn *hw, size_t *size) +{ + size_t start; + + start =3D audio_ring_posb(hw->pos_emul, hw->pending_emul, hw->size_emu= l); + assert(start < hw->size_emul); + + *size =3D MIN(*size, hw->pending_emul); + *size =3D MIN(*size, hw->size_emul - start); + return hw->buf_emul + start; +} + +void audio_generic_put_buffer_in(HWVoiceIn *hw, void *buf, size_t size) +{ + assert(size <=3D hw->pending_emul); + hw->pending_emul -=3D size; +} + +size_t audio_generic_buffer_get_free(HWVoiceOut *hw) +{ + if (hw->buf_emul) { + return hw->size_emul - hw->pending_emul; + } else { + return hw->samples * hw->info.bytes_per_frame; + } +} + +void audio_generic_run_buffer_out(HWVoiceOut *hw) +{ + while (hw->pending_emul) { + size_t write_len, written, start; + + start =3D audio_ring_posb(hw->pos_emul, hw->pending_emul, hw->size= _emul); + assert(start < hw->size_emul); + + write_len =3D MIN(hw->pending_emul, hw->size_emul - start); + + written =3D hw->pcm_ops->write(hw, hw->buf_emul + start, write_len= ); + hw->pending_emul -=3D written; + + if (written < write_len) { + break; + } + } +} + +void *audio_generic_get_buffer_out(HWVoiceOut *hw, size_t *size) +{ + if (unlikely(!hw->buf_emul)) { + hw->size_emul =3D hw->samples * hw->info.bytes_per_frame; + hw->buf_emul =3D g_malloc(hw->size_emul); + hw->pos_emul =3D hw->pending_emul =3D 0; + } + + *size =3D MIN(hw->size_emul - hw->pending_emul, + hw->size_emul - hw->pos_emul); + return hw->buf_emul + hw->pos_emul; +} + +size_t audio_generic_put_buffer_out(HWVoiceOut *hw, void *buf, size_t size) +{ + assert(buf =3D=3D hw->buf_emul + hw->pos_emul && + size + hw->pending_emul <=3D hw->size_emul); + + hw->pending_emul +=3D size; + hw->pos_emul =3D (hw->pos_emul + size) % hw->size_emul; + + return size; +} + +size_t audio_generic_write(HWVoiceOut *hw, void *buf, size_t size) +{ + size_t total =3D 0; + + if (hw->pcm_ops->buffer_get_free) { + size_t free =3D hw->pcm_ops->buffer_get_free(hw); + + size =3D MIN(size, free); + } + + while (total < size) { + size_t dst_size =3D size - total; + size_t copy_size, proc; + void *dst =3D hw->pcm_ops->get_buffer_out(hw, &dst_size); + + if (dst_size =3D=3D 0) { + break; + } + + copy_size =3D MIN(size - total, dst_size); + if (dst) { + memcpy(dst, (char *)buf + total, copy_size); + } + proc =3D hw->pcm_ops->put_buffer_out(hw, dst, copy_size); + total +=3D proc; + + if (proc =3D=3D 0 || proc < copy_size) { + break; + } + } + + return total; +} + +size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size) +{ + size_t total =3D 0; + + if (hw->pcm_ops->run_buffer_in) { + hw->pcm_ops->run_buffer_in(hw); + } + + while (total < size) { + size_t src_size =3D size - total; + void *src =3D hw->pcm_ops->get_buffer_in(hw, &src_size); + + if (src_size =3D=3D 0) { + break; + } + + memcpy((char *)buf + total, src, src_size); + hw->pcm_ops->put_buffer_in(hw, src, src_size); + total +=3D src_size; + } + + return total; +} + +static bool audio_mixeng_backend_realize(AudioBackend *abe, + Audiodev *dev, Error **errp) +{ + AudioMixengBackend *be =3D AUDIO_MIXENG_BACKEND(abe); + audio_driver *drv =3D AUDIO_MIXENG_BACKEND_GET_CLASS(be)->driver; + + be->dev =3D dev; + be->drv_opaque =3D drv->init(be->dev, errp); + if (!be->drv_opaque) { + return false; + } + + if (!drv->pcm_ops->get_buffer_in) { + drv->pcm_ops->get_buffer_in =3D audio_generic_get_buffer_in; + drv->pcm_ops->put_buffer_in =3D audio_generic_put_buffer_in; + } + if (!drv->pcm_ops->get_buffer_out) { + drv->pcm_ops->get_buffer_out =3D audio_generic_get_buffer_out; + drv->pcm_ops->put_buffer_out =3D audio_generic_put_buffer_out; + } + + audio_init_nb_voices_out(be, drv, 1); + audio_init_nb_voices_in(be, drv, 0); + be->drv =3D drv; + + if (be->dev->timer_period <=3D 0) { + be->period_ticks =3D 1; + } else { + be->period_ticks =3D be->dev->timer_period * (int64_t)SCALE_US; + } + + return true; +} + +static void audio_vm_change_state_handler (void *opaque, bool running, + RunState state) +{ + AudioMixengBackend *s =3D opaque; + HWVoiceOut *hwo =3D NULL; + HWVoiceIn *hwi =3D NULL; + + while ((hwo =3D audio_pcm_hw_find_any_enabled_out(s, hwo))) { + if (hwo->pcm_ops->enable_out) { + hwo->pcm_ops->enable_out(hwo, running); + } + } + + while ((hwi =3D audio_pcm_hw_find_any_enabled_in(s, hwi))) { + if (hwi->pcm_ops->enable_in) { + hwi->pcm_ops->enable_in(hwi, running); + } + } + audio_reset_timer (s); +} + +static const VMStateDescription vmstate_audio; + +static const char *audio_mixeng_backend_get_id(AudioBackend *be) +{ + return AUDIO_MIXENG_BACKEND(be)->dev->id; +} + +static CaptureVoiceOut *audio_mixeng_backend_add_capture( + AudioBackend *be, + struct audsettings *as, + struct audio_capture_ops *ops, + void *cb_opaque); + +static void audio_mixeng_backend_del_capture( + AudioBackend *be, + CaptureVoiceOut *cap, + void *cb_opaque); + +static void audio_mixeng_backend_set_volume_out(AudioBackend *be, SWVoiceO= ut *sw, + Volume *vol); +static void audio_mixeng_backend_set_volume_in(AudioBackend *be, SWVoiceIn= *sw, + Volume *vol); + +static void audio_mixeng_backend_class_init(ObjectClass *klass, const void= *data) +{ + AudioBackendClass *be =3D AUDIO_BACKEND_CLASS(klass); + + be->realize =3D audio_mixeng_backend_realize; + be->get_id =3D audio_mixeng_backend_get_id; + be->open_in =3D audio_mixeng_backend_open_in; + be->open_out =3D audio_mixeng_backend_open_out; + be->close_in =3D audio_mixeng_backend_close_in; + be->close_out =3D audio_mixeng_backend_close_out; + be->is_active_out =3D audio_mixeng_backend_is_active_out; + be->is_active_in =3D audio_mixeng_backend_is_active_in; + be->set_active_out =3D audio_mixeng_backend_set_active_out; + be->set_active_in =3D audio_mixeng_backend_set_active_in; + be->set_volume_out =3D audio_mixeng_backend_set_volume_out; + be->set_volume_in =3D audio_mixeng_backend_set_volume_in; + be->read =3D audio_mixeng_backend_read; + be->write =3D audio_mixeng_backend_write; + be->get_buffer_size_out =3D audio_mixeng_backend_get_buffer_size_out; + be->add_capture =3D audio_mixeng_backend_add_capture; + be->del_capture =3D audio_mixeng_backend_del_capture; +} + +static void audio_mixeng_backend_init(Object *obj) +{ + AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(obj); + + QLIST_INIT(&s->hw_head_out); + QLIST_INIT(&s->hw_head_in); + QLIST_INIT(&s->cap_head); + s->ts =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); + + s->vmse =3D qemu_add_vm_change_state_handler(audio_vm_change_state_han= dler, s); + assert(s->vmse !=3D NULL); + + vmstate_register_any(NULL, &vmstate_audio, s); +} + +static void audio_mixeng_backend_finalize(Object *obj) +{ + AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(obj); + HWVoiceOut *hwo, *hwon; + HWVoiceIn *hwi, *hwin; + + QLIST_FOREACH_SAFE(hwo, &s->hw_head_out, entries, hwon) { + SWVoiceCap *sc; + + if (hwo->enabled && hwo->pcm_ops->enable_out) { + hwo->pcm_ops->enable_out(hwo, false); + } + hwo->pcm_ops->fini_out (hwo); + + for (sc =3D hwo->cap_head.lh_first; sc; sc =3D sc->entries.le_next= ) { + CaptureVoiceOut *cap =3D sc->cap; + struct capture_callback *cb; + + for (cb =3D cap->cb_head.lh_first; cb; cb =3D cb->entries.le_n= ext) { + cb->ops.destroy (cb->opaque); + } + } + QLIST_REMOVE(hwo, entries); + } + + QLIST_FOREACH_SAFE(hwi, &s->hw_head_in, entries, hwin) { + if (hwi->enabled && hwi->pcm_ops->enable_in) { + hwi->pcm_ops->enable_in(hwi, false); + } + hwi->pcm_ops->fini_in (hwi); + QLIST_REMOVE(hwi, entries); + } + + if (s->drv) { + s->drv->fini (s->drv_opaque); + s->drv =3D NULL; + } + + if (s->dev) { + qapi_free_Audiodev(s->dev); + s->dev =3D NULL; + } + + if (s->ts) { + timer_free(s->ts); + s->ts =3D NULL; + } + + if (s->vmse) { + qemu_del_vm_change_state_handler(s->vmse); + s->vmse =3D NULL; + } + + vmstate_unregister(NULL, &vmstate_audio, s); +} + +static bool vmstate_audio_needed(void *opaque) +{ + /* + * Never needed, this vmstate only exists in case + * an old qemu sends it to us. + */ + return false; +} + +static const VMStateDescription vmstate_audio =3D { + .name =3D "audio", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D vmstate_audio_needed, + .fields =3D (const VMStateField[]) { + VMSTATE_END_OF_LIST() + } +}; + +static struct audio_pcm_ops capture_pcm_ops; + +static CaptureVoiceOut *audio_mixeng_backend_add_capture( + AudioBackend *be, + struct audsettings *as, + struct audio_capture_ops *ops, + void *cb_opaque) +{ + AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(be); + CaptureVoiceOut *cap; + struct capture_callback *cb; + + if (!s) { + error_report("Capturing without setting an audiodev is not support= ed"); + abort(); + } + + if (!audio_get_pdo_out(s->dev)->mixing_engine) { + dolog("Can't capture with mixeng disabled\n"); + return NULL; + } + + if (audio_validate_settings (as)) { + dolog ("Invalid settings were passed when trying to add capture\n"= ); + audio_print_settings (as); + return NULL; + } + + cb =3D g_malloc0(sizeof(*cb)); + cb->ops =3D *ops; + cb->opaque =3D cb_opaque; + + cap =3D audio_pcm_capture_find_specific(s, as); + if (cap) { + QLIST_INSERT_HEAD (&cap->cb_head, cb, entries); + } else { + HWVoiceOut *hw; + + cap =3D g_malloc0(sizeof(*cap)); + + hw =3D &cap->hw; + hw->s =3D s; + hw->pcm_ops =3D &capture_pcm_ops; + QLIST_INIT (&hw->sw_head); + QLIST_INIT (&cap->cb_head); + + /* XXX find a more elegant way */ + hw->samples =3D 4096 * 4; + audio_pcm_hw_alloc_resources_out(hw); + + audio_pcm_init_info (&hw->info, as); + + cap->buf =3D g_malloc0_n(hw->mix_buf.size, hw->info.bytes_per_fram= e); + + if (hw->info.is_float) { + hw->clip =3D mixeng_clip_float[hw->info.nchannels =3D=3D 2] + [hw->info.swap_endianness]; + } else { + hw->clip =3D mixeng_clip + [hw->info.nchannels =3D=3D 2] + [hw->info.is_signed] + [hw->info.swap_endianness] + [audio_bits_to_index(hw->info.bits)]; + } + + QLIST_INSERT_HEAD (&s->cap_head, cap, entries); + QLIST_INSERT_HEAD (&cap->cb_head, cb, entries); + + QLIST_FOREACH(hw, &s->hw_head_out, entries) { + audio_attach_capture (hw); + } + } + + return cap; +} + +static void audio_mixeng_backend_del_capture( + AudioBackend *be, + CaptureVoiceOut *cap, + void *cb_opaque) +{ + struct capture_callback *cb; + + for (cb =3D cap->cb_head.lh_first; cb; cb =3D cb->entries.le_next) { + if (cb->opaque =3D=3D cb_opaque) { + cb->ops.destroy (cb_opaque); + QLIST_REMOVE (cb, entries); + g_free (cb); + + if (!cap->cb_head.lh_first) { + SWVoiceOut *sw =3D cap->hw.sw_head.lh_first, *sw1; + + while (sw) { + SWVoiceCap *sc =3D (SWVoiceCap *) sw; +#ifdef DEBUG_CAPTURE + dolog ("freeing %s\n", sw->name); +#endif + + sw1 =3D sw->entries.le_next; + if (sw->rate) { + st_rate_stop (sw->rate); + sw->rate =3D NULL; + } + QLIST_REMOVE (sw, entries); + QLIST_REMOVE (sc, entries); + g_free (sc); + sw =3D sw1; + } + QLIST_REMOVE (cap, entries); + g_free(cap->hw.mix_buf.buffer); + g_free (cap->buf); + g_free (cap); + } + return; + } + } +} + +static void audio_mixeng_backend_set_volume_out(AudioBackend *be, SWVoiceO= ut *sw, + Volume *vol) +{ + if (sw) { + HWVoiceOut *hw =3D sw->hw; + + sw->vol.mute =3D vol->mute; + sw->vol.l =3D nominal_volume.l * vol->vol[0] / 255; + sw->vol.r =3D nominal_volume.l * vol->vol[vol->channels > 1 ? 1 : = 0] / + 255; + + if (hw->pcm_ops->volume_out) { + hw->pcm_ops->volume_out(hw, vol); + } + } +} + +static void audio_mixeng_backend_set_volume_in(AudioBackend *be, SWVoiceIn= *sw, + Volume *vol) +{ + if (sw) { + HWVoiceIn *hw =3D sw->hw; + + sw->vol.mute =3D vol->mute; + sw->vol.l =3D nominal_volume.l * vol->vol[0] / 255; + sw->vol.r =3D nominal_volume.r * vol->vol[vol->channels > 1 ? 1 : = 0] / + 255; + + if (hw->pcm_ops->volume_in) { + hw->pcm_ops->volume_in(hw, vol); + } + } +} + +audsettings audiodev_to_audsettings(AudiodevPerDirectionOptions *pdo) +{ + return (audsettings) { + .freq =3D pdo->frequency, + .nchannels =3D pdo->channels, + .fmt =3D pdo->format, + .endianness =3D HOST_BIG_ENDIAN, + }; +} + +int audioformat_bytes_per_sample(AudioFormat fmt) +{ + switch (fmt) { + case AUDIO_FORMAT_U8: + case AUDIO_FORMAT_S8: + return 1; + + case AUDIO_FORMAT_U16: + case AUDIO_FORMAT_S16: + return 2; + + case AUDIO_FORMAT_U32: + case AUDIO_FORMAT_S32: + case AUDIO_FORMAT_F32: + return 4; + + case AUDIO_FORMAT__MAX: + ; + } + abort(); +} + + +/* frames =3D freq * usec / 1e6 */ +int audio_buffer_frames(AudiodevPerDirectionOptions *pdo, + audsettings *as, int def_usecs) +{ + uint64_t usecs =3D pdo->has_buffer_length ? pdo->buffer_length : def_u= secs; + return (as->freq * usecs + 500000) / 1000000; +} + +/* samples =3D channels * frames =3D channels * freq * usec / 1e6 */ +int audio_buffer_samples(AudiodevPerDirectionOptions *pdo, + audsettings *as, int def_usecs) +{ + return as->nchannels * audio_buffer_frames(pdo, as, def_usecs); +} + +/* + * bytes =3D bytes_per_sample * samples =3D + * bytes_per_sample * channels * freq * usec / 1e6 + */ +int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo, + audsettings *as, int def_usecs) +{ + return audio_buffer_samples(pdo, as, def_usecs) * + audioformat_bytes_per_sample(as->fmt); +} + +void audio_rate_start(RateCtl *rate) +{ + memset(rate, 0, sizeof(RateCtl)); + rate->start_ticks =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); +} + +size_t audio_rate_peek_bytes(RateCtl *rate, struct audio_pcm_info *info) +{ + int64_t now; + int64_t ticks; + int64_t bytes; + int64_t frames; + + now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + ticks =3D now - rate->start_ticks; + bytes =3D muldiv64(ticks, info->bytes_per_second, NANOSECONDS_PER_SECO= ND); + frames =3D (bytes - rate->bytes_sent) / info->bytes_per_frame; + rate->peeked_frames =3D frames; + + return frames < 0 ? 0 : frames * info->bytes_per_frame; +} + +void audio_rate_add_bytes(RateCtl *rate, size_t bytes_used) +{ + if (rate->peeked_frames < 0 || rate->peeked_frames > 65536) { + AUD_log(NULL, "Resetting rate control (%" PRId64 " frames)\n", + rate->peeked_frames); + audio_rate_start(rate); + } + + rate->bytes_sent +=3D bytes_used; +} + +size_t audio_rate_get_bytes(RateCtl *rate, struct audio_pcm_info *info, + size_t bytes_avail) +{ + size_t bytes; + + bytes =3D audio_rate_peek_bytes(rate, info); + bytes =3D MIN(bytes, bytes_avail); + audio_rate_add_bytes(rate, bytes); + + return bytes; +} + +static const TypeInfo audio_types[] =3D { + { + .name =3D TYPE_AUDIO_MIXENG_BACKEND, + .parent =3D TYPE_AUDIO_BACKEND, + .instance_size =3D sizeof(AudioMixengBackend), + .instance_init =3D audio_mixeng_backend_init, + .instance_finalize =3D audio_mixeng_backend_finalize, + .class_size =3D sizeof(AudioMixengBackendClass), + .class_init =3D audio_mixeng_backend_class_init, + }, +}; + +DEFINE_TYPES(audio_types) diff --git a/audio/audio.c b/audio/audio.c index 22e55ac9758..6f10ee470ee 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1,1751 +1,55 @@ -/* - * QEMU Audio subsystem - * - * Copyright (c) 2003-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a= copy - * of this software and associated documentation files (the "Software"), t= o deal - * in the Software without restriction, including without limitation the r= ights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included= in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN - * THE SOFTWARE. - */ - -#include "qemu/osdep.h" -#include "qemu/audio.h" -#include "migration/vmstate.h" -#include "qemu/timer.h" -#include "qapi/error.h" -#include "qapi/clone-visitor.h" -#include "qapi/qobject-input-visitor.h" -#include "qapi/qapi-visit-audio.h" -#include "qapi/qapi-commands-audio.h" -#include "qobject/qdict.h" -#include "qemu/bswap.h" -#include "qemu/error-report.h" -#include "qemu/log.h" -#include "qemu/module.h" -#include "qemu/help_option.h" -#include "qom/object.h" -#include "system/system.h" -#include "system/replay.h" -#include "system/runstate.h" -#include "trace.h" - -#define AUDIO_CAP "audio" -#include "audio_int.h" - -/* #define DEBUG_LIVE */ -/* #define DEBUG_OUT */ -/* #define DEBUG_CAPTURE */ -/* #define DEBUG_POLL */ - -#define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" - - -/* Order of CONFIG_AUDIO_DRIVERS is import. - The 1st one is the one used by default, that is the reason - that we generate the list. -*/ -const char *audio_prio_list[] =3D { -#ifdef CONFIG_GIO - "dbus", -#endif - "spice", - CONFIG_AUDIO_DRIVERS - "none", - NULL -}; - -typedef struct AudiodevListEntry { - Audiodev *dev; - QSIMPLEQ_ENTRY(AudiodevListEntry) next; -} AudiodevListEntry; - -typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead; - -static AudiodevListHead audiodevs =3D - QSIMPLEQ_HEAD_INITIALIZER(audiodevs); -static AudiodevListHead default_audiodevs =3D - QSIMPLEQ_HEAD_INITIALIZER(default_audiodevs); - -static AudioBackendClass *audio_be_class_by_name(const char *name) -{ - g_autofree char *tname =3D g_strconcat("audio-", name, NULL); - ObjectClass *oc =3D module_object_class_by_name(tname); - - if (!oc || !object_class_dynamic_cast(oc, TYPE_AUDIO_BACKEND)) { - return NULL; - } - - return AUDIO_BACKEND_CLASS(oc); -} - -static AudioBackend *default_audio_be; - -const struct mixeng_volume nominal_volume =3D { - .mute =3D 0, -#ifdef FLOAT_MIXENG - .r =3D 1.0, - .l =3D 1.0, -#else - .r =3D 1ULL << 32, - .l =3D 1ULL << 32, -#endif -}; - -int audio_bug (const char *funcname, int cond) -{ - if (cond) { - static int shown; - - AUD_log (NULL, "A bug was just triggered in %s\n", funcname); - if (!shown) { - shown =3D 1; - AUD_log (NULL, "Save all your work and restart without audio\n= "); - AUD_log (NULL, "I am sorry\n"); - } - AUD_log (NULL, "Context:\n"); - } - - return cond; -} - -static inline int audio_bits_to_index (int bits) -{ - switch (bits) { - case 8: - return 0; - - case 16: - return 1; - - case 32: - return 2; - - default: - audio_bug ("bits_to_index", 1); - AUD_log (NULL, "invalid bits %d\n", bits); - return 0; - } -} - -void AUD_vlog (const char *cap, const char *fmt, va_list ap) -{ - if (cap) { - fprintf(stderr, "%s: ", cap); - } - - vfprintf(stderr, fmt, ap); -} - -void AUD_log (const char *cap, const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (cap, fmt, ap); - va_end (ap); -} - -static void audio_print_settings (const struct audsettings *as) -{ - dolog ("frequency=3D%d nchannels=3D%d fmt=3D", as->freq, as->nchannels= ); - - switch (as->fmt) { - case AUDIO_FORMAT_S8: - AUD_log (NULL, "S8"); - break; - case AUDIO_FORMAT_U8: - AUD_log (NULL, "U8"); - break; - case AUDIO_FORMAT_S16: - AUD_log (NULL, "S16"); - break; - case AUDIO_FORMAT_U16: - AUD_log (NULL, "U16"); - break; - case AUDIO_FORMAT_S32: - AUD_log (NULL, "S32"); - break; - case AUDIO_FORMAT_U32: - AUD_log (NULL, "U32"); - break; - case AUDIO_FORMAT_F32: - AUD_log (NULL, "F32"); - break; - default: - AUD_log (NULL, "invalid(%d)", as->fmt); - break; - } - - AUD_log (NULL, " endianness=3D"); - switch (as->endianness) { - case 0: - AUD_log (NULL, "little"); - break; - case 1: - AUD_log (NULL, "big"); - break; - default: - AUD_log (NULL, "invalid"); - break; - } - AUD_log (NULL, "\n"); -} - -static int audio_validate_settings (const struct audsettings *as) -{ - int invalid; - - invalid =3D as->nchannels < 1; - invalid |=3D as->endianness !=3D 0 && as->endianness !=3D 1; - - switch (as->fmt) { - case AUDIO_FORMAT_S8: - case AUDIO_FORMAT_U8: - case AUDIO_FORMAT_S16: - case AUDIO_FORMAT_U16: - case AUDIO_FORMAT_S32: - case AUDIO_FORMAT_U32: - case AUDIO_FORMAT_F32: - break; - default: - invalid =3D 1; - break; - } - - invalid |=3D as->freq <=3D 0; - return invalid ? -1 : 0; -} - -static int audio_pcm_info_eq (struct audio_pcm_info *info, const struct au= dsettings *as) -{ - int bits =3D 8; - bool is_signed =3D false, is_float =3D false; - - switch (as->fmt) { - case AUDIO_FORMAT_S8: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U8: - break; - - case AUDIO_FORMAT_S16: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U16: - bits =3D 16; - break; - - case AUDIO_FORMAT_F32: - is_float =3D true; - /* fall through */ - case AUDIO_FORMAT_S32: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U32: - bits =3D 32; - break; - - default: - abort(); - } - return info->freq =3D=3D as->freq - && info->nchannels =3D=3D as->nchannels - && info->is_signed =3D=3D is_signed - && info->is_float =3D=3D is_float - && info->bits =3D=3D bits - && info->swap_endianness =3D=3D (as->endianness !=3D HOST_BIG_ENDI= AN); -} - -void audio_pcm_init_info (struct audio_pcm_info *info, const struct audset= tings *as) -{ - int bits =3D 8, mul; - bool is_signed =3D false, is_float =3D false; - - switch (as->fmt) { - case AUDIO_FORMAT_S8: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U8: - mul =3D 1; - break; - - case AUDIO_FORMAT_S16: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U16: - bits =3D 16; - mul =3D 2; - break; - - case AUDIO_FORMAT_F32: - is_float =3D true; - /* fall through */ - case AUDIO_FORMAT_S32: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U32: - bits =3D 32; - mul =3D 4; - break; - - default: - abort(); - } - - info->freq =3D as->freq; - info->bits =3D bits; - info->is_signed =3D is_signed; - info->is_float =3D is_float; - info->nchannels =3D as->nchannels; - info->bytes_per_frame =3D as->nchannels * mul; - info->bytes_per_second =3D info->freq * info->bytes_per_frame; - info->swap_endianness =3D (as->endianness !=3D HOST_BIG_ENDIAN); -} - -void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int= len) -{ - if (!len) { - return; - } - - if (info->is_signed || info->is_float) { - memset(buf, 0x00, len * info->bytes_per_frame); - } else { - switch (info->bits) { - case 8: - memset(buf, 0x80, len * info->bytes_per_frame); - break; - - case 16: - { - int i; - uint16_t *p =3D buf; - short s =3D INT16_MAX; - - if (info->swap_endianness) { - s =3D bswap16 (s); - } - - for (i =3D 0; i < len * info->nchannels; i++) { - p[i] =3D s; - } - } - break; - - case 32: - { - int i; - uint32_t *p =3D buf; - int32_t s =3D INT32_MAX; - - if (info->swap_endianness) { - s =3D bswap32 (s); - } - - for (i =3D 0; i < len * info->nchannels; i++) { - p[i] =3D s; - } - } - break; - - default: - AUD_log (NULL, "audio_pcm_info_clear_buf: invalid bits %d\n", - info->bits); - break; - } - } -} - -/* - * Capture - */ -static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioMixengBackend= *s, - struct audsettings= *as) -{ - CaptureVoiceOut *cap; - - for (cap =3D s->cap_head.lh_first; cap; cap =3D cap->entries.le_next) { - if (audio_pcm_info_eq (&cap->hw.info, as)) { - return cap; - } - } - return NULL; -} - -static void audio_notify_capture (CaptureVoiceOut *cap, audcnotification_e= cmd) -{ - struct capture_callback *cb; - -#ifdef DEBUG_CAPTURE - dolog ("notification %d sent\n", cmd); -#endif - for (cb =3D cap->cb_head.lh_first; cb; cb =3D cb->entries.le_next) { - cb->ops.notify (cb->opaque, cmd); - } -} - -static void audio_capture_maybe_changed(CaptureVoiceOut *cap, bool enabled) -{ - if (cap->hw.enabled !=3D enabled) { - audcnotification_e cmd; - cap->hw.enabled =3D enabled; - cmd =3D enabled ? AUD_CNOTIFY_ENABLE : AUD_CNOTIFY_DISABLE; - audio_notify_capture (cap, cmd); - } -} - -static void audio_recalc_and_notify_capture (CaptureVoiceOut *cap) -{ - HWVoiceOut *hw =3D &cap->hw; - SWVoiceOut *sw; - bool enabled =3D false; - - for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { - if (sw->active) { - enabled =3D true; - break; - } - } - audio_capture_maybe_changed (cap, enabled); -} - -static void audio_detach_capture (HWVoiceOut *hw) -{ - SWVoiceCap *sc =3D hw->cap_head.lh_first; - - while (sc) { - SWVoiceCap *sc1 =3D sc->entries.le_next; - SWVoiceOut *sw =3D &sc->sw; - CaptureVoiceOut *cap =3D sc->cap; - int was_active =3D sw->active; - - if (sw->rate) { - st_rate_stop (sw->rate); - sw->rate =3D NULL; - } - - QLIST_REMOVE (sw, entries); - QLIST_REMOVE (sc, entries); - g_free (sc); - if (was_active) { - /* We have removed soft voice from the capture: - this might have changed the overall status of the capture - since this might have been the only active voice */ - audio_recalc_and_notify_capture (cap); - } - sc =3D sc1; - } -} - -static int audio_attach_capture (HWVoiceOut *hw) -{ - AudioMixengBackend *s =3D hw->s; - CaptureVoiceOut *cap; - - audio_detach_capture (hw); - for (cap =3D s->cap_head.lh_first; cap; cap =3D cap->entries.le_next) { - SWVoiceCap *sc; - SWVoiceOut *sw; - HWVoiceOut *hw_cap =3D &cap->hw; - - sc =3D g_malloc0(sizeof(*sc)); - - sc->cap =3D cap; - sw =3D &sc->sw; - sw->hw =3D hw_cap; - sw->info =3D hw->info; - sw->empty =3D true; - sw->active =3D hw->enabled; - sw->vol =3D nominal_volume; - sw->rate =3D st_rate_start (sw->info.freq, hw_cap->info.freq); - QLIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); - QLIST_INSERT_HEAD (&hw->cap_head, sc, entries); -#ifdef DEBUG_CAPTURE - sw->name =3D g_strdup_printf ("for %p %d,%d,%d", - hw, sw->info.freq, sw->info.bits, - sw->info.nchannels); - dolog ("Added %s active =3D %d\n", sw->name, sw->active); -#endif - if (sw->active) { - audio_capture_maybe_changed (cap, 1); - } - } - return 0; -} - -/* - * Hard voice (capture) - */ -static size_t audio_pcm_hw_find_min_in (HWVoiceIn *hw) -{ - SWVoiceIn *sw; - size_t m =3D hw->total_samples_captured; - - for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { - if (sw->active) { - m =3D MIN (m, sw->total_hw_samples_acquired); - } - } - return m; -} - -static size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw) -{ - size_t live =3D hw->total_samples_captured - audio_pcm_hw_find_min_in = (hw); - if (audio_bug(__func__, live > hw->conv_buf.size)) { - dolog("live=3D%zu hw->conv_buf.size=3D%zu\n", live, hw->conv_buf.s= ize); - return 0; - } - return live; -} - -static size_t audio_pcm_hw_conv_in(HWVoiceIn *hw, void *pcm_buf, size_t sa= mples) -{ - size_t conv =3D 0; - STSampleBuffer *conv_buf =3D &hw->conv_buf; - - while (samples) { - uint8_t *src =3D advance(pcm_buf, conv * hw->info.bytes_per_frame); - size_t proc =3D MIN(samples, conv_buf->size - conv_buf->pos); - - hw->conv(conv_buf->buffer + conv_buf->pos, src, proc); - conv_buf->pos =3D (conv_buf->pos + proc) % conv_buf->size; - samples -=3D proc; - conv +=3D proc; - } - - return conv; -} - -/* - * Soft voice (capture) - */ -static void audio_pcm_sw_resample_in(SWVoiceIn *sw, - size_t frames_in_max, size_t frames_out_max, - size_t *total_in, size_t *total_out) -{ - HWVoiceIn *hw =3D sw->hw; - struct st_sample *src, *dst; - size_t live, rpos, frames_in, frames_out; - - live =3D hw->total_samples_captured - sw->total_hw_samples_acquired; - rpos =3D audio_ring_posb(hw->conv_buf.pos, live, hw->conv_buf.size); - - /* resample conv_buf from rpos to end of buffer */ - src =3D hw->conv_buf.buffer + rpos; - frames_in =3D MIN(frames_in_max, hw->conv_buf.size - rpos); - dst =3D sw->resample_buf.buffer; - frames_out =3D frames_out_max; - st_rate_flow(sw->rate, src, dst, &frames_in, &frames_out); - rpos +=3D frames_in; - *total_in =3D frames_in; - *total_out =3D frames_out; - - /* resample conv_buf from start of buffer if there are input frames le= ft */ - if (frames_in_max - frames_in && rpos =3D=3D hw->conv_buf.size) { - src =3D hw->conv_buf.buffer; - frames_in =3D frames_in_max - frames_in; - dst +=3D frames_out; - frames_out =3D frames_out_max - frames_out; - st_rate_flow(sw->rate, src, dst, &frames_in, &frames_out); - *total_in +=3D frames_in; - *total_out +=3D frames_out; - } -} - -static size_t audio_pcm_sw_read(SWVoiceIn *sw, void *buf, size_t buf_len) -{ - HWVoiceIn *hw =3D sw->hw; - size_t live, frames_out_max, total_in, total_out; - - live =3D hw->total_samples_captured - sw->total_hw_samples_acquired; - if (!live) { - return 0; - } - if (audio_bug(__func__, live > hw->conv_buf.size)) { - dolog("live_in=3D%zu hw->conv_buf.size=3D%zu\n", live, hw->conv_bu= f.size); - return 0; - } - - frames_out_max =3D MIN(buf_len / sw->info.bytes_per_frame, - sw->resample_buf.size); - - audio_pcm_sw_resample_in(sw, live, frames_out_max, &total_in, &total_o= ut); - - if (!hw->pcm_ops->volume_in) { - mixeng_volume(sw->resample_buf.buffer, total_out, &sw->vol); - } - sw->clip(buf, sw->resample_buf.buffer, total_out); - - sw->total_hw_samples_acquired +=3D total_in; - return total_out * sw->info.bytes_per_frame; -} - -/* - * Hard voice (playback) - */ -static size_t audio_pcm_hw_find_min_out (HWVoiceOut *hw, int *nb_livep) -{ - SWVoiceOut *sw; - size_t m =3D SIZE_MAX; - int nb_live =3D 0; - - for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { - if (sw->active || !sw->empty) { - m =3D MIN (m, sw->total_hw_samples_mixed); - nb_live +=3D 1; - } - } - - *nb_livep =3D nb_live; - return m; -} - -static size_t audio_pcm_hw_get_live_out (HWVoiceOut *hw, int *nb_live) -{ - size_t smin; - int nb_live1; - - smin =3D audio_pcm_hw_find_min_out (hw, &nb_live1); - if (nb_live) { - *nb_live =3D nb_live1; - } - - if (nb_live1) { - size_t live =3D smin; - - if (audio_bug(__func__, live > hw->mix_buf.size)) { - dolog("live=3D%zu hw->mix_buf.size=3D%zu\n", live, hw->mix_buf= .size); - return 0; - } - return live; - } - return 0; -} - -static size_t audio_pcm_hw_get_free(HWVoiceOut *hw) -{ - return (hw->pcm_ops->buffer_get_free ? hw->pcm_ops->buffer_get_free(hw= ) : - INT_MAX) / hw->info.bytes_per_frame; -} - -static void audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf, size_t le= n) -{ - size_t clipped =3D 0; - size_t pos =3D hw->mix_buf.pos; - - while (len) { - st_sample *src =3D hw->mix_buf.buffer + pos; - uint8_t *dst =3D advance(pcm_buf, clipped * hw->info.bytes_per_fra= me); - size_t samples_till_end_of_buf =3D hw->mix_buf.size - pos; - size_t samples_to_clip =3D MIN(len, samples_till_end_of_buf); - - hw->clip(dst, src, samples_to_clip); - - pos =3D (pos + samples_to_clip) % hw->mix_buf.size; - len -=3D samples_to_clip; - clipped +=3D samples_to_clip; - } -} - -/* - * Soft voice (playback) - */ -static void audio_pcm_sw_resample_out(SWVoiceOut *sw, - size_t frames_in_max, size_t frames_out_max, - size_t *total_in, size_t *total_out) -{ - HWVoiceOut *hw =3D sw->hw; - struct st_sample *src, *dst; - size_t live, wpos, frames_in, frames_out; - - live =3D sw->total_hw_samples_mixed; - wpos =3D (hw->mix_buf.pos + live) % hw->mix_buf.size; - - /* write to mix_buf from wpos to end of buffer */ - src =3D sw->resample_buf.buffer; - frames_in =3D frames_in_max; - dst =3D hw->mix_buf.buffer + wpos; - frames_out =3D MIN(frames_out_max, hw->mix_buf.size - wpos); - st_rate_flow_mix(sw->rate, src, dst, &frames_in, &frames_out); - wpos +=3D frames_out; - *total_in =3D frames_in; - *total_out =3D frames_out; - - /* write to mix_buf from start of buffer if there are input frames lef= t */ - if (frames_in_max - frames_in > 0 && wpos =3D=3D hw->mix_buf.size) { - src +=3D frames_in; - frames_in =3D frames_in_max - frames_in; - dst =3D hw->mix_buf.buffer; - frames_out =3D frames_out_max - frames_out; - st_rate_flow_mix(sw->rate, src, dst, &frames_in, &frames_out); - *total_in +=3D frames_in; - *total_out +=3D frames_out; - } -} - -static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *buf, size_t buf_len) -{ - HWVoiceOut *hw =3D sw->hw; - size_t live, dead, hw_free, sw_max, fe_max; - size_t frames_in_max, frames_out_max, total_in, total_out; - - live =3D sw->total_hw_samples_mixed; - if (audio_bug(__func__, live > hw->mix_buf.size)) { - dolog("live=3D%zu hw->mix_buf.size=3D%zu\n", live, hw->mix_buf.siz= e); - return 0; - } - - if (live =3D=3D hw->mix_buf.size) { -#ifdef DEBUG_OUT - dolog ("%s is full %zu\n", sw->name, live); -#endif - return 0; - } - - dead =3D hw->mix_buf.size - live; - hw_free =3D audio_pcm_hw_get_free(hw); - hw_free =3D hw_free > live ? hw_free - live : 0; - frames_out_max =3D MIN(dead, hw_free); - sw_max =3D st_rate_frames_in(sw->rate, frames_out_max); - fe_max =3D MIN(buf_len / sw->info.bytes_per_frame + sw->resample_buf.p= os, - sw->resample_buf.size); - frames_in_max =3D MIN(sw_max, fe_max); - - if (!frames_in_max) { - return 0; - } - - if (frames_in_max > sw->resample_buf.pos) { - sw->conv(sw->resample_buf.buffer + sw->resample_buf.pos, - buf, frames_in_max - sw->resample_buf.pos); - if (!sw->hw->pcm_ops->volume_out) { - mixeng_volume(sw->resample_buf.buffer + sw->resample_buf.pos, - frames_in_max - sw->resample_buf.pos, &sw->vol); - } - } - - audio_pcm_sw_resample_out(sw, frames_in_max, frames_out_max, - &total_in, &total_out); - - sw->total_hw_samples_mixed +=3D total_out; - sw->empty =3D sw->total_hw_samples_mixed =3D=3D 0; - - /* - * Upsampling may leave one audio frame in the resample buffer. Decrem= ent - * total_in by one if there was a leftover frame from the previous res= ample - * pass in the resample buffer. Increment total_in by one if the curre= nt - * resample pass left one frame in the resample buffer. - */ - if (frames_in_max - total_in =3D=3D 1) { - /* copy one leftover audio frame to the beginning of the buffer */ - *sw->resample_buf.buffer =3D *(sw->resample_buf.buffer + total_in); - total_in +=3D 1 - sw->resample_buf.pos; - sw->resample_buf.pos =3D 1; - } else if (total_in >=3D sw->resample_buf.pos) { - total_in -=3D sw->resample_buf.pos; - sw->resample_buf.pos =3D 0; - } - -#ifdef DEBUG_OUT - dolog ( - "%s: write size %zu written %zu total mixed %zu\n", - SW_NAME(sw), - buf_len / sw->info.bytes_per_frame, - total_in, - sw->total_hw_samples_mixed - ); -#endif - - return total_in * sw->info.bytes_per_frame; -} - -#ifdef DEBUG_AUDIO -static void audio_pcm_print_info (const char *cap, struct audio_pcm_info *= info) -{ - dolog("%s: bits %d, sign %d, float %d, freq %d, nchan %d\n", - cap, info->bits, info->is_signed, info->is_float, info->freq, - info->nchannels); -} -#endif - -#define DAC -#include "audio_template.h" -#undef DAC -#include "audio_template.h" - -/* - * Timer - */ -static int audio_is_timer_needed(AudioMixengBackend *s) -{ - HWVoiceIn *hwi =3D NULL; - HWVoiceOut *hwo =3D NULL; - - while ((hwo =3D audio_pcm_hw_find_any_enabled_out(s, hwo))) { - if (!hwo->poll_mode) { - return 1; - } - } - while ((hwi =3D audio_pcm_hw_find_any_enabled_in(s, hwi))) { - if (!hwi->poll_mode) { - return 1; - } - } - return 0; -} - -static void audio_reset_timer(AudioMixengBackend *s) -{ - if (audio_is_timer_needed(s)) { - timer_mod_anticipate_ns(s->ts, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + s->period_ticks); - if (!s->timer_running) { - s->timer_running =3D true; - s->timer_last =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - trace_audio_timer_start(s->period_ticks / SCALE_MS); - } - } else { - timer_del(s->ts); - if (s->timer_running) { - s->timer_running =3D false; - trace_audio_timer_stop(); - } - } -} - -static void audio_timer (void *opaque) -{ - int64_t now, diff; - AudioMixengBackend *s =3D opaque; - - now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - diff =3D now - s->timer_last; - if (diff > s->period_ticks * 3 / 2) { - trace_audio_timer_delayed(diff / SCALE_MS); - } - s->timer_last =3D now; - - audio_run(s, "timer"); - audio_reset_timer(s); -} - -/* - * Public API - */ -static size_t audio_mixeng_backend_write(AudioBackend *be, SWVoiceOut *sw, - void *buf, size_t size) -{ - HWVoiceOut *hw; - - if (!sw) { - /* XXX: Consider options */ - return size; - } - hw =3D sw->hw; - - if (!hw->enabled) { - dolog("Writing to disabled voice %s\n", SW_NAME(sw)); - return 0; - } - - if (audio_get_pdo_out(hw->s->dev)->mixing_engine) { - return audio_pcm_sw_write(sw, buf, size); - } else { - return hw->pcm_ops->write(hw, buf, size); - } -} - -static size_t audio_mixeng_backend_read(AudioBackend *be, - SWVoiceIn *sw, void *buf, size_t s= ize) -{ - HWVoiceIn *hw; - - if (!sw) { - /* XXX: Consider options */ - return size; - } - hw =3D sw->hw; - - if (!hw->enabled) { - dolog("Reading from disabled voice %s\n", SW_NAME(sw)); - return 0; - } - - if (audio_get_pdo_in(hw->s->dev)->mixing_engine) { - return audio_pcm_sw_read(sw, buf, size); - } else { - return hw->pcm_ops->read(hw, buf, size); - } - -} - -static int audio_mixeng_backend_get_buffer_size_out(AudioBackend *be, SWVo= iceOut *sw) -{ - if (!sw) { - return 0; - } - - if (audio_get_pdo_out(sw->s->dev)->mixing_engine) { - return sw->resample_buf.size * sw->info.bytes_per_frame; - } - - return sw->hw->samples * sw->hw->info.bytes_per_frame; -} - -static void audio_mixeng_backend_set_active_out(AudioBackend *be, SWVoiceO= ut *sw, - bool on) -{ - HWVoiceOut *hw; - - if (!sw) { - return; - } - - hw =3D sw->hw; - if (sw->active !=3D on) { - AudioMixengBackend *s =3D sw->s; - SWVoiceOut *temp_sw; - SWVoiceCap *sc; - - if (on) { - hw->pending_disable =3D 0; - if (!hw->enabled) { - hw->enabled =3D true; - if (runstate_is_running()) { - if (hw->pcm_ops->enable_out) { - hw->pcm_ops->enable_out(hw, true); - } - audio_reset_timer (s); - } - } - } else { - if (hw->enabled) { - int nb_active =3D 0; - - for (temp_sw =3D hw->sw_head.lh_first; temp_sw; - temp_sw =3D temp_sw->entries.le_next) { - nb_active +=3D temp_sw->active !=3D 0; - } - - hw->pending_disable =3D nb_active =3D=3D 1; - } - } - - for (sc =3D hw->cap_head.lh_first; sc; sc =3D sc->entries.le_next)= { - sc->sw.active =3D hw->enabled; - if (hw->enabled) { - audio_capture_maybe_changed (sc->cap, 1); - } - } - sw->active =3D on; - } - -} - -static void audio_mixeng_backend_set_active_in(AudioBackend *be, SWVoiceIn= *sw, bool on) -{ - HWVoiceIn *hw; - - if (!sw) { - return; - } - - hw =3D sw->hw; - if (sw->active !=3D on) { - AudioMixengBackend *s =3D sw->s; - SWVoiceIn *temp_sw; - - if (on) { - if (!hw->enabled) { - hw->enabled =3D true; - if (runstate_is_running()) { - if (hw->pcm_ops->enable_in) { - hw->pcm_ops->enable_in(hw, true); - } - audio_reset_timer (s); - } - } - sw->total_hw_samples_acquired =3D hw->total_samples_captured; - } else { - if (hw->enabled) { - int nb_active =3D 0; - - for (temp_sw =3D hw->sw_head.lh_first; temp_sw; - temp_sw =3D temp_sw->entries.le_next) { - nb_active +=3D temp_sw->active !=3D 0; - } - - if (nb_active =3D=3D 1) { - hw->enabled =3D false; - if (hw->pcm_ops->enable_in) { - hw->pcm_ops->enable_in(hw, false); - } - } - } - } - sw->active =3D on; - } -} - -static size_t audio_get_avail(SWVoiceIn *sw) -{ - size_t live; - - if (!sw) { - return 0; - } - - live =3D sw->hw->total_samples_captured - sw->total_hw_samples_acquire= d; - if (audio_bug(__func__, live > sw->hw->conv_buf.size)) { - dolog("live=3D%zu sw->hw->conv_buf.size=3D%zu\n", live, - sw->hw->conv_buf.size); - return 0; - } - - ldebug ( - "%s: get_avail live %zu frontend frames %u\n", - SW_NAME (sw), - live, st_rate_frames_out(sw->rate, live) - ); - - return live; -} - -static size_t audio_get_free(SWVoiceOut *sw) -{ - size_t live, dead; - - if (!sw) { - return 0; - } - - live =3D sw->total_hw_samples_mixed; - - if (audio_bug(__func__, live > sw->hw->mix_buf.size)) { - dolog("live=3D%zu sw->hw->mix_buf.size=3D%zu\n", live, - sw->hw->mix_buf.size); - return 0; - } - - dead =3D sw->hw->mix_buf.size - live; - -#ifdef DEBUG_OUT - dolog("%s: get_free live %zu dead %zu frontend frames %u\n", - SW_NAME(sw), live, dead, st_rate_frames_in(sw->rate, dead)); -#endif - - return dead; -} - -static void audio_capture_mix_and_clear(HWVoiceOut *hw, size_t rpos, - size_t samples) -{ - size_t n; - - if (hw->enabled) { - SWVoiceCap *sc; - - for (sc =3D hw->cap_head.lh_first; sc; sc =3D sc->entries.le_next)= { - SWVoiceOut *sw =3D &sc->sw; - size_t rpos2 =3D rpos; - - n =3D samples; - while (n) { - size_t till_end_of_hw =3D hw->mix_buf.size - rpos2; - size_t to_read =3D MIN(till_end_of_hw, n); - size_t live, frames_in, frames_out; - - sw->resample_buf.buffer =3D hw->mix_buf.buffer + rpos2; - sw->resample_buf.size =3D to_read; - live =3D sw->total_hw_samples_mixed; - - audio_pcm_sw_resample_out(sw, - to_read, sw->hw->mix_buf.size - = live, - &frames_in, &frames_out); - - sw->total_hw_samples_mixed +=3D frames_out; - sw->empty =3D sw->total_hw_samples_mixed =3D=3D 0; - - if (to_read - frames_in) { - dolog("Could not mix %zu frames into a capture " - "buffer, mixed %zu\n", - to_read, frames_in); - break; - } - n -=3D to_read; - rpos2 =3D (rpos2 + to_read) % hw->mix_buf.size; - } - } - } - - n =3D MIN(samples, hw->mix_buf.size - rpos); - mixeng_clear(hw->mix_buf.buffer + rpos, n); - mixeng_clear(hw->mix_buf.buffer, samples - n); -} - -static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live) -{ - size_t clipped =3D 0; - - while (live) { - size_t size =3D live * hw->info.bytes_per_frame; - size_t decr, proc; - void *buf =3D hw->pcm_ops->get_buffer_out(hw, &size); - - if (size =3D=3D 0) { - break; - } - - decr =3D MIN(size / hw->info.bytes_per_frame, live); - if (buf) { - audio_pcm_hw_clip_out(hw, buf, decr); - } - proc =3D hw->pcm_ops->put_buffer_out(hw, buf, - decr * hw->info.bytes_per_frame= ) / - hw->info.bytes_per_frame; - - live -=3D proc; - clipped +=3D proc; - hw->mix_buf.pos =3D (hw->mix_buf.pos + proc) % hw->mix_buf.size; - - if (proc =3D=3D 0 || proc < decr) { - break; - } - } - - if (hw->pcm_ops->run_buffer_out) { - hw->pcm_ops->run_buffer_out(hw); - } - - return clipped; -} - -static void audio_run_out(AudioMixengBackend *s) -{ - HWVoiceOut *hw =3D NULL; - SWVoiceOut *sw; - - while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) { - size_t played, live, prev_rpos; - size_t hw_free =3D audio_pcm_hw_get_free(hw); - int nb_live; - - if (!audio_get_pdo_out(s->dev)->mixing_engine) { - /* there is exactly 1 sw for each hw with no mixeng */ - sw =3D hw->sw_head.lh_first; - - if (hw->pending_disable) { - hw->enabled =3D false; - hw->pending_disable =3D false; - if (hw->pcm_ops->enable_out) { - hw->pcm_ops->enable_out(hw, false); - } - } - - if (sw->active) { - sw->callback.fn(sw->callback.opaque, - hw_free * sw->info.bytes_per_frame); - } - - if (hw->pcm_ops->run_buffer_out) { - hw->pcm_ops->run_buffer_out(hw); - } - - continue; - } - - for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { - if (sw->active) { - size_t sw_free =3D audio_get_free(sw); - size_t free; - - if (hw_free > sw->total_hw_samples_mixed) { - free =3D st_rate_frames_in(sw->rate, - MIN(sw_free, hw_free - sw->total_hw_samples_mixed)= ); - } else { - free =3D 0; - } - if (free > sw->resample_buf.pos) { - free =3D MIN(free, sw->resample_buf.size) - - sw->resample_buf.pos; - sw->callback.fn(sw->callback.opaque, - free * sw->info.bytes_per_frame); - } - } - } - - live =3D audio_pcm_hw_get_live_out (hw, &nb_live); - if (!nb_live) { - live =3D 0; - } - - if (audio_bug(__func__, live > hw->mix_buf.size)) { - dolog("live=3D%zu hw->mix_buf.size=3D%zu\n", live, hw->mix_buf= .size); - continue; - } - - if (hw->pending_disable && !nb_live) { - SWVoiceCap *sc; -#ifdef DEBUG_OUT - dolog ("Disabling voice\n"); -#endif - hw->enabled =3D false; - hw->pending_disable =3D false; - if (hw->pcm_ops->enable_out) { - hw->pcm_ops->enable_out(hw, false); - } - for (sc =3D hw->cap_head.lh_first; sc; sc =3D sc->entries.le_n= ext) { - sc->sw.active =3D false; - audio_recalc_and_notify_capture (sc->cap); - } - continue; - } - - if (!live) { - if (hw->pcm_ops->run_buffer_out) { - hw->pcm_ops->run_buffer_out(hw); - } - continue; - } - - prev_rpos =3D hw->mix_buf.pos; - played =3D audio_pcm_hw_run_out(hw, live); - replay_audio_out(&played); - if (audio_bug(__func__, hw->mix_buf.pos >=3D hw->mix_buf.size)) { - dolog("hw->mix_buf.pos=3D%zu hw->mix_buf.size=3D%zu played=3D%= zu\n", - hw->mix_buf.pos, hw->mix_buf.size, played); - hw->mix_buf.pos =3D 0; - } - -#ifdef DEBUG_OUT - dolog("played=3D%zu\n", played); -#endif - - if (played) { - audio_capture_mix_and_clear (hw, prev_rpos, played); - } - - for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { - if (!sw->active && sw->empty) { - continue; - } - - if (audio_bug(__func__, played > sw->total_hw_samples_mixed)) { - dolog("played=3D%zu sw->total_hw_samples_mixed=3D%zu\n", - played, sw->total_hw_samples_mixed); - played =3D sw->total_hw_samples_mixed; - } - - sw->total_hw_samples_mixed -=3D played; - - if (!sw->total_hw_samples_mixed) { - sw->empty =3D true; - } - } - } -} - -static size_t audio_pcm_hw_run_in(HWVoiceIn *hw, size_t samples) -{ - size_t conv =3D 0; - - if (hw->pcm_ops->run_buffer_in) { - hw->pcm_ops->run_buffer_in(hw); - } - - while (samples) { - size_t proc; - size_t size =3D samples * hw->info.bytes_per_frame; - void *buf =3D hw->pcm_ops->get_buffer_in(hw, &size); - - assert(size % hw->info.bytes_per_frame =3D=3D 0); - if (size =3D=3D 0) { - break; - } - - proc =3D audio_pcm_hw_conv_in(hw, buf, size / hw->info.bytes_per_f= rame); - - samples -=3D proc; - conv +=3D proc; - hw->pcm_ops->put_buffer_in(hw, buf, proc * hw->info.bytes_per_fram= e); - } - - return conv; -} - -static void audio_run_in(AudioMixengBackend *s) -{ - HWVoiceIn *hw =3D NULL; - - if (!audio_get_pdo_in(s->dev)->mixing_engine) { - while ((hw =3D audio_pcm_hw_find_any_enabled_in(s, hw))) { - /* there is exactly 1 sw for each hw with no mixeng */ - SWVoiceIn *sw =3D hw->sw_head.lh_first; - if (sw->active) { - sw->callback.fn(sw->callback.opaque, INT_MAX); - } - } - return; - } - - while ((hw =3D audio_pcm_hw_find_any_enabled_in(s, hw))) { - SWVoiceIn *sw; - size_t captured =3D 0, min; - int pos; - - if (replay_mode !=3D REPLAY_MODE_PLAY) { - captured =3D audio_pcm_hw_run_in( - hw, hw->conv_buf.size - audio_pcm_hw_get_live_in(hw)); - } - - replay_audio_in_start(&captured); - assert(captured <=3D hw->conv_buf.size); - if (replay_mode =3D=3D REPLAY_MODE_PLAY) { - hw->conv_buf.pos =3D (hw->conv_buf.pos + captured) % hw->conv_= buf.size; - } - for (pos =3D (hw->conv_buf.pos - captured + hw->conv_buf.size) % h= w->conv_buf.size; - pos !=3D hw->conv_buf.pos; - pos =3D (pos + 1) % hw->conv_buf.size) { - uint64_t left, right; - - if (replay_mode =3D=3D REPLAY_MODE_RECORD) { - audio_sample_to_uint64(hw->conv_buf.buffer, pos, &left= , &right); - } - replay_audio_in_sample_lr(&left, &right); - if (replay_mode =3D=3D REPLAY_MODE_PLAY) { - audio_sample_from_uint64(hw->conv_buf.buffer, pos, lef= t, right); - } - } - replay_audio_in_finish(); - - min =3D audio_pcm_hw_find_min_in (hw); - hw->total_samples_captured +=3D captured - min; - - for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { - sw->total_hw_samples_acquired -=3D min; - - if (sw->active) { - size_t sw_avail =3D audio_get_avail(sw); - size_t avail; - - avail =3D st_rate_frames_out(sw->rate, sw_avail); - if (avail > 0) { - avail =3D MIN(avail, sw->resample_buf.size); - sw->callback.fn(sw->callback.opaque, - avail * sw->info.bytes_per_frame); - } - } - } - } -} - -static void audio_run_capture(AudioMixengBackend *s) -{ - CaptureVoiceOut *cap; - - for (cap =3D s->cap_head.lh_first; cap; cap =3D cap->entries.le_next) { - size_t live, rpos, captured; - HWVoiceOut *hw =3D &cap->hw; - SWVoiceOut *sw; - - captured =3D live =3D audio_pcm_hw_get_live_out (hw, NULL); - rpos =3D hw->mix_buf.pos; - while (live) { - size_t left =3D hw->mix_buf.size - rpos; - size_t to_capture =3D MIN(live, left); - struct st_sample *src; - struct capture_callback *cb; - - src =3D hw->mix_buf.buffer + rpos; - hw->clip (cap->buf, src, to_capture); - mixeng_clear (src, to_capture); - - for (cb =3D cap->cb_head.lh_first; cb; cb =3D cb->entries.le_n= ext) { - cb->ops.capture (cb->opaque, cap->buf, - to_capture * hw->info.bytes_per_frame); - } - rpos =3D (rpos + to_capture) % hw->mix_buf.size; - live -=3D to_capture; - } - hw->mix_buf.pos =3D rpos; - - for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { - if (!sw->active && sw->empty) { - continue; - } - - if (audio_bug(__func__, captured > sw->total_hw_samples_mixed)= ) { - dolog("captured=3D%zu sw->total_hw_samples_mixed=3D%zu\n", - captured, sw->total_hw_samples_mixed); - captured =3D sw->total_hw_samples_mixed; - } - - sw->total_hw_samples_mixed -=3D captured; - sw->empty =3D sw->total_hw_samples_mixed =3D=3D 0; - } - } -} - -void audio_run(AudioMixengBackend *s, const char *msg) -{ - audio_run_out(s); - audio_run_in(s); - audio_run_capture(s); - -#ifdef DEBUG_POLL - { - static double prevtime; - double currtime; - struct timeval tv; - - if (gettimeofday (&tv, NULL)) { - perror ("audio_run: gettimeofday"); - return; - } - - currtime =3D tv.tv_sec + tv.tv_usec * 1e-6; - dolog ("Elapsed since last %s: %f\n", msg, currtime - prevtime); - prevtime =3D currtime; - } -#endif -} - -void audio_generic_run_buffer_in(HWVoiceIn *hw) -{ - if (unlikely(!hw->buf_emul)) { - hw->size_emul =3D hw->samples * hw->info.bytes_per_frame; - hw->buf_emul =3D g_malloc(hw->size_emul); - hw->pos_emul =3D hw->pending_emul =3D 0; - } - - while (hw->pending_emul < hw->size_emul) { - size_t read_len =3D MIN(hw->size_emul - hw->pos_emul, - hw->size_emul - hw->pending_emul); - size_t read =3D hw->pcm_ops->read(hw, hw->buf_emul + hw->pos_emul, - read_len); - hw->pending_emul +=3D read; - hw->pos_emul =3D (hw->pos_emul + read) % hw->size_emul; - if (read < read_len) { - break; - } - } -} - -void *audio_generic_get_buffer_in(HWVoiceIn *hw, size_t *size) -{ - size_t start; - - start =3D audio_ring_posb(hw->pos_emul, hw->pending_emul, hw->size_emu= l); - assert(start < hw->size_emul); - - *size =3D MIN(*size, hw->pending_emul); - *size =3D MIN(*size, hw->size_emul - start); - return hw->buf_emul + start; -} - -void audio_generic_put_buffer_in(HWVoiceIn *hw, void *buf, size_t size) -{ - assert(size <=3D hw->pending_emul); - hw->pending_emul -=3D size; -} - -size_t audio_generic_buffer_get_free(HWVoiceOut *hw) -{ - if (hw->buf_emul) { - return hw->size_emul - hw->pending_emul; - } else { - return hw->samples * hw->info.bytes_per_frame; - } -} - -void audio_generic_run_buffer_out(HWVoiceOut *hw) -{ - while (hw->pending_emul) { - size_t write_len, written, start; - - start =3D audio_ring_posb(hw->pos_emul, hw->pending_emul, hw->size= _emul); - assert(start < hw->size_emul); - - write_len =3D MIN(hw->pending_emul, hw->size_emul - start); - - written =3D hw->pcm_ops->write(hw, hw->buf_emul + start, write_len= ); - hw->pending_emul -=3D written; - - if (written < write_len) { - break; - } - } -} - -void *audio_generic_get_buffer_out(HWVoiceOut *hw, size_t *size) -{ - if (unlikely(!hw->buf_emul)) { - hw->size_emul =3D hw->samples * hw->info.bytes_per_frame; - hw->buf_emul =3D g_malloc(hw->size_emul); - hw->pos_emul =3D hw->pending_emul =3D 0; - } - - *size =3D MIN(hw->size_emul - hw->pending_emul, - hw->size_emul - hw->pos_emul); - return hw->buf_emul + hw->pos_emul; -} - -size_t audio_generic_put_buffer_out(HWVoiceOut *hw, void *buf, size_t size) -{ - assert(buf =3D=3D hw->buf_emul + hw->pos_emul && - size + hw->pending_emul <=3D hw->size_emul); - - hw->pending_emul +=3D size; - hw->pos_emul =3D (hw->pos_emul + size) % hw->size_emul; - - return size; -} - -size_t audio_generic_write(HWVoiceOut *hw, void *buf, size_t size) -{ - size_t total =3D 0; - - if (hw->pcm_ops->buffer_get_free) { - size_t free =3D hw->pcm_ops->buffer_get_free(hw); - - size =3D MIN(size, free); - } - - while (total < size) { - size_t dst_size =3D size - total; - size_t copy_size, proc; - void *dst =3D hw->pcm_ops->get_buffer_out(hw, &dst_size); - - if (dst_size =3D=3D 0) { - break; - } - - copy_size =3D MIN(size - total, dst_size); - if (dst) { - memcpy(dst, (char *)buf + total, copy_size); - } - proc =3D hw->pcm_ops->put_buffer_out(hw, dst, copy_size); - total +=3D proc; - - if (proc =3D=3D 0 || proc < copy_size) { - break; - } - } - - return total; -} - -size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size) -{ - size_t total =3D 0; - - if (hw->pcm_ops->run_buffer_in) { - hw->pcm_ops->run_buffer_in(hw); - } - - while (total < size) { - size_t src_size =3D size - total; - void *src =3D hw->pcm_ops->get_buffer_in(hw, &src_size); - - if (src_size =3D=3D 0) { - break; - } - - memcpy((char *)buf + total, src, src_size); - hw->pcm_ops->put_buffer_in(hw, src, src_size); - total +=3D src_size; - } - - return total; -} - -static bool audio_mixeng_backend_realize(AudioBackend *abe, - Audiodev *dev, Error **errp) -{ - AudioMixengBackend *be =3D AUDIO_MIXENG_BACKEND(abe); - audio_driver *drv =3D AUDIO_MIXENG_BACKEND_GET_CLASS(be)->driver; - - be->dev =3D dev; - be->drv_opaque =3D drv->init(be->dev, errp); - if (!be->drv_opaque) { - return false; - } - - if (!drv->pcm_ops->get_buffer_in) { - drv->pcm_ops->get_buffer_in =3D audio_generic_get_buffer_in; - drv->pcm_ops->put_buffer_in =3D audio_generic_put_buffer_in; - } - if (!drv->pcm_ops->get_buffer_out) { - drv->pcm_ops->get_buffer_out =3D audio_generic_get_buffer_out; - drv->pcm_ops->put_buffer_out =3D audio_generic_put_buffer_out; - } - - audio_init_nb_voices_out(be, drv, 1); - audio_init_nb_voices_in(be, drv, 0); - be->drv =3D drv; - - if (be->dev->timer_period <=3D 0) { - be->period_ticks =3D 1; - } else { - be->period_ticks =3D be->dev->timer_period * (int64_t)SCALE_US; - } - - return true; -} - -static void audio_vm_change_state_handler (void *opaque, bool running, - RunState state) -{ - AudioMixengBackend *s =3D opaque; - HWVoiceOut *hwo =3D NULL; - HWVoiceIn *hwi =3D NULL; - - while ((hwo =3D audio_pcm_hw_find_any_enabled_out(s, hwo))) { - if (hwo->pcm_ops->enable_out) { - hwo->pcm_ops->enable_out(hwo, running); - } - } - - while ((hwi =3D audio_pcm_hw_find_any_enabled_in(s, hwi))) { - if (hwi->pcm_ops->enable_in) { - hwi->pcm_ops->enable_in(hwi, running); - } - } - audio_reset_timer (s); -} - -static const VMStateDescription vmstate_audio; - -static const char *audio_mixeng_backend_get_id(AudioBackend *be) -{ - return AUDIO_MIXENG_BACKEND(be)->dev->id; -} - -static CaptureVoiceOut *audio_mixeng_backend_add_capture( - AudioBackend *be, - struct audsettings *as, - struct audio_capture_ops *ops, - void *cb_opaque); - -static void audio_mixeng_backend_del_capture( - AudioBackend *be, - CaptureVoiceOut *cap, - void *cb_opaque); - -static void audio_mixeng_backend_set_volume_out(AudioBackend *be, SWVoiceO= ut *sw, - Volume *vol); -static void audio_mixeng_backend_set_volume_in(AudioBackend *be, SWVoiceIn= *sw, - Volume *vol); - -static void audio_mixeng_backend_class_init(ObjectClass *klass, const void= *data) -{ - AudioBackendClass *be =3D AUDIO_BACKEND_CLASS(klass); - - be->realize =3D audio_mixeng_backend_realize; - be->get_id =3D audio_mixeng_backend_get_id; - be->open_in =3D audio_mixeng_backend_open_in; - be->open_out =3D audio_mixeng_backend_open_out; - be->close_in =3D audio_mixeng_backend_close_in; - be->close_out =3D audio_mixeng_backend_close_out; - be->is_active_out =3D audio_mixeng_backend_is_active_out; - be->is_active_in =3D audio_mixeng_backend_is_active_in; - be->set_active_out =3D audio_mixeng_backend_set_active_out; - be->set_active_in =3D audio_mixeng_backend_set_active_in; - be->set_volume_out =3D audio_mixeng_backend_set_volume_out; - be->set_volume_in =3D audio_mixeng_backend_set_volume_in; - be->read =3D audio_mixeng_backend_read; - be->write =3D audio_mixeng_backend_write; - be->get_buffer_size_out =3D audio_mixeng_backend_get_buffer_size_out; - be->add_capture =3D audio_mixeng_backend_add_capture; - be->del_capture =3D audio_mixeng_backend_del_capture; -} - -static void audio_mixeng_backend_init(Object *obj) -{ - AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(obj); - - QLIST_INIT(&s->hw_head_out); - QLIST_INIT(&s->hw_head_in); - QLIST_INIT(&s->cap_head); - s->ts =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); - - s->vmse =3D qemu_add_vm_change_state_handler(audio_vm_change_state_han= dler, s); - assert(s->vmse !=3D NULL); - - vmstate_register_any(NULL, &vmstate_audio, s); -} - -static void audio_mixeng_backend_finalize(Object *obj) -{ - AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(obj); - HWVoiceOut *hwo, *hwon; - HWVoiceIn *hwi, *hwin; - - QLIST_FOREACH_SAFE(hwo, &s->hw_head_out, entries, hwon) { - SWVoiceCap *sc; +/* SPDX-License-Identifier: MIT */ =20 - if (hwo->enabled && hwo->pcm_ops->enable_out) { - hwo->pcm_ops->enable_out(hwo, false); - } - hwo->pcm_ops->fini_out (hwo); - - for (sc =3D hwo->cap_head.lh_first; sc; sc =3D sc->entries.le_next= ) { - CaptureVoiceOut *cap =3D sc->cap; - struct capture_callback *cb; +#include "qemu/osdep.h" +#include "qemu/audio.h" +#include "qemu/help_option.h" +#include "qapi/clone-visitor.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/qapi-visit-audio.h" +#include "qapi/qapi-commands-audio.h" +#include "qobject/qdict.h" +#include "system/system.h" =20 - for (cb =3D cap->cb_head.lh_first; cb; cb =3D cb->entries.le_n= ext) { - cb->ops.destroy (cb->opaque); - } - } - QLIST_REMOVE(hwo, entries); - } +/* Order of CONFIG_AUDIO_DRIVERS is import. + The 1st one is the one used by default, that is the reason + that we generate the list. +*/ +const char *audio_prio_list[] =3D { +#ifdef CONFIG_GIO + "dbus", +#endif + "spice", + CONFIG_AUDIO_DRIVERS + "none", + NULL +}; =20 - QLIST_FOREACH_SAFE(hwi, &s->hw_head_in, entries, hwin) { - if (hwi->enabled && hwi->pcm_ops->enable_in) { - hwi->pcm_ops->enable_in(hwi, false); - } - hwi->pcm_ops->fini_in (hwi); - QLIST_REMOVE(hwi, entries); - } +typedef struct AudiodevListEntry { + Audiodev *dev; + QSIMPLEQ_ENTRY(AudiodevListEntry) next; +} AudiodevListEntry; =20 - if (s->drv) { - s->drv->fini (s->drv_opaque); - s->drv =3D NULL; - } +typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead; =20 - if (s->dev) { - qapi_free_Audiodev(s->dev); - s->dev =3D NULL; - } +static AudiodevListHead audiodevs =3D + QSIMPLEQ_HEAD_INITIALIZER(audiodevs); +static AudiodevListHead default_audiodevs =3D + QSIMPLEQ_HEAD_INITIALIZER(default_audiodevs); =20 - if (s->ts) { - timer_free(s->ts); - s->ts =3D NULL; - } +static AudioBackendClass *audio_be_class_by_name(const char *name) +{ + g_autofree char *tname =3D g_strconcat("audio-", name, NULL); + ObjectClass *oc =3D module_object_class_by_name(tname); =20 - if (s->vmse) { - qemu_del_vm_change_state_handler(s->vmse); - s->vmse =3D NULL; + if (!oc || !object_class_dynamic_cast(oc, TYPE_AUDIO_BACKEND)) { + return NULL; } =20 - vmstate_unregister(NULL, &vmstate_audio, s); + return AUDIO_BACKEND_CLASS(oc); } =20 +static AudioBackend *default_audio_be; + static Object *get_audiodevs_root(void) { return object_get_container("audiodevs"); @@ -1758,25 +62,6 @@ void audio_cleanup(void) object_unparent(get_audiodevs_root()); } =20 -static bool vmstate_audio_needed(void *opaque) -{ - /* - * Never needed, this vmstate only exists in case - * an old qemu sends it to us. - */ - return false; -} - -static const VMStateDescription vmstate_audio =3D { - .name =3D "audio", - .version_id =3D 1, - .minimum_version_id =3D 1, - .needed =3D vmstate_audio_needed, - .fields =3D (const VMStateField[]) { - VMSTATE_END_OF_LIST() - } -}; - void audio_create_default_audiodevs(void) { for (int i =3D 0; audio_prio_list[i]; i++) { @@ -1817,15 +102,13 @@ static AudioBackend *audio_init(Audiodev *dev, Error= **errp) assert(!default_audio_be); for (;;) { AudiodevListEntry *e =3D QSIMPLEQ_FIRST(&default_audiodevs); - if (!e) { error_setg(errp, "no default audio driver available"); return NULL; } - dev =3D e->dev; QSIMPLEQ_REMOVE_HEAD(&default_audiodevs, next); + be =3D audio_be_new(e->dev, NULL); g_free(e); - be =3D audio_be_new(dev, NULL); if (be) { break; } @@ -1856,156 +139,35 @@ AudioBackend *audio_get_default_audio_be(Error **er= rp) return default_audio_be; } =20 -static struct audio_pcm_ops capture_pcm_ops; - -static CaptureVoiceOut *audio_mixeng_backend_add_capture( - AudioBackend *be, - struct audsettings *as, - struct audio_capture_ops *ops, - void *cb_opaque) -{ - AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(be); - CaptureVoiceOut *cap; - struct capture_callback *cb; - - if (!s) { - error_report("Capturing without setting an audiodev is not support= ed"); - abort(); - } - - if (!audio_get_pdo_out(s->dev)->mixing_engine) { - dolog("Can't capture with mixeng disabled\n"); - return NULL; - } - - if (audio_validate_settings (as)) { - dolog ("Invalid settings were passed when trying to add capture\n"= ); - audio_print_settings (as); - return NULL; - } - - cb =3D g_malloc0(sizeof(*cb)); - cb->ops =3D *ops; - cb->opaque =3D cb_opaque; - - cap =3D audio_pcm_capture_find_specific(s, as); - if (cap) { - QLIST_INSERT_HEAD (&cap->cb_head, cb, entries); - } else { - HWVoiceOut *hw; - - cap =3D g_malloc0(sizeof(*cap)); - - hw =3D &cap->hw; - hw->s =3D s; - hw->pcm_ops =3D &capture_pcm_ops; - QLIST_INIT (&hw->sw_head); - QLIST_INIT (&cap->cb_head); - - /* XXX find a more elegant way */ - hw->samples =3D 4096 * 4; - audio_pcm_hw_alloc_resources_out(hw); - - audio_pcm_init_info (&hw->info, as); - - cap->buf =3D g_malloc0_n(hw->mix_buf.size, hw->info.bytes_per_fram= e); - - if (hw->info.is_float) { - hw->clip =3D mixeng_clip_float[hw->info.nchannels =3D=3D 2] - [hw->info.swap_endianness]; - } else { - hw->clip =3D mixeng_clip - [hw->info.nchannels =3D=3D 2] - [hw->info.is_signed] - [hw->info.swap_endianness] - [audio_bits_to_index(hw->info.bits)]; - } - - QLIST_INSERT_HEAD (&s->cap_head, cap, entries); - QLIST_INSERT_HEAD (&cap->cb_head, cb, entries); - - QLIST_FOREACH(hw, &s->hw_head_out, entries) { - audio_attach_capture (hw); - } - } - - return cap; -} - -static void audio_mixeng_backend_del_capture( - AudioBackend *be, - CaptureVoiceOut *cap, - void *cb_opaque) +void audio_help(void) { - struct capture_callback *cb; - - for (cb =3D cap->cb_head.lh_first; cb; cb =3D cb->entries.le_next) { - if (cb->opaque =3D=3D cb_opaque) { - cb->ops.destroy (cb_opaque); - QLIST_REMOVE (cb, entries); - g_free (cb); + int i; =20 - if (!cap->cb_head.lh_first) { - SWVoiceOut *sw =3D cap->hw.sw_head.lh_first, *sw1; + printf("Available audio drivers:\n"); =20 - while (sw) { - SWVoiceCap *sc =3D (SWVoiceCap *) sw; -#ifdef DEBUG_CAPTURE - dolog ("freeing %s\n", sw->name); -#endif + for (i =3D 0; i < AUDIODEV_DRIVER__MAX; i++) { + const char *name =3D AudiodevDriver_str(i); + AudioBackendClass *be =3D audio_be_class_by_name(name); =20 - sw1 =3D sw->entries.le_next; - if (sw->rate) { - st_rate_stop (sw->rate); - sw->rate =3D NULL; - } - QLIST_REMOVE (sw, entries); - QLIST_REMOVE (sc, entries); - g_free (sc); - sw =3D sw1; - } - QLIST_REMOVE (cap, entries); - g_free(cap->hw.mix_buf.buffer); - g_free (cap->buf); - g_free (cap); - } - return; + if (be) { + printf("%s\n", name); } } } =20 -static void audio_mixeng_backend_set_volume_out(AudioBackend *be, SWVoiceO= ut *sw, - Volume *vol) +void audio_parse_option(const char *opt) { - if (sw) { - HWVoiceOut *hw =3D sw->hw; - - sw->vol.mute =3D vol->mute; - sw->vol.l =3D nominal_volume.l * vol->vol[0] / 255; - sw->vol.r =3D nominal_volume.l * vol->vol[vol->channels > 1 ? 1 : = 0] / - 255; + Audiodev *dev =3D NULL; =20 - if (hw->pcm_ops->volume_out) { - hw->pcm_ops->volume_out(hw, vol); - } + if (is_help_option(opt)) { + audio_help(); + exit(EXIT_SUCCESS); } -} - -static void audio_mixeng_backend_set_volume_in(AudioBackend *be, SWVoiceIn= *sw, - Volume *vol) -{ - if (sw) { - HWVoiceIn *hw =3D sw->hw; - - sw->vol.mute =3D vol->mute; - sw->vol.l =3D nominal_volume.l * vol->vol[0] / 255; - sw->vol.r =3D nominal_volume.r * vol->vol[vol->channels > 1 ? 1 : = 0] / - 255; + Visitor *v =3D qobject_input_visitor_new_str(opt, "driver", &error_fat= al); + visit_type_Audiodev(v, NULL, &dev, &error_fatal); + visit_free(v); =20 - if (hw->pcm_ops->volume_in) { - hw->pcm_ops->volume_in(hw, vol); - } - } + audio_add_audiodev(dev); } =20 static void audio_create_pdos(Audiodev *dev) @@ -2104,6 +266,124 @@ static void audio_validate_per_direction_opts( } } =20 +static AudiodevPerDirectionOptions *audio_get_pdo_out(Audiodev *dev) +{ + switch (dev->driver) { + case AUDIODEV_DRIVER_NONE: + return dev->u.none.out; +#ifdef CONFIG_AUDIO_ALSA + case AUDIODEV_DRIVER_ALSA: + return qapi_AudiodevAlsaPerDirectionOptions_base(dev->u.alsa.out); +#endif +#ifdef CONFIG_AUDIO_COREAUDIO + case AUDIODEV_DRIVER_COREAUDIO: + return qapi_AudiodevCoreaudioPerDirectionOptions_base( + dev->u.coreaudio.out); +#endif +#ifdef CONFIG_DBUS_DISPLAY + case AUDIODEV_DRIVER_DBUS: + return dev->u.dbus.out; +#endif +#ifdef CONFIG_AUDIO_DSOUND + case AUDIODEV_DRIVER_DSOUND: + return dev->u.dsound.out; +#endif +#ifdef CONFIG_AUDIO_JACK + case AUDIODEV_DRIVER_JACK: + return qapi_AudiodevJackPerDirectionOptions_base(dev->u.jack.out); +#endif +#ifdef CONFIG_AUDIO_OSS + case AUDIODEV_DRIVER_OSS: + return qapi_AudiodevOssPerDirectionOptions_base(dev->u.oss.out); +#endif +#ifdef CONFIG_AUDIO_PA + case AUDIODEV_DRIVER_PA: + return qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.out); +#endif +#ifdef CONFIG_AUDIO_PIPEWIRE + case AUDIODEV_DRIVER_PIPEWIRE: + return qapi_AudiodevPipewirePerDirectionOptions_base(dev->u.pipewi= re.out); +#endif +#ifdef CONFIG_AUDIO_SDL + case AUDIODEV_DRIVER_SDL: + return qapi_AudiodevSdlPerDirectionOptions_base(dev->u.sdl.out); +#endif +#ifdef CONFIG_AUDIO_SNDIO + case AUDIODEV_DRIVER_SNDIO: + return dev->u.sndio.out; +#endif +#ifdef CONFIG_SPICE + case AUDIODEV_DRIVER_SPICE: + return dev->u.spice.out; +#endif + case AUDIODEV_DRIVER_WAV: + return dev->u.wav.out; + + case AUDIODEV_DRIVER__MAX: + break; + } + abort(); +} + +static AudiodevPerDirectionOptions *audio_get_pdo_in(Audiodev *dev) +{ + switch (dev->driver) { + case AUDIODEV_DRIVER_NONE: + return dev->u.none.in; +#ifdef CONFIG_AUDIO_ALSA + case AUDIODEV_DRIVER_ALSA: + return qapi_AudiodevAlsaPerDirectionOptions_base(dev->u.alsa.in); +#endif +#ifdef CONFIG_AUDIO_COREAUDIO + case AUDIODEV_DRIVER_COREAUDIO: + return qapi_AudiodevCoreaudioPerDirectionOptions_base( + dev->u.coreaudio.in); +#endif +#ifdef CONFIG_DBUS_DISPLAY + case AUDIODEV_DRIVER_DBUS: + return dev->u.dbus.in; +#endif +#ifdef CONFIG_AUDIO_DSOUND + case AUDIODEV_DRIVER_DSOUND: + return dev->u.dsound.in; +#endif +#ifdef CONFIG_AUDIO_JACK + case AUDIODEV_DRIVER_JACK: + return qapi_AudiodevJackPerDirectionOptions_base(dev->u.jack.in); +#endif +#ifdef CONFIG_AUDIO_OSS + case AUDIODEV_DRIVER_OSS: + return qapi_AudiodevOssPerDirectionOptions_base(dev->u.oss.in); +#endif +#ifdef CONFIG_AUDIO_PA + case AUDIODEV_DRIVER_PA: + return qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.in); +#endif +#ifdef CONFIG_AUDIO_PIPEWIRE + case AUDIODEV_DRIVER_PIPEWIRE: + return qapi_AudiodevPipewirePerDirectionOptions_base(dev->u.pipewi= re.in); +#endif +#ifdef CONFIG_AUDIO_SDL + case AUDIODEV_DRIVER_SDL: + return qapi_AudiodevSdlPerDirectionOptions_base(dev->u.sdl.in); +#endif +#ifdef CONFIG_AUDIO_SNDIO + case AUDIODEV_DRIVER_SNDIO: + return dev->u.sndio.in; +#endif +#ifdef CONFIG_SPICE + case AUDIODEV_DRIVER_SPICE: + return dev->u.spice.in; +#endif + case AUDIODEV_DRIVER_WAV: + return dev->u.wav.in; + + case AUDIODEV_DRIVER__MAX: + break; + } + abort(); +} + static void audio_validate_opts(Audiodev *dev, Error **errp) { Error *err =3D NULL; @@ -2128,37 +408,6 @@ static void audio_validate_opts(Audiodev *dev, Error = **errp) } } =20 -void audio_help(void) -{ - int i; - - printf("Available audio drivers:\n"); - - for (i =3D 0; i < AUDIODEV_DRIVER__MAX; i++) { - const char *name =3D AudiodevDriver_str(i); - AudioBackendClass *be =3D audio_be_class_by_name(name); - - if (be) { - printf("%s\n", name); - } - } -} - -void audio_parse_option(const char *opt) -{ - Audiodev *dev =3D NULL; - - if (is_help_option(opt)) { - audio_help(); - exit(EXIT_SUCCESS); - } - Visitor *v =3D qobject_input_visitor_new_str(opt, "driver", &error_fat= al); - visit_type_Audiodev(v, NULL, &dev, &error_fatal); - visit_free(v); - - audio_add_audiodev(dev); -} - void audio_add_audiodev(Audiodev *dev) { AudiodevListEntry *e; @@ -2190,65 +439,6 @@ void audio_init_audiodevs(void) } } =20 -audsettings audiodev_to_audsettings(AudiodevPerDirectionOptions *pdo) -{ - return (audsettings) { - .freq =3D pdo->frequency, - .nchannels =3D pdo->channels, - .fmt =3D pdo->format, - .endianness =3D HOST_BIG_ENDIAN, - }; -} - -int audioformat_bytes_per_sample(AudioFormat fmt) -{ - switch (fmt) { - case AUDIO_FORMAT_U8: - case AUDIO_FORMAT_S8: - return 1; - - case AUDIO_FORMAT_U16: - case AUDIO_FORMAT_S16: - return 2; - - case AUDIO_FORMAT_U32: - case AUDIO_FORMAT_S32: - case AUDIO_FORMAT_F32: - return 4; - - case AUDIO_FORMAT__MAX: - ; - } - abort(); -} - - -/* frames =3D freq * usec / 1e6 */ -int audio_buffer_frames(AudiodevPerDirectionOptions *pdo, - audsettings *as, int def_usecs) -{ - uint64_t usecs =3D pdo->has_buffer_length ? pdo->buffer_length : def_u= secs; - return (as->freq * usecs + 500000) / 1000000; -} - -/* samples =3D channels * frames =3D channels * freq * usec / 1e6 */ -int audio_buffer_samples(AudiodevPerDirectionOptions *pdo, - audsettings *as, int def_usecs) -{ - return as->nchannels * audio_buffer_frames(pdo, as, def_usecs); -} - -/* - * bytes =3D bytes_per_sample * samples =3D - * bytes_per_sample * channels * freq * usec / 1e6 - */ -int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo, - audsettings *as, int def_usecs) -{ - return audio_buffer_samples(pdo, as, def_usecs) * - audioformat_bytes_per_sample(as->fmt); -} - AudioBackend *audio_be_by_name(const char *name, Error **errp) { Object *obj =3D object_resolve_path_component(get_audiodevs_root(), na= me); @@ -2269,51 +459,6 @@ const char *audio_application_name(void) return vm_name ? vm_name : "qemu"; } =20 -void audio_rate_start(RateCtl *rate) -{ - memset(rate, 0, sizeof(RateCtl)); - rate->start_ticks =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); -} - -size_t audio_rate_peek_bytes(RateCtl *rate, struct audio_pcm_info *info) -{ - int64_t now; - int64_t ticks; - int64_t bytes; - int64_t frames; - - now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - ticks =3D now - rate->start_ticks; - bytes =3D muldiv64(ticks, info->bytes_per_second, NANOSECONDS_PER_SECO= ND); - frames =3D (bytes - rate->bytes_sent) / info->bytes_per_frame; - rate->peeked_frames =3D frames; - - return frames < 0 ? 0 : frames * info->bytes_per_frame; -} - -void audio_rate_add_bytes(RateCtl *rate, size_t bytes_used) -{ - if (rate->peeked_frames < 0 || rate->peeked_frames > 65536) { - AUD_log(NULL, "Resetting rate control (%" PRId64 " frames)\n", - rate->peeked_frames); - audio_rate_start(rate); - } - - rate->bytes_sent +=3D bytes_used; -} - -size_t audio_rate_get_bytes(RateCtl *rate, struct audio_pcm_info *info, - size_t bytes_avail) -{ - size_t bytes; - - bytes =3D audio_rate_peek_bytes(rate, info); - bytes =3D MIN(bytes, bytes_avail); - audio_rate_add_bytes(rate, bytes); - - return bytes; -} - AudiodevList *qmp_query_audiodevs(Error **errp) { AudiodevList *ret =3D NULL; @@ -2323,17 +468,3 @@ AudiodevList *qmp_query_audiodevs(Error **errp) } return ret; } - -static const TypeInfo audio_types[] =3D { - { - .name =3D TYPE_AUDIO_MIXENG_BACKEND, - .parent =3D TYPE_AUDIO_BACKEND, - .instance_size =3D sizeof(AudioMixengBackend), - .instance_init =3D audio_mixeng_backend_init, - .instance_finalize =3D audio_mixeng_backend_finalize, - .class_size =3D sizeof(AudioMixengBackendClass), - .class_init =3D audio_mixeng_backend_class_init, - } -}; - -DEFINE_TYPES(audio_types) diff --git a/audio/meson.build b/audio/meson.build index 17f58369c20..0e33b6f9836 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -2,6 +2,7 @@ audio_ss =3D ss.source_set() audio_ss.add(files( 'audio.c', 'audio-be.c', + 'audio-mixeng-be.c', 'mixeng.c', 'noaudio.c', 'wavaudio.c', --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242432; cv=none; d=zohomail.com; s=zohoarc; b=PGKERuowlSIulT/gx3rRqRdo8nhy2TBpNTVZ3DihDVXQEoVIrJZM83O7lJxMFkAyVyfAOgv2hNlO1sdXgrZC47DdL/TTuY4gtLGZLXen4/aGYIY/VyCTQevyf63wHt2olR9YcoNGcXEvmEIhDugZ26j+okWpWq+KoIydilph52g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242432; h=Content-Type: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=WtzBFPtZnBgBep7PFOTmKmy8bJLlcZgL5VlJnM7+pJ0=; b=iebFMP8ytOYyglhVve8vLxyjJVoZ04LN25bCReLH9r3P6n1chpzhT4s95Q+X8vfZtIPJgf84bmFTOSNX5iB1Aw/ZBA5p+T6myGg3052o0EG8uZVMWIr/UBZuX3sZiMKbd/gkybzW1Gr+B63Xx6FkXL6DGyHnJ6gROGwWk0+bac8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242432083140.7776227883095; Mon, 16 Feb 2026 03:47:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweE-0002hq-8Z; Mon, 16 Feb 2026 06:20:14 -0500 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 1vrwbu-0006B2-Dz for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbo-00085t-9s for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:49 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-691-OyzgE7IpMM2b6tCvuj9R3Q-1; Mon, 16 Feb 2026 06:17:35 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 21D4A19560AA; Mon, 16 Feb 2026 11:17:33 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7902030001A5; Mon, 16 Feb 2026 11:17:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WtzBFPtZnBgBep7PFOTmKmy8bJLlcZgL5VlJnM7+pJ0=; b=fewvYkhqYEDmCI7gNbUUPvfaoMZlrQYlhcKXTlyFdaxUAUrzibHraL821YbzcLSp8Y+8bF cvaweGlFnzw+4QpwMl5xpIivZkj8cpGv1qYYs2z1eFokmhF2ClfpKwbzjChynYE7wOYwrp /cHgeyoI0Y3HcEE3WBW48eLNA+L+IRk= X-MC-Unique: OyzgE7IpMM2b6tCvuj9R3Q-1 X-Mimecast-MFC-AGG-ID: OyzgE7IpMM2b6tCvuj9R3Q_1771240653 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:30 +0100 Subject: [PATCH 41/85] audio: make audio_driver init() & fini() optional MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-41-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1273; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=XQa2aioA9AFhg3/Oy50D65dq2g48xqh2ie7D90kz/0Q=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQcgsxG/QPT1xwp6eTSva+fkwZaMPVgDQ5s tdKRSBWNNuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5RrbEAC6nuwwg50L+LZw27hDN+5qNR4U4jwGL9q6Dg0pxY1loNf3ojd3vqw8UrE51gQPdQpEX12 WfA2XEoSjxZ4qvwU8Q6CcvMXM03QGeRuDkYZpRy9ynry6jx1e+5+0/dMIzzd/IybXsRQnrADoDX 9IbM243vhrMwoUUmlL9Er/+VM2764zELP3e2fsym3lXGOwGKyYt1ddmv6Jm0i8CKqVxlTwbRtRN XHF1MQATkyWwnhHFXMH5o22Y/y0sLCqFxyyd8YGYykG6j53OvvIB/tBF9XGo9rVZiDDFMnrKywB xYf8TBdBU7xEJeccI/nMyNgDrcWHK1XaZF/6aWPUY4cXYVz2z4n8vtpXxwE3aKPlk2i68EfaxNY pD4u3r0XF5f6kYpdCHAVUl1GDoFpU7oOFmM16ViX05+wx2udhBdD0uqEK/iLraVQy+iuVBcrU/2 6SVVPRbdDmX9EOGuRqIdGP2eNyLjzHI4X57LHB8DNb++KjAI8hA8CN1mPl5htrWFnsv1q28iAGD B57bJXSc8kvN+JcDRH3Xgb+Srkn987dEYWP4jooaqLQ5t0S5DLUOIhIHNxatH0I4fpvkkQ5XlKz EH23S0CKio0QEk0+6+PzJAXwycG8iNqut9ReKKDcJfFnCsJ4HA8zFBejrP0oD/J9fpl34Q+YmIG GuvJIamUvPR7qPA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242435467158500 The next patches are going to remove usage of the driver callbacks in favor of QOM realize/finalize. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio-mixeng-be.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index f906c84bf7c..45873646b3c 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -1521,9 +1521,11 @@ static bool audio_mixeng_backend_realize(AudioBacken= d *abe, audio_driver *drv =3D AUDIO_MIXENG_BACKEND_GET_CLASS(be)->driver; =20 be->dev =3D dev; - be->drv_opaque =3D drv->init(be->dev, errp); - if (!be->drv_opaque) { - return false; + if (drv->init !=3D NULL) { + be->drv_opaque =3D drv->init(be->dev, errp); + if (!be->drv_opaque) { + return false; + } } =20 if (!drv->pcm_ops->get_buffer_in) { @@ -1664,7 +1666,9 @@ static void audio_mixeng_backend_finalize(Object *obj) } =20 if (s->drv) { - s->drv->fini (s->drv_opaque); + if (s->drv->fini) { + s->drv->fini (s->drv_opaque); + } s->drv =3D NULL; } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244726; cv=none; d=zohomail.com; s=zohoarc; b=AneaezNwl1mgEsOlbuAyn7joxKJrIzVeuUhH7QSEV5krsAqUkEwJoMWKeS2LtSGygmp5QV0KqdO/bUQE68sZ7ac/5T8C9HIt2LipUOyHj4bBP7qL5ouNZo+hgF4QSkV497BCbW8NMNmSL7ARwl17PppgOGgBeCclthRclPMrvAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244726; h=Content-Type: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=y/Ta2/+6tanZPEqwKnrywl7NwwZ2ZYkZIXSRRkGPRnY=; b=IXWXRhgy73VjLDJX5PNCORmF8nH00Wx2JrX4NyZ+9+/5kIcynzD1boWjCFGA/80Kxfunre1+TL70emNBBmv0ztqaF6amXKkjT4KLV2Ue663gKVwupKvMdZ3NaI9TOPKbDi5NvuWu0tPlv4jFxTSvKqnrwlV4lVUAo66N4vyCRsw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244726139794.4463569175399; Mon, 16 Feb 2026 04:25:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweP-0004Ey-UP; Mon, 16 Feb 2026 06:20:26 -0500 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 1vrwbu-0006B5-Eu for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbo-000860-AA for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:50 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-657--Zf7ODvbOEaFv8EE6FYLmg-1; Mon, 16 Feb 2026 06:17:37 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 978651800349; Mon, 16 Feb 2026 11:17:35 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E8F8418003F5; Mon, 16 Feb 2026 11:17:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y/Ta2/+6tanZPEqwKnrywl7NwwZ2ZYkZIXSRRkGPRnY=; b=WKaPTxD4KYDVQPTLNzb5or67xHdE0/08ogRGW42TJmrKnbpeUm/FJF45NpopI9C/d0xFc8 /lLEZjJK+74EMNPBkLaeU//mJsmqAfUmyzfARymQPbWQRJHIBWnmavrk/5jZ0aNFG93HXe LS/utzu+VrdBgL6jDGwwq0U0J7nEW4Q= X-MC-Unique: -Zf7ODvbOEaFv8EE6FYLmg-1 X-Mimecast-MFC-AGG-ID: -Zf7ODvbOEaFv8EE6FYLmg_1771240655 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:31 +0100 Subject: [PATCH 42/85] audio/dbus: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-42-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=9679; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=hqY7zX5F8HT1vdCl7Kk/fQsqT6fF8aO3qTi7hU2HEPA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQtSxNoN5ioakHIqQW4BlvcgkOZbu5MP6RL PVppGSbME2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5Yp/EACnRgHzf/C8cRqsOZZNXgQi+ZVkynICTHJsnTvY+dcEtvQjk/Ba+rK6MAR48iXhDN1DNbK D4ucc+zTgBXkz1KR7dWEMB7NQBGYZRc8PAhN4bep9apdLcVEDg0H6OyKn3hiocsWPUw/2FtiO5J zY/xFLY1rkCc/B6qxfsP/g5ao245/GjZMNn03wm0Dsc9L1E5oo1nlekAf/d6d7SW45ymBzylE9+ zNDx12TnU3xickXh0UrgFFhrjSRvw2xU2f3S52pngJunBHc7JWgAegEpI0KQpqx+V4srCIn1j5M 09Y2wnwiHFoZOnSjDyXQjIcNZId4eWjJPlI1tZCjIibeiUtN6R7l1B7R7PF8/y902iMjg9ixCp/ wh3YPP9qUvpPIuZBtNp4wRfbFX6Ee4PqEDD/hOm3g7NYhL6QgkX0Y4TsdZGdD+SRCATS2w/WoV3 M+F+Otxy2An6Xip5HcwuKzE8WIVFoTZtMl1LidI7C42YnU5g47ljPBVpTN9+eOl0GpyDD0bFq3K dM7JyarAL/nfteVBN/u9crIau9RfyjOhFuLULYlI2VK+m0NTvCtKYggI/d2e/LrQaKVA8LMm1my BJxzrJICix5TG4PktxL7D3n2Nxggn+U0/MPAa4IjPb7lE25ymJNaF4y1fVvoV4ZBYVV2vmWEmkE dZobMrcM9aFfMJg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771244728361158500 Migrate the D-Bus audio backend from the legacy driver init/fini callbacks to proper QOM realize and finalize methods. The DBusAudio struct fields are now embedded directly in the AudioDbus QOM object instead of being allocated separately as drv_opaque. This allows accessing the backend state through proper QOM type casting with AUDIO_DBUS() rather than casting drv_opaque pointers. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/dbusaudio.c | 76 ++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 269db7877b6..fb059815de9 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -48,21 +48,20 @@ #define TYPE_AUDIO_DBUS "audio-dbus" OBJECT_DECLARE_SIMPLE_TYPE(AudioDbus, AUDIO_DBUS) =20 +static AudioBackendClass *audio_dbus_parent_class; + struct AudioDbus { AudioMixengBackend parent_obj; -}; - -static struct audio_driver dbus_audio_driver; =20 -typedef struct DBusAudio { - Audiodev *dev; GDBusObjectManagerServer *server; bool p2p; GDBusObjectSkeleton *audio; QemuDBusDisplay1Audio *iface; GHashTable *out_listeners; GHashTable *in_listeners; -} DBusAudio; +}; + +static struct audio_driver dbus_audio_driver; =20 typedef struct DBusVoiceOut { HWVoiceOut hw; @@ -105,7 +104,7 @@ static void *dbus_get_buffer_out(HWVoiceOut *hw, size_t= *size) =20 static size_t dbus_put_buffer_out(HWVoiceOut *hw, void *buf, size_t size) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceOut *vo =3D container_of(hw, DBusVoiceOut, hw); GHashTableIter iter; QemuDBusDisplay1AudioOutListener *listener =3D NULL; @@ -162,9 +161,9 @@ dbus_init_out_listener(QemuDBusDisplay1AudioOutListener= *listener, } =20 static guint -dbus_audio_get_nsamples(DBusAudio *da) +dbus_audio_get_nsamples(AudioDbus *da) { - AudiodevDBusOptions *opts =3D &da->dev->u.dbus; + AudiodevDBusOptions *opts =3D &AUDIO_MIXENG_BACKEND(da)->dev->u.dbus; =20 if (opts->has_nsamples && opts->nsamples) { return opts->nsamples; @@ -176,7 +175,7 @@ dbus_audio_get_nsamples(DBusAudio *da) static int dbus_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceOut *vo =3D container_of(hw, DBusVoiceOut, hw); GHashTableIter iter; QemuDBusDisplay1AudioOutListener *listener =3D NULL; @@ -195,7 +194,7 @@ dbus_init_out(HWVoiceOut *hw, struct audsettings *as, v= oid *drv_opaque) static void dbus_fini_out(HWVoiceOut *hw) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceOut *vo =3D container_of(hw, DBusVoiceOut, hw); GHashTableIter iter; QemuDBusDisplay1AudioOutListener *listener =3D NULL; @@ -214,7 +213,7 @@ dbus_fini_out(HWVoiceOut *hw) static void dbus_enable_out(HWVoiceOut *hw, bool enable) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceOut *vo =3D container_of(hw, DBusVoiceOut, hw); GHashTableIter iter; QemuDBusDisplay1AudioOutListener *listener =3D NULL; @@ -256,7 +255,7 @@ dbus_volume_out_listener(HWVoiceOut *hw, static void dbus_volume_out(HWVoiceOut *hw, Volume *vol) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceOut *vo =3D container_of(hw, DBusVoiceOut, hw); GHashTableIter iter; QemuDBusDisplay1AudioOutListener *listener =3D NULL; @@ -290,7 +289,7 @@ dbus_init_in_listener(QemuDBusDisplay1AudioInListener *= listener, HWVoiceIn *hw) static int dbus_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceIn *vo =3D container_of(hw, DBusVoiceIn, hw); GHashTableIter iter; QemuDBusDisplay1AudioInListener *listener =3D NULL; @@ -309,7 +308,7 @@ dbus_init_in(HWVoiceIn *hw, struct audsettings *as, voi= d *drv_opaque) static void dbus_fini_in(HWVoiceIn *hw) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); GHashTableIter iter; QemuDBusDisplay1AudioInListener *listener =3D NULL; =20 @@ -346,7 +345,7 @@ dbus_volume_in_listener(HWVoiceIn *hw, static void dbus_volume_in(HWVoiceIn *hw, Volume *vol) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceIn *vo =3D container_of(hw, DBusVoiceIn, hw); GHashTableIter iter; QemuDBusDisplay1AudioInListener *listener =3D NULL; @@ -363,7 +362,7 @@ dbus_volume_in(HWVoiceIn *hw, Volume *vol) static size_t dbus_read(HWVoiceIn *hw, void *buf, size_t size) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); /* DBusVoiceIn *vo =3D container_of(hw, DBusVoiceIn, hw); */ GHashTableIter iter; QemuDBusDisplay1AudioInListener *listener =3D NULL; @@ -398,7 +397,7 @@ dbus_read(HWVoiceIn *hw, void *buf, size_t size) static void dbus_enable_in(HWVoiceIn *hw, bool enable) { - DBusAudio *da =3D (DBusAudio *)hw->s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceIn *vo =3D container_of(hw, DBusVoiceIn, hw); GHashTableIter iter; QemuDBusDisplay1AudioInListener *listener =3D NULL; @@ -416,28 +415,31 @@ dbus_enable_in(HWVoiceIn *hw, bool enable) } } =20 -static void * -dbus_audio_init(Audiodev *dev, Error **errp) +static bool +audio_dbus_realize(AudioBackend *abe, Audiodev *dev, Error **errp) { - DBusAudio *da; + AudioDbus *da =3D AUDIO_DBUS(abe); =20 if (!qemu_using_dbus_display(errp)) { - return NULL; + qapi_free_Audiodev(dev); + return false; + } + + if (!audio_dbus_parent_class->realize(abe, dev, errp)) { + return false; } =20 - da =3D g_new0(DBusAudio, 1); - da->dev =3D dev; da->out_listeners =3D g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_object_unref); + g_free, g_object_unref); da->in_listeners =3D g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_object_unref); - return da; + g_free, g_object_unref); + return true; } =20 static void -dbus_audio_fini(void *opaque) +audio_dbus_finalize(Object *obj) { - DBusAudio *da =3D opaque; + AudioDbus *da =3D AUDIO_DBUS(obj); =20 if (da->server) { g_dbus_object_manager_server_unexport(da->server, @@ -448,14 +450,13 @@ dbus_audio_fini(void *opaque) g_clear_pointer(&da->in_listeners, g_hash_table_unref); g_clear_pointer(&da->out_listeners, g_hash_table_unref); g_clear_object(&da->server); - g_free(da); } =20 static void listener_out_vanished_cb(GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, - DBusAudio *da) + AudioDbus *da) { char *name =3D g_object_get_data(G_OBJECT(connection), "name"); =20 @@ -466,7 +467,7 @@ static void listener_in_vanished_cb(GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, - DBusAudio *da) + AudioDbus *da) { char *name =3D g_object_get_data(G_OBJECT(connection), "name"); =20 @@ -482,7 +483,7 @@ dbus_audio_register_listener(AudioMixengBackend *s, GVariant *arg_listener, bool out) { - DBusAudio *da =3D s->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(s); const char *sender =3D da->p2p ? "p2p" : g_dbus_method_invocation_get_sender(invocation); g_autoptr(GDBusConnection) listener_conn =3D NULL; @@ -667,9 +668,8 @@ dbus_audio_set_server(AudioBackend *s, bool p2p, Error **errp) { - DBusAudio *da =3D AUDIO_MIXENG_BACKEND(s)->drv_opaque; + AudioDbus *da =3D AUDIO_DBUS(s); =20 - g_assert(da); g_assert(!da->server); =20 da->server =3D g_object_ref(server); @@ -711,8 +711,6 @@ static struct audio_pcm_ops dbus_pcm_ops =3D { =20 static struct audio_driver dbus_audio_driver =3D { .name =3D "dbus", - .init =3D dbus_audio_init, - .fini =3D dbus_audio_fini, .pcm_ops =3D &dbus_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, @@ -725,6 +723,9 @@ static void audio_dbus_class_init(ObjectClass *klass, c= onst void *data) AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 + audio_dbus_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_paren= t(klass)); + + b->realize =3D audio_dbus_realize; b->set_dbus_server =3D dbus_audio_set_server; k->driver =3D &dbus_audio_driver; } @@ -734,6 +735,7 @@ static const TypeInfo audio_types[] =3D { .name =3D TYPE_AUDIO_DBUS, .parent =3D TYPE_AUDIO_MIXENG_BACKEND, .instance_size =3D sizeof(AudioDbus), + .instance_finalize =3D audio_dbus_finalize, .class_init =3D audio_dbus_class_init, }, }; --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244667; cv=none; d=zohomail.com; s=zohoarc; b=lKucsAK8HRt518l5/puuyurQEHtiErC2r1K2fagA2IFnGXRq/s7JGGBJs+mA5lt/UOYkDxS5s9bSdNugnZ7hmwy2ld3u0/D+ewhnKosfk+vCDeQF0hZ3gLnpfFnqIpgHhDZqshCFJQqjT1VBIjOO51230xlUKGNXlLEArWWncko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244667; h=Content-Type: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=ZAePRO9iX/CdNZl5mbtEzsh4UrYfxMJmJv42slqeaKE=; b=ei6mVoyYgf8TXTU+X2YLn/L7e0HnQQHJYjAiK1OmkIHUPqFHtPdVH2qtSIThUz84lwkVMemruZXjs9vx97+45miBoc2fy7ixhQpfu4Cp+hoyUo4puRI5XrdjsXfv81BnymMeDIVKp1lQa/WegzcjRracVdVj24wcDVQBYPdbbbw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244667577320.5876445318736; Mon, 16 Feb 2026 04:24:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfX-0007rg-AB; Mon, 16 Feb 2026 06:21:35 -0500 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 1vrwbv-0006EF-V1 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbq-00086x-5r for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:51 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-213-jmIuXMb8MmCISZFgiasbOQ-1; Mon, 16 Feb 2026 06:17:41 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 43D7119560AA; Mon, 16 Feb 2026 11:17:39 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C96B119560A2; Mon, 16 Feb 2026 11:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZAePRO9iX/CdNZl5mbtEzsh4UrYfxMJmJv42slqeaKE=; b=InubpNMfFFamqOdXQkfxHz9umZk4QQtbBKA0WJVjYB41+ichPJIq3pK9slcwqpoFeEBLLW TzvvX5F8SrBgtgd26XvM8G0wT1AW995Sm9oO9Ha+jTtaYR0b3WhQHqDAJe2XQvBA9a2QeN wcjywYgYAXx7XDeFrYrAjkm6jQ3X/50= X-MC-Unique: jmIuXMb8MmCISZFgiasbOQ-1 X-Mimecast-MFC-AGG-ID: jmIuXMb8MmCISZFgiasbOQ_1771240659 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:32 +0100 Subject: [PATCH 43/85] audio/spice: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-43-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2621; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Rcs408lO9P4mK3uz8yvMkyVGqD72XWjzygJPEae432E=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQAwF6m/TkCaYFng41JyP1I6mFplns1w39M VCyg9F1V7yJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5dXTD/4roKmuR4JVDbGSh1B2Tv7YYNc+wLiMg6Vo5Oum72fx4eaGMB/jDzjpWl1tcYyUeHZRydY yF5FSzdhdVz+gvs53HwXhwyKcbEt1jJPAim14RehF7e5Y2ZOp1VSQ1XS9VcdTUPvaw4BtmIMbUU LJCI2SLTzLYyt2/wgKhYmB3NmedVG3n1ljRyPSq7zF1gTjsct6X7d7jAW+qQd/sYDsgfK7ANrDG 7g/oaWYhLP6F7lscbZOrboROm1u4OQY0JaXruNETx6xb+DyJF4khxKvNL9z/rRkeI8v3eKqUXvr RkaTJM6WmWv4GSV0BVRHoo3IPz6hPBQ478s2nihRbNFAtf/7qhVHRV1jXk6SjlGbeRxEj6fmeVF 6iy2cdA48jsyGIFXYEaf/NDKr2nR7L6dSwvMCSv0dRNrcW+ux5BZjBdBvSxPPgMDJn6i5XW3UVw 3wMnVoB1guas3YAioQW4wb/pE7M0GzwktYauLXKk/I0UYvFJZ2yczpes1p3f3U0SOvvPLQ33/CY Z6xZo2JYiGEFGtkZiUPtpb2O++cSBT44eTn6Tu0mu8xMvuphALaC8lY8S67Q6sy3Q8j0aHB2QpC K/izWRigAhPbugB0kfMtLL1uKsxdK93BWkchDYQ0b3MAIuqKen/w8oaA9IftG/D3fXiIyv4t62x TczxZ1PJLLgvXzw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244669231154100 Migrate the SPICE audio backend from the legacy driver init/fini callbacks to proper QOM realize method. The spice_audio_init() function is replaced with spice_audio_realize(), which validates that SPICE is enabled before delegating to the parent class realize method. The empty spice_audio_fini() is removed as no cleanup is needed. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/spiceaudio.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index ad7cb69673b..953dbf6c308 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -33,16 +33,33 @@ #define TYPE_AUDIO_SPICE "audio-spice" OBJECT_DECLARE_SIMPLE_TYPE(AudioSpice, AUDIO_SPICE) =20 +static AudioBackendClass *audio_spice_parent_class; + struct AudioSpice { AudioMixengBackend parent_obj; }; =20 static struct audio_driver spice_audio_driver; =20 +static bool spice_audio_realize(AudioBackend *abe, Audiodev *dev, Error **= errp) +{ + if (!using_spice) { + error_setg(errp, "Cannot use spice audio without -spice"); + qapi_free_Audiodev(dev); + return false; + } + + return audio_spice_parent_class->realize(abe, dev, errp); +} + static void audio_spice_class_init(ObjectClass *klass, const void *data) { + AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 + audio_spice_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_pare= nt(klass)); + + b->realize =3D spice_audio_realize; k->driver =3D &spice_audio_driver; } =20 @@ -89,21 +106,6 @@ static const SpiceRecordInterface record_sif =3D { .base.minor_version =3D SPICE_INTERFACE_RECORD_MINOR, }; =20 -static void *spice_audio_init(Audiodev *dev, Error **errp) -{ - if (!using_spice) { - error_setg(errp, "Cannot use spice audio without -spice"); - return NULL; - } - - return &spice_audio_init; -} - -static void spice_audio_fini (void *opaque) -{ - /* nothing */ -} - /* playback */ =20 static int line_out_init(HWVoiceOut *hw, struct audsettings *as, @@ -333,8 +335,6 @@ static struct audio_pcm_ops audio_callbacks =3D { =20 static struct audio_driver spice_audio_driver =3D { .name =3D "spice", - .init =3D spice_audio_init, - .fini =3D spice_audio_fini, .pcm_ops =3D &audio_callbacks, .max_voices_out =3D 1, .max_voices_in =3D 1, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243008; cv=none; d=zohomail.com; s=zohoarc; b=X/K2eLHubqr0gZwTTq2UYxIPa0FsxeG0r8wlBV+6YzYf7gTnDwLYhy1AzxCYgpcjuE5LoEjcBvDQjJ8PsF+Of0iwcCnbNi98uA/Qi+XndXsvp6yGnax9ZmmJw0d+vYCtzpDDnaedpVigHtwRsU6N/Jp57Vue8edNJQNU0nvpmp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243008; h=Content-Type: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=ED51RwFH+aXGygOFGeGe3zuDHJ0atkgjQmDOXgsvEnQ=; b=Vd8cUl9fPb0rSL8azhdAljjLGYZ0irPdW/SXAaHGMRlh/3t5BZHCGoFmeITG8KrJTww+jUAjsHNQuf2QdI5rtefRG2JLV0erjY2j3xPSc1+gF9FVLLgdpWWa+S5pOjq7az3+BL/P+MYz/9PPasXedyRWKHxaa0WGJXf0TiwgtIQ= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243008749409.20618774798595; Mon, 16 Feb 2026 03:56:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfI-0005lw-JQ; Mon, 16 Feb 2026 06:21:20 -0500 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 1vrwbx-0006Fw-8r for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbt-00087U-Pd for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:52 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-294-ClKJmrmwM2y-wgxdFVeEEg-1; Mon, 16 Feb 2026 06:17:44 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6434C195DE50; Mon, 16 Feb 2026 11:17:42 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 321961955F43; Mon, 16 Feb 2026 11:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ED51RwFH+aXGygOFGeGe3zuDHJ0atkgjQmDOXgsvEnQ=; b=efr7E51F65cqQdX2I/yQLOssrGaTfa/2FiJV5Gjk6VLjgVLwc7My91qKZcWG+uYbKJl/21 2gFuwKVQTdhst5t0272RPO4KinPvWsmUsoR+XTbo9JcwA7x/CuZd4277t4Rhx9orFj55pf fnV6KpBH9jaNhlnVrSJFKS77GoDRxkk= X-MC-Unique: ClKJmrmwM2y-wgxdFVeEEg-1 X-Mimecast-MFC-AGG-ID: ClKJmrmwM2y-wgxdFVeEEg_1771240662 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:33 +0100 Subject: [PATCH 44/85] audio/wav: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-44-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1879; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=pK/y5/lIOqV/i/C8zTOt7k3t0ZUfllKojrAoxzndaVs=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQc9z2ZrvrAwwhcbx++h1SQzswtQZT+D0VW QjuGDu3pF+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5SZ5D/4yJTryyW/MgVu5aSz9nN6AchcMsmjoMVTOlrkW1JTQ0fsL76EsSlFqrTDxArsTHNIlp8A mS5/uB4MggAVR6OfD5N7gfdki093/9Ttft992UcFM9FoO0rZiCT8GOIn7TVB5D71z2stp3r39WT NsVEmAlIcWfAbhqqsXN0wCY0hqUfFqLVnVKrPFJOHuGXXe7MYW/s1lggBTp0Ly+j/JhRwBVWu4K uVJ/NVoI9Icx5bb6t6CUbwUz2jSs1yZkSQoudGUHqrY9zCFSLv6SfzTuZRV3/nD7+u8e31SNUxn KNtlVju/4veQTfb/ucUMIfJwpwbZ6e2ajq6no1Usf2UQ5Co1WpmvPCrWzVfFilIeX9DGDUKsvMw 71yBHQxchHsQ4Kvm3yH1LxO9PSiKVjX0DkMgfhZ5SoaOcs/ZdmGk4nFAeB2IK7bERfn6QT5BvTp B0YcTIVqevkxqREkRkx7YhWMdoPjHQh0l67Ic0tWCKAhSt1U/Ydsd7aFdZjZvLEAbW2T4gf/T5V 6lqsLdhKgtYz/OZNN+abTup/mbk87orAzKRvjKeyAZFZxnveYV4dFssm6HaJSXVIpDklpwWUoz3 UAlVglpt+1LHc17Fg6O6IXwuBM/zJs+wk7qBKvAr3Kb8dHZTHrslPdrzFd+BvjXCoWfU+2DvwR+ 18VGwPKhUEcLloA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243010705154100 Remove the legacy driver init/fini callbacks from the WAV audio backend. The wav_audio_init() just returned the Audiodev pointer and wav_audio_fini() only logged a debug message. Access to the Audiodev is now through hw->s->dev instead of the drv_opaque pointer. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/wavaudio.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/audio/wavaudio.c b/audio/wavaudio.c index cd2ceffd42b..f1a414f208c 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -89,7 +89,7 @@ static int wav_init_out(HWVoiceOut *hw, struct audsetting= s *as, 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00 }; - Audiodev *dev =3D drv_opaque; + Audiodev *dev =3D hw->s->dev; AudiodevWavOptions *wopts =3D &dev->u.wav; struct audsettings wav_as =3D audiodev_to_audsettings(dev->u.wav.out); const char *wav_path =3D wopts->path ?: "qemu.wav"; @@ -200,17 +200,6 @@ static void wav_enable_out(HWVoiceOut *hw, bool enable) } } =20 -static void *wav_audio_init(Audiodev *dev, Error **errp) -{ - assert(dev->driver =3D=3D AUDIODEV_DRIVER_WAV); - return dev; -} - -static void wav_audio_fini (void *opaque) -{ - ldebug ("wav_fini"); -} - static struct audio_pcm_ops wav_pcm_ops =3D { .init_out =3D wav_init_out, .fini_out =3D wav_fini_out, @@ -222,8 +211,6 @@ static struct audio_pcm_ops wav_pcm_ops =3D { =20 static struct audio_driver wav_audio_driver =3D { .name =3D "wav", - .init =3D wav_audio_init, - .fini =3D wav_audio_fini, .pcm_ops =3D &wav_pcm_ops, .max_voices_out =3D 1, .max_voices_in =3D 0, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771241992; cv=none; d=zohomail.com; s=zohoarc; b=bK4RJUaFcRhYVrIPBYBrCaXAGocAQwq44JjkZkYpQZLlbLZNUxz10qU2N/X3bAU6DUB3rlDean6gZReez2DSXDEaa4WdA2t8ocGMfSyCi3kAe8czyg0OH1yjn7RLTrrs52pQn6OsQITZ2J/T+o+V3kB2qFHtOOnd1ef2psIL9lU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771241992; h=Content-Type: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=Bp0mskgHmvB97enRMSdlOJ4I9kcDKm/gxqwRVuVQsRc=; b=Zqbo/NY1QYcOgfrlUcfoW9rySHcudBdmO2n7IUU9T3Rw1U6OJWN+ew7LGp+brsEFXYEM2nBbDht0DSGgi+hQu61kCRlv5GYpGQ8EZFzxUdRUjJkFXHNYDMvlbe7pJjwETmCObICcEszDEdvvR0vLMrDMWjSFiLx4zcNgieyHGRc= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177124199267295.95410993979146; Mon, 16 Feb 2026 03:39:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweH-00031Z-Iq; Mon, 16 Feb 2026 06:20:17 -0500 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 1vrwbx-0006Gm-Ct for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwbv-00087p-4v for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:17:53 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-484-riZ0SfBzOXiE2vcjXnM2hw-1; Mon, 16 Feb 2026 06:17:47 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 01B081956050; Mon, 16 Feb 2026 11:17:45 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E91A21800464; Mon, 16 Feb 2026 11:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Bp0mskgHmvB97enRMSdlOJ4I9kcDKm/gxqwRVuVQsRc=; b=iitDGNsIJhaW+vDy+FDd+dcokGdTE/qRqoM/WDT3hR9K5F1z+3zVs+LVtM0Dz4JuApaN9Q sUpICe30jbbabQQU0HlMlD3kLckIrBnoaqyMDaIGGOMA2TobAZP7O5MrDB5PyqRCW1GD7O WFxVaCWPM4MyAqPvO/PvbjLguEUEDR8= X-MC-Unique: riZ0SfBzOXiE2vcjXnM2hw-1 X-Mimecast-MFC-AGG-ID: riZ0SfBzOXiE2vcjXnM2hw_1771240665 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:34 +0100 Subject: [PATCH 45/85] audio/noaudio: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-45-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1239; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=KzRYkvsfVLo5yTsnTsx6InHmXoSpaT1Oo7AoHbV0etw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQtofhQE7cmv8UOdKZBPGI8grKTxrVekcEk tcZsqjH8FCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5bKwD/9lHLtMG0zexrzysNPtsNdka0qi2Zx5/a4MhIpkPo47fi823P48paxO28JQE2TGylgb1Oe 8HpkwkAy5LKrYVnRXHxD2RdAMEr62mIXmWVrAqiU+n72fLzUkEDIkG6oNUOI12ulZuVeIjHkNMj 3e6IUsL08zyycOftHvT8kEYgKfkuKMcm06bZFfy/6C9ZmGumECA0BC4UNW8QHwlI3hIzR3eqgha ACYJRXBtNhZXG9QuoBht6SnEzCp8ckaGDrduNha4OUEF5z2HVJsUE6Tu1zlDgP57JGCV1z0UIfw wvUgWpSfuYP4WEVAms3002bodJdQsvfJOdjJoCc3rCnh945qmcJsBGknamHayfQ+skWGvIcAgV4 XiGC+spWlU6qgb9hWCyfcUW/GmJfI85nb/tQpV54u/Zfrf70Ht/tswEtS1sH+SXCKtkJ60YIOhN SuS6EMsaGLCCqh7sYnA14844PZVQYw59W5l9pLDzT0Gf4RlpMzcVJEolhowrRfqU+uPrCQj1cvB j8koEdO3y5FNzKOYzTgg7U4tLS3IM6pP15IUM5swSrRHTDGW64yRBK2luvBYlhAaMOZghcchNDS C0ldSHf8Iod/47N09eQLfC3ip3ETicLayh24I8rH5WGTtmVtBLL5LeU8ycNjpVBxRQGe9Zansw/ q9kC7bD73xs/tQQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771241996277154100 Remove the legacy driver init/fini callbacks from the null audio backend. Both no_audio_init() and no_audio_fini() were no-ops that performed no real initialization or cleanup work. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/noaudio.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/audio/noaudio.c b/audio/noaudio.c index 65679b8b13d..2bd110caac4 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -119,16 +119,6 @@ static void no_enable_in(HWVoiceIn *hw, bool enable) } } =20 -static void *no_audio_init(Audiodev *dev, Error **errp) -{ - return &no_audio_init; -} - -static void no_audio_fini (void *opaque) -{ - (void) opaque; -} - static struct audio_pcm_ops no_pcm_ops =3D { .init_out =3D no_init_out, .fini_out =3D no_fini_out, @@ -146,8 +136,6 @@ static struct audio_pcm_ops no_pcm_ops =3D { =20 static struct audio_driver no_audio_driver =3D { .name =3D "none", - .init =3D no_audio_init, - .fini =3D no_audio_fini, .pcm_ops =3D &no_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244764; cv=none; d=zohomail.com; s=zohoarc; b=Cujg16jD0U5XduTaPqKYFeF9CjPdPhW096m3USNXfg/wJIhgAxhd20E3veUvREWcIokVbWy5kif9XiiTnNRGG5/3W32771nfmEwhriXcBE8UmLuWNH9E+cTKIzN2+vjxam2jxmrh5osobGf9OtI4gqAbibCETBhUa6GgzsRNCpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244764; h=Content-Type: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=BmWsdaoNqpVIR51QxuWz4WHbtihjGKEs2lMyJkFhJdU=; b=lU6dmUj9af/YpqRaXff6xalsuV+hpkGADmVz9ZrhEDDhHji+6VBkzdpnIMCvS6052e1Vn3NRQzNFoZEfqgp/vk24rh/uhJeBYPY6b2f0+XJV6D6AYFJjtq6c9llAAwih3mQ8RWczshY3pQ9HHfDdH8EoWQTboRHslgsI67IUB3Q= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244764839323.4079571855831; Mon, 16 Feb 2026 04:26:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfb-0008VH-R9; Mon, 16 Feb 2026 06:21:39 -0500 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 1vrwc5-0006Om-4a for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwc1-00089G-PO for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:00 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-259-YWNviQL8PsSzcH4TeNd7AA-1; Mon, 16 Feb 2026 06:17:49 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 762891955D7F; Mon, 16 Feb 2026 11:17:47 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C83F41800465; Mon, 16 Feb 2026 11:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BmWsdaoNqpVIR51QxuWz4WHbtihjGKEs2lMyJkFhJdU=; b=JVoczkfDMMr7puJpY57iiEwzDI4/QbBohXcGSbzbYFNm6FHlhV1v0UJrLArFutWbQrYRp+ NKBPY9srLI1XRC5oQ9hQx/TBdIVoN3sCnYLH1mbD3fc6z76plUU1DeWU4l4BnpwpfmgnPW EAcivtfzN8AKxI6lZ5OwZ73tO+sb1wQ= X-MC-Unique: YWNviQL8PsSzcH4TeNd7AA-1 X-Mimecast-MFC-AGG-ID: YWNviQL8PsSzcH4TeNd7AA_1771240667 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:35 +0100 Subject: [PATCH 46/85] audio/alsa: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-46-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=5252; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=sSRqkWRZ9hS4IFoZz7rr3+mLEDXoYfNvp3TZ0iZgY6Y=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQmk9b3wzN3LM3fcPoVlXSzyKcASxtAa+kr 2r/1mlq7USJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5auqD/46RIfQboxk82mbkTY3HCCjNGnhpRYk4hp4AjGvuho7AbzCwq7Y48DZT0iv9X/azQ7GULJ DEwMQ7XN6B2PrbMFu6sn8LU1L1kdLE/0AW3kPt8ILIdSiFiiSYA1Pr3r20oKwTfLq+s0vIL8XPO +eXyVDaKpiXzWPeIA3WKW4Da/kpGD1gFBaDaluEx/j0+Jqt1FuJ6DVZwxCFcafbn93McgBqW8xe HrVbJ+rcFTuZBwIFCgPJ+cOCDCtGG4DUbMDA5wZq46IK1KODWbq9BK8z4/3gnhcp0DmJzI8YieY ZMkunBgnukoccVIVLrb+BQxWm2Qb/mVG5EyvWQUpFDjvnodKxJBeAhigolvgNdyLt59dZGTZP/l IxJW1UIjhW5lfHpsy3q1modoQT0Ixo3zPQ9qx0ni0x4msnTSnFaN6yB+fYc/wXpiyopIhEKpi+E m4iCS0Zqh9/Zn2H3sN9YcU0d0bylS9HJLmrgL6ZEBQH9Q/9HhjWsk1/T1+56tl2wD2cUR5k3kHv w6ckbVKADWcwYpjLUh1Nokbo02lw7gLnVMkNVCQIGg7KXQkG4yD9jj8WVN3OMaza6KE4jeecLvq U6WTSfhdcqI+CY00fWMJYK+X34s87ssL79Nbb6HTb9tTRMWK6K8TH4/QeDNqIZBB/lLfkUiASXN vo/vXrEhP5lRMPg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244766369158500 Migrate the ALSA audio backend from the legacy driver init/fini callbacks to proper QOM realize method. The alsa_audio_init() function is replaced with audio_alsa_realize(), which performs the same ALSA option initialization before delegating to the parent class realize method. The empty alsa_audio_fini() is removed. The Audiodev pointer stored in ALSAVoiceOut and ALSAVoiceIn is removed as it can now be accessed through hw->s->dev. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/alsaaudio.c | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index ae1cec6a36e..c2788606b28 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -40,19 +40,14 @@ #define TYPE_AUDIO_ALSA "audio-alsa" OBJECT_DECLARE_SIMPLE_TYPE(AudioALSA, AUDIO_ALSA) =20 +static AudioBackendClass *audio_alsa_parent_class; + struct AudioALSA { AudioMixengBackend parent_obj; }; =20 static struct audio_driver alsa_audio_driver; =20 -static void audio_alsa_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &alsa_audio_driver; -} - struct pollhlp { snd_pcm_t *handle; struct pollfd *pfds; @@ -65,14 +60,12 @@ typedef struct ALSAVoiceOut { HWVoiceOut hw; snd_pcm_t *handle; struct pollhlp pollhlp; - Audiodev *dev; } ALSAVoiceOut; =20 typedef struct ALSAVoiceIn { HWVoiceIn hw; snd_pcm_t *handle; struct pollhlp pollhlp; - Audiodev *dev; } ALSAVoiceIn; =20 struct alsa_params_req { @@ -707,7 +700,7 @@ static int alsa_init_out(HWVoiceOut *hw, struct audsett= ings *as, struct alsa_params_obt obt; snd_pcm_t *handle; struct audsettings obt_as; - Audiodev *dev =3D drv_opaque; + Audiodev *dev =3D hw->s->dev; =20 req.fmt =3D aud_to_alsafmt (as->fmt, as->endianness); req.freq =3D as->freq; @@ -727,7 +720,6 @@ static int alsa_init_out(HWVoiceOut *hw, struct audsett= ings *as, =20 alsa->pollhlp.s =3D hw->s; alsa->handle =3D handle; - alsa->dev =3D dev; return 0; } =20 @@ -766,7 +758,7 @@ static int alsa_voice_ctl (snd_pcm_t *handle, const cha= r *typ, int ctl) static void alsa_enable_out(HWVoiceOut *hw, bool enable) { ALSAVoiceOut *alsa =3D (ALSAVoiceOut *) hw; - AudiodevAlsaPerDirectionOptions *apdo =3D alsa->dev->u.alsa.out; + AudiodevAlsaPerDirectionOptions *apdo =3D hw->s->dev->u.alsa.out; =20 if (enable) { bool poll_mode =3D apdo->try_poll; @@ -794,7 +786,7 @@ static int alsa_init_in(HWVoiceIn *hw, struct audsettin= gs *as, void *drv_opaque) struct alsa_params_obt obt; snd_pcm_t *handle; struct audsettings obt_as; - Audiodev *dev =3D drv_opaque; + Audiodev *dev =3D hw->s->dev; =20 req.fmt =3D aud_to_alsafmt (as->fmt, as->endianness); req.freq =3D as->freq; @@ -814,7 +806,6 @@ static int alsa_init_in(HWVoiceIn *hw, struct audsettin= gs *as, void *drv_opaque) =20 alsa->pollhlp.s =3D hw->s; alsa->handle =3D handle; - alsa->dev =3D dev; return 0; } =20 @@ -871,7 +862,7 @@ static size_t alsa_read(HWVoiceIn *hw, void *buf, size_= t len) static void alsa_enable_in(HWVoiceIn *hw, bool enable) { ALSAVoiceIn *alsa =3D (ALSAVoiceIn *) hw; - AudiodevAlsaPerDirectionOptions *apdo =3D alsa->dev->u.alsa.in; + AudiodevAlsaPerDirectionOptions *apdo =3D hw->s->dev->u.alsa.in; =20 if (enable) { bool poll_mode =3D apdo->try_poll; @@ -901,7 +892,8 @@ static void alsa_init_per_direction(AudiodevAlsaPerDire= ctionOptions *apdo) } } =20 -static void *alsa_audio_init(Audiodev *dev, Error **errp) +static bool +audio_alsa_realize(AudioBackend *abe, Audiodev *dev, Error **errp) { AudiodevAlsaOptions *aopts; assert(dev->driver =3D=3D AUDIODEV_DRIVER_ALSA); @@ -929,11 +921,7 @@ static void *alsa_audio_init(Audiodev *dev, Error **er= rp) dev->u.alsa.in->buffer_length =3D 92880; } =20 - return dev; -} - -static void alsa_audio_fini (void *opaque) -{ + return audio_alsa_parent_class->realize(abe, dev, errp); } =20 static struct audio_pcm_ops alsa_pcm_ops =3D { @@ -953,8 +941,6 @@ static struct audio_pcm_ops alsa_pcm_ops =3D { =20 static struct audio_driver alsa_audio_driver =3D { .name =3D "alsa", - .init =3D alsa_audio_init, - .fini =3D alsa_audio_fini, .pcm_ops =3D &alsa_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, @@ -962,6 +948,17 @@ static struct audio_driver alsa_audio_driver =3D { .voice_size_in =3D sizeof (ALSAVoiceIn) }; =20 +static void audio_alsa_class_init(ObjectClass *klass, const void *data) +{ + AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + audio_alsa_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_paren= t(klass)); + + b->realize =3D audio_alsa_realize; + k->driver =3D &alsa_audio_driver; +} + static const TypeInfo audio_types[] =3D { { .name =3D TYPE_AUDIO_ALSA, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243950; cv=none; d=zohomail.com; s=zohoarc; b=fBfVwTahcOmFjiN14sP+bMnKciTV4pwX0jqdYVLHo2oFb6Uic5o9FEHL+jOicZhqIAwuUryRbW7xdvPXLM0tsdfg+xBR81807Wq8p0iydKe3GJIAB8L8ajDKOie6fcrfn37V7hP4FfRTIHlo2NlNjFSF+xosmoypiezH8UtG2Ls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243950; h=Content-Type: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=FEm66eRxFketQFIgeZBzb+TUChBafUGfeNq/IMh5ojk=; b=RHCMgItwwnVHSjB6SnKNcHWBwVaLf/25jEaLxftLyVye8odLwTJCVEPN/feEjVLFufgu1Ia0rsp9YtZjqyniweQllf0gEBlEAmvlvNaRP0w65KTyVmhEbda9b9rwcO5mXWGgYTrSuJCgT+/n4J5sm0jzrs/wkwzZAj59yn0NaTQ= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243950287160.86709706188708; Mon, 16 Feb 2026 04:12:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfG-0005EL-4D; Mon, 16 Feb 2026 06:21:18 -0500 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 1vrwc5-0006Ol-2v for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwc1-00089Q-Q8 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:00 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-499-xBxOfUlKOMW5imetpbPsyw-1; Mon, 16 Feb 2026 06:17:52 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3AB731800367; Mon, 16 Feb 2026 11:17:50 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 44DED30001A5; Mon, 16 Feb 2026 11:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240675; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FEm66eRxFketQFIgeZBzb+TUChBafUGfeNq/IMh5ojk=; b=JrSvBeQmc6eU6zJa+kzPxRizcsgyKPL9P0kByv1wD9455qpiuTRyEgjb3i8hEMmEpbt4g+ Z+uz5dzV7foteG1EsuEj+9IllMb/D7iPXTuc6CRUtjuINj4uAXyrUbcvpiHF0cAynIYhgY Qj6HPyZwvdxxUTwR+t2zdss97c3L3H0= X-MC-Unique: xBxOfUlKOMW5imetpbPsyw-1 X-Mimecast-MFC-AGG-ID: xBxOfUlKOMW5imetpbPsyw_1771240670 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:36 +0100 Subject: [PATCH 47/85] audio/oss: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-47-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=4118; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=WSaswajA4EH4bQvF1yrHLLnXVV/md1CQHXeFT1moIKg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQCWIyFxILKTEM9E5I8G/E+JA2cKon2GziR 0mw2ZgO4GSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5ZVrD/0aE3LDDMhOs8tIc36loNx326609rrLev+SeQjQ0OvkE4fitDeY+ZFjvSOBJeldk0Ejgub I9HpvWfasNhPnn+bqhx85dWEYPgtBsGilDfAtXxUfqbr4+aowcYk9hBdgLGexX2MrxkYuSe3Rj7 jfEMvY9j3+49VHu9Om6Xg78NmpRK973xo/J9DSqOrx4EYegsQ5uOqVJmkSErSMJy/CiS3sFYJNG CGz5h5dQbONyMNtEdt4ipcRvjeWbr2MS1UvzC9EE455qO/2iD8WtgXENaLaZuXFw/DVmvokB/vu d9RoFfLmd3zUbYmIqY+8JahHoLYZzJjFTKu63jlTmdzkq92QWLmJXm++yDDPGg1wAFc/lrlXYIf EYuOtGM4VG7JYV2z0lwyxsR0wvIvIHcZY4xarj8LDzCigFfR7VxA2WGWqHyMC0fSdv/kFgWaiIN 6PEUG9CBh2H7JT+IJBhr2TcSUWgk+gcjdW5LYOuQb1n+KjiJT/bW1Bwusc0zhMh2HMDqal2aIzZ kx6psFeNh4ykZjNyCDxircAghw8RfNq5QUbssv1zWtcyz2LoY0n+r7ubnnyqvADJc7bBOOHh3Ry jjgSM2MmyV4y7BWVhvZ1+CIY8VrGZLHFR+JbYoXAw7MC62i90qgTFnXPOzSwLBrCT9/aHmDqQxv M+pD4POPkumPXNw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243952642158500 Migrate the OSS audio backend from the legacy driver init/fini callbacks to proper QOM realize method. The oss_audio_init() function is replaced with audio_oss_realize(), which performs the same device accessibility check before delegating to the parent class realize method. The empty oss_audio_fini() is removed. Access to the Audiodev is now through hw->s->dev instead of the drv_opaque pointer. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/ossaudio.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/audio/ossaudio.c b/audio/ossaudio.c index f64c564e345..fedd2bbd722 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qapi-types-audio.h" #include #include #include "qemu/main-loop.h" @@ -39,19 +40,14 @@ #define TYPE_AUDIO_OSS "audio-oss" OBJECT_DECLARE_SIMPLE_TYPE(AudioOss, AUDIO_OSS) =20 +static AudioBackendClass *audio_oss_parent_class; + struct AudioOss { AudioMixengBackend parent_obj; }; =20 static struct audio_driver oss_audio_driver; =20 -static void audio_oss_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &oss_audio_driver; -} - #if defined OSS_GETVERSION && defined SNDCTL_DSP_POLICY #define USE_DSP_POLICY #endif @@ -505,7 +501,7 @@ static int oss_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, int err; int fd; struct audsettings obt_as; - Audiodev *dev =3D drv_opaque; + Audiodev *dev =3D hw->s->dev; AudiodevOssOptions *oopts =3D &dev->u.oss; =20 oss->fd =3D -1; @@ -636,7 +632,7 @@ static int oss_init_in(HWVoiceIn *hw, struct audsetting= s *as, void *drv_opaque) int err; int fd; struct audsettings obt_as; - Audiodev *dev =3D drv_opaque; + Audiodev *dev =3D hw->s->dev; =20 oss->fd =3D -1; =20 @@ -737,7 +733,8 @@ static void oss_init_per_direction(AudiodevOssPerDirect= ionOptions *opdo) } } =20 -static void *oss_audio_init(Audiodev *dev, Error **errp) +static bool +audio_oss_realize(AudioBackend *abe, Audiodev *dev, Error **errp) { AudiodevOssOptions *oopts; assert(dev->driver =3D=3D AUDIODEV_DRIVER_OSS); @@ -748,17 +745,16 @@ static void *oss_audio_init(Audiodev *dev, Error **er= rp) =20 if (access(oopts->in->dev ?: "/dev/dsp", R_OK | W_OK) < 0) { error_setg_errno(errp, errno, "%s not accessible", oopts->in->dev = ?: "/dev/dsp"); - return NULL; + qapi_free_Audiodev(dev); + return false; } if (access(oopts->out->dev ?: "/dev/dsp", R_OK | W_OK) < 0) { error_setg_errno(errp, errno, "%s not accessible", oopts->out->dev= ?: "/dev/dsp"); - return NULL; + qapi_free_Audiodev(dev); + return false; } - return dev; -} =20 -static void oss_audio_fini (void *opaque) -{ + return audio_oss_parent_class->realize(abe, dev, errp); } =20 static struct audio_pcm_ops oss_pcm_ops =3D { @@ -780,8 +776,6 @@ static struct audio_pcm_ops oss_pcm_ops =3D { =20 static struct audio_driver oss_audio_driver =3D { .name =3D "oss", - .init =3D oss_audio_init, - .fini =3D oss_audio_fini, .pcm_ops =3D &oss_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, @@ -789,6 +783,17 @@ static struct audio_driver oss_audio_driver =3D { .voice_size_in =3D sizeof (OSSVoiceIn) }; =20 +static void audio_oss_class_init(ObjectClass *klass, const void *data) +{ + AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + audio_oss_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent= (klass)); + + b->realize =3D audio_oss_realize; + k->driver =3D &oss_audio_driver; +} + static const TypeInfo audio_types[] =3D { { .name =3D TYPE_AUDIO_OSS, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244436; cv=none; d=zohomail.com; s=zohoarc; b=G4rmVg/f8hASLq/qha6gHW69tOGp0BoEJdukrf+uvfwtETavxF1c0TJIII1A4VjCuhB0AlnhOoVCLPFLIksnTRHRJYBNyUpPbds6PnawPYF+e35X9663DyEhuzJDEV7ZH7zg+vxqxJPQMBbt99/FJySbcgNsdiiwFVRQtaZiOh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244436; h=Content-Type: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=wllvUW1z4j78fEcJ0Ch9mn6nwgUd9WiNw4vpX1q0pPQ=; b=DnEwOkM3d95EO04jqFpm1jsX5CWkErZpYT9WNz4J7zSYKBybZvhaTDZVJSICb6jFIHaxAhCV/kTaup3iRLCM8y+xXa4HFSHcW8JTRXs/oGHtG03ZPyQYWrldt3O19Z1I0vclpTnyBICYG+nIWm+vx7fyCmKci2lYoee18avKwXk= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17712444362391011.746967545265; Mon, 16 Feb 2026 04:20:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfM-0006Hi-1s; Mon, 16 Feb 2026 06:21:24 -0500 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 1vrwc6-0006Pd-OI for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwc3-00089v-Uu for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:02 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-453-CigqbbDnNLmJLjBr1isJDQ-1; Mon, 16 Feb 2026 06:17:54 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 00C4618003F5; Mon, 16 Feb 2026 11:17:53 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 264FD1955F43; Mon, 16 Feb 2026 11:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240678; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wllvUW1z4j78fEcJ0Ch9mn6nwgUd9WiNw4vpX1q0pPQ=; b=facClmjo+nyiNm/7cNadUuJtjyhVwr8NLWTinDqV67jEig4JdkeV6yRomfOhpgf9GSI8xw 70QlxEs0qHxCfUJx+ZiNTDPw4uJHSC3/AAv2f9ctRSXDQX+9zBvpcEzxcklnmyzwKgz9+9 wx8KFQtXp7eGQWVJAPVNHx/dLSNk7jM= X-MC-Unique: CigqbbDnNLmJLjBr1isJDQ-1 X-Mimecast-MFC-AGG-ID: CigqbbDnNLmJLjBr1isJDQ_1771240673 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:37 +0100 Subject: [PATCH 48/85] audio/pa: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-48-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=8857; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=XClO4Ihg9Kzu0GeOaZiAff+2TMQWcfkYzMlWRAVRIxg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQD8gBVAdWOFDlxdmV0Viobi9nhH6J48XL+ SoDga9yC3GJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5WHVD/sFcKK+M2UThK+hpUkwcMwGYfhp/GFYmMUBEZjf2KaRD1tHV+V30HkqkRRXX3msoePGl5r Rz1sf/B537bywKAuGP2PRwhTT83XEfjmjZJwh2WNhdfnc5yxvSuk83xb8egMaI7nfutqwwaa8+4 fDIoke4Ojbo8oT3ZOxmKHfMVrPGoMQXvV5Z7mAYaVhc0PY0ZnmBH4+WMl9Nlzc/r5dCMQL+6LGz IyyforAC5gk6wiUUnRTS15IGRWswaBcGzRg26oUQ7tGHVGVD9vuzdmPf6xbzvoxzHvkEibaSwnc ZqJ6iJflULwFNOdCz5lpf0bcN0kwrF2X87plpbMJs8PTaNz2ZpRLvcPkkuy0UXIjX5hp18ONVM4 nB1NG7gNyGxQOmWYYZFM+ARgNe2Nnkb+PqJK7ewOAdzMIiw1s8XoMATQIAruWr3o1lszuevzuw1 nnOxaYZTeVrr/0fbgnB1hXsgN1dpubzMl6LR5n9Ts4vYN8GZNOMdlnvCUpsC22CLLyFomDPNUD2 yRylniDJCbuppb3y1AKRuvnG4DpTVyNFrzAqO+mcxE4XXFaX9y3eAsdW/GlN0x5bkVhEPdc3YLE KkNXzrACgYIyw0BMz0Q44qC1ekYpbhrVt1oAeS+S8dgTgHwca2GoLY4Q6RnSR+4+dyza7QA7+eO OdgvEuRDTJVbg+w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244438094154100 Migrate the PulseAudio backend from the legacy driver init/fini callbacks to proper QOM realize and finalize methods. The paaudio struct fields are now embedded directly in the AudioPa QOM object instead of being allocated separately as drv_opaque. This allows accessing the backend state through proper QOM type casting with AUDIO_PA() rather than casting drv_opaque pointers. The PulseAudio connection is now managed through the QOM lifecycle, with the connection reference acquired in realize and released in finalize. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/paaudio.c | 109 +++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index 331da4f2ed6..97e6c0d1794 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -14,19 +14,10 @@ #define TYPE_AUDIO_PA "audio-pa" OBJECT_DECLARE_SIMPLE_TYPE(AudioPa, AUDIO_PA) =20 -struct AudioPa { - AudioMixengBackend parent_obj; -}; +static AudioBackendClass *audio_pa_parent_class; =20 static struct audio_driver pa_audio_driver; =20 -static void audio_pa_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &pa_audio_driver; -} - typedef struct PAConnection { char *server; int refcount; @@ -36,18 +27,19 @@ typedef struct PAConnection { pa_context *context; } PAConnection; =20 -static QTAILQ_HEAD(PAConnectionHead, PAConnection) pa_conns =3D - QTAILQ_HEAD_INITIALIZER(pa_conns); +struct AudioPa { + AudioMixengBackend parent_obj; =20 -typedef struct { - Audiodev *dev; PAConnection *conn; -} paaudio; +}; + +static QTAILQ_HEAD(PAConnectionHead, PAConnection) pa_conns =3D + QTAILQ_HEAD_INITIALIZER(pa_conns); =20 typedef struct { HWVoiceOut hw; pa_stream *stream; - paaudio *g; + AudioPa *g; } PAVoiceOut; =20 typedef struct { @@ -55,7 +47,7 @@ typedef struct { pa_stream *stream; const void *read_data; size_t read_length; - paaudio *g; + AudioPa *g; } PAVoiceIn; =20 static void qpa_conn_fini(PAConnection *c); @@ -529,23 +521,25 @@ fail: static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque) { + AudioMixengBackend *amb =3D hw->s; + AudioPa *apa =3D AUDIO_PA(amb); int error; pa_sample_spec ss; pa_buffer_attr ba; struct audsettings obt_as =3D *as; PAVoiceOut *pa =3D (PAVoiceOut *) hw; - paaudio *g =3D pa->g =3D drv_opaque; - AudiodevPaOptions *popts =3D &g->dev->u.pa; + AudiodevPaOptions *popts =3D &amb->dev->u.pa; AudiodevPaPerDirectionOptions *ppdo =3D popts->out; - PAConnection *c =3D g->conn; + PAConnection *c =3D apa->conn; =20 + pa->g =3D apa; ss.format =3D audfmt_to_pa (as->fmt, as->endianness); ss.channels =3D as->nchannels; ss.rate =3D as->freq; =20 ba.tlength =3D pa_usec_to_bytes(ppdo->latency, &ss); ba.minreq =3D pa_usec_to_bytes(MIN(ppdo->latency >> 2, - (g->dev->timer_period >> 2) * 3), &ss= ); + (amb->dev->timer_period >> 2) * 3), &= ss); ba.maxlength =3D -1; ba.prebuf =3D -1; =20 @@ -553,7 +547,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, =20 pa->stream =3D qpa_simple_new ( c, - ppdo->stream_name ?: g->dev->id, + ppdo->stream_name ?: amb->dev->id, PA_STREAM_PLAYBACK, ppdo->name, &ss, @@ -578,23 +572,25 @@ static int qpa_init_out(HWVoiceOut *hw, struct audset= tings *as, =20 static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_op= aque) { + AudioMixengBackend *amb =3D hw->s; + AudioPa *apa =3D AUDIO_PA(amb); int error; pa_sample_spec ss; pa_buffer_attr ba; struct audsettings obt_as =3D *as; PAVoiceIn *pa =3D (PAVoiceIn *) hw; - paaudio *g =3D pa->g =3D drv_opaque; - AudiodevPaOptions *popts =3D &g->dev->u.pa; + AudiodevPaOptions *popts =3D &amb->dev->u.pa; AudiodevPaPerDirectionOptions *ppdo =3D popts->in; - PAConnection *c =3D g->conn; + PAConnection *c =3D apa->conn; =20 + pa->g =3D apa; ss.format =3D audfmt_to_pa (as->fmt, as->endianness); ss.channels =3D as->nchannels; ss.rate =3D as->freq; =20 - ba.fragsize =3D pa_usec_to_bytes((g->dev->timer_period >> 1) * 3, &ss); + ba.fragsize =3D pa_usec_to_bytes((amb->dev->timer_period >> 1) * 3, &s= s); ba.maxlength =3D pa_usec_to_bytes( - MAX(ppdo->latency, g->dev->timer_period * 3), &ss); + MAX(ppdo->latency, amb->dev->timer_period * 3), &ss); ba.minreq =3D -1; ba.prebuf =3D -1; =20 @@ -602,7 +598,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsetting= s *as, void *drv_opaque) =20 pa->stream =3D qpa_simple_new ( c, - ppdo->stream_name ?: g->dev->id, + ppdo->stream_name ?: amb->dev->id, PA_STREAM_RECORD, ppdo->name, &ss, @@ -834,15 +830,20 @@ fail: return NULL; } =20 -static void *qpa_audio_init(Audiodev *dev, Error **errp) +static bool +audio_pa_realize(AudioBackend *abe, Audiodev *dev, Error **errp) { - paaudio *g; + AudioPa *apa =3D AUDIO_PA(abe); AudiodevPaOptions *popts =3D &dev->u.pa; const char *server; PAConnection *c; =20 assert(dev->driver =3D=3D AUDIODEV_DRIVER_PA); =20 + if (!audio_pa_parent_class->realize(abe, dev, errp)) { + return false; + } + if (!popts->server) { char pidfile[64]; char *runtime; @@ -851,42 +852,38 @@ static void *qpa_audio_init(Audiodev *dev, Error **er= rp) runtime =3D getenv("XDG_RUNTIME_DIR"); if (!runtime) { error_setg(errp, "XDG_RUNTIME_DIR not set"); - return NULL; + return false; } snprintf(pidfile, sizeof(pidfile), "%s/pulse/pid", runtime); if (stat(pidfile, &st) !=3D 0) { error_setg_errno(errp, errno, "could not stat pidfile %s", pid= file); - return NULL; + return false; } } =20 qpa_validate_per_direction_opts(dev, popts->in); qpa_validate_per_direction_opts(dev, popts->out); =20 - g =3D g_new0(paaudio, 1); server =3D popts->server; - - g->dev =3D dev; - QTAILQ_FOREACH(c, &pa_conns, list) { if (server =3D=3D NULL || c->server =3D=3D NULL ? server =3D=3D c->server : strcmp(server, c->server) =3D=3D 0) { - g->conn =3D c; + apa->conn =3D c; break; } } - if (!g->conn) { - g->conn =3D qpa_conn_init(server); + if (!apa->conn) { + apa->conn =3D qpa_conn_init(server); } - if (!g->conn) { - g_free(g); + if (!apa->conn) { error_setg(errp, "could not connect to PulseAudio server"); - return NULL; + return false; } =20 - ++g->conn->refcount; - return g; + ++apa->conn->refcount; + + return true; } =20 static void qpa_conn_fini(PAConnection *c) @@ -908,16 +905,14 @@ static void qpa_conn_fini(PAConnection *c) g_free(c); } =20 -static void qpa_audio_fini (void *opaque) +static void audio_pa_finalize(Object *obj) { - paaudio *g =3D opaque; - PAConnection *c =3D g->conn; + AudioPa *apa =3D AUDIO_PA(obj); + PAConnection *c =3D apa->conn; =20 - if (--c->refcount =3D=3D 0) { + if (c && --c->refcount =3D=3D 0) { qpa_conn_fini(c); } - - g_free(g); } =20 static struct audio_pcm_ops qpa_pcm_ops =3D { @@ -939,8 +934,6 @@ static struct audio_pcm_ops qpa_pcm_ops =3D { =20 static struct audio_driver pa_audio_driver =3D { .name =3D "pa", - .init =3D qpa_audio_init, - .fini =3D qpa_audio_fini, .pcm_ops =3D &qpa_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, @@ -948,12 +941,24 @@ static struct audio_driver pa_audio_driver =3D { .voice_size_in =3D sizeof (PAVoiceIn), }; =20 +static void audio_pa_class_init(ObjectClass *klass, const void *data) +{ + AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + audio_pa_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent(= klass)); + + b->realize =3D audio_pa_realize; + k->driver =3D &pa_audio_driver; +} + static const TypeInfo audio_types[] =3D { { .name =3D TYPE_AUDIO_PA, .parent =3D TYPE_AUDIO_MIXENG_BACKEND, .instance_size =3D sizeof(AudioPa), .class_init =3D audio_pa_class_init, + .instance_finalize =3D audio_pa_finalize, }, }; =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244740; cv=none; d=zohomail.com; s=zohoarc; b=SsqTimJLeRg4+LX4MUVJGJMJnUuhb9/aznfRXSqJlzan7z3X5JVQFmqt8N5q4RTfUYQz1tP4D7vhD9GfQtbZy2MkPdAvxR+NWNKhNVYuNYCaBojnpA+b6IbihBqRg8AuMs6E+OMRyMQJ1VmD3U0tW6DhmYNrN3x3+92TQN3PJMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244740; h=Content-Type: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=5Rp8fyVkH2hZh+mPHtPSd3g8yoblH6WdY9/V5EDNhAE=; b=GaqL9nGYWEIksgLwe7/IBeOf/ZShAqd3ovfiTafuG7X+vvOdDceOrWcl9uSRdN7KWXVsXypNg5yufNN3NO9cxmCB37DEOEmdEeB+oebu8Yt/hlyh6c/re1f7k+c58BoZbnEOGQod/9AmwAzi7ZhIQZLZZzWkuhXRTzpRPKBjUfY= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244740543567.9546387510909; Mon, 16 Feb 2026 04:25:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfb-0008Ue-Ok; Mon, 16 Feb 2026 06:21:39 -0500 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 1vrwc8-0006RL-0I for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwc6-0008An-5g for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:03 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-P-tWzq9TPfiVszLycTCsUA-1; Mon, 16 Feb 2026 06:17:57 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5E8791800259; Mon, 16 Feb 2026 11:17:55 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9FDFB30001A5; Mon, 16 Feb 2026 11:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Rp8fyVkH2hZh+mPHtPSd3g8yoblH6WdY9/V5EDNhAE=; b=WfV4v4v8Niw6d3blMMx0HcMqYe4o5d1b/OnIQ9KfhjsDO5rDvEdbjogCq5ogeYwbdlNn/w EMok9dP48pzXM/vlkovneo+1lVA66UemkaUEU11H70AYBZemtu3/dOtWtDpm7PHhu4MSv7 niJNQ/LHBdw4Bz5K2brF3aWOozsW/gk= X-MC-Unique: P-tWzq9TPfiVszLycTCsUA-1 X-Mimecast-MFC-AGG-ID: P-tWzq9TPfiVszLycTCsUA_1771240675 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:38 +0100 Subject: [PATCH 49/85] audio/sdl: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-49-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=4088; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Bi9IEy+nlgFFCt8QlBx2RYdWyux3lXAtO/gg3ozTayY=; b=owEBbAKT/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQtE3m5hY51mQAQrSKdZIBcmYjmT5YyP8cp vUMuz6qBp6JAjIEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5ROQD/dzAu4kQRBZiOoqG5a4TEY5nm127pGZega2hSBFiRQ5Ep3ZEB96xPTxG+kJoi6VHCY/T9I P0JxTrt2PellSi0S5ZPNSE6w+hy2YdSgVTsq1dRLcoNBT4wix6puI7qRp/8xs5ksDvYeGB+77NP hJ49mk3KxmBClm1/nJzrdZoG1gff3cVoPMapiEo4CxA6BpNyiz0FXrU83O240Ww1Iu9yliK908P W4z70Y+vG+c65ZlyXgEKJKqJZBmYZ4HN8K2c8yrBzxSe3Qh+1UBtz8usuKC9VwAthWT0iB/qtWI tVNitn6TMUkr7+d7grRKcJCxiyfNmLmU7i81ctLXoAtKmqgoY5Js0ajXZxl75IHyP0PG4A4uesd eLUECuz2FuOFkA4rii9YbVLUtB9QBCkw5AxtS1imhNm8/B0sFxUxCkAHAmZUEdoEMsl/uDQ/tgX bZRn5UkR4QwjOiwME9j+IywHiLJKMWrN/Z5leTLj3tXHUYD4voY0hmlgsQjxqRN5AOJIxuR1ybg cZVtsini+XZklQPGJW+Ei1SjOdsNBmlnK/nCyPDEw+N9lNgFlBPo4eUv1TROTnbTxe5GlTgp94q e5cL85CnhCLssitegN/Bsl28ADaGJqfKGOkam+a6V6xHQHvcgfBC+IYN0yzteFim5DUe9GnewOB TfaORBqIzmdtT X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771244742263158500 Migrate the SDL audio backend from the legacy driver init/fini callbacks to proper QOM realize and finalize methods. The sdl_audio_init() function is replaced with audio_sdl_realize(), which initializes the SDL audio subsystem before delegating to the parent class realize method. The sdl_audio_fini() is replaced with audio_sdl_finalize() to properly clean up the SDL audio subsystem. Access to the Audiodev is now through hw->s->dev instead of the drv_opaque pointer. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/sdlaudio.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index a60b1629da0..0dfa3100828 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -44,19 +44,14 @@ #define TYPE_AUDIO_SDL "audio-sdl" OBJECT_DECLARE_SIMPLE_TYPE(AudioSdl, AUDIO_SDL) =20 +static AudioBackendClass *audio_sdl_parent_class; + struct AudioSdl { AudioMixengBackend parent_obj; }; =20 static struct audio_driver sdl_audio_driver; =20 -static void audio_sdl_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &sdl_audio_driver; -} - typedef struct SDLVoiceOut { HWVoiceOut hw; int exit; @@ -356,7 +351,7 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, SDLVoiceOut *sdl =3D (SDLVoiceOut *)hw; SDL_AudioSpec req, obt; int err; - Audiodev *dev =3D drv_opaque; + Audiodev *dev =3D hw->s->dev; AudiodevSdlPerDirectionOptions *spdo =3D dev->u.sdl.out; struct audsettings obt_as; =20 @@ -412,7 +407,7 @@ static int sdl_init_in(HWVoiceIn *hw, audsettings *as, = void *drv_opaque) SDLVoiceIn *sdl =3D (SDLVoiceIn *)hw; SDL_AudioSpec req, obt; int err; - Audiodev *dev =3D drv_opaque; + Audiodev *dev =3D hw->s->dev; AudiodevSdlPerDirectionOptions *spdo =3D dev->u.sdl.in; struct audsettings obt_as; =20 @@ -459,19 +454,20 @@ static void sdl_enable_in(HWVoiceIn *hw, bool enable) SDL_PauseAudioDevice(sdl->devid, !enable); } =20 -static void *sdl_audio_init(Audiodev *dev, Error **errp) +static bool audio_sdl_realize(AudioBackend *abe, Audiodev *dev, Error **er= rp) { - if (SDL_InitSubSystem (SDL_INIT_AUDIO)) { + if (SDL_InitSubSystem(SDL_INIT_AUDIO)) { error_setg(errp, "SDL failed to initialize audio subsystem"); - return NULL; + qapi_free_Audiodev(dev); + return false; } =20 - return dev; + return audio_sdl_parent_class->realize(abe, dev, errp); } =20 -static void sdl_audio_fini (void *opaque) +static void audio_sdl_finalize(Object *obj) { - SDL_QuitSubSystem (SDL_INIT_AUDIO); + SDL_QuitSubSystem(SDL_INIT_AUDIO); } =20 static struct audio_pcm_ops sdl_pcm_ops =3D { @@ -499,8 +495,6 @@ static struct audio_pcm_ops sdl_pcm_ops =3D { =20 static struct audio_driver sdl_audio_driver =3D { .name =3D "sdl", - .init =3D sdl_audio_init, - .fini =3D sdl_audio_fini, .pcm_ops =3D &sdl_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, @@ -508,12 +502,24 @@ static struct audio_driver sdl_audio_driver =3D { .voice_size_in =3D sizeof(SDLVoiceIn), }; =20 +static void audio_sdl_class_init(ObjectClass *klass, const void *data) +{ + AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + audio_sdl_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent= (klass)); + + b->realize =3D audio_sdl_realize; + k->driver =3D &sdl_audio_driver; +} + static const TypeInfo audio_types[] =3D { { .name =3D TYPE_AUDIO_SDL, .parent =3D TYPE_AUDIO_MIXENG_BACKEND, .instance_size =3D sizeof(AudioSdl), .class_init =3D audio_sdl_class_init, + .instance_finalize =3D audio_sdl_finalize, }, }; =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243993; cv=none; d=zohomail.com; s=zohoarc; b=KX1eMKl6IhSILPRwPCoF3iAEMKCCbUB7tRluC6l+t4zbSacFKHwwytgMrKpHev7rXsnFuCx0bimUurzVlKS4cFFg2o1VUCNtBxj6e8FaDHoDFmg2EjH0EeYuY88Q3beUSmbKYNEs6jES4bneGYpwjtZ3B8HlPuyLKt5BVJMFThs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243993; h=Content-Type: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=JxdTNnVEA5dLWdTaaPYS9EB7LtH7sy5sV7cgK+yuVqQ=; b=Qc3E5TSMmo7Jzxf4XCdok5xBPYNADc6lpF8L1to6PLU2+cxxt8B9/r9M59XSn8JOQoz/rC46Rz5g95am90k2vfZyn2Z6JiABporCeIe1hGONjraQuO8TW8D4eLA5Qf6Ih9pRexhdl3XsfgXzy1HM7Fe0VtZvJgVybhAYGs1bOio= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243993569396.09648086248694; Mon, 16 Feb 2026 04:13:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfO-0006Ze-90; Mon, 16 Feb 2026 06:21:26 -0500 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 1vrwcA-0006UA-RP for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwc8-0008BV-SN for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:06 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-436--wvVxrslPou7Q_UZU69iHg-1; Mon, 16 Feb 2026 06:18:00 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1CECF18004BB; Mon, 16 Feb 2026 11:17:58 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5A74E30001A5; Mon, 16 Feb 2026 11:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JxdTNnVEA5dLWdTaaPYS9EB7LtH7sy5sV7cgK+yuVqQ=; b=W2W/Y3vtlCdsK9xJu0mKnxCIInXIfgrnpPco15/eW7/XmQeXMyTzUMNWWT4syM/RyTUfNB KsZjp/zLrCZtoeG+5Z+6kWv9Ck4RNDZOT2HVMsrqQzHqdJAuW3SmGnrcrFZ8oG0mUvLcYk rphm96pzKabqL4htyMsMY2VUaEteig8= X-MC-Unique: -wvVxrslPou7Q_UZU69iHg-1 X-Mimecast-MFC-AGG-ID: -wvVxrslPou7Q_UZU69iHg_1771240678 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:39 +0100 Subject: [PATCH 50/85] audio/pw: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-50-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=12053; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=bH5+vNyDDwdZkNy3frawvDWH6mwupPcSpMoXcje0aDk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQJ/hD0x7wGCiHDqWdVH3+569qWFB7r8MYE AFOV0C5zOiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5dJ4D/0eBJ519OUSgb8YMQ6AUwynOBk6buTKswp2KglOQu3mliBl8Y/o8F2p6hRvLMWgWhTxrGx i6M8wAhBb91KQLmNlotztvgoRGQwoee38u4ROs6+5kYPB+e7zl2OElxDH5bNgR1132f8bmDHjzT 61P3Dkrb7BsD121mEA4OSO4zitDuW7VRlbrcNnUcvU+6roRIB5aU9hYx/juk6gWI5SeEJbX5Zba RoxRRMLMy/DWRazbVuVnJnxYTXh6wM49pdvt+VaIJqW5krUm+YfQiGzOW/J7zJGtfvzCG2R47bp z9aGuz6aOSBkXRxRVLeAU1xj4I5kmKBsKWM7ZfROtj0670V5AY5BilxFPg36rlOFrFx0XqYxmrF 7NWbABgXpAiMHI7rhI1A+b9M3xwYJ3b1MhEz2dsWf36OEiNkond1TYUbokkINqe2T2CpeS2FymV FU2D/WdjkMONAp/NKnxNPuIL68lyxu3mt9C2rRDJmLewrqftCftVFIPRkuz1RDo8LXAnpmm8fHG ZzMNIg9Y9b91aBogU3ML7CYPdl2YgOrNIfcx8FRi7AOQi5lValcnh0fSyA4kWHnMdUp6FlyGelU VJ2DgmurlxTTq1yyUgrIHPWrXUsY1VGIdjTg7BggemNZ3KSjj9zdPkAmwml6bV9BpVO3St4k6Tw O2HmGJy61t2JOZQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243994459158500 Migrate the PipeWire audio backend from the legacy driver init/fini callbacks to proper QOM realize and finalize methods. The pwaudio struct fields are now embedded directly in the AudioPw QOM object instead of being allocated separately as drv_opaque. This allows accessing the backend state through proper QOM type casting with AUDIO_PW() rather than casting drv_opaque pointers. The PipeWire thread loop and context are now managed through the QOM lifecycle, with initialization in realize and cleanup in finalize. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/pwaudio.c | 119 +++++++++++++++++++++++++++-------------------------= ---- 1 file changed, 58 insertions(+), 61 deletions(-) diff --git a/audio/pwaudio.c b/audio/pwaudio.c index 3b524dfea5a..ca61a1b4ef5 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -31,36 +31,27 @@ #define TYPE_AUDIO_PW "audio-pipewire" OBJECT_DECLARE_SIMPLE_TYPE(AudioPw, AUDIO_PW) =20 +static AudioBackendClass *audio_pw_parent_class; + struct AudioPw { AudioMixengBackend parent_obj; -}; =20 -static struct audio_driver pw_audio_driver; + struct pw_thread_loop *thread_loop; + struct pw_context *context; =20 -static void audio_pw_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + struct pw_core *core; + struct spa_hook core_listener; + int last_seq, pending_seq, error; +}; =20 - k->driver =3D &pw_audio_driver; -} +static struct audio_driver pw_audio_driver; =20 typedef struct pwvolume { uint32_t channels; float values[SPA_AUDIO_MAX_CHANNELS]; } pwvolume; =20 -typedef struct pwaudio { - Audiodev *dev; - struct pw_thread_loop *thread_loop; - struct pw_context *context; - - struct pw_core *core; - struct spa_hook core_listener; - int last_seq, pending_seq, error; -} pwaudio; - typedef struct PWVoice { - pwaudio *g; struct pw_stream *stream; struct spa_hook stream_listener; struct spa_audio_info_raw info; @@ -236,9 +227,9 @@ static const struct pw_stream_events playback_stream_ev= ents =3D { static size_t qpw_read(HWVoiceIn *hw, void *data, size_t len) { + AudioPw *c =3D AUDIO_PW(hw->s); PWVoiceIn *pw =3D (PWVoiceIn *) hw; PWVoice *v =3D &pw->v; - pwaudio *c =3D v->g; const char *error =3D NULL; size_t l; int32_t avail; @@ -273,9 +264,9 @@ done_unlock: =20 static size_t qpw_buffer_get_free(HWVoiceOut *hw) { + AudioPw *c =3D AUDIO_PW(hw->s); PWVoiceOut *pw =3D (PWVoiceOut *)hw; PWVoice *v =3D &pw->v; - pwaudio *c =3D v->g; const char *error =3D NULL; int32_t filled, avail; uint32_t index; @@ -298,9 +289,9 @@ done_unlock: static size_t qpw_write(HWVoiceOut *hw, void *data, size_t len) { + AudioPw *c =3D AUDIO_PW(hw->s); PWVoiceOut *pw =3D (PWVoiceOut *) hw; PWVoice *v =3D &pw->v; - pwaudio *c =3D v->g; const char *error =3D NULL; int32_t filled, avail; uint32_t index; @@ -434,7 +425,7 @@ pw_to_audfmt(enum spa_audio_format fmt, int *endianness, } =20 static int -qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name, +qpw_stream_new(AudioPw *c, PWVoice *v, const char *stream_name, const char *name, enum spa_direction dir) { int res; @@ -452,8 +443,8 @@ qpw_stream_new(pwaudio *c, PWVoice *v, const char *stre= am_name, } =20 /* 75% of the timer period for faster updates */ - buf_samples =3D (uint64_t)v->g->dev->timer_period * v->info.rate - * 3 / 4 / 1000000; + buf_samples =3D (uint64_t)AUDIO_MIXENG_BACKEND(c)->dev->timer_period + * v->info.rate * 3 / 4 / 1000000; pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%" PRIu64 "/%u", buf_samples, v->info.rate); =20 @@ -535,11 +526,11 @@ qpw_set_position(uint32_t channels, uint32_t position= [SPA_AUDIO_MAX_CHANNELS]) static int qpw_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque) { + AudioPw *c =3D AUDIO_PW(hw->s); PWVoiceOut *pw =3D (PWVoiceOut *) hw; PWVoice *v =3D &pw->v; struct audsettings obt_as =3D *as; - pwaudio *c =3D v->g =3D drv_opaque; - AudiodevPipewireOptions *popts =3D &c->dev->u.pipewire; + AudiodevPipewireOptions *popts =3D &AUDIO_MIXENG_BACKEND(c)->dev->u.pi= pewire; AudiodevPipewirePerDirectionOptions *ppdo =3D popts->out; int r; =20 @@ -554,11 +545,11 @@ qpw_init_out(HWVoiceOut *hw, struct audsettings *as, = void *drv_opaque) pw_to_audfmt(v->info.format, &obt_as.endianness, &v->frame_size); v->frame_size *=3D as->nchannels; =20 - v->req =3D (uint64_t)c->dev->timer_period * v->info.rate + v->req =3D (uint64_t)AUDIO_MIXENG_BACKEND(c)->dev->timer_period * v->i= nfo.rate * 1 / 2 / 1000000 * v->frame_size; =20 /* call the function that creates a new stream for playback */ - r =3D qpw_stream_new(c, v, ppdo->stream_name ? : c->dev->id, + r =3D qpw_stream_new(c, v, ppdo->stream_name ?: AUDIO_MIXENG_BACKEND(c= )->dev->id, ppdo->name, SPA_DIRECTION_OUTPUT); if (r < 0) { pw_thread_loop_unlock(c->thread_loop); @@ -582,11 +573,11 @@ qpw_init_out(HWVoiceOut *hw, struct audsettings *as, = void *drv_opaque) static int qpw_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) { + AudioPw *c =3D AUDIO_PW(hw->s); PWVoiceIn *pw =3D (PWVoiceIn *) hw; PWVoice *v =3D &pw->v; struct audsettings obt_as =3D *as; - pwaudio *c =3D v->g =3D drv_opaque; - AudiodevPipewireOptions *popts =3D &c->dev->u.pipewire; + AudiodevPipewireOptions *popts =3D &AUDIO_MIXENG_BACKEND(c)->dev->u.pi= pewire; AudiodevPipewirePerDirectionOptions *ppdo =3D popts->in; int r; =20 @@ -602,7 +593,7 @@ qpw_init_in(HWVoiceIn *hw, struct audsettings *as, void= *drv_opaque) v->frame_size *=3D as->nchannels; =20 /* call the function that creates a new stream for recording */ - r =3D qpw_stream_new(c, v, ppdo->stream_name ? : c->dev->id, + r =3D qpw_stream_new(c, v, ppdo->stream_name ? : AUDIO_MIXENG_BACKEND(= c)->dev->id, ppdo->name, SPA_DIRECTION_INPUT); if (r < 0) { pw_thread_loop_unlock(c->thread_loop); @@ -621,10 +612,8 @@ qpw_init_in(HWVoiceIn *hw, struct audsettings *as, voi= d *drv_opaque) } =20 static void -qpw_voice_fini(PWVoice *v) +qpw_voice_fini(AudioPw *c, PWVoice *v) { - pwaudio *c =3D v->g; - if (!v->stream) { return; } @@ -637,19 +626,18 @@ qpw_voice_fini(PWVoice *v) static void qpw_fini_out(HWVoiceOut *hw) { - qpw_voice_fini(&PW_VOICE_OUT(hw)->v); + qpw_voice_fini(AUDIO_PW(hw->s), &PW_VOICE_OUT(hw)->v); } =20 static void qpw_fini_in(HWVoiceIn *hw) { - qpw_voice_fini(&PW_VOICE_IN(hw)->v); + qpw_voice_fini(AUDIO_PW(hw->s), &PW_VOICE_IN(hw)->v); } =20 static void -qpw_voice_set_enabled(PWVoice *v, bool enable) +qpw_voice_set_enabled(AudioPw *c, PWVoice *v, bool enable) { - pwaudio *c =3D v->g; pw_thread_loop_lock(c->thread_loop); pw_stream_set_active(v->stream, enable); pw_thread_loop_unlock(c->thread_loop); @@ -658,19 +646,18 @@ qpw_voice_set_enabled(PWVoice *v, bool enable) static void qpw_enable_out(HWVoiceOut *hw, bool enable) { - qpw_voice_set_enabled(&PW_VOICE_OUT(hw)->v, enable); + qpw_voice_set_enabled(AUDIO_PW(hw->s), &PW_VOICE_OUT(hw)->v, enable); } =20 static void qpw_enable_in(HWVoiceIn *hw, bool enable) { - qpw_voice_set_enabled(&PW_VOICE_IN(hw)->v, enable); + qpw_voice_set_enabled(AUDIO_PW(hw->s), &PW_VOICE_IN(hw)->v, enable); } =20 static void -qpw_voice_set_volume(PWVoice *v, Volume *vol) +qpw_voice_set_volume(AudioPw *c, PWVoice *v, Volume *vol) { - pwaudio *c =3D v->g; int i, ret; =20 pw_thread_loop_lock(c->thread_loop); @@ -693,16 +680,16 @@ qpw_voice_set_volume(PWVoice *v, Volume *vol) static void qpw_volume_out(HWVoiceOut *hw, Volume *vol) { - qpw_voice_set_volume(&PW_VOICE_OUT(hw)->v, vol); + qpw_voice_set_volume(AUDIO_PW(hw->s), &PW_VOICE_OUT(hw)->v, vol); } =20 static void qpw_volume_in(HWVoiceIn *hw, Volume *vol) { - qpw_voice_set_volume(&PW_VOICE_IN(hw)->v, vol); + qpw_voice_set_volume(AUDIO_PW(hw->s), &PW_VOICE_IN(hw)->v, vol); } =20 -static int wait_resync(pwaudio *pw) +static int wait_resync(AudioPw *pw) { int res; pw->pending_seq =3D pw_core_sync(pw->core, PW_ID_CORE, pw->pending_seq= ); @@ -725,7 +712,7 @@ static int wait_resync(pwaudio *pw) static void on_core_error(void *data, uint32_t id, int seq, int res, const char *messa= ge) { - pwaudio *pw =3D data; + AudioPw *pw =3D data; =20 error_report("error id:%u seq:%d res:%d (%s): %s", id, seq, res, spa_strerror(res), message); @@ -737,7 +724,7 @@ on_core_error(void *data, uint32_t id, int seq, int res= , const char *message) static void on_core_done(void *data, uint32_t id, int seq) { - pwaudio *pw =3D data; + AudioPw *pw =3D data; assert(id =3D=3D PW_ID_CORE); pw->last_seq =3D seq; if (pw->pending_seq =3D=3D seq) { @@ -752,17 +739,20 @@ static const struct pw_core_events core_events =3D { .error =3D on_core_error, }; =20 -static void * -qpw_audio_init(Audiodev *dev, Error **errp) +static bool +audio_pw_realize(AudioBackend *abe, Audiodev *dev, Error **errp) { - g_autofree pwaudio *pw =3D g_new0(pwaudio, 1); + AudioPw *pw =3D AUDIO_PW(abe); =20 assert(dev->driver =3D=3D AUDIODEV_DRIVER_PIPEWIRE); trace_pw_audio_init(); =20 + if (!audio_pw_parent_class->realize(abe, dev, errp)) { + return false; + } + pw_init(NULL, NULL); =20 - pw->dev =3D dev; pw->thread_loop =3D pw_thread_loop_new("PipeWire thread loop", NULL); if (pw->thread_loop =3D=3D NULL) { error_setg_errno(errp, errno, "Could not create PipeWire loop"); @@ -801,8 +791,7 @@ qpw_audio_init(Audiodev *dev, Error **errp) } =20 pw_thread_loop_unlock(pw->thread_loop); - - return g_steal_pointer(&pw); + return true; =20 fail: if (pw->thread_loop) { @@ -810,13 +799,13 @@ fail: } g_clear_pointer(&pw->context, pw_context_destroy); g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy); - return NULL; + return false; } =20 static void -qpw_audio_fini(void *opaque) +audio_pw_finalize(Object *obj) { - pwaudio *pw =3D opaque; + AudioPw *pw =3D AUDIO_PW(obj); =20 if (pw->thread_loop) { pw_thread_loop_stop(pw->thread_loop); @@ -831,9 +820,7 @@ qpw_audio_fini(void *opaque) if (pw->context) { pw_context_destroy(pw->context); } - pw_thread_loop_destroy(pw->thread_loop); - - g_free(pw); + g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy); } =20 static struct audio_pcm_ops qpw_pcm_ops =3D { @@ -855,8 +842,6 @@ static struct audio_pcm_ops qpw_pcm_ops =3D { =20 static struct audio_driver pw_audio_driver =3D { .name =3D "pipewire", - .init =3D qpw_audio_init, - .fini =3D qpw_audio_fini, .pcm_ops =3D &qpw_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, @@ -864,12 +849,24 @@ static struct audio_driver pw_audio_driver =3D { .voice_size_in =3D sizeof(PWVoiceIn), }; =20 +static void audio_pw_class_init(ObjectClass *klass, const void *data) +{ + AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + audio_pw_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent(= klass)); + + b->realize =3D audio_pw_realize; + k->driver =3D &pw_audio_driver; +} + static const TypeInfo audio_types[] =3D { { .name =3D TYPE_AUDIO_PW, .parent =3D TYPE_AUDIO_MIXENG_BACKEND, .instance_size =3D sizeof(AudioPw), .class_init =3D audio_pw_class_init, + .instance_finalize =3D audio_pw_finalize, }, }; =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243736; cv=none; d=zohomail.com; s=zohoarc; b=b0ZDDjgBDtjX8eqhovLW6qju7OGGIsT4w/4YwZGeyi+7L5ZAVHbd6t9bYctSKyyW0GopeF/nS7crolXprUsbRNyD2G9MIijyc6rR/s9pBJiralc6TEKzb34LuKdcZev1nMYPgZYcBqGe2yLNXo91T0mbPMOPxhO4S/wUg08vZ3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243736; h=Content-Type: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=aSw0+nWfREHkM9D3OEgLFV+S+9mgN4B1YEV84KexTb8=; b=gWSdQLxlONpFQOMtGq3NQMZ00xZvlDMt6mnnMPMDGVi7QtT0o7HkuVRAslBbI9eincKq0Y3eMesqu+uoSCiYgwAV+5I2xEsh9pK+8Hb1xXZxKXnGUwkD/OFXqUwjiAmuaSCJnME9klCL/CA27qWW18XZaQLB/5XIyUU0iDx4l64= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243736128571.3357001250051; Mon, 16 Feb 2026 04:08:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrweJ-0003GR-Oj; Mon, 16 Feb 2026 06:20:19 -0500 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 1vrwcE-0006ak-BL for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcC-0008CB-E8 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:09 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-187-Nf_NEw_UMeih7CYbTExd2Q-1; Mon, 16 Feb 2026 06:18:02 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6ED021800454; Mon, 16 Feb 2026 11:18:00 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E54C518003F5; Mon, 16 Feb 2026 11:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240687; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aSw0+nWfREHkM9D3OEgLFV+S+9mgN4B1YEV84KexTb8=; b=baETH920E1k/gOmzlN5QH7Nn45biI+VSwzxoKU1Ef7AJX8c9DURqFsBbTb6OnMcTOMXg8i mrMF4TDrJ3nx9+bJFIdeIlcnZvDOnaAp0KBUocGWm/aaFrwaYnuG1gFkjl9suwnAxQTW4B i7Mi0DP6j99jRdBUMvBjAd2RxoowI0A= X-MC-Unique: Nf_NEw_UMeih7CYbTExd2Q-1 X-Mimecast-MFC-AGG-ID: Nf_NEw_UMeih7CYbTExd2Q_1771240680 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:40 +0100 Subject: [PATCH 51/85] audio/jack: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-51-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2688; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=t0ucslZSKbGcBRFeyrKr2G8Lh/S+UoRUSUp+0FAVQBY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQ5zrVbVSPL/xI25NQc7n5DQc/dYT/XBYH6 jGtBjQPRGOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5WzOEACqKsIXAM9F0PkZZn+jgTBQSEewvNiNgfEvoF6pvr4SPmK3rKBkBVcm2Qv1k9uGOjmOyiY 4Ql6Xq8Iw8lfcJa9VOz9O254OuuM4rqp9g6ydM+fQlTsv+p4pDMztk5vN+IbQlzgFIz7OKr2OBa nTgEpU/ymBj4ynkfbSPuze0f4O8jlPQ2FyPVO/var1rsHGiXl43Wolr0kuYx4DPLgjhobpg20Ug ReWFwfEdMEnJ1tmVvPGKYCv4dkLsFNkg5SJLfgmnOig2Gtkq2dgV4iK8bKAshHRK10R0BTmmx2X CXf8SgxL6lxpTQjTY5gsYOp1WOgImz9BqlqXqaCmwXY0gjefx1SWZX8e/p5Ys5yM7t6Ml5j1Jp2 j2aFncipEjiEYzS7qmaneSezzThU7KP6Q0dOk29uYAp+TMV1gJML5j1Xk6OdUUDpluk8ODbJ1s+ xBwM99P9PbDrjum5voco10gOCYfFLWbTazqO0u7JJsGoSL5uaiJEXQbu+zhQTH7jE7D9AtjQznJ nvqdfb3g4V0xAm4Cv2UMwTR8NeZM9fbPwswin8o6iiUagrK75YJzLjEj9iH5HluGZNLtmwDdNXS meGyOq9YLD0vTrxGPbmzc+Pa1U0ZprYpo9R5Vs0UW3AtDw7YQrgPHpbMW85mul0z9Y66T7x5GxL bQKS5h5MBYY87ow== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243737089154100 Remove the legacy driver init/fini callbacks from the JACK audio backend. Both qjack_init() and qjack_fini() were no-ops that performed no real initialization or cleanup work. Access to the Audiodev is now through hw->s->dev instead of the drv_opaque pointer. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/jackaudio.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 972b158f023..31e3da6a7fe 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -44,13 +44,6 @@ struct AudioJack { =20 static struct audio_driver jack_driver; =20 -static void audio_jack_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &jack_driver; -} - struct QJack; =20 typedef enum QJackState { @@ -518,7 +511,7 @@ static int qjack_init_out(HWVoiceOut *hw, struct audset= tings *as, void *drv_opaque) { QJackOut *jo =3D (QJackOut *)hw; - Audiodev *dev =3D (Audiodev *)drv_opaque; + Audiodev *dev =3D hw->s->dev; =20 jo->c.out =3D true; jo->c.enabled =3D false; @@ -555,7 +548,7 @@ static int qjack_init_in(HWVoiceIn *hw, struct audsetti= ngs *as, void *drv_opaque) { QJackIn *ji =3D (QJackIn *)hw; - Audiodev *dev =3D (Audiodev *)drv_opaque; + Audiodev *dev =3D hw->s->dev; =20 ji->c.out =3D false; ji->c.enabled =3D false; @@ -662,16 +655,6 @@ static int qjack_thread_creator(jack_native_thread_t *= thread, } #endif =20 -static void *qjack_init(Audiodev *dev, Error **errp) -{ - assert(dev->driver =3D=3D AUDIODEV_DRIVER_JACK); - return dev; -} - -static void qjack_fini(void *opaque) -{ -} - static struct audio_pcm_ops jack_pcm_ops =3D { .init_out =3D qjack_init_out, .fini_out =3D qjack_fini_out, @@ -689,8 +672,6 @@ static struct audio_pcm_ops jack_pcm_ops =3D { =20 static struct audio_driver jack_driver =3D { .name =3D "jack", - .init =3D qjack_init, - .fini =3D qjack_fini, .pcm_ops =3D &jack_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, @@ -708,6 +689,13 @@ static void qjack_info(const char *msg) dolog("I: %s\n", msg); } =20 +static void audio_jack_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->driver =3D &jack_driver; +} + static const TypeInfo audio_types[] =3D { { .name =3D TYPE_AUDIO_JACK, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242334; cv=none; d=zohomail.com; s=zohoarc; b=BW5WYu9NIyRwtq9AKG9mD0UGHcYWPxd6lYDccrg+aZn8cqpTdBmhHOOv4Enbjub+0CN386s50PsmRcCHpt+btQTLct+cS5c7t0qtkUG7/H6Cv7UXx4Q3TABhd7NMWTblbSy1iouiBRaov94Am2az9URSaFUijw92SAtOg6zLlck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242334; h=Content-Type: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=Qj7tPbVqgOlKJ+Ll6M3+6JaJu6YSwwchSgbBCeu4O1M=; b=CBUB2Pki9UlfYxklQ1jves7JXRTQKsmX148WqZk+2i95eZ09OGKwY2Tbvw4sqOimjrRjnR7GJ9T5xtlDlDg6w0PK5OGuOUXOM7Iqr2OfXOaavKNNJ3yVVmeDjko+wa73CjDaOEjrDb/Nvxw2GdSd3i/5WZD+NkgAe8jnAedvZOU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242334610607.1376901639372; Mon, 16 Feb 2026 03:45:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfY-00082z-Pw; Mon, 16 Feb 2026 06:21:36 -0500 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 1vrwcF-0006b1-I8 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcE-0008CQ-48 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:11 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-353-5O8WJ4ZdM0ysddx2svczBw-1; Mon, 16 Feb 2026 06:18:06 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EA62D1956094; Mon, 16 Feb 2026 11:18:03 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AD06019560A2; Mon, 16 Feb 2026 11:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qj7tPbVqgOlKJ+Ll6M3+6JaJu6YSwwchSgbBCeu4O1M=; b=TwDyq/pnlKNRYGOfBa2pvN1MkcQdjqzV69iRE6acHGPUbB+abN56aFgiZgevsHroRaJKeS 3jqJD5dZ76gYRWwXl25gWTv4UNkw7+8nwga7cpsQkn/MUqjrTGs+t82FZyo4URljC+1YkE RligsrwXuO8UnGUStkSHdUPI35r0wZM= X-MC-Unique: 5O8WJ4ZdM0ysddx2svczBw-1 X-Mimecast-MFC-AGG-ID: 5O8WJ4ZdM0ysddx2svczBw_1771240684 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:41 +0100 Subject: [PATCH 52/85] audio/sndio: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-52-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2039; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=idLQbKa19YwiU46EtQoQP2sry84lA/BHtl+BQc+SfU0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQyvJ5Sp0lr4p334/waquRoLpaMl8d00Wl1 B/yZSTqLt+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5aooD/4geXbnZ4hfJpI2CicCN/NSOcSTacyRuSYM/YdRVob1CoJvAqrcF1lXYsioTOO1tqHXsZR 1ulGUnmdOK/Qb0sRVhmmZLHLuanzw4j1iUTyJCIvxQYatdyPSRn1ZR3yvQ4tIdxz5Ep8wHNP5MT to886YMHX5xr7bN4Gx8Gjz5/0168kf2HAKtH3ZU+8XbbcBEYx2JXHe/jYRDhFsCPxaN8f+NrBXq ZkepiDTjmeq2OhWw5IZxEhwf2MYH3HO/4rSajPVMBxgjHFyQvIxBN2Y3c7gPwI9zM0T8Xf1k/Vm ANIBUvKGBYOzR7nszGDRqjDUHndCe17oDllP66Tc9MPOVy66W+ctz7EBO4XKVaerGVNwkcme8g4 2SrMDK+gol5ZLu078XRYNaxoXk+zk40Iv/ZXwdZcoagOOIOdWM8hYHr6unr5Dcv5oIMtRyZLY8f YgsGaSHSIHZ8B0rXSe+tdwnhbg18FfKCs5i+s6InQUiaK6SNjJ/3dfkp0cbK4KGf4bK9CkF2fgx TDdODJNjCa6IkYwrI+kaQR6o7GUEEi5OjhaU83MVNS0o8qvjTtTxYGPZztLtVp52GBDLB/RUoIv 8VNcyZmljnFU/o+BihgY5jGberEpyoa3CzHtXXOOiT/Y+cwtHaAhPnxXKhns/9t3blPxSvHujZm gtA/0qJCHVPbFKw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242338215154100 Remove the legacy driver init/fini callbacks from the sndio audio backend. Both sndio_audio_init() and sndio_audio_fini() were no-ops that performed no real initialization or cleanup work. Access to the Audiodev is now through hw->s->dev instead of the drv_opaque pointer. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/sndioaudio.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 2a9ae42992b..c15d8b6684a 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -499,7 +499,7 @@ static int sndio_init_out(HWVoiceOut *hw, struct audset= tings *as, void *opaque) { SndioVoice *self =3D (SndioVoice *) hw; =20 - if (sndio_init(self, as, SIO_PLAY, opaque) =3D=3D -1) { + if (sndio_init(self, as, SIO_PLAY, hw->s->dev) =3D=3D -1) { return -1; } =20 @@ -512,7 +512,7 @@ static int sndio_init_in(HWVoiceIn *hw, struct audsetti= ngs *as, void *opaque) { SndioVoice *self =3D (SndioVoice *) hw; =20 - if (sndio_init(self, as, SIO_REC, opaque) =3D=3D -1) { + if (sndio_init(self, as, SIO_REC, hw->s->dev) =3D=3D -1) { return -1; } =20 @@ -535,16 +535,6 @@ static void sndio_fini_in(HWVoiceIn *hw) sndio_fini(self); } =20 -static void *sndio_audio_init(Audiodev *dev, Error **errp) -{ - assert(dev->driver =3D=3D AUDIODEV_DRIVER_SNDIO); - return dev; -} - -static void sndio_audio_fini(void *opaque) -{ -} - static struct audio_pcm_ops sndio_pcm_ops =3D { .init_out =3D sndio_init_out, .fini_out =3D sndio_fini_out, @@ -563,8 +553,6 @@ static struct audio_pcm_ops sndio_pcm_ops =3D { =20 static struct audio_driver sndio_audio_driver =3D { .name =3D "sndio", - .init =3D sndio_audio_init, - .fini =3D sndio_audio_fini, .pcm_ops =3D &sndio_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D INT_MAX, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243245; cv=none; d=zohomail.com; s=zohoarc; b=lk/xEjUUvKDP9CKh9VcqvmqSgohZLgncajoZeaqOyAWd+7iQhJX48r/yJucwdn2VbrYYIcPsk2WGwvD4aIFpwqI5giouXDmGUphmD3Eik6wDBbp62WCLQv2fai/9PrERKjTKcJGHU9bLN/8Yz67rYey9k8Pcq2kfhF7zSfY25DE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243245; h=Content-Type: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=uH9F5ZbfheqEuQKcQaxVN621xVlRLtEAcdHBWTCahY4=; b=ELScSh2lpKVi1Z/XFemTQ1JfES82R6eeNbrtphxocT2uSwIE+QL3QzmYa9z6fVtm8ufUwHt/qDDMVDQPjE9ZO2bjQAR32UK2rh90lP53va0jrwRDjzOFEBi0V26JlJBijV2h6Xv5unOsq0MkVrK8Nj1Si3kDX4k6bcj0Zv9Qpu8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243245876567.9936745804919; Mon, 16 Feb 2026 04:00:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfI-0005ky-Gy; Mon, 16 Feb 2026 06:21:20 -0500 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 1vrwcL-0006i3-Og for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcI-0008D2-PR for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:17 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-437-Stq9VjIlP7qh-Q1F_XVTLA-1; Mon, 16 Feb 2026 06:18:09 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E956E1956058; Mon, 16 Feb 2026 11:18:06 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EF7B230001A5; Mon, 16 Feb 2026 11:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240692; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uH9F5ZbfheqEuQKcQaxVN621xVlRLtEAcdHBWTCahY4=; b=NSaQlktooaxvaPEq+12d7y8ViY3r8GhfdpLd8YDj5ZFVziaGLYccLDAhCe1/EO0hcN00mG uM2sAj68lUzwv5urti74Z/+7n80N6M8glseLvrX4QgT9Jhv9i5xGzpXZts3oV4NCxgYu43 uYatZhx8Mo0wlhXdYCYOuX5NI6QYzzQ= X-MC-Unique: Stq9VjIlP7qh-Q1F_XVTLA-1 X-Mimecast-MFC-AGG-ID: Stq9VjIlP7qh-Q1F_XVTLA_1771240687 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:42 +0100 Subject: [PATCH 53/85] audio/coreaudio: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-53-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1859; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=vQiHwzIc9rV8//NbzAafizGFjxFI5+TEF7+H85FTPW8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQsEj/x84XZ2zrVn1c7YV6t77/ljjT9YCwC JsYIyqPEyeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5fVVD/4p1ZxH28XdPxkA+QQ2lt2h4PAapFFsNv7e480/s5PeKu78gV9oO7RANBomYL6Lst26reU xdbR4UlIHQbEHEqTUITsPBLex2EBf3g6DUbVVrZtdRkXUqD+tha5dNNfXgEBb4MU6UtcKZvQolX 8ZbSEbDLWmayLkwTAPwRduDr6H/hpZ0An54UC+YeKgCdgo4Q9Aikttfqd/w6fKRZX41oPoiQK5S J+BwO2qH3WXTG4N8ZkFIUPs26RedCggjeYa5SDAtmUY7VID0ukQBpzanZ8Yo4zl3FvB0AsFKU26 phXYUF85kWV+6itdoGICZNBIdDi9cHqZwkU1E+1Di1mdBaxbq1m2uBx2MS45moyeBSdeeOOL+CZ u1k2cX3yev5qsJqpWrOWBuWZbdu6TKBxjYYRdYUOsz+6JvCHWafXDYJO6pbX+fPmFDCMnNYWkEF XQZnVEkaGLMANY3zujxHWa/gkmZtAwIDRsuOgBL6OEy8q9OdUHL6m7ZYvW0UCm0qrwfnaHYZ4Ju lUn5z6+XW1TrJvlSdeTzxD6KnsxZHoZl4VZpQAbwl6k3Wk/peSmkytAHa93a0Uef2OavU8CDLln 1+wIWNRvvzD+FIOps5cWQwi0nRIwxwTDsr6hS4xcVMwVcgG+cKyIEi4ugPmaIs6gRsX9PfK8+Na DhMIiUNRXFay7lA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243248288158500 Remove the legacy driver init/fini callbacks from the CoreAudio backend. Both coreaudio_audio_init() and coreaudio_audio_fini() were no-ops that performed no real initialization or cleanup work. Access to the Audiodev is now through hw->s->dev instead of the drv_opaque pointer. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/coreaudio.m | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 862cb9dd9b0..4a0904f0073 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -579,7 +579,7 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct au= dsettings *as, OSStatus status; coreaudioVoiceOut *core =3D (coreaudioVoiceOut *) hw; int err; - Audiodev *dev =3D drv_opaque; + Audiodev *dev =3D hw->s->dev; AudiodevCoreaudioPerDirectionOptions *cpdo =3D dev->u.coreaudio.out; struct audsettings obt_as; =20 @@ -656,15 +656,6 @@ static void coreaudio_enable_out(HWVoiceOut *hw, bool = enable) update_device_playback_state(core); } =20 -static void *coreaudio_audio_init(Audiodev *dev, Error **errp) -{ - return dev; -} - -static void coreaudio_audio_fini (void *opaque) -{ -} - static struct audio_pcm_ops coreaudio_pcm_ops =3D { .init_out =3D coreaudio_init_out, .fini_out =3D coreaudio_fini_out, @@ -681,8 +672,6 @@ static void coreaudio_audio_fini (void *opaque) =20 static struct audio_driver coreaudio_audio_driver =3D { .name =3D "coreaudio", - .init =3D coreaudio_audio_init, - .fini =3D coreaudio_audio_fini, .pcm_ops =3D &coreaudio_pcm_ops, .max_voices_out =3D 1, .max_voices_in =3D 0, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242944; cv=none; d=zohomail.com; s=zohoarc; b=N63xER56USd7MFZvXpyaq9eCNUs91Art3tgQOescJGK9PFkyYkbRTBqQX8OH22y1CkDkThj9Huvba4xlMUMH6MW9ARUqPmu6CdtSvAnBxqlsqMXBX2Sa0hcSA0Bt5uhV/XScraEUgBJ4WTeHV2yBUzYwBGTkUY3POTnz6X0v99o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242944; h=Content-Type: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=8Im4lnpoE1TK3toHuThq/L1NhoACCesgAi+QPC2+8cY=; b=np2opzoC2i19fVAV6nbR37LT1QSQLo7v3f7Xv9uSOfclMqKYdEwdEzChocpuonSURzZjua0Xf1dweiY2gHN489wwchhs2HLXxhVbVrYk0uGard06+6i/rsDpDHtg1kVNoU3jP96r5Lz9RI5NFEcmmii430ExQPdypB+Xn9C8IRY= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242944733178.12781261862995; Mon, 16 Feb 2026 03:55:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfd-0000Az-8Z; Mon, 16 Feb 2026 06:21:41 -0500 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 1vrwcM-0006iA-07 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcJ-0008DA-2m for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:17 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-576-zgK7_PJxM1C-l1zrxRviUg-1; Mon, 16 Feb 2026 06:18:11 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 400FB1800465; Mon, 16 Feb 2026 11:18:09 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9A6B130001A5; Mon, 16 Feb 2026 11:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240694; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Im4lnpoE1TK3toHuThq/L1NhoACCesgAi+QPC2+8cY=; b=e51bSX0X1CzIoITiUxqI5zS6FqF8una78nQJXd31424vHvs5GLNalVgkLoCKUeRNr5qgfO vLRFVNLis1pef4Q7Zv57OqSxkjefmES9XOmUaW2TOewa/1IL3Jct2rYo8ghJCffk+FUs33 h+y1k+NAd2pdmpVlotD1dPhHI1W8fvw= X-MC-Unique: zgK7_PJxM1C-l1zrxRviUg-1 X-Mimecast-MFC-AGG-ID: zgK7_PJxM1C-l1zrxRviUg_1771240689 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:43 +0100 Subject: [PATCH 54/85] audio/dsound: convert to QOM lifecycle methods MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-54-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=10062; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=zosDSUMZvgT7AxQdHHQTxQcAqrjNJXmlF9JjWNb4w0A=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQ50UdJWvf78vYCPsgMOXHp2+/NgRW89lse nNjA3PL7omJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5YMzD/wIHUx2MVT1354xNxdM0amM8faKAoGJxapM6/YG2Co5WSaFpKEGdJ09XATxm7LcsUq20wH jq6zKSD1KVlYFhRpeDwHRKAU8ngFO9GTBLrNvf3WlcXbodTOUH6uGrHFC38r1Te9vxTRQfG/wUX YmATdka1uZE8o/XnzEV44pogKSvJAazdDOk/O04PeoJSEq4BPgFYv0cFNAlus96GUaynCAu9BWt jOvZxWussEatxU5NwZ9PXWWBzH29B8JW+u2U9ur2qYjY0aiSDYY5uAG4tnxBAz8OVGbpMh6lJg3 mL8t31h/e1z+GzcainC0RRdJ3KjQ45JxLR4FrMSulWHussrvJfx/I0x5TaGpE0zBwRdZEh7FTlf cKrdrk/1K8/VHeaMdjjQ2IbZVFLXQQvKHlFclMjuUMJrZ/vRxEJooFrrRsIuCCtGCZot/ZWypic a7VI7zjYJ3R+PYAXFX8XFaY3yIPs2FLE2GcWC2R5bmVOlRurDRyDC+KgYJ6/MO6XX4HlKpUzzKY 6LdVnRWYM5zeNxRH8eJPl/3Jnijvu06vbXljEGKWIBxsUrJ+o2YvpJr60cwkW7FOqNxg37MP3i/ HbVA3vhRcwjfa6MoRNcM2Ra214sxEoC8aETmBW+v8ECGlkTG00Cr5Tj79SXpnn78WpMKzT/khof K7BQL9bodOLnpmQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242947556158500 Migrate the DirectSound audio backend from the legacy driver init/fini callbacks to proper QOM realize and finalize methods. The dsound struct fields are now embedded directly in the AudioDsound QOM object instead of being allocated separately as drv_opaque. This allows accessing the backend state through proper QOM type casting with AUDIO_DSOUND() rather than casting drv_opaque pointers. The DirectSound and DirectSoundCapture COM objects are now managed through the QOM lifecycle, with initialization in realize and cleanup in finalize. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/dsound_template.h | 9 +++-- audio/dsoundaudio.c | 87 +++++++++++++++++++++++----------------------= ---- 2 files changed, 45 insertions(+), 51 deletions(-) diff --git a/audio/dsound_template.h b/audio/dsound_template.h index 0678f2de38b..7979773eb86 100644 --- a/audio/dsound_template.h +++ b/audio/dsound_template.h @@ -72,7 +72,7 @@ static int glue (dsound_lock_, TYPE) ( DWORD *blen1p, DWORD *blen2p, int entire, - dsound *s + AudioDsound *s ) { HRESULT hr; @@ -166,7 +166,7 @@ static int dsound_init_out(HWVoiceOut *hw, struct audse= ttings *as, { int err; HRESULT hr; - dsound *s =3D drv_opaque; + AudioDsound *s =3D AUDIO_DSOUND(hw->s); WAVEFORMATEX wfx; struct audsettings obt_as; #ifdef DSBTYPE_IN @@ -174,13 +174,13 @@ static int dsound_init_out(HWVoiceOut *hw, struct aud= settings *as, DSoundVoiceIn *ds =3D (DSoundVoiceIn *) hw; DSCBUFFERDESC bd; DSCBCAPS bc; - AudiodevPerDirectionOptions *pdo =3D s->dev->u.dsound.in; + AudiodevPerDirectionOptions *pdo =3D hw->s->dev->u.dsound.in; #else const char *typ =3D "DAC"; DSoundVoiceOut *ds =3D (DSoundVoiceOut *) hw; DSBUFFERDESC bd; DSBCAPS bc; - AudiodevPerDirectionOptions *pdo =3D s->dev->u.dsound.out; + AudiodevPerDirectionOptions *pdo =3D hw->s->dev->u.dsound.out; #endif =20 if (!s->FIELD2) { @@ -256,7 +256,6 @@ static int dsound_init_out(HWVoiceOut *hw, struct audse= ttings *as, } hw->size_emul =3D bc.dwBufferBytes; hw->samples =3D bc.dwBufferBytes / hw->info.bytes_per_frame; - ds->s =3D s; =20 #ifdef DEBUG_DSOUND dolog ("caps %ld, desc %ld\n", diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 462d09e02af..a90c348230b 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -45,40 +45,30 @@ #define TYPE_AUDIO_DSOUND "audio-dsound" OBJECT_DECLARE_SIMPLE_TYPE(AudioDsound, AUDIO_DSOUND) =20 +static AudioBackendClass *audio_dsound_parent_class; + struct AudioDsound { AudioMixengBackend parent_obj; + + LPDIRECTSOUND dsound; + LPDIRECTSOUNDCAPTURE dsound_capture; + struct audsettings settings; }; =20 static struct audio_driver dsound_audio_driver; =20 -static void audio_dsound_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &dsound_audio_driver; -} - /* #define DEBUG_DSOUND */ =20 -typedef struct { - LPDIRECTSOUND dsound; - LPDIRECTSOUNDCAPTURE dsound_capture; - struct audsettings settings; - Audiodev *dev; -} dsound; - typedef struct { HWVoiceOut hw; LPDIRECTSOUNDBUFFER dsound_buffer; bool first_time; - dsound *s; } DSoundVoiceOut; =20 typedef struct { HWVoiceIn hw; LPDIRECTSOUNDCAPTUREBUFFER dsound_capture_buffer; bool first_time; - dsound *s; } DSoundVoiceIn; =20 static const char *dserror(HRESULT hr) @@ -276,7 +266,7 @@ static void print_wave_format (WAVEFORMATEX *wfx) } #endif =20 -static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb, dsound *s) +static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb, AudioDsound *s) { HRESULT hr; =20 @@ -295,7 +285,7 @@ static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb,= dsound *s) #undef DSBTYPE_IN =20 static int dsound_get_status_out (LPDIRECTSOUNDBUFFER dsb, DWORD *statusp, - dsound *s) + AudioDsound *s) { HRESULT hr; =20 @@ -328,7 +318,7 @@ static int dsound_get_status_in (LPDIRECTSOUNDCAPTUREBU= FFER dscb, } =20 static void dsound_clear_sample (HWVoiceOut *hw, LPDIRECTSOUNDBUFFER dsb, - dsound *s) + AudioDsound *s) { int err; LPVOID p1, p2; @@ -372,9 +362,9 @@ static void dsound_enable_out(HWVoiceOut *hw, bool enab= le) { HRESULT hr; DWORD status; + AudioDsound *s =3D AUDIO_DSOUND(hw->s); DSoundVoiceOut *ds =3D (DSoundVoiceOut *) hw; LPDIRECTSOUNDBUFFER dsb =3D ds->dsound_buffer; - dsound *s =3D ds->s; =20 if (!dsb) { dolog ("Attempt to control voice without a buffer\n"); @@ -450,7 +440,7 @@ static void *dsound_get_buffer_out(HWVoiceOut *hw, size= _t *size) assert(req_size > 0); =20 err =3D dsound_lock_out(dsb, &hw->info, hw->pos_emul, req_size, &ret, = NULL, - &act_size, NULL, false, ds->s); + &act_size, NULL, false, AUDIO_DSOUND(hw->s)); if (err) { dolog("Failed to lock buffer\n"); *size =3D 0; @@ -553,7 +543,7 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t= *size) } =20 err =3D dsound_lock_in(dscb, &hw->info, hw->pos_emul, req_size, &ret, = NULL, - &act_size, NULL, false, ds->s); + &act_size, NULL, false, AUDIO_DSOUND(hw->s)); if (err) { dolog("Failed to lock buffer\n"); *size =3D 0; @@ -577,13 +567,12 @@ static void dsound_put_buffer_in(HWVoiceIn *hw, void = *buf, size_t len) hw->pos_emul =3D (hw->pos_emul + len) % hw->size_emul; } =20 -static void dsound_audio_fini (void *opaque) +static void audio_dsound_finalize(Object *obj) { + AudioDsound *s =3D AUDIO_DSOUND(obj); HRESULT hr; - dsound *s =3D opaque; =20 if (!s->dsound) { - g_free(s); return; } =20 @@ -594,7 +583,6 @@ static void dsound_audio_fini (void *opaque) s->dsound =3D NULL; =20 if (!s->dsound_capture) { - g_free(s); return; } =20 @@ -603,18 +591,21 @@ static void dsound_audio_fini (void *opaque) dsound_logerr (hr, "Could not release DirectSoundCapture\n"); } s->dsound_capture =3D NULL; - - g_free(s); } =20 -static void *dsound_audio_init(Audiodev *dev, Error **errp) +static bool +audio_dsound_realize(AudioBackend *abe, Audiodev *dev, Error **errp) { + AudioDsound *s =3D AUDIO_DSOUND(abe); HRESULT hr; - dsound *s =3D g_new0(dsound, 1); AudiodevDsoundOptions *dso; =20 assert(dev->driver =3D=3D AUDIODEV_DRIVER_DSOUND); - s->dev =3D dev; + + if (!audio_dsound_parent_class->realize(abe, dev, errp)) { + return false; + } + dso =3D &dev->u.dsound; =20 if (!dso->has_latency) { @@ -625,8 +616,7 @@ static void *dsound_audio_init(Audiodev *dev, Error **e= rrp) hr =3D CoInitialize (NULL); if (FAILED (hr)) { dserror_set(errp, hr, "Could not initialize COM"); - dsound_audio_fini(s); - return NULL; + return false; } =20 hr =3D CoCreateInstance ( @@ -638,15 +628,13 @@ static void *dsound_audio_init(Audiodev *dev, Error *= *errp) ); if (FAILED (hr)) { dserror_set(errp, hr, "Could not create DirectSound instance"); - dsound_audio_fini(s); - return NULL; + return false; } =20 hr =3D IDirectSound_Initialize (s->dsound, NULL); if (FAILED (hr)) { dserror_set(errp, hr, "Could not initialize DirectSound"); - dsound_audio_fini(s); - return NULL; + return false; } =20 hr =3D CoCreateInstance ( @@ -658,15 +646,13 @@ static void *dsound_audio_init(Audiodev *dev, Error *= *errp) ); if (FAILED (hr)) { dserror_set(errp, hr, "Could not create DirectSoundCapture instanc= e"); - dsound_audio_fini(s); - return NULL; + return false; } =20 hr =3D IDirectSoundCapture_Initialize (s->dsound_capture, NULL); if (FAILED(hr)) { dserror_set(errp, hr, "Could not initialize DirectSoundCapture"); - dsound_audio_fini(s); - return NULL; + return false; } =20 hr =3D IDirectSound_SetCooperativeLevel ( @@ -676,11 +662,10 @@ static void *dsound_audio_init(Audiodev *dev, Error *= *errp) ); if (FAILED(hr)) { dserror_set(errp, hr, "Could not set cooperative level"); - dsound_audio_fini(s); - return NULL; + return false; } =20 - return s; + return true; } =20 static struct audio_pcm_ops dsound_pcm_ops =3D { @@ -702,8 +687,6 @@ static struct audio_pcm_ops dsound_pcm_ops =3D { =20 static struct audio_driver dsound_audio_driver =3D { .name =3D "dsound", - .init =3D dsound_audio_init, - .fini =3D dsound_audio_fini, .pcm_ops =3D &dsound_pcm_ops, .max_voices_out =3D INT_MAX, .max_voices_in =3D 1, @@ -711,12 +694,24 @@ static struct audio_driver dsound_audio_driver =3D { .voice_size_in =3D sizeof (DSoundVoiceIn) }; =20 +static void audio_dsound_class_init(ObjectClass *klass, const void *data) +{ + AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + audio_dsound_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_par= ent(klass)); + + b->realize =3D audio_dsound_realize; + k->driver =3D &dsound_audio_driver; +} + static const TypeInfo audio_types[] =3D { { .name =3D TYPE_AUDIO_DSOUND, .parent =3D TYPE_AUDIO_MIXENG_BACKEND, .instance_size =3D sizeof(AudioDsound), .class_init =3D audio_dsound_class_init, + .instance_finalize =3D audio_dsound_finalize, }, }; =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771241704; cv=none; d=zohomail.com; s=zohoarc; b=CyXQ5JYk2l45jUMqu6VPV8bR/itSLL6C/oM7G8P4F7a422QCcYlSusld3R/L+znK3KgnTf9zZe2Tw/QUd8KXc0qhhF/9bw5tVPEF48zEI/gY4EHnaWM5tIU5TwHGTJ0RSyN/FS4c5qQoyWEMTtpRGl5Pp6CqNzB+s1tbZgZ2cTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771241704; h=Content-Type: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=b886deA9Pvd1EJ7wX/pK/rJb46L4AzeC6UVFBZkrEdc=; b=IHAXJel573NAKii0L3hygwLnDba9+EMZ6OlKJC/wd50b7xs28MBRg7qJlRf4vPimKmb6b5Rv1vW2iL5+OmVyG1TceICCffYQ6O83NRCeXECA89XUHoXKNtgDGPINSq7dGr9gSbE+ApQ+obBuq/akx4O6D6RuxbdOIAjUjtKYZgY= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771241704050291.4491001502597; Mon, 16 Feb 2026 03:35:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfH-0005VF-2a; Mon, 16 Feb 2026 06:21:19 -0500 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 1vrwcP-0006kl-43 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcL-0008Do-Ls for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:19 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-73-6ADIR1OIO3WEdeOi6R8n5A-1; Mon, 16 Feb 2026 06:18:14 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 961FF1955F15; Mon, 16 Feb 2026 11:18:12 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3186218004BB; Mon, 16 Feb 2026 11:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b886deA9Pvd1EJ7wX/pK/rJb46L4AzeC6UVFBZkrEdc=; b=Ak8NP4dgdfYJFiIfQ1CtkCmaHk1IdrGGxkfqFXxZFNnzj6w/2vZpO6dF30RBhpneaxdFRE PJVHIr7Oo5pxUN41t66t4yonCGStZyMs++ZfGZk5zqtqdEpJGvBpjzrujQdGmUCJvSt9Ud O8qSDngLOT8nRqRCVLRCECi50GFjjfM= X-MC-Unique: 6ADIR1OIO3WEdeOi6R8n5A-1 X-Mimecast-MFC-AGG-ID: 6ADIR1OIO3WEdeOi6R8n5A_1771240692 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:44 +0100 Subject: [PATCH 55/85] audio: remove audio_driver init/fini/next MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-55-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=13684; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=hPnyFV3/nDK/Z8DsYQddyB9yVVLc1fypYo+VfCTLDXc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQe9sVZrsT+zOjUEMr/Kr2b6zsaHQuISnNM 4pRvJbtGx+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5cVIEACHuwa865kfZWYsezVudKlm4Q/dPWx8MUY6qT+b/kQto7PYUKQE2l84tiQkMO3iElWaJoc CTuPWGvACSTEENgowE4cffIb1yiDRAF4DPWMe/GmQ9ZfrZ2JxUv5BaGHmECNNaCTmeIeHq3oUZS a0Mz48O7lqR+OhlzXJO9XiozEy/uM0PlQVIB/nd08ZH0w7Frqp3brIxdXTElpzJVi9F+5S5T5OP rlMxMl33DmVEOYurOCLDcQAZqvNZoKLt9CGmMu6bCoTGo23IRcyyfqI1BxVFuT0jUir2aLj2Dyo iWc0elQb7YO4WBZfQLYiRNfSCiC7/qAEbaS8lwX5jGKB1LLrCpArbXhxh2hvDVsDD2o1cMm675s JJ4p0n4w72HvH0cGCsse6WCyCMFe40d8JpU1++aNNOHeSDU1OV0Li1P/RBM7+uAFIzqJWgsSNph G0iCYbKwqu+ZiddtSHKd4wF9o9uZwduP55qN0oEiKu3fLcq30+0NFGdySS2lWP/YtjTkBEbHRpU XiceiN3t6MtZ5n6faBb4rEr6WhGQ3sJk0CxZ7WqTdpwHb0hP2X5/MI7AqINcf0whr6Ytx/ejFCw W5KxxC7VRleGLMBCljv+/xYyEJzN4AMP6FmjdxWZbBAUrc5HAigZOGS32/QpbLIQ0r5XM91plgX CYimES2iybGUxPA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771241705589154100 They are no longer used after conversion to QOM. Also removing the drv_opaque from a few of the pcm_ops methods. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki Reviewed-by: Mark Cave-Ayland --- audio/audio_int.h | 8 ++------ audio/audio_template.h | 2 +- audio/dsound_template.h | 6 ++---- audio/alsaaudio.c | 5 ++--- audio/audio-mixeng-be.c | 15 +-------------- audio/dbusaudio.c | 4 ++-- audio/jackaudio.c | 6 ++---- audio/noaudio.c | 4 ++-- audio/ossaudio.c | 5 ++--- audio/paaudio.c | 5 ++--- audio/pwaudio.c | 4 ++-- audio/sdlaudio.c | 5 ++--- audio/sndioaudio.c | 4 ++-- audio/spiceaudio.c | 5 ++--- audio/wavaudio.c | 3 +-- audio/coreaudio.m | 3 +-- 16 files changed, 28 insertions(+), 56 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 6ecd75c4fbf..fb5a9dd871e 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -139,18 +139,15 @@ struct SWVoiceIn { typedef struct audio_driver audio_driver; struct audio_driver { const char *name; - void *(*init) (Audiodev *, Error **); - void (*fini) (void *); struct audio_pcm_ops *pcm_ops; int max_voices_out; int max_voices_in; size_t voice_size_out; size_t voice_size_in; - QLIST_ENTRY(audio_driver) next; }; =20 struct audio_pcm_ops { - int (*init_out)(HWVoiceOut *hw, audsettings *as, void *drv_opaque); + int (*init_out)(HWVoiceOut *hw, audsettings *as); void (*fini_out)(HWVoiceOut *hw); size_t (*write) (HWVoiceOut *hw, void *buf, size_t size); void (*run_buffer_out)(HWVoiceOut *hw); @@ -173,7 +170,7 @@ struct audio_pcm_ops { void (*enable_out)(HWVoiceOut *hw, bool enable); void (*volume_out)(HWVoiceOut *hw, Volume *vol); =20 - int (*init_in) (HWVoiceIn *hw, audsettings *as, void *drv_opaque); + int (*init_in) (HWVoiceIn *hw, audsettings *as); void (*fini_in) (HWVoiceIn *hw); size_t (*read) (HWVoiceIn *hw, void *buf, size_t size); void (*run_buffer_in)(HWVoiceIn *hw); @@ -240,7 +237,6 @@ struct AudioMixengBackend { =20 struct audio_driver *drv; Audiodev *dev; - void *drv_opaque; =20 QEMUTimer *ts; QLIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in; diff --git a/audio/audio_template.h b/audio/audio_template.h index 77a70d6e56a..6c2d2ad5dca 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -295,7 +295,7 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixen= gBackend *s, #ifdef DAC QLIST_INIT (&hw->cap_head); #endif - if (glue (hw->pcm_ops->init_, TYPE) (hw, as, s->drv_opaque)) { + if (glue (hw->pcm_ops->init_, TYPE) (hw, as)) { goto err0; } =20 diff --git a/audio/dsound_template.h b/audio/dsound_template.h index 7979773eb86..022a7307c99 100644 --- a/audio/dsound_template.h +++ b/audio/dsound_template.h @@ -157,11 +157,9 @@ static void dsound_fini_out (HWVoiceOut *hw) } =20 #ifdef DSBTYPE_IN -static int dsound_init_in(HWVoiceIn *hw, struct audsettings *as, - void *drv_opaque) +static int dsound_init_in(HWVoiceIn *hw, struct audsettings *as) #else -static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as, - void *drv_opaque) +static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as) #endif { int err; diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index c2788606b28..0c63d133496 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -692,8 +692,7 @@ static void alsa_fini_out (HWVoiceOut *hw) alsa_anal_close (&alsa->handle, &alsa->pollhlp); } =20 -static int alsa_init_out(HWVoiceOut *hw, struct audsettings *as, - void *drv_opaque) +static int alsa_init_out(HWVoiceOut *hw, struct audsettings *as) { ALSAVoiceOut *alsa =3D (ALSAVoiceOut *) hw; struct alsa_params_req req; @@ -779,7 +778,7 @@ static void alsa_enable_out(HWVoiceOut *hw, bool enable) } } =20 -static int alsa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_o= paque) +static int alsa_init_in(HWVoiceIn *hw, struct audsettings *as) { ALSAVoiceIn *alsa =3D (ALSAVoiceIn *) hw; struct alsa_params_req req; diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 45873646b3c..ee593310180 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -1521,13 +1521,6 @@ static bool audio_mixeng_backend_realize(AudioBacken= d *abe, audio_driver *drv =3D AUDIO_MIXENG_BACKEND_GET_CLASS(be)->driver; =20 be->dev =3D dev; - if (drv->init !=3D NULL) { - be->drv_opaque =3D drv->init(be->dev, errp); - if (!be->drv_opaque) { - return false; - } - } - if (!drv->pcm_ops->get_buffer_in) { drv->pcm_ops->get_buffer_in =3D audio_generic_get_buffer_in; drv->pcm_ops->put_buffer_in =3D audio_generic_put_buffer_in; @@ -1665,13 +1658,7 @@ static void audio_mixeng_backend_finalize(Object *ob= j) QLIST_REMOVE(hwi, entries); } =20 - if (s->drv) { - if (s->drv->fini) { - s->drv->fini (s->drv_opaque); - } - s->drv =3D NULL; - } - + s->drv =3D NULL; if (s->dev) { qapi_free_Audiodev(s->dev); s->dev =3D NULL; diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index fb059815de9..9cc6e826b7e 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -173,7 +173,7 @@ dbus_audio_get_nsamples(AudioDbus *da) } =20 static int -dbus_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque) +dbus_init_out(HWVoiceOut *hw, struct audsettings *as) { AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceOut *vo =3D container_of(hw, DBusVoiceOut, hw); @@ -287,7 +287,7 @@ dbus_init_in_listener(QemuDBusDisplay1AudioInListener *= listener, HWVoiceIn *hw) } =20 static int -dbus_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) +dbus_init_in(HWVoiceIn *hw, struct audsettings *as) { AudioDbus *da =3D AUDIO_DBUS(hw->s); DBusVoiceIn *vo =3D container_of(hw, DBusVoiceIn, hw); diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 31e3da6a7fe..d1bf80f8b68 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -507,8 +507,7 @@ static int qjack_client_init(QJackClient *c) return 0; } =20 -static int qjack_init_out(HWVoiceOut *hw, struct audsettings *as, - void *drv_opaque) +static int qjack_init_out(HWVoiceOut *hw, struct audsettings *as) { QJackOut *jo =3D (QJackOut *)hw; Audiodev *dev =3D hw->s->dev; @@ -544,8 +543,7 @@ static int qjack_init_out(HWVoiceOut *hw, struct audset= tings *as, return 0; } =20 -static int qjack_init_in(HWVoiceIn *hw, struct audsettings *as, - void *drv_opaque) +static int qjack_init_in(HWVoiceIn *hw, struct audsettings *as) { QJackIn *ji =3D (QJackIn *)hw; Audiodev *dev =3D hw->s->dev; diff --git a/audio/noaudio.c b/audio/noaudio.c index 2bd110caac4..6016f516d4a 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -62,7 +62,7 @@ static size_t no_write(HWVoiceOut *hw, void *buf, size_t = len) return audio_rate_get_bytes(&no->rate, &hw->info, len); } =20 -static int no_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_o= paque) +static int no_init_out(HWVoiceOut *hw, struct audsettings *as) { NoVoiceOut *no =3D (NoVoiceOut *) hw; =20 @@ -86,7 +86,7 @@ static void no_enable_out(HWVoiceOut *hw, bool enable) } } =20 -static int no_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opa= que) +static int no_init_in(HWVoiceIn *hw, struct audsettings *as) { NoVoiceIn *no =3D (NoVoiceIn *) hw; =20 diff --git a/audio/ossaudio.c b/audio/ossaudio.c index fedd2bbd722..e6f8d6d41e5 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -493,8 +493,7 @@ static void oss_fini_out (HWVoiceOut *hw) } } =20 -static int oss_init_out(HWVoiceOut *hw, struct audsettings *as, - void *drv_opaque) +static int oss_init_out(HWVoiceOut *hw, struct audsettings *as) { OSSVoiceOut *oss =3D (OSSVoiceOut *) hw; struct oss_params req, obt; @@ -625,7 +624,7 @@ static void oss_enable_out(HWVoiceOut *hw, bool enable) } } =20 -static int oss_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_op= aque) +static int oss_init_in(HWVoiceIn *hw, struct audsettings *as) { OSSVoiceIn *oss =3D (OSSVoiceIn *) hw; struct oss_params req, obt; diff --git a/audio/paaudio.c b/audio/paaudio.c index 97e6c0d1794..35818296282 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -518,8 +518,7 @@ fail: return NULL; } =20 -static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as, - void *drv_opaque) +static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as) { AudioMixengBackend *amb =3D hw->s; AudioPa *apa =3D AUDIO_PA(amb); @@ -570,7 +569,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, return -1; } =20 -static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_op= aque) +static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as) { AudioMixengBackend *amb =3D hw->s; AudioPa *apa =3D AUDIO_PA(amb); diff --git a/audio/pwaudio.c b/audio/pwaudio.c index ca61a1b4ef5..c668ef19a3e 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -524,7 +524,7 @@ qpw_set_position(uint32_t channels, uint32_t position[S= PA_AUDIO_MAX_CHANNELS]) } =20 static int -qpw_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque) +qpw_init_out(HWVoiceOut *hw, struct audsettings *as) { AudioPw *c =3D AUDIO_PW(hw->s); PWVoiceOut *pw =3D (PWVoiceOut *) hw; @@ -571,7 +571,7 @@ qpw_init_out(HWVoiceOut *hw, struct audsettings *as, vo= id *drv_opaque) } =20 static int -qpw_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) +qpw_init_in(HWVoiceIn *hw, struct audsettings *as) { AudioPw *c =3D AUDIO_PW(hw->s); PWVoiceIn *pw =3D (PWVoiceIn *) hw; diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 0dfa3100828..a1d453aa307 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -345,8 +345,7 @@ static void sdl_fini_out(HWVoiceOut *hw) sdl_close_out(sdl); } =20 -static int sdl_init_out(HWVoiceOut *hw, struct audsettings *as, - void *drv_opaque) +static int sdl_init_out(HWVoiceOut *hw, struct audsettings *as) { SDLVoiceOut *sdl =3D (SDLVoiceOut *)hw; SDL_AudioSpec req, obt; @@ -402,7 +401,7 @@ static void sdl_fini_in(HWVoiceIn *hw) sdl_close_in(sdl); } =20 -static int sdl_init_in(HWVoiceIn *hw, audsettings *as, void *drv_opaque) +static int sdl_init_in(HWVoiceIn *hw, audsettings *as) { SDLVoiceIn *sdl =3D (SDLVoiceIn *)hw; SDL_AudioSpec req, obt; diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index c15d8b6684a..77685e27cb1 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -495,7 +495,7 @@ static void sndio_enable_in(HWVoiceIn *hw, bool enable) sndio_enable(self, enable); } =20 -static int sndio_init_out(HWVoiceOut *hw, struct audsettings *as, void *op= aque) +static int sndio_init_out(HWVoiceOut *hw, struct audsettings *as) { SndioVoice *self =3D (SndioVoice *) hw; =20 @@ -508,7 +508,7 @@ static int sndio_init_out(HWVoiceOut *hw, struct audset= tings *as, void *opaque) return 0; } =20 -static int sndio_init_in(HWVoiceIn *hw, struct audsettings *as, void *opaq= ue) +static int sndio_init_in(HWVoiceIn *hw, struct audsettings *as) { SndioVoice *self =3D (SndioVoice *) hw; =20 diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 953dbf6c308..cc6c5d7e287 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -108,8 +108,7 @@ static const SpiceRecordInterface record_sif =3D { =20 /* playback */ =20 -static int line_out_init(HWVoiceOut *hw, struct audsettings *as, - void *drv_opaque) +static int line_out_init(HWVoiceOut *hw, struct audsettings *as) { SpiceVoiceOut *out =3D container_of (hw, SpiceVoiceOut, hw); struct audsettings settings; @@ -225,7 +224,7 @@ static void line_out_volume(HWVoiceOut *hw, Volume *vol) =20 /* record */ =20 -static int line_in_init(HWVoiceIn *hw, struct audsettings *as, void *drv_o= paque) +static int line_in_init(HWVoiceIn *hw, struct audsettings *as) { SpiceVoiceIn *in =3D container_of (hw, SpiceVoiceIn, hw); struct audsettings settings; diff --git a/audio/wavaudio.c b/audio/wavaudio.c index f1a414f208c..f9a0484488b 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -78,8 +78,7 @@ static void le_store (uint8_t *buf, uint32_t val, int len) } } =20 -static int wav_init_out(HWVoiceOut *hw, struct audsettings *as, - void *drv_opaque) +static int wav_init_out(HWVoiceOut *hw, struct audsettings *as) { WAVVoiceOut *wav =3D (WAVVoiceOut *) hw; int bits16 =3D 0, stereo =3D 0; diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 4a0904f0073..a3a0b83eb9d 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -573,8 +573,7 @@ static OSStatus handle_voice_change( return 0; } =20 -static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as, - void *drv_opaque) +static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as) { OSStatus status; coreaudioVoiceOut *core =3D (coreaudioVoiceOut *) hw; --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243703; cv=none; d=zohomail.com; s=zohoarc; b=DgdmzwCqXe+b0ecFAX3C/F6SXQXOO4dJz1oHHyloETZnAcB1epObPOhlqnukZaDHMZs9eHfLCHi5paGZJhL1kuJmgj9eU+vmceyWPNoB9mzbhRPhAxv2U/Otj1weofcr+2fyXM5cpCHiTuqoW52DqvrVEphsb8B75noyc0CcHAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243703; h=Content-Type: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=LCOy/goLs2TwldRqrNhKvcGGMixVtj9WQh4RsXyO41Q=; b=TFjFULdM4zmcKyKijCnYlH1eedCP8S4DY4QwmIt9K5HO/Ez/0QngkI/NY2+Qq1Q80PL3Pd6JXCkq00WJroO98/0K4vm91fXperoJcRo6JXAbLCfiEPIW4DK3v4WQ6QVNLyD2NgvUP7qQc11Mfu1r34D1+MaTF4iG97vp9dtyrlg= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243703833166.33444114817485; Mon, 16 Feb 2026 04:08:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfJ-0005uv-PF; Mon, 16 Feb 2026 06:21:21 -0500 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 1vrwcS-0006ms-NL for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcP-0008Ex-Pm for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:24 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-49-V7sCawgRP0OStQvAMraFNg-1; Mon, 16 Feb 2026 06:18:17 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7ED5F195605C; Mon, 16 Feb 2026 11:18:15 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C5EA230001B9; Mon, 16 Feb 2026 11:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LCOy/goLs2TwldRqrNhKvcGGMixVtj9WQh4RsXyO41Q=; b=Ft9o61LzdjGE3AThLAuTbuVFJ784tVpn3/NIHoZswh70GVIcYfGz8fu655cFgVO1h91aIV nG4TtufMASfDfnpsOk8zddH1rIyEqBLFPDdWgWPP40VemYvoYMY2Bw+6Q3enRCWoh6vrm0 OJxqSnfdMIhq6r6PJQ6Qw3VwXsKquxs= X-MC-Unique: V7sCawgRP0OStQvAMraFNg-1 X-Mimecast-MFC-AGG-ID: V7sCawgRP0OStQvAMraFNg_1771240695 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:45 +0100 Subject: [PATCH 56/85] audio: remove audio_driver MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-56-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=26851; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=eov+yl9HxRh/mzkXBewE8Zp+1GhaCy5G7F70BydXeMc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRvgojbNGLRLDN0LyW+V9MXAOKrN5zGdS2n MaxNtFtQseJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5V/PD/4us8wH3a8cMTPUe+STNaSt9C0WbUjXGAcIDrBOyND7pQYa2vE9kr8RZWu2f2/bGCmFyoo 6T5l/TkAnvB6Eag4ZjHFzKmulPNRzarDWoG8ibX0QFy2TkpyK4uPt5jSK9eTI+RgjCLP1F1DLP3 FLGPIbPewMCxAWfhmRpDYVTnKv7l/jTKm3TnMh0SHlTFIKjgSRZYm7smnL2JgZRFkIES4aKV53d GeYEm64l7/CCXxzOsnvGmtlgYyHZif/ptZ6DNhUXR4kE6AmkoGTLyexR/XnYSzIxu8XpXOTse+G F74MlVdNEhY4Ns/c4ea4ZH/wTBoVBK77M5aadsU0La3PMBpbeyb4gsZaUsA0Mlhj5Jo2kt5rynA WuaH4nDSIWmi0fgvu9qe3IWN/RsR2qUUR1xv/kLD2s0VdFIWh7SHmrDL27prZ+kWhaBISbdSC3a nPzTcDOIYE47TsKkBBv8ZvLpbMhXmrJVG0zlR5xq2Ze0JVLawhzja/YJiSaFVPwBEQQ63iN58v9 1TyzLTjOkGNnopuHNIRGLIjjkp7kaIrMsAGzVhkvqdXMYRJKwpS+QwrnIhUWS/txsTcc52XyhKC 87RfgjfrtqXzna/ozVP70mPGdym0kwoEzY7BujrScEakTwmlWMyReBWVd+R8wCqXSLu9tRmzwDv UZdlX0Rt8AKwGoQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243706680154100 Move all fields from audio_driver directly into AudioMixengBackendClass, eliminating an unnecessary extra struct. Drivers now set class fields directly in class_init instead of creating a static audio_driver instance. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 18 +++++---------- audio/audio_template.h | 58 +++++++++++++++++++++++----------------------= ---- audio/alsaaudio.c | 17 +++++---------- audio/audio-mixeng-be.c | 20 ++++++++--------- audio/dbusaudio.c | 17 +++++---------- audio/dsoundaudio.c | 17 +++++---------- audio/jackaudio.c | 17 +++++---------- audio/noaudio.c | 28 ++++++++++-------------- audio/ossaudio.c | 17 +++++---------- audio/paaudio.c | 17 +++++---------- audio/pwaudio.c | 17 +++++---------- audio/sdlaudio.c | 17 +++++---------- audio/sndioaudio.c | 27 ++++++++++------------- audio/spiceaudio.c | 36 +++++++++++++----------------- audio/wavaudio.c | 28 ++++++++++-------------- audio/coreaudio.m | 28 ++++++++++-------------- 16 files changed, 149 insertions(+), 230 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index fb5a9dd871e..bd9c7a29e41 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -136,16 +136,6 @@ struct SWVoiceIn { QLIST_ENTRY (SWVoiceIn) entries; }; =20 -typedef struct audio_driver audio_driver; -struct audio_driver { - const char *name; - struct audio_pcm_ops *pcm_ops; - int max_voices_out; - int max_voices_in; - size_t voice_size_out; - size_t voice_size_in; -}; - struct audio_pcm_ops { int (*init_out)(HWVoiceOut *hw, audsettings *as); void (*fini_out)(HWVoiceOut *hw); @@ -229,13 +219,17 @@ struct SWVoiceCap { struct AudioMixengBackendClass { AudioBackendClass parent_class; =20 - audio_driver *driver; + const char *name; + struct audio_pcm_ops *pcm_ops; + int max_voices_out; + int max_voices_in; + size_t voice_size_out; + size_t voice_size_in; }; =20 struct AudioMixengBackend { AudioBackend parent_obj; =20 - struct audio_driver *drv; Audiodev *dev; =20 QEMUTimer *ts; diff --git a/audio/audio_template.h b/audio/audio_template.h index 6c2d2ad5dca..7187571c668 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -37,41 +37,42 @@ #endif =20 static void glue(audio_init_nb_voices_, TYPE)(AudioMixengBackend *s, - struct audio_driver *drv, in= t min_voices) + AudioMixengBackendClass *k, + int min_voices) { - int max_voices =3D glue (drv->max_voices_, TYPE); - size_t voice_size =3D glue(drv->voice_size_, TYPE); + int max_voices =3D glue(k->max_voices_, TYPE); + size_t voice_size =3D glue(k->voice_size_, TYPE); =20 - glue (s->nb_hw_voices_, TYPE) =3D glue(audio_get_pdo_, TYPE)(s->dev)->= voices; - if (glue (s->nb_hw_voices_, TYPE) > max_voices) { + glue(s->nb_hw_voices_, TYPE) =3D glue(audio_get_pdo_, TYPE)(s->dev)->v= oices; + if (glue(s->nb_hw_voices_, TYPE) > max_voices) { if (!max_voices) { #ifdef DAC - dolog ("Driver `%s' does not support " NAME "\n", drv->name); + dolog("Driver `%s' does not support " NAME "\n", k->name); #endif } else { - dolog ("Driver `%s' does not support %d " NAME " voices, max %= d\n", - drv->name, - glue (s->nb_hw_voices_, TYPE), + dolog("Driver `%s' does not support %d " NAME " voices, max %d= \n", + k->name, + glue(s->nb_hw_voices_, TYPE), max_voices); } - glue (s->nb_hw_voices_, TYPE) =3D max_voices; + glue(s->nb_hw_voices_, TYPE) =3D max_voices; } =20 - if (glue (s->nb_hw_voices_, TYPE) < min_voices) { - dolog ("Bogus number of " NAME " voices %d, setting to %d\n", - glue (s->nb_hw_voices_, TYPE), + if (glue(s->nb_hw_voices_, TYPE) < min_voices) { + dolog("Bogus number of " NAME " voices %d, setting to %d\n", + glue(s->nb_hw_voices_, TYPE), min_voices); } =20 if (audio_bug(__func__, !voice_size && max_voices)) { - dolog ("drv=3D`%s' voice_size=3D0 max_voices=3D%d\n", - drv->name, max_voices); - glue (s->nb_hw_voices_, TYPE) =3D 0; + dolog("drv=3D`%s' voice_size=3D0 max_voices=3D%d\n", + k->name, max_voices); + glue(s->nb_hw_voices_, TYPE) =3D 0; } =20 if (audio_bug(__func__, voice_size && !max_voices)) { dolog("drv=3D`%s' voice_size=3D%zu max_voices=3D0\n", - drv->name, voice_size); + k->name, voice_size); } } =20 @@ -267,29 +268,24 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMix= engBackend *s, struct audsettings *as) { HW *hw; - struct audio_driver *drv =3D s->drv; + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(s); =20 - if (!glue (s->nb_hw_voices_, TYPE)) { + if (!glue(s->nb_hw_voices_, TYPE)) { return NULL; } =20 - if (audio_bug(__func__, !drv)) { - dolog ("No host audio driver\n"); - return NULL; - } - - if (audio_bug(__func__, !drv->pcm_ops)) { - dolog ("Host audio driver without pcm_ops\n"); + if (audio_bug(__func__, !k->pcm_ops)) { + dolog("No host audio driver or missing pcm_ops\n"); return NULL; } =20 /* - * Since glue(s->nb_hw_voices_, TYPE) is !=3D 0, glue(drv->voice_size_= , TYPE) + * Since glue(s->nb_hw_voices_, TYPE) is !=3D 0, glue(k->voice_size_, = TYPE) * is guaranteed to be !=3D 0. See the audio_init_nb_voices_* function= s. */ - hw =3D g_malloc0(glue(drv->voice_size_, TYPE)); + hw =3D g_malloc0(glue(k->voice_size_, TYPE)); hw->s =3D AUDIO_MIXENG_BACKEND(object_ref(s)); - hw->pcm_ops =3D drv->pcm_ops; + hw->pcm_ops =3D k->pcm_ops; =20 QLIST_INIT (&hw->sw_head); #ifdef DAC @@ -517,8 +513,8 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( goto fail; } =20 - if (audio_bug(__func__, !s->drv)) { - dolog ("Can not open `%s' (no host audio driver)\n", name); + if (audio_bug(__func__, !AUDIO_MIXENG_BACKEND_GET_CLASS(s)->pcm_ops)) { + dolog("Can not open `%s' (no host audio driver)\n", name); goto fail; } =20 diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 0c63d133496..d008ce7b627 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -46,7 +46,6 @@ struct AudioALSA { AudioMixengBackend parent_obj; }; =20 -static struct audio_driver alsa_audio_driver; =20 struct pollhlp { snd_pcm_t *handle; @@ -938,15 +937,6 @@ static struct audio_pcm_ops alsa_pcm_ops =3D { .enable_in =3D alsa_enable_in, }; =20 -static struct audio_driver alsa_audio_driver =3D { - .name =3D "alsa", - .pcm_ops =3D &alsa_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D INT_MAX, - .voice_size_out =3D sizeof (ALSAVoiceOut), - .voice_size_in =3D sizeof (ALSAVoiceIn) -}; - static void audio_alsa_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -955,7 +945,12 @@ static void audio_alsa_class_init(ObjectClass *klass, = const void *data) audio_alsa_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_paren= t(klass)); =20 b->realize =3D audio_alsa_realize; - k->driver =3D &alsa_audio_driver; + k->name =3D "alsa"; + k->pcm_ops =3D &alsa_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D INT_MAX; + k->voice_size_out =3D sizeof(ALSAVoiceOut); + k->voice_size_in =3D sizeof(ALSAVoiceIn); } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index ee593310180..3a0a537713e 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -1518,21 +1518,20 @@ static bool audio_mixeng_backend_realize(AudioBacke= nd *abe, Audiodev *dev, Error **errp) { AudioMixengBackend *be =3D AUDIO_MIXENG_BACKEND(abe); - audio_driver *drv =3D AUDIO_MIXENG_BACKEND_GET_CLASS(be)->driver; + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(be); =20 be->dev =3D dev; - if (!drv->pcm_ops->get_buffer_in) { - drv->pcm_ops->get_buffer_in =3D audio_generic_get_buffer_in; - drv->pcm_ops->put_buffer_in =3D audio_generic_put_buffer_in; + if (!k->pcm_ops->get_buffer_in) { + k->pcm_ops->get_buffer_in =3D audio_generic_get_buffer_in; + k->pcm_ops->put_buffer_in =3D audio_generic_put_buffer_in; } - if (!drv->pcm_ops->get_buffer_out) { - drv->pcm_ops->get_buffer_out =3D audio_generic_get_buffer_out; - drv->pcm_ops->put_buffer_out =3D audio_generic_put_buffer_out; + if (!k->pcm_ops->get_buffer_out) { + k->pcm_ops->get_buffer_out =3D audio_generic_get_buffer_out; + k->pcm_ops->put_buffer_out =3D audio_generic_put_buffer_out; } =20 - audio_init_nb_voices_out(be, drv, 1); - audio_init_nb_voices_in(be, drv, 0); - be->drv =3D drv; + audio_init_nb_voices_out(be, k, 1); + audio_init_nb_voices_in(be, k, 0); =20 if (be->dev->timer_period <=3D 0) { be->period_ticks =3D 1; @@ -1658,7 +1657,6 @@ static void audio_mixeng_backend_finalize(Object *obj) QLIST_REMOVE(hwi, entries); } =20 - s->drv =3D NULL; if (s->dev) { qapi_free_Audiodev(s->dev); s->dev =3D NULL; diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 9cc6e826b7e..82e76c41f9f 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -61,7 +61,6 @@ struct AudioDbus { GHashTable *in_listeners; }; =20 -static struct audio_driver dbus_audio_driver; =20 typedef struct DBusVoiceOut { HWVoiceOut hw; @@ -709,15 +708,6 @@ static struct audio_pcm_ops dbus_pcm_ops =3D { .volume_in =3D dbus_volume_in, }; =20 -static struct audio_driver dbus_audio_driver =3D { - .name =3D "dbus", - .pcm_ops =3D &dbus_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D INT_MAX, - .voice_size_out =3D sizeof(DBusVoiceOut), - .voice_size_in =3D sizeof(DBusVoiceIn) -}; - static void audio_dbus_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -727,7 +717,12 @@ static void audio_dbus_class_init(ObjectClass *klass, = const void *data) =20 b->realize =3D audio_dbus_realize; b->set_dbus_server =3D dbus_audio_set_server; - k->driver =3D &dbus_audio_driver; + k->name =3D "dbus"; + k->pcm_ops =3D &dbus_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D INT_MAX; + k->voice_size_out =3D sizeof(DBusVoiceOut); + k->voice_size_in =3D sizeof(DBusVoiceIn); } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index a90c348230b..e35b7fc233f 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -55,7 +55,6 @@ struct AudioDsound { struct audsettings settings; }; =20 -static struct audio_driver dsound_audio_driver; =20 /* #define DEBUG_DSOUND */ =20 @@ -685,15 +684,6 @@ static struct audio_pcm_ops dsound_pcm_ops =3D { .enable_in =3D dsound_enable_in, }; =20 -static struct audio_driver dsound_audio_driver =3D { - .name =3D "dsound", - .pcm_ops =3D &dsound_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D 1, - .voice_size_out =3D sizeof (DSoundVoiceOut), - .voice_size_in =3D sizeof (DSoundVoiceIn) -}; - static void audio_dsound_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -702,7 +692,12 @@ static void audio_dsound_class_init(ObjectClass *klass= , const void *data) audio_dsound_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_par= ent(klass)); =20 b->realize =3D audio_dsound_realize; - k->driver =3D &dsound_audio_driver; + k->name =3D "dsound"; + k->pcm_ops =3D &dsound_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D 1; + k->voice_size_out =3D sizeof(DSoundVoiceOut); + k->voice_size_in =3D sizeof(DSoundVoiceIn); } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/jackaudio.c b/audio/jackaudio.c index d1bf80f8b68..7caa2ddf43f 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -42,7 +42,6 @@ struct AudioJack { AudioMixengBackend parent_obj; }; =20 -static struct audio_driver jack_driver; =20 struct QJack; =20 @@ -668,15 +667,6 @@ static struct audio_pcm_ops jack_pcm_ops =3D { .enable_in =3D qjack_enable_in }; =20 -static struct audio_driver jack_driver =3D { - .name =3D "jack", - .pcm_ops =3D &jack_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D INT_MAX, - .voice_size_out =3D sizeof(QJackOut), - .voice_size_in =3D sizeof(QJackIn) -}; - static void qjack_error(const char *msg) { dolog("E: %s\n", msg); @@ -691,7 +681,12 @@ static void audio_jack_class_init(ObjectClass *klass, = const void *data) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 - k->driver =3D &jack_driver; + k->name =3D "jack"; + k->pcm_ops =3D &jack_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D INT_MAX; + k->voice_size_out =3D sizeof(QJackOut); + k->voice_size_in =3D sizeof(QJackIn); } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/noaudio.c b/audio/noaudio.c index 6016f516d4a..be2e2e684ce 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -37,15 +37,6 @@ struct AudioNone { AudioMixengBackend parent_obj; }; =20 -static struct audio_driver no_audio_driver; - -static void audio_none_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &no_audio_driver; -} - typedef struct NoVoiceOut { HWVoiceOut hw; RateCtl rate; @@ -134,14 +125,17 @@ static struct audio_pcm_ops no_pcm_ops =3D { .enable_in =3D no_enable_in }; =20 -static struct audio_driver no_audio_driver =3D { - .name =3D "none", - .pcm_ops =3D &no_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D INT_MAX, - .voice_size_out =3D sizeof (NoVoiceOut), - .voice_size_in =3D sizeof (NoVoiceIn) -}; +static void audio_none_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->name =3D "none"; + k->pcm_ops =3D &no_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D INT_MAX; + k->voice_size_out =3D sizeof(NoVoiceOut); + k->voice_size_in =3D sizeof(NoVoiceIn); +} =20 static const TypeInfo audio_types[] =3D { { diff --git a/audio/ossaudio.c b/audio/ossaudio.c index e6f8d6d41e5..0ad974e20cc 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -46,7 +46,6 @@ struct AudioOss { AudioMixengBackend parent_obj; }; =20 -static struct audio_driver oss_audio_driver; =20 #if defined OSS_GETVERSION && defined SNDCTL_DSP_POLICY #define USE_DSP_POLICY @@ -773,15 +772,6 @@ static struct audio_pcm_ops oss_pcm_ops =3D { .enable_in =3D oss_enable_in }; =20 -static struct audio_driver oss_audio_driver =3D { - .name =3D "oss", - .pcm_ops =3D &oss_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D INT_MAX, - .voice_size_out =3D sizeof (OSSVoiceOut), - .voice_size_in =3D sizeof (OSSVoiceIn) -}; - static void audio_oss_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -790,7 +780,12 @@ static void audio_oss_class_init(ObjectClass *klass, c= onst void *data) audio_oss_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent= (klass)); =20 b->realize =3D audio_oss_realize; - k->driver =3D &oss_audio_driver; + k->name =3D "oss"; + k->pcm_ops =3D &oss_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D INT_MAX; + k->voice_size_out =3D sizeof(OSSVoiceOut); + k->voice_size_in =3D sizeof(OSSVoiceIn); } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/paaudio.c b/audio/paaudio.c index 35818296282..5758050cb55 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -16,7 +16,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(AudioPa, AUDIO_PA) =20 static AudioBackendClass *audio_pa_parent_class; =20 -static struct audio_driver pa_audio_driver; =20 typedef struct PAConnection { char *server; @@ -931,15 +930,6 @@ static struct audio_pcm_ops qpa_pcm_ops =3D { .volume_in =3D qpa_volume_in }; =20 -static struct audio_driver pa_audio_driver =3D { - .name =3D "pa", - .pcm_ops =3D &qpa_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D INT_MAX, - .voice_size_out =3D sizeof (PAVoiceOut), - .voice_size_in =3D sizeof (PAVoiceIn), -}; - static void audio_pa_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -948,7 +938,12 @@ static void audio_pa_class_init(ObjectClass *klass, co= nst void *data) audio_pa_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent(= klass)); =20 b->realize =3D audio_pa_realize; - k->driver =3D &pa_audio_driver; + k->name =3D "pa"; + k->pcm_ops =3D &qpa_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D INT_MAX; + k->voice_size_out =3D sizeof(PAVoiceOut); + k->voice_size_in =3D sizeof(PAVoiceIn); } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/pwaudio.c b/audio/pwaudio.c index c668ef19a3e..f7f7dfbe0ad 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -44,7 +44,6 @@ struct AudioPw { int last_seq, pending_seq, error; }; =20 -static struct audio_driver pw_audio_driver; =20 typedef struct pwvolume { uint32_t channels; @@ -840,15 +839,6 @@ static struct audio_pcm_ops qpw_pcm_ops =3D { .enable_in =3D qpw_enable_in }; =20 -static struct audio_driver pw_audio_driver =3D { - .name =3D "pipewire", - .pcm_ops =3D &qpw_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D INT_MAX, - .voice_size_out =3D sizeof(PWVoiceOut), - .voice_size_in =3D sizeof(PWVoiceIn), -}; - static void audio_pw_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -857,7 +847,12 @@ static void audio_pw_class_init(ObjectClass *klass, co= nst void *data) audio_pw_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent(= klass)); =20 b->realize =3D audio_pw_realize; - k->driver =3D &pw_audio_driver; + k->name =3D "pipewire"; + k->pcm_ops =3D &qpw_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D INT_MAX; + k->voice_size_out =3D sizeof(PWVoiceOut); + k->voice_size_in =3D sizeof(PWVoiceIn); } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index a1d453aa307..62f7ac8d76b 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -50,7 +50,6 @@ struct AudioSdl { AudioMixengBackend parent_obj; }; =20 -static struct audio_driver sdl_audio_driver; =20 typedef struct SDLVoiceOut { HWVoiceOut hw; @@ -492,15 +491,6 @@ static struct audio_pcm_ops sdl_pcm_ops =3D { .enable_in =3D sdl_enable_in, }; =20 -static struct audio_driver sdl_audio_driver =3D { - .name =3D "sdl", - .pcm_ops =3D &sdl_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D INT_MAX, - .voice_size_out =3D sizeof(SDLVoiceOut), - .voice_size_in =3D sizeof(SDLVoiceIn), -}; - static void audio_sdl_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -509,7 +499,12 @@ static void audio_sdl_class_init(ObjectClass *klass, c= onst void *data) audio_sdl_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent= (klass)); =20 b->realize =3D audio_sdl_realize; - k->driver =3D &sdl_audio_driver; + k->name =3D "sdl"; + k->pcm_ops =3D &sdl_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D INT_MAX; + k->voice_size_out =3D sizeof(SDLVoiceOut); + k->voice_size_in =3D sizeof(SDLVoiceIn); } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 77685e27cb1..5cd6250775b 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -32,14 +32,6 @@ struct AudioSndio { AudioMixengBackend parent_obj; }; =20 -static struct audio_driver sndio_audio_driver; - -static void audio_sndio_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &sndio_audio_driver; -} =20 /* default latency in microseconds if no option is set */ #define SNDIO_LATENCY_US 50000 @@ -551,14 +543,17 @@ static struct audio_pcm_ops sndio_pcm_ops =3D { .put_buffer_in =3D sndio_put_buffer_in, }; =20 -static struct audio_driver sndio_audio_driver =3D { - .name =3D "sndio", - .pcm_ops =3D &sndio_pcm_ops, - .max_voices_out =3D INT_MAX, - .max_voices_in =3D INT_MAX, - .voice_size_out =3D sizeof(SndioVoice), - .voice_size_in =3D sizeof(SndioVoice) -}; +static void audio_sndio_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->name =3D "sndio"; + k->pcm_ops =3D &sndio_pcm_ops; + k->max_voices_out =3D INT_MAX; + k->max_voices_in =3D INT_MAX; + k->voice_size_out =3D sizeof(SndioVoice); + k->voice_size_in =3D sizeof(SndioVoice); +} =20 static const TypeInfo audio_types[] =3D { { diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index cc6c5d7e287..995e0f6faa3 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -39,8 +39,6 @@ struct AudioSpice { AudioMixengBackend parent_obj; }; =20 -static struct audio_driver spice_audio_driver; - static bool spice_audio_realize(AudioBackend *abe, Audiodev *dev, Error **= errp) { if (!using_spice) { @@ -52,17 +50,6 @@ static bool spice_audio_realize(AudioBackend *abe, Audio= dev *dev, Error **errp) return audio_spice_parent_class->realize(abe, dev, errp); } =20 -static void audio_spice_class_init(ObjectClass *klass, const void *data) -{ - AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - audio_spice_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_pare= nt(klass)); - - b->realize =3D spice_audio_realize; - k->driver =3D &spice_audio_driver; -} - #if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= =3D 3 #define LINE_OUT_SAMPLES (480 * 4) #else @@ -332,14 +319,21 @@ static struct audio_pcm_ops audio_callbacks =3D { #endif }; =20 -static struct audio_driver spice_audio_driver =3D { - .name =3D "spice", - .pcm_ops =3D &audio_callbacks, - .max_voices_out =3D 1, - .max_voices_in =3D 1, - .voice_size_out =3D sizeof (SpiceVoiceOut), - .voice_size_in =3D sizeof (SpiceVoiceIn), -}; +static void audio_spice_class_init(ObjectClass *klass, const void *data) +{ + AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + audio_spice_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_pare= nt(klass)); + + b->realize =3D spice_audio_realize; + k->name =3D "spice"; + k->pcm_ops =3D &audio_callbacks; + k->max_voices_out =3D 1; + k->max_voices_in =3D 1; + k->voice_size_out =3D sizeof(SpiceVoiceOut); + k->voice_size_in =3D sizeof(SpiceVoiceIn); +} =20 static const TypeInfo audio_types[] =3D { { diff --git a/audio/wavaudio.c b/audio/wavaudio.c index f9a0484488b..153e50fa0be 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -37,15 +37,6 @@ struct AudioWav { AudioMixengBackend parent_obj; }; =20 -static struct audio_driver wav_audio_driver; - -static void audio_wav_class_init(ObjectClass *klass, const void *data) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &wav_audio_driver; -} - typedef struct WAVVoiceOut { HWVoiceOut hw; FILE *f; @@ -208,14 +199,17 @@ static struct audio_pcm_ops wav_pcm_ops =3D { .enable_out =3D wav_enable_out, }; =20 -static struct audio_driver wav_audio_driver =3D { - .name =3D "wav", - .pcm_ops =3D &wav_pcm_ops, - .max_voices_out =3D 1, - .max_voices_in =3D 0, - .voice_size_out =3D sizeof (WAVVoiceOut), - .voice_size_in =3D 0 -}; +static void audio_wav_class_init(ObjectClass *klass, const void *data) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->name =3D "wav"; + k->pcm_ops =3D &wav_pcm_ops; + k->max_voices_out =3D 1; + k->max_voices_in =3D 0; + k->voice_size_out =3D sizeof(WAVVoiceOut); + k->voice_size_in =3D 0; +} =20 static const TypeInfo audio_types[] =3D { { diff --git a/audio/coreaudio.m b/audio/coreaudio.m index a3a0b83eb9d..e9274976f94 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -41,15 +41,6 @@ AudioMixengBackend parent_obj; }; =20 -static struct audio_driver coreaudio_audio_driver; - -static void audio_coreaudio_class_init(ObjectClass *klass, const void *dat= a) -{ - AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); - - k->driver =3D &coreaudio_audio_driver; -} - typedef struct coreaudioVoiceOut { HWVoiceOut hw; pthread_mutex_t buf_mutex; @@ -669,14 +660,17 @@ static void coreaudio_enable_out(HWVoiceOut *hw, bool= enable) .enable_out =3D coreaudio_enable_out }; =20 -static struct audio_driver coreaudio_audio_driver =3D { - .name =3D "coreaudio", - .pcm_ops =3D &coreaudio_pcm_ops, - .max_voices_out =3D 1, - .max_voices_in =3D 0, - .voice_size_out =3D sizeof (coreaudioVoiceOut), - .voice_size_in =3D 0 -}; +static void audio_coreaudio_class_init(ObjectClass *klass, const void *dat= a) +{ + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); + + k->name =3D "coreaudio"; + k->pcm_ops =3D &coreaudio_pcm_ops; + k->max_voices_out =3D 1; + k->max_voices_in =3D 0; + k->voice_size_out =3D sizeof(coreaudioVoiceOut); + k->voice_size_in =3D 0; +} =20 static const TypeInfo audio_types[] =3D { { --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771245897; cv=none; d=zohomail.com; s=zohoarc; b=n3ORQQTTF3RRZ/EhZzF0SyWrn689SW7ofixAzNduPnQ+3bwXHBu4qvoiElh7RaJ9l29ocCyymZuYoiSyiHexNUTBN5NzUY1q8xLRJV7fX/uG1zZOUZPuup/aBOgO4yM44rR1pd6SwKb34XWoGmB4dt84a+ojDdK6aDj6ZK5SXrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771245897; h=Content-Type: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=9squzf3KFb5y+JqzrvGK8siM2naJv6a7ZvlyYN1J/Ik=; b=nBb1Xn4vYkFCOnQod0v8syrWDlcpOiu3OApPcyi8fy5n0E3nEbFCnN9HxR7Lm+wS5v0dH4ra4jcPuJCckD4PWMycUWBfzAHJ5hkdEEF2CNRQhQVVkWRWjVGQPxONc0jCFXUSakY+pqchD45FU3EYo0OmCu1qLkTJGOMolYMiSxU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177124589786599.42848542118588; Mon, 16 Feb 2026 04:44:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfN-0006U3-8z; Mon, 16 Feb 2026 06:21:25 -0500 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 1vrwcZ-0006rp-OY for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcS-0008FJ-JW for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:28 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-464--KjTidx7Ol62MRLWvdh55g-1; Mon, 16 Feb 2026 06:18:20 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 872D818004BB; Mon, 16 Feb 2026 11:18:18 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 661F618003F5; Mon, 16 Feb 2026 11:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240704; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9squzf3KFb5y+JqzrvGK8siM2naJv6a7ZvlyYN1J/Ik=; b=EXiojmygOKDIy3BanyhW7683fduoMw+/z3dbi7z1P+BL5SaRdDGceP/nJEOuuzD9xAuMbN DUwR7BZuJrDu+GOYZDK6uAzoZMk8mczRt/7ZNGQ70dQDmnkpIquwmfVXYRpXIIRGNz00+G RRB0gtG0xY+dwLpOB2cst8oSKjn8+8s= X-MC-Unique: -KjTidx7Ol62MRLWvdh55g-1 X-Mimecast-MFC-AGG-ID: -KjTidx7Ol62MRLWvdh55g_1771240698 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:46 +0100 Subject: [PATCH 57/85] audio: move pcm_ops into AudioMixengBackendClass MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-57-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=49522; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=H80VC2lmA1mgIJAS1IeeAPq8vKiezekJkNE6YmZhgfo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRwnHg4NQCTXkbpLvmjT9GG+yIxCuqoFnO4 wqdqd3jfuCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5asTEACr/OnDWhPMHSQtkAzGdxKeTZiM7+mcEJthlaZQNVWR8yvwwWpMbAUD8crtCeWM8cLGTz1 iPA/z3FvbZjegrftUlnjh56kEIp/tup9ToE+Qvbz+b2paa9dFvGFzTNtF2fpxirSP1U0mnax2Vz hWZ9CnaIj4D4sRs+Mcj/i73AuYMvX0XVeCp89GtElWAwk91sbq6vfCZC6mTKgmSKCd+geauFJEw oxXeQanzgyotGc8CItWSfMpRk3qiGmDZXX7YLZz4v1EzaeNlIT2jX19lXxLl1fAoWNCtsT8rIBp 64L7R576aiRisvWkNT59j11DxnvFPW7XpyK4HpxYSRvuEHZECJq+iWe3gYVVfYvxbzO3SqMG2b7 MIftsFjAfjjvRdiVDKDM+1xDKr+8646YmeirFj1cc5AJFs1RNaiDwggg/mHJB0VMb32Fa4YyH6o rAiRXGzisi1ie5spDKCGG5PKZ5enwXBwrWJLW1SwgSjZUfLaamiKoGHNm0XLrOg/Z/+S2XMvB7S ZXDiqCCMc48uY/sGWET02KeRGxcnfaL7sQYZeRjS+Dwzw7VixNwdowcJ4qvawDjs3Ld0MoYJbcB B8lMpkj/cWKeNmenm66CqhESZhOi3h3DYh3ixrFx40wRbR9mPPDEawa7MDfhrnSzOAjHnu9QLe7 9OHRd/UMJPj5ybw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771245900370154100 Remove the separate audio_pcm_ops structure and move its function pointers directly into AudioMixengBackendClass. This is a cleaner QOM-style design where the PCM operations are part of the class vtable rather than a separate indirection through hw->pcm_ops. The HWVoiceOut and HWVoiceIn structures no longer need to store a pcm_ops pointer, as the operations are now accessed through the class with AUDIO_MIXENG_BACKEND_GET_CLASS(). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki Reviewed-by: Mark Cave-Ayland --- audio/audio_int.h | 71 +++++++++++-------------- audio/audio_template.h | 16 +++--- audio/alsaaudio.c | 29 +++++----- audio/audio-mixeng-be.c | 139 ++++++++++++++++++++++++++------------------= ---- audio/dbusaudio.c | 33 ++++++------ audio/dsoundaudio.c | 33 ++++++------ audio/jackaudio.c | 29 +++++----- audio/noaudio.c | 29 +++++----- audio/ossaudio.c | 33 ++++++------ audio/paaudio.c | 33 ++++++------ audio/pwaudio.c | 33 ++++++------ audio/sdlaudio.c | 46 ++++++++-------- audio/sndioaudio.c | 32 ++++++----- audio/spiceaudio.c | 45 ++++++++-------- audio/wavaudio.c | 17 +++--- audio/coreaudio.m | 27 +++++----- 16 files changed, 308 insertions(+), 337 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index bd9c7a29e41..5334c4baad2 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -39,8 +39,6 @@ AUD_vlog(const char *cap, const char *fmt, va_list ap); void G_GNUC_PRINTF(2, 3) AUD_log(const char *cap, const char *fmt, ...); =20 -struct audio_pcm_ops; - struct audio_callback { void *opaque; audio_callback_fn fn; @@ -81,7 +79,6 @@ typedef struct HWVoiceOut { size_t samples; QLIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head; QLIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head; - struct audio_pcm_ops *pcm_ops; QLIST_ENTRY (HWVoiceOut) entries; } HWVoiceOut; =20 @@ -101,7 +98,6 @@ typedef struct HWVoiceIn { =20 size_t samples; QLIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head; - struct audio_pcm_ops *pcm_ops; QLIST_ENTRY (HWVoiceIn) entries; } HWVoiceIn; =20 @@ -136,40 +132,6 @@ struct SWVoiceIn { QLIST_ENTRY (SWVoiceIn) entries; }; =20 -struct audio_pcm_ops { - int (*init_out)(HWVoiceOut *hw, audsettings *as); - void (*fini_out)(HWVoiceOut *hw); - size_t (*write) (HWVoiceOut *hw, void *buf, size_t size); - void (*run_buffer_out)(HWVoiceOut *hw); - /* - * Get the free output buffer size. This is an upper limit. The size - * returned by function get_buffer_out may be smaller. - */ - size_t (*buffer_get_free)(HWVoiceOut *hw); - /* - * get a buffer that after later can be passed to put_buffer_out; opti= onal - * returns the buffer, and writes it's size to size (in bytes) - */ - void *(*get_buffer_out)(HWVoiceOut *hw, size_t *size); - /* - * put back the buffer returned by get_buffer_out; optional - * buf must be equal the pointer returned by get_buffer_out, - * size may be smaller - */ - size_t (*put_buffer_out)(HWVoiceOut *hw, void *buf, size_t size); - void (*enable_out)(HWVoiceOut *hw, bool enable); - void (*volume_out)(HWVoiceOut *hw, Volume *vol); - - int (*init_in) (HWVoiceIn *hw, audsettings *as); - void (*fini_in) (HWVoiceIn *hw); - size_t (*read) (HWVoiceIn *hw, void *buf, size_t size); - void (*run_buffer_in)(HWVoiceIn *hw); - void *(*get_buffer_in)(HWVoiceIn *hw, size_t *size); - void (*put_buffer_in)(HWVoiceIn *hw, void *buf, size_t size); - void (*enable_in)(HWVoiceIn *hw, bool enable); - void (*volume_in)(HWVoiceIn *hw, Volume *vol); -}; - audsettings audiodev_to_audsettings(AudiodevPerDirectionOptions *pdo); int audioformat_bytes_per_sample(AudioFormat fmt); int audio_buffer_frames(AudiodevPerDirectionOptions *pdo, @@ -220,11 +182,42 @@ struct AudioMixengBackendClass { AudioBackendClass parent_class; =20 const char *name; - struct audio_pcm_ops *pcm_ops; int max_voices_out; int max_voices_in; size_t voice_size_out; size_t voice_size_in; + + int (*init_out)(HWVoiceOut *hw, audsettings *as); + void (*fini_out)(HWVoiceOut *hw); + size_t (*write) (HWVoiceOut *hw, void *buf, size_t size); + void (*run_buffer_out)(HWVoiceOut *hw); + /* + * Get the free output buffer size. This is an upper limit. The size + * returned by function get_buffer_out may be smaller. + */ + size_t (*buffer_get_free)(HWVoiceOut *hw); + /* + * get a buffer that after later can be passed to put_buffer_out; opti= onal + * returns the buffer, and writes it's size to size (in bytes) + */ + void *(*get_buffer_out)(HWVoiceOut *hw, size_t *size); + /* + * put back the buffer returned by get_buffer_out; optional + * buf must be equal the pointer returned by get_buffer_out, + * size may be smaller + */ + size_t (*put_buffer_out)(HWVoiceOut *hw, void *buf, size_t size); + void (*enable_out)(HWVoiceOut *hw, bool enable); + void (*volume_out)(HWVoiceOut *hw, Volume *vol); + + int (*init_in) (HWVoiceIn *hw, audsettings *as); + void (*fini_in) (HWVoiceIn *hw); + size_t (*read) (HWVoiceIn *hw, void *buf, size_t size); + void (*run_buffer_in)(HWVoiceIn *hw); + void *(*get_buffer_in)(HWVoiceIn *hw, size_t *size); + void (*put_buffer_in)(HWVoiceIn *hw, void *buf, size_t size); + void (*enable_in)(HWVoiceIn *hw, bool enable); + void (*volume_in)(HWVoiceIn *hw, Volume *vol); }; =20 struct AudioMixengBackend { diff --git a/audio/audio_template.h b/audio/audio_template.h index 7187571c668..08d60422589 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -223,13 +223,14 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) { HW *hw =3D *hwp; AudioMixengBackend *s =3D hw->s; + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(s); =20 if (!hw->sw_head.lh_first) { #ifdef DAC audio_detach_capture(hw); #endif QLIST_REMOVE(hw, entries); - glue(hw->pcm_ops->fini_, TYPE) (hw); + glue(k->fini_, TYPE)(hw); glue(s->nb_hw_voices_, TYPE) +=3D 1; glue(audio_pcm_hw_free_resources_ , TYPE) (hw); object_unref(hw->s); @@ -274,8 +275,8 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixen= gBackend *s, return NULL; } =20 - if (audio_bug(__func__, !k->pcm_ops)) { - dolog("No host audio driver or missing pcm_ops\n"); + if (audio_bug(__func__, !glue(k->init_, TYPE))) { + dolog("No host audio driver or missing init_%s\n", NAME); return NULL; } =20 @@ -285,13 +286,12 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMix= engBackend *s, */ hw =3D g_malloc0(glue(k->voice_size_, TYPE)); hw->s =3D AUDIO_MIXENG_BACKEND(object_ref(s)); - hw->pcm_ops =3D k->pcm_ops; =20 QLIST_INIT (&hw->sw_head); #ifdef DAC QLIST_INIT (&hw->cap_head); #endif - if (glue (hw->pcm_ops->init_, TYPE) (hw, as)) { + if (glue(k->init_, TYPE)(hw, as)) { goto err0; } =20 @@ -330,7 +330,7 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixen= gBackend *s, return hw; =20 err1: - glue (hw->pcm_ops->fini_, TYPE) (hw); + glue(k->fini_, TYPE)(hw); err0: object_unref(hw->s); g_free (hw); @@ -495,6 +495,7 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( const struct audsettings *as) { AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(be); + AudioMixengBackendClass *k; AudiodevPerDirectionOptions *pdo; =20 if (audio_bug(__func__, !be || !name || !callback_fn || !as)) { @@ -503,6 +504,7 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( goto fail; } =20 + k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(s); pdo =3D glue(audio_get_pdo_, TYPE)(s->dev); =20 ldebug ("open %s, freq %d, nchannels %d, fmt %d\n", @@ -513,7 +515,7 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( goto fail; } =20 - if (audio_bug(__func__, !AUDIO_MIXENG_BACKEND_GET_CLASS(s)->pcm_ops)) { + if (audio_bug(__func__, !glue(k->init_, TYPE))) { dolog("Can not open `%s' (no host audio driver)\n", name); goto fail; } diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index d008ce7b627..8f226b42612 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -922,21 +922,6 @@ audio_alsa_realize(AudioBackend *abe, Audiodev *dev, E= rror **errp) return audio_alsa_parent_class->realize(abe, dev, errp); } =20 -static struct audio_pcm_ops alsa_pcm_ops =3D { - .init_out =3D alsa_init_out, - .fini_out =3D alsa_fini_out, - .write =3D alsa_write, - .buffer_get_free =3D alsa_buffer_get_free, - .run_buffer_out =3D audio_generic_run_buffer_out, - .enable_out =3D alsa_enable_out, - - .init_in =3D alsa_init_in, - .fini_in =3D alsa_fini_in, - .read =3D alsa_read, - .run_buffer_in =3D audio_generic_run_buffer_in, - .enable_in =3D alsa_enable_in, -}; - static void audio_alsa_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -946,11 +931,23 @@ static void audio_alsa_class_init(ObjectClass *klass,= const void *data) =20 b->realize =3D audio_alsa_realize; k->name =3D "alsa"; - k->pcm_ops =3D &alsa_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(ALSAVoiceOut); k->voice_size_in =3D sizeof(ALSAVoiceIn); + + k->init_out =3D alsa_init_out; + k->fini_out =3D alsa_fini_out; + k->write =3D alsa_write; + k->buffer_get_free =3D alsa_buffer_get_free; + k->run_buffer_out =3D audio_generic_run_buffer_out; + k->enable_out =3D alsa_enable_out; + + k->init_in =3D alsa_init_in; + k->fini_in =3D alsa_fini_in; + k->read =3D alsa_read; + k->run_buffer_in =3D audio_generic_run_buffer_in; + k->enable_in =3D alsa_enable_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 3a0a537713e..17301ec80e7 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -526,7 +526,7 @@ static size_t audio_pcm_sw_read(SWVoiceIn *sw, void *bu= f, size_t buf_len) =20 audio_pcm_sw_resample_in(sw, live, frames_out_max, &total_in, &total_o= ut); =20 - if (!hw->pcm_ops->volume_in) { + if (!AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s)->volume_in) { mixeng_volume(sw->resample_buf.buffer, total_out, &sw->vol); } sw->clip(buf, sw->resample_buf.buffer, total_out); @@ -579,8 +579,10 @@ static size_t audio_pcm_hw_get_live_out (HWVoiceOut *h= w, int *nb_live) =20 static size_t audio_pcm_hw_get_free(HWVoiceOut *hw) { - return (hw->pcm_ops->buffer_get_free ? hw->pcm_ops->buffer_get_free(hw= ) : - INT_MAX) / hw->info.bytes_per_frame; + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s); + + return (k->buffer_get_free ? k->buffer_get_free(hw) : INT_MAX) / + hw->info.bytes_per_frame; } =20 static void audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf, size_t le= n) @@ -673,7 +675,7 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *= buf, size_t buf_len) if (frames_in_max > sw->resample_buf.pos) { sw->conv(sw->resample_buf.buffer + sw->resample_buf.pos, buf, frames_in_max - sw->resample_buf.pos); - if (!sw->hw->pcm_ops->volume_out) { + if (!AUDIO_MIXENG_BACKEND_GET_CLASS(sw->hw->s)->volume_out) { mixeng_volume(sw->resample_buf.buffer + sw->resample_buf.pos, frames_in_max - sw->resample_buf.pos, &sw->vol); } @@ -806,7 +808,7 @@ static size_t audio_mixeng_backend_write(AudioBackend *= be, SWVoiceOut *sw, if (audio_get_pdo_out(hw->s->dev)->mixing_engine) { return audio_pcm_sw_write(sw, buf, size); } else { - return hw->pcm_ops->write(hw, buf, size); + return AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s)->write(hw, buf, size); } } =20 @@ -829,7 +831,7 @@ static size_t audio_mixeng_backend_read(AudioBackend *b= e, if (audio_get_pdo_in(hw->s->dev)->mixing_engine) { return audio_pcm_sw_read(sw, buf, size); } else { - return hw->pcm_ops->read(hw, buf, size); + return AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s)->read(hw, buf, size); } =20 } @@ -863,12 +865,14 @@ static void audio_mixeng_backend_set_active_out(Audio= Backend *be, SWVoiceOut *sw SWVoiceCap *sc; =20 if (on) { + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(= s); + hw->pending_disable =3D 0; if (!hw->enabled) { hw->enabled =3D true; if (runstate_is_running()) { - if (hw->pcm_ops->enable_out) { - hw->pcm_ops->enable_out(hw, true); + if (k->enable_out) { + k->enable_out(hw, true); } audio_reset_timer (s); } @@ -908,14 +912,15 @@ static void audio_mixeng_backend_set_active_in(AudioB= ackend *be, SWVoiceIn *sw, hw =3D sw->hw; if (sw->active !=3D on) { AudioMixengBackend *s =3D sw->s; + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(s); SWVoiceIn *temp_sw; =20 if (on) { if (!hw->enabled) { hw->enabled =3D true; if (runstate_is_running()) { - if (hw->pcm_ops->enable_in) { - hw->pcm_ops->enable_in(hw, true); + if (k->enable_in) { + k->enable_in(hw, true); } audio_reset_timer (s); } @@ -932,8 +937,8 @@ static void audio_mixeng_backend_set_active_in(AudioBac= kend *be, SWVoiceIn *sw, =20 if (nb_active =3D=3D 1) { hw->enabled =3D false; - if (hw->pcm_ops->enable_in) { - hw->pcm_ops->enable_in(hw, false); + if (k->enable_in) { + k->enable_in(hw, false); } } } @@ -1040,12 +1045,13 @@ static void audio_capture_mix_and_clear(HWVoiceOut = *hw, size_t rpos, =20 static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live) { + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s); size_t clipped =3D 0; =20 while (live) { size_t size =3D live * hw->info.bytes_per_frame; size_t decr, proc; - void *buf =3D hw->pcm_ops->get_buffer_out(hw, &size); + void *buf =3D k->get_buffer_out(hw, &size); =20 if (size =3D=3D 0) { break; @@ -1055,8 +1061,7 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, si= ze_t live) if (buf) { audio_pcm_hw_clip_out(hw, buf, decr); } - proc =3D hw->pcm_ops->put_buffer_out(hw, buf, - decr * hw->info.bytes_per_frame= ) / + proc =3D k->put_buffer_out(hw, buf, decr * hw->info.bytes_per_fram= e) / hw->info.bytes_per_frame; =20 live -=3D proc; @@ -1068,8 +1073,8 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, si= ze_t live) } } =20 - if (hw->pcm_ops->run_buffer_out) { - hw->pcm_ops->run_buffer_out(hw); + if (k->run_buffer_out) { + k->run_buffer_out(hw); } =20 return clipped; @@ -1077,6 +1082,7 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, si= ze_t live) =20 static void audio_run_out(AudioMixengBackend *s) { + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(s); HWVoiceOut *hw =3D NULL; SWVoiceOut *sw; =20 @@ -1092,8 +1098,8 @@ static void audio_run_out(AudioMixengBackend *s) if (hw->pending_disable) { hw->enabled =3D false; hw->pending_disable =3D false; - if (hw->pcm_ops->enable_out) { - hw->pcm_ops->enable_out(hw, false); + if (k->enable_out) { + k->enable_out(hw, false); } } =20 @@ -1102,8 +1108,8 @@ static void audio_run_out(AudioMixengBackend *s) hw_free * sw->info.bytes_per_frame); } =20 - if (hw->pcm_ops->run_buffer_out) { - hw->pcm_ops->run_buffer_out(hw); + if (k->run_buffer_out) { + k->run_buffer_out(hw); } =20 continue; @@ -1146,8 +1152,8 @@ static void audio_run_out(AudioMixengBackend *s) #endif hw->enabled =3D false; hw->pending_disable =3D false; - if (hw->pcm_ops->enable_out) { - hw->pcm_ops->enable_out(hw, false); + if (k->enable_out) { + k->enable_out(hw, false); } for (sc =3D hw->cap_head.lh_first; sc; sc =3D sc->entries.le_n= ext) { sc->sw.active =3D false; @@ -1157,8 +1163,8 @@ static void audio_run_out(AudioMixengBackend *s) } =20 if (!live) { - if (hw->pcm_ops->run_buffer_out) { - hw->pcm_ops->run_buffer_out(hw); + if (k->run_buffer_out) { + k->run_buffer_out(hw); } continue; } @@ -1202,16 +1208,17 @@ static void audio_run_out(AudioMixengBackend *s) =20 static size_t audio_pcm_hw_run_in(HWVoiceIn *hw, size_t samples) { + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s); size_t conv =3D 0; =20 - if (hw->pcm_ops->run_buffer_in) { - hw->pcm_ops->run_buffer_in(hw); + if (k->run_buffer_in) { + k->run_buffer_in(hw); } =20 while (samples) { size_t proc; size_t size =3D samples * hw->info.bytes_per_frame; - void *buf =3D hw->pcm_ops->get_buffer_in(hw, &size); + void *buf =3D k->get_buffer_in(hw, &size); =20 assert(size % hw->info.bytes_per_frame =3D=3D 0); if (size =3D=3D 0) { @@ -1222,7 +1229,7 @@ static size_t audio_pcm_hw_run_in(HWVoiceIn *hw, size= _t samples) =20 samples -=3D proc; conv +=3D proc; - hw->pcm_ops->put_buffer_in(hw, buf, proc * hw->info.bytes_per_fram= e); + k->put_buffer_in(hw, buf, proc * hw->info.bytes_per_frame); } =20 return conv; @@ -1367,6 +1374,8 @@ void audio_run(AudioMixengBackend *s, const char *msg) =20 void audio_generic_run_buffer_in(HWVoiceIn *hw) { + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s); + if (unlikely(!hw->buf_emul)) { hw->size_emul =3D hw->samples * hw->info.bytes_per_frame; hw->buf_emul =3D g_malloc(hw->size_emul); @@ -1376,8 +1385,7 @@ void audio_generic_run_buffer_in(HWVoiceIn *hw) while (hw->pending_emul < hw->size_emul) { size_t read_len =3D MIN(hw->size_emul - hw->pos_emul, hw->size_emul - hw->pending_emul); - size_t read =3D hw->pcm_ops->read(hw, hw->buf_emul + hw->pos_emul, - read_len); + size_t read =3D k->read(hw, hw->buf_emul + hw->pos_emul, read_len); hw->pending_emul +=3D read; hw->pos_emul =3D (hw->pos_emul + read) % hw->size_emul; if (read < read_len) { @@ -1415,6 +1423,8 @@ size_t audio_generic_buffer_get_free(HWVoiceOut *hw) =20 void audio_generic_run_buffer_out(HWVoiceOut *hw) { + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s); + while (hw->pending_emul) { size_t write_len, written, start; =20 @@ -1423,7 +1433,7 @@ void audio_generic_run_buffer_out(HWVoiceOut *hw) =20 write_len =3D MIN(hw->pending_emul, hw->size_emul - start); =20 - written =3D hw->pcm_ops->write(hw, hw->buf_emul + start, write_len= ); + written =3D k->write(hw, hw->buf_emul + start, write_len); hw->pending_emul -=3D written; =20 if (written < write_len) { @@ -1458,10 +1468,11 @@ size_t audio_generic_put_buffer_out(HWVoiceOut *hw,= void *buf, size_t size) =20 size_t audio_generic_write(HWVoiceOut *hw, void *buf, size_t size) { + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s); size_t total =3D 0; =20 - if (hw->pcm_ops->buffer_get_free) { - size_t free =3D hw->pcm_ops->buffer_get_free(hw); + if (k->buffer_get_free) { + size_t free =3D k->buffer_get_free(hw); =20 size =3D MIN(size, free); } @@ -1469,7 +1480,7 @@ size_t audio_generic_write(HWVoiceOut *hw, void *buf,= size_t size) while (total < size) { size_t dst_size =3D size - total; size_t copy_size, proc; - void *dst =3D hw->pcm_ops->get_buffer_out(hw, &dst_size); + void *dst =3D k->get_buffer_out(hw, &dst_size); =20 if (dst_size =3D=3D 0) { break; @@ -1479,7 +1490,7 @@ size_t audio_generic_write(HWVoiceOut *hw, void *buf,= size_t size) if (dst) { memcpy(dst, (char *)buf + total, copy_size); } - proc =3D hw->pcm_ops->put_buffer_out(hw, dst, copy_size); + proc =3D k->put_buffer_out(hw, dst, copy_size); total +=3D proc; =20 if (proc =3D=3D 0 || proc < copy_size) { @@ -1492,22 +1503,23 @@ size_t audio_generic_write(HWVoiceOut *hw, void *bu= f, size_t size) =20 size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size) { + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s); size_t total =3D 0; =20 - if (hw->pcm_ops->run_buffer_in) { - hw->pcm_ops->run_buffer_in(hw); + if (k->run_buffer_in) { + k->run_buffer_in(hw); } =20 while (total < size) { size_t src_size =3D size - total; - void *src =3D hw->pcm_ops->get_buffer_in(hw, &src_size); + void *src =3D k->get_buffer_in(hw, &src_size); =20 if (src_size =3D=3D 0) { break; } =20 memcpy((char *)buf + total, src, src_size); - hw->pcm_ops->put_buffer_in(hw, src, src_size); + k->put_buffer_in(hw, src, src_size); total +=3D src_size; } =20 @@ -1521,13 +1533,13 @@ static bool audio_mixeng_backend_realize(AudioBacke= nd *abe, AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(be); =20 be->dev =3D dev; - if (!k->pcm_ops->get_buffer_in) { - k->pcm_ops->get_buffer_in =3D audio_generic_get_buffer_in; - k->pcm_ops->put_buffer_in =3D audio_generic_put_buffer_in; + if (!k->get_buffer_in) { + k->get_buffer_in =3D audio_generic_get_buffer_in; + k->put_buffer_in =3D audio_generic_put_buffer_in; } - if (!k->pcm_ops->get_buffer_out) { - k->pcm_ops->get_buffer_out =3D audio_generic_get_buffer_out; - k->pcm_ops->put_buffer_out =3D audio_generic_put_buffer_out; + if (!k->get_buffer_out) { + k->get_buffer_out =3D audio_generic_get_buffer_out; + k->put_buffer_out =3D audio_generic_put_buffer_out; } =20 audio_init_nb_voices_out(be, k, 1); @@ -1546,18 +1558,19 @@ static void audio_vm_change_state_handler (void *op= aque, bool running, RunState state) { AudioMixengBackend *s =3D opaque; + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(s); HWVoiceOut *hwo =3D NULL; HWVoiceIn *hwi =3D NULL; =20 while ((hwo =3D audio_pcm_hw_find_any_enabled_out(s, hwo))) { - if (hwo->pcm_ops->enable_out) { - hwo->pcm_ops->enable_out(hwo, running); + if (k->enable_out) { + k->enable_out(hwo, running); } } =20 while ((hwi =3D audio_pcm_hw_find_any_enabled_in(s, hwi))) { - if (hwi->pcm_ops->enable_in) { - hwi->pcm_ops->enable_in(hwi, running); + if (k->enable_in) { + k->enable_in(hwi, running); } } audio_reset_timer (s); @@ -1627,16 +1640,17 @@ static void audio_mixeng_backend_init(Object *obj) static void audio_mixeng_backend_finalize(Object *obj) { AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(obj); + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(s); HWVoiceOut *hwo, *hwon; HWVoiceIn *hwi, *hwin; =20 QLIST_FOREACH_SAFE(hwo, &s->hw_head_out, entries, hwon) { SWVoiceCap *sc; =20 - if (hwo->enabled && hwo->pcm_ops->enable_out) { - hwo->pcm_ops->enable_out(hwo, false); + if (hwo->enabled && k->enable_out) { + k->enable_out(hwo, false); } - hwo->pcm_ops->fini_out (hwo); + k->fini_out(hwo); =20 for (sc =3D hwo->cap_head.lh_first; sc; sc =3D sc->entries.le_next= ) { CaptureVoiceOut *cap =3D sc->cap; @@ -1650,10 +1664,10 @@ static void audio_mixeng_backend_finalize(Object *o= bj) } =20 QLIST_FOREACH_SAFE(hwi, &s->hw_head_in, entries, hwin) { - if (hwi->enabled && hwi->pcm_ops->enable_in) { - hwi->pcm_ops->enable_in(hwi, false); + if (hwi->enabled && k->enable_in) { + k->enable_in(hwi, false); } - hwi->pcm_ops->fini_in (hwi); + k->fini_in(hwi); QLIST_REMOVE(hwi, entries); } =20 @@ -1694,8 +1708,6 @@ static const VMStateDescription vmstate_audio =3D { } }; =20 -static struct audio_pcm_ops capture_pcm_ops; - static CaptureVoiceOut *audio_mixeng_backend_add_capture( AudioBackend *be, struct audsettings *as, @@ -1736,7 +1748,6 @@ static CaptureVoiceOut *audio_mixeng_backend_add_capt= ure( =20 hw =3D &cap->hw; hw->s =3D s; - hw->pcm_ops =3D &capture_pcm_ops; QLIST_INIT (&hw->sw_head); QLIST_INIT (&cap->cb_head); =20 @@ -1817,14 +1828,15 @@ static void audio_mixeng_backend_set_volume_out(Aud= ioBackend *be, SWVoiceOut *sw { if (sw) { HWVoiceOut *hw =3D sw->hw; + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->= s); =20 sw->vol.mute =3D vol->mute; sw->vol.l =3D nominal_volume.l * vol->vol[0] / 255; sw->vol.r =3D nominal_volume.l * vol->vol[vol->channels > 1 ? 1 : = 0] / 255; =20 - if (hw->pcm_ops->volume_out) { - hw->pcm_ops->volume_out(hw, vol); + if (k->volume_out) { + k->volume_out(hw, vol); } } } @@ -1834,14 +1846,15 @@ static void audio_mixeng_backend_set_volume_in(Audi= oBackend *be, SWVoiceIn *sw, { if (sw) { HWVoiceIn *hw =3D sw->hw; + AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->= s); =20 sw->vol.mute =3D vol->mute; sw->vol.l =3D nominal_volume.l * vol->vol[0] / 255; sw->vol.r =3D nominal_volume.r * vol->vol[vol->channels > 1 ? 1 : = 0] / 255; =20 - if (hw->pcm_ops->volume_in) { - hw->pcm_ops->volume_in(hw, vol); + if (k->volume_in) { + k->volume_in(hw, vol); } } } diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 82e76c41f9f..d8e548bf469 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -691,23 +691,6 @@ dbus_audio_set_server(AudioBackend *s, return true; } =20 -static struct audio_pcm_ops dbus_pcm_ops =3D { - .init_out =3D dbus_init_out, - .fini_out =3D dbus_fini_out, - .write =3D audio_generic_write, - .get_buffer_out =3D dbus_get_buffer_out, - .put_buffer_out =3D dbus_put_buffer_out, - .enable_out =3D dbus_enable_out, - .volume_out =3D dbus_volume_out, - - .init_in =3D dbus_init_in, - .fini_in =3D dbus_fini_in, - .read =3D dbus_read, - .run_buffer_in =3D audio_generic_run_buffer_in, - .enable_in =3D dbus_enable_in, - .volume_in =3D dbus_volume_in, -}; - static void audio_dbus_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -718,11 +701,25 @@ static void audio_dbus_class_init(ObjectClass *klass,= const void *data) b->realize =3D audio_dbus_realize; b->set_dbus_server =3D dbus_audio_set_server; k->name =3D "dbus"; - k->pcm_ops =3D &dbus_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(DBusVoiceOut); k->voice_size_in =3D sizeof(DBusVoiceIn); + + k->init_out =3D dbus_init_out; + k->fini_out =3D dbus_fini_out; + k->write =3D audio_generic_write; + k->get_buffer_out =3D dbus_get_buffer_out; + k->put_buffer_out =3D dbus_put_buffer_out; + k->enable_out =3D dbus_enable_out; + k->volume_out =3D dbus_volume_out; + + k->init_in =3D dbus_init_in; + k->fini_in =3D dbus_fini_in; + k->read =3D dbus_read; + k->run_buffer_in =3D audio_generic_run_buffer_in; + k->enable_in =3D dbus_enable_in; + k->volume_in =3D dbus_volume_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index e35b7fc233f..2c592c56663 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -667,23 +667,6 @@ audio_dsound_realize(AudioBackend *abe, Audiodev *dev,= Error **errp) return true; } =20 -static struct audio_pcm_ops dsound_pcm_ops =3D { - .init_out =3D dsound_init_out, - .fini_out =3D dsound_fini_out, - .write =3D audio_generic_write, - .buffer_get_free =3D dsound_buffer_get_free, - .get_buffer_out =3D dsound_get_buffer_out, - .put_buffer_out =3D dsound_put_buffer_out, - .enable_out =3D dsound_enable_out, - - .init_in =3D dsound_init_in, - .fini_in =3D dsound_fini_in, - .read =3D audio_generic_read, - .get_buffer_in =3D dsound_get_buffer_in, - .put_buffer_in =3D dsound_put_buffer_in, - .enable_in =3D dsound_enable_in, -}; - static void audio_dsound_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -693,11 +676,25 @@ static void audio_dsound_class_init(ObjectClass *klas= s, const void *data) =20 b->realize =3D audio_dsound_realize; k->name =3D "dsound"; - k->pcm_ops =3D &dsound_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D 1; k->voice_size_out =3D sizeof(DSoundVoiceOut); k->voice_size_in =3D sizeof(DSoundVoiceIn); + + k->init_out =3D dsound_init_out; + k->fini_out =3D dsound_fini_out; + k->write =3D audio_generic_write; + k->buffer_get_free =3D dsound_buffer_get_free; + k->get_buffer_out =3D dsound_get_buffer_out; + k->put_buffer_out =3D dsound_put_buffer_out; + k->enable_out =3D dsound_enable_out; + + k->init_in =3D dsound_init_in; + k->fini_in =3D dsound_fini_in; + k->read =3D audio_generic_read; + k->get_buffer_in =3D dsound_get_buffer_in; + k->put_buffer_in =3D dsound_put_buffer_in; + k->enable_in =3D dsound_enable_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 7caa2ddf43f..e415e94e6e6 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -652,21 +652,6 @@ static int qjack_thread_creator(jack_native_thread_t *= thread, } #endif =20 -static struct audio_pcm_ops jack_pcm_ops =3D { - .init_out =3D qjack_init_out, - .fini_out =3D qjack_fini_out, - .write =3D qjack_write, - .buffer_get_free =3D audio_generic_buffer_get_free, - .run_buffer_out =3D audio_generic_run_buffer_out, - .enable_out =3D qjack_enable_out, - - .init_in =3D qjack_init_in, - .fini_in =3D qjack_fini_in, - .read =3D qjack_read, - .run_buffer_in =3D audio_generic_run_buffer_in, - .enable_in =3D qjack_enable_in -}; - static void qjack_error(const char *msg) { dolog("E: %s\n", msg); @@ -682,11 +667,23 @@ static void audio_jack_class_init(ObjectClass *klass,= const void *data) AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 k->name =3D "jack"; - k->pcm_ops =3D &jack_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(QJackOut); k->voice_size_in =3D sizeof(QJackIn); + + k->init_out =3D qjack_init_out; + k->fini_out =3D qjack_fini_out; + k->write =3D qjack_write; + k->buffer_get_free =3D audio_generic_buffer_get_free; + k->run_buffer_out =3D audio_generic_run_buffer_out; + k->enable_out =3D qjack_enable_out; + + k->init_in =3D qjack_init_in; + k->fini_in =3D qjack_fini_in; + k->read =3D qjack_read; + k->run_buffer_in =3D audio_generic_run_buffer_in; + k->enable_in =3D qjack_enable_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/noaudio.c b/audio/noaudio.c index be2e2e684ce..e056813181a 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -110,31 +110,28 @@ static void no_enable_in(HWVoiceIn *hw, bool enable) } } =20 -static struct audio_pcm_ops no_pcm_ops =3D { - .init_out =3D no_init_out, - .fini_out =3D no_fini_out, - .write =3D no_write, - .buffer_get_free =3D audio_generic_buffer_get_free, - .run_buffer_out =3D audio_generic_run_buffer_out, - .enable_out =3D no_enable_out, - - .init_in =3D no_init_in, - .fini_in =3D no_fini_in, - .read =3D no_read, - .run_buffer_in =3D audio_generic_run_buffer_in, - .enable_in =3D no_enable_in -}; - static void audio_none_class_init(ObjectClass *klass, const void *data) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 k->name =3D "none"; - k->pcm_ops =3D &no_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(NoVoiceOut); k->voice_size_in =3D sizeof(NoVoiceIn); + + k->init_out =3D no_init_out; + k->fini_out =3D no_fini_out; + k->write =3D no_write; + k->buffer_get_free =3D audio_generic_buffer_get_free; + k->run_buffer_out =3D audio_generic_run_buffer_out; + k->enable_out =3D no_enable_out; + + k->init_in =3D no_init_in; + k->fini_in =3D no_fini_in; + k->read =3D no_read; + k->run_buffer_in =3D audio_generic_run_buffer_in; + k->enable_in =3D no_enable_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 0ad974e20cc..d12c65dd0d7 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -755,23 +755,6 @@ audio_oss_realize(AudioBackend *abe, Audiodev *dev, Er= ror **errp) return audio_oss_parent_class->realize(abe, dev, errp); } =20 -static struct audio_pcm_ops oss_pcm_ops =3D { - .init_out =3D oss_init_out, - .fini_out =3D oss_fini_out, - .write =3D oss_write, - .buffer_get_free =3D oss_buffer_get_free, - .run_buffer_out =3D oss_run_buffer_out, - .get_buffer_out =3D oss_get_buffer_out, - .put_buffer_out =3D oss_put_buffer_out, - .enable_out =3D oss_enable_out, - - .init_in =3D oss_init_in, - .fini_in =3D oss_fini_in, - .read =3D oss_read, - .run_buffer_in =3D audio_generic_run_buffer_in, - .enable_in =3D oss_enable_in -}; - static void audio_oss_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -781,11 +764,25 @@ static void audio_oss_class_init(ObjectClass *klass, = const void *data) =20 b->realize =3D audio_oss_realize; k->name =3D "oss"; - k->pcm_ops =3D &oss_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(OSSVoiceOut); k->voice_size_in =3D sizeof(OSSVoiceIn); + + k->init_out =3D oss_init_out; + k->fini_out =3D oss_fini_out; + k->write =3D oss_write; + k->buffer_get_free =3D oss_buffer_get_free; + k->run_buffer_out =3D oss_run_buffer_out; + k->get_buffer_out =3D oss_get_buffer_out; + k->put_buffer_out =3D oss_put_buffer_out; + k->enable_out =3D oss_enable_out; + + k->init_in =3D oss_init_in; + k->fini_in =3D oss_fini_in; + k->read =3D oss_read; + k->run_buffer_in =3D audio_generic_run_buffer_in; + k->enable_in =3D oss_enable_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/paaudio.c b/audio/paaudio.c index 5758050cb55..b7826402e12 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -913,23 +913,6 @@ static void audio_pa_finalize(Object *obj) } } =20 -static struct audio_pcm_ops qpa_pcm_ops =3D { - .init_out =3D qpa_init_out, - .fini_out =3D qpa_fini_out, - .write =3D qpa_write, - .buffer_get_free =3D qpa_buffer_get_free, - .get_buffer_out =3D qpa_get_buffer_out, - .put_buffer_out =3D qpa_put_buffer_out, - .volume_out =3D qpa_volume_out, - - .init_in =3D qpa_init_in, - .fini_in =3D qpa_fini_in, - .read =3D qpa_read, - .get_buffer_in =3D qpa_get_buffer_in, - .put_buffer_in =3D qpa_put_buffer_in, - .volume_in =3D qpa_volume_in -}; - static void audio_pa_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -939,11 +922,25 @@ static void audio_pa_class_init(ObjectClass *klass, c= onst void *data) =20 b->realize =3D audio_pa_realize; k->name =3D "pa"; - k->pcm_ops =3D &qpa_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(PAVoiceOut); k->voice_size_in =3D sizeof(PAVoiceIn); + + k->init_out =3D qpa_init_out; + k->fini_out =3D qpa_fini_out; + k->write =3D qpa_write; + k->buffer_get_free =3D qpa_buffer_get_free; + k->get_buffer_out =3D qpa_get_buffer_out; + k->put_buffer_out =3D qpa_put_buffer_out; + k->volume_out =3D qpa_volume_out; + + k->init_in =3D qpa_init_in; + k->fini_in =3D qpa_fini_in; + k->read =3D qpa_read; + k->get_buffer_in =3D qpa_get_buffer_in; + k->put_buffer_in =3D qpa_put_buffer_in; + k->volume_in =3D qpa_volume_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/pwaudio.c b/audio/pwaudio.c index f7f7dfbe0ad..7a009a94f3a 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -822,23 +822,6 @@ audio_pw_finalize(Object *obj) g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy); } =20 -static struct audio_pcm_ops qpw_pcm_ops =3D { - .init_out =3D qpw_init_out, - .fini_out =3D qpw_fini_out, - .write =3D qpw_write, - .buffer_get_free =3D qpw_buffer_get_free, - .run_buffer_out =3D audio_generic_run_buffer_out, - .enable_out =3D qpw_enable_out, - .volume_out =3D qpw_volume_out, - .volume_in =3D qpw_volume_in, - - .init_in =3D qpw_init_in, - .fini_in =3D qpw_fini_in, - .read =3D qpw_read, - .run_buffer_in =3D audio_generic_run_buffer_in, - .enable_in =3D qpw_enable_in -}; - static void audio_pw_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -848,11 +831,25 @@ static void audio_pw_class_init(ObjectClass *klass, c= onst void *data) =20 b->realize =3D audio_pw_realize; k->name =3D "pipewire"; - k->pcm_ops =3D &qpw_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(PWVoiceOut); k->voice_size_in =3D sizeof(PWVoiceIn); + + k->init_out =3D qpw_init_out; + k->fini_out =3D qpw_fini_out; + k->write =3D qpw_write; + k->buffer_get_free =3D qpw_buffer_get_free; + k->run_buffer_out =3D audio_generic_run_buffer_out; + k->enable_out =3D qpw_enable_out; + k->volume_out =3D qpw_volume_out; + + k->init_in =3D qpw_init_in; + k->fini_in =3D qpw_fini_in; + k->read =3D qpw_read; + k->run_buffer_in =3D audio_generic_run_buffer_in; + k->enable_in =3D qpw_enable_in; + k->volume_in =3D qpw_volume_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 62f7ac8d76b..d974d7eac46 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -468,29 +468,6 @@ static void audio_sdl_finalize(Object *obj) SDL_QuitSubSystem(SDL_INIT_AUDIO); } =20 -static struct audio_pcm_ops sdl_pcm_ops =3D { - .init_out =3D sdl_init_out, - .fini_out =3D sdl_fini_out, - /* wrapper for audio_generic_write */ - .write =3D sdl_write, - /* wrapper for audio_generic_buffer_get_free */ - .buffer_get_free =3D sdl_buffer_get_free, - /* wrapper for audio_generic_get_buffer_out */ - .get_buffer_out =3D sdl_get_buffer_out, - /* wrapper for audio_generic_put_buffer_out */ - .put_buffer_out =3D sdl_put_buffer_out, - .enable_out =3D sdl_enable_out, - .init_in =3D sdl_init_in, - .fini_in =3D sdl_fini_in, - /* wrapper for audio_generic_read */ - .read =3D sdl_read, - /* wrapper for audio_generic_get_buffer_in */ - .get_buffer_in =3D sdl_get_buffer_in, - /* wrapper for audio_generic_put_buffer_in */ - .put_buffer_in =3D sdl_put_buffer_in, - .enable_in =3D sdl_enable_in, -}; - static void audio_sdl_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -500,11 +477,32 @@ static void audio_sdl_class_init(ObjectClass *klass, = const void *data) =20 b->realize =3D audio_sdl_realize; k->name =3D "sdl"; - k->pcm_ops =3D &sdl_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(SDLVoiceOut); k->voice_size_in =3D sizeof(SDLVoiceIn); + + k->init_out =3D sdl_init_out; + k->fini_out =3D sdl_fini_out; + /* wrapper for audio_generic_write */ + k->write =3D sdl_write; + /* wrapper for audio_generic_buffer_get_free */ + k->buffer_get_free =3D sdl_buffer_get_free; + /* wrapper for audio_generic_get_buffer_out */ + k->get_buffer_out =3D sdl_get_buffer_out; + /* wrapper for audio_generic_put_buffer_out */ + k->put_buffer_out =3D sdl_put_buffer_out; + k->enable_out =3D sdl_enable_out; + + k->init_in =3D sdl_init_in; + k->fini_in =3D sdl_fini_in; + /* wrapper for audio_generic_read */ + k->read =3D sdl_read; + /* wrapper for audio_generic_get_buffer_in */ + k->get_buffer_in =3D sdl_get_buffer_in; + /* wrapper for audio_generic_put_buffer_in */ + k->put_buffer_in =3D sdl_put_buffer_in; + k->enable_in =3D sdl_enable_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 5cd6250775b..21f43836fd1 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -527,32 +527,30 @@ static void sndio_fini_in(HWVoiceIn *hw) sndio_fini(self); } =20 -static struct audio_pcm_ops sndio_pcm_ops =3D { - .init_out =3D sndio_init_out, - .fini_out =3D sndio_fini_out, - .enable_out =3D sndio_enable_out, - .write =3D audio_generic_write, - .buffer_get_free =3D sndio_buffer_get_free, - .get_buffer_out =3D sndio_get_buffer_out, - .put_buffer_out =3D sndio_put_buffer_out, - .init_in =3D sndio_init_in, - .fini_in =3D sndio_fini_in, - .read =3D audio_generic_read, - .enable_in =3D sndio_enable_in, - .get_buffer_in =3D sndio_get_buffer_in, - .put_buffer_in =3D sndio_put_buffer_in, -}; - static void audio_sndio_class_init(ObjectClass *klass, const void *data) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 k->name =3D "sndio"; - k->pcm_ops =3D &sndio_pcm_ops; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(SndioVoice); k->voice_size_in =3D sizeof(SndioVoice); + + k->init_out =3D sndio_init_out; + k->fini_out =3D sndio_fini_out; + k->write =3D audio_generic_write; + k->buffer_get_free =3D sndio_buffer_get_free; + k->get_buffer_out =3D sndio_get_buffer_out; + k->put_buffer_out =3D sndio_put_buffer_out; + k->enable_out =3D sndio_enable_out; + + k->init_in =3D sndio_init_in; + k->fini_in =3D sndio_fini_in; + k->read =3D audio_generic_read; + k->get_buffer_in =3D sndio_get_buffer_in; + k->put_buffer_in =3D sndio_put_buffer_in; + k->enable_in =3D sndio_enable_in; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 995e0f6faa3..0d188e974df 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -296,29 +296,6 @@ static void line_in_volume(HWVoiceIn *hw, Volume *vol) } #endif =20 -static struct audio_pcm_ops audio_callbacks =3D { - .init_out =3D line_out_init, - .fini_out =3D line_out_fini, - .write =3D audio_generic_write, - .buffer_get_free =3D line_out_get_free, - .get_buffer_out =3D line_out_get_buffer, - .put_buffer_out =3D line_out_put_buffer, - .enable_out =3D line_out_enable, -#if (SPICE_INTERFACE_PLAYBACK_MAJOR >=3D 1) && \ - (SPICE_INTERFACE_PLAYBACK_MINOR >=3D 2) - .volume_out =3D line_out_volume, -#endif - - .init_in =3D line_in_init, - .fini_in =3D line_in_fini, - .read =3D line_in_read, - .run_buffer_in =3D audio_generic_run_buffer_in, - .enable_in =3D line_in_enable, -#if ((SPICE_INTERFACE_RECORD_MAJOR >=3D 2) && (SPICE_INTERFACE_RECORD_MINO= R >=3D 2)) - .volume_in =3D line_in_volume, -#endif -}; - static void audio_spice_class_init(ObjectClass *klass, const void *data) { AudioBackendClass *b =3D AUDIO_BACKEND_CLASS(klass); @@ -328,11 +305,31 @@ static void audio_spice_class_init(ObjectClass *klass= , const void *data) =20 b->realize =3D spice_audio_realize; k->name =3D "spice"; - k->pcm_ops =3D &audio_callbacks; k->max_voices_out =3D 1; k->max_voices_in =3D 1; k->voice_size_out =3D sizeof(SpiceVoiceOut); k->voice_size_in =3D sizeof(SpiceVoiceIn); + + k->init_out =3D line_out_init; + k->fini_out =3D line_out_fini; + k->write =3D audio_generic_write; + k->buffer_get_free =3D line_out_get_free; + k->get_buffer_out =3D line_out_get_buffer; + k->put_buffer_out =3D line_out_put_buffer; + k->enable_out =3D line_out_enable; +#if (SPICE_INTERFACE_PLAYBACK_MAJOR >=3D 1) && \ + (SPICE_INTERFACE_PLAYBACK_MINOR >=3D 2) + k->volume_out =3D line_out_volume; +#endif + + k->init_in =3D line_in_init; + k->fini_in =3D line_in_fini; + k->read =3D line_in_read; + k->run_buffer_in =3D audio_generic_run_buffer_in; + k->enable_in =3D line_in_enable; +#if ((SPICE_INTERFACE_RECORD_MAJOR >=3D 2) && (SPICE_INTERFACE_RECORD_MINO= R >=3D 2)) + k->volume_in =3D line_in_volume; +#endif } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 153e50fa0be..ade8fd1d8c3 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -190,25 +190,22 @@ static void wav_enable_out(HWVoiceOut *hw, bool enabl= e) } } =20 -static struct audio_pcm_ops wav_pcm_ops =3D { - .init_out =3D wav_init_out, - .fini_out =3D wav_fini_out, - .write =3D wav_write_out, - .buffer_get_free =3D audio_generic_buffer_get_free, - .run_buffer_out =3D audio_generic_run_buffer_out, - .enable_out =3D wav_enable_out, -}; - static void audio_wav_class_init(ObjectClass *klass, const void *data) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 k->name =3D "wav"; - k->pcm_ops =3D &wav_pcm_ops; k->max_voices_out =3D 1; k->max_voices_in =3D 0; k->voice_size_out =3D sizeof(WAVVoiceOut); k->voice_size_in =3D 0; + + k->init_out =3D wav_init_out; + k->fini_out =3D wav_fini_out; + k->write =3D wav_write_out; + k->buffer_get_free =3D audio_generic_buffer_get_free; + k->run_buffer_out =3D audio_generic_run_buffer_out; + k->enable_out =3D wav_enable_out; } =20 static const TypeInfo audio_types[] =3D { diff --git a/audio/coreaudio.m b/audio/coreaudio.m index e9274976f94..561c08f47c1 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -646,30 +646,27 @@ static void coreaudio_enable_out(HWVoiceOut *hw, bool= enable) update_device_playback_state(core); } =20 -static struct audio_pcm_ops coreaudio_pcm_ops =3D { - .init_out =3D coreaudio_init_out, - .fini_out =3D coreaudio_fini_out, - /* wrapper for audio_generic_write */ - .write =3D coreaudio_write, - /* wrapper for audio_generic_buffer_get_free */ - .buffer_get_free =3D coreaudio_buffer_get_free, - /* wrapper for audio_generic_get_buffer_out */ - .get_buffer_out =3D coreaudio_get_buffer_out, - /* wrapper for audio_generic_put_buffer_out */ - .put_buffer_out =3D coreaudio_put_buffer_out, - .enable_out =3D coreaudio_enable_out -}; - static void audio_coreaudio_class_init(ObjectClass *klass, const void *dat= a) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 k->name =3D "coreaudio"; - k->pcm_ops =3D &coreaudio_pcm_ops; k->max_voices_out =3D 1; k->max_voices_in =3D 0; k->voice_size_out =3D sizeof(coreaudioVoiceOut); k->voice_size_in =3D 0; + + k->init_out =3D coreaudio_init_out; + k->fini_out =3D coreaudio_fini_out; + /* wrapper for audio_generic_write */ + k->write =3D coreaudio_write; + /* wrapper for audio_generic_buffer_get_free */ + k->buffer_get_free =3D coreaudio_buffer_get_free; + /* wrapper for audio_generic_get_buffer_out */ + k->get_buffer_out =3D coreaudio_get_buffer_out; + /* wrapper for audio_generic_put_buffer_out */ + k->put_buffer_out =3D coreaudio_put_buffer_out; + k->enable_out =3D coreaudio_enable_out; } =20 static const TypeInfo audio_types[] =3D { --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242066; cv=none; d=zohomail.com; s=zohoarc; b=A1ejLSs4jckIMl13rV+BvG7dPWzFLV280SXrMzcv/ZigZCkpWqW5RR35nF461lcYeIbAxiAlIqJ0Zdw5sN5yg3egRThz6VnR1Edw9/0F0CoMTwmdDJKJag8qIqv/xt/s/fo1VmFx9y3ubAH2RqTc/QUGYtrQb+8CByvsUsMKIic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242066; h=Content-Type: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=YN4DJG0Py/cRgpapumSpUdL2yVxH+gWGCGJxHSN+2zE=; b=ishgz4mORrZlSK10fVE1J6AAEK2jlR+xKQ+9EZf9XhkcZmLMIe0UW0ekkLzP9olQhKDEJC8IlPHf4+VI61hxX+5TWiDyYjyeDQnFHtIR+GKI1Rwwz+K1bL7lYuo1KIu+QiOoDREWA911A0o9fDswiRHiLj4LnhBLPZw3oOzHUbw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242066861164.37499175490325; Mon, 16 Feb 2026 03:41:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfR-00078N-PL; Mon, 16 Feb 2026 06:21:29 -0500 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 1vrwcc-0006rw-Ot for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcY-0008FY-Fy for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:32 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-4Mdc60m7N4qGHae_LRbnYA-1; Mon, 16 Feb 2026 06:18:24 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 14DB918003F5; Mon, 16 Feb 2026 11:18:22 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CACD719560AD; Mon, 16 Feb 2026 11:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YN4DJG0Py/cRgpapumSpUdL2yVxH+gWGCGJxHSN+2zE=; b=DwePrjy01C/PcMXtUg2VqyWV8sGTQDoiihw9zElUNYc1jCW7F1B0ZVDB47rIdQWJnEsd8r xnxiR/dhFxkvaUYBStkTKQCPR+IiqBD4I10rvxEWYZyl4GyrtCetvy3jPmddVBfbRoJsbj 3B6/zZ0385dY6FR9gmrSd+inPPpcZqc= X-MC-Unique: 4Mdc60m7N4qGHae_LRbnYA-1 X-Mimecast-MFC-AGG-ID: 4Mdc60m7N4qGHae_LRbnYA_1771240702 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:47 +0100 Subject: [PATCH 58/85] audio: constify some add_capture() arguments MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-58-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3590; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2WNGqq2fzWN/830O7ChQYzY+xt6tqSyBcFbWMnGS2jY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxR7PS+Liz5OHdTZgYxmGunCMhPI1sIv7R83 2gdpHSlZyWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5ZArEACI8UXpWfYt6lXaTLbKyhcdsQuvBXmmFu01HPZByLx2siMY2TlqLfT9E+TReN+4UcmrUGp k5v9RZqDTOAN3HTf05sN8RD5KuEjxFL47DU+lVLc725MD3Q18niFkz3pu5aQlZ/glEobjGuKYdl Cpij8jPqjfhY/g4mJaXcSerdEjAfJoop/jEtjicYw69SuWQuN3w1iDL8DbFpjzWwz2+CUrOyUCe AKxB4CYC6WDT1ZI3uoVfmf3zY/cVekQYhwbxugghgpbquUEFjlMTFfTYmcwwAhLsFuP7zD2Jcsp Avi4wOSyizumftwoYEpWqtqyi5F3grTAAgAIOtfs0A9ea8g+bB9H0QJj1lVlFN8c54lhZtcbYu1 eB+usxnAeMUL0TRWaIyCVF/yu4WBsW3cL4tpSqNhJcwTmVAOpr7kYv7e609DVa6oEBf++I9VPnE 9OaMYdPSqLMFU4pRhuyoXhhRNhWmwxTU52sHo/mZ9r5H9Ss91yaf0jm2jvUZrqBKKZDLI8yG1kX BPZ57e027Fc8wxeYqopZMnAYr+WcAdUipfXgAVSHMSrliOlL4QfsA0WDJuBTeeQXXNhWpOa2IEs hrGCYEil/B7jjCV7tQV7y61ODdazEjuyY6j/CApH1fHA6tTscMVyYjeASkIBpDiua2uAO7EEpNP XmY2cNhK9RL/GAQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242071027154100 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- include/qemu/audio-capture.h | 4 ++-- include/qemu/audio.h | 4 ++-- audio/audio-be.c | 4 ++-- audio/audio-mixeng-be.c | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/qemu/audio-capture.h b/include/qemu/audio-capture.h index d7998232243..f1319c90020 100644 --- a/include/qemu/audio-capture.h +++ b/include/qemu/audio-capture.h @@ -21,8 +21,8 @@ typedef struct CaptureState { =20 CaptureVoiceOut *audio_be_add_capture( AudioBackend *be, - struct audsettings *as, - struct audio_capture_ops *ops, + const struct audsettings *as, + const struct audio_capture_ops *ops, void *opaque); =20 void audio_be_del_capture( diff --git a/include/qemu/audio.h b/include/qemu/audio.h index dfe247ab8c4..b6b6ee9b560 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -96,8 +96,8 @@ typedef struct AudioBackendClass { size_t (*read)(AudioBackend *be, SWVoiceIn *sw, void *buf, size_t size= ); int (*get_buffer_size_out)(AudioBackend *be, SWVoiceOut *sw); CaptureVoiceOut *(*add_capture)(AudioBackend *be, - struct audsettings *as, - struct audio_capture_ops *ops, + const struct audsettings *as, + const struct audio_capture_ops *ops, void *cb_opaque); void (*del_capture)(AudioBackend *be, CaptureVoiceOut *cap, void *cb_o= paque); =20 diff --git a/audio/audio-be.c b/audio/audio-be.c index 8094a3196c7..ee065fa4968 100644 --- a/audio/audio-be.c +++ b/audio/audio-be.c @@ -182,8 +182,8 @@ void audio_be_set_volume_in(AudioBackend *be, SWVoiceIn= *sw, Volume *vol) =20 CaptureVoiceOut *audio_be_add_capture( AudioBackend *be, - struct audsettings *as, - struct audio_capture_ops *ops, + const struct audsettings *as, + const struct audio_capture_ops *ops, void *cb_opaque) { AudioBackendClass *klass =3D AUDIO_BACKEND_GET_CLASS(be); diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 17301ec80e7..d02cfe3c509 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -314,7 +314,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *i= nfo, void *buf, int len) * Capture */ static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioMixengBackend= *s, - struct audsettings= *as) + const struct audse= ttings *as) { CaptureVoiceOut *cap; =20 @@ -1585,8 +1585,8 @@ static const char *audio_mixeng_backend_get_id(AudioB= ackend *be) =20 static CaptureVoiceOut *audio_mixeng_backend_add_capture( AudioBackend *be, - struct audsettings *as, - struct audio_capture_ops *ops, + const struct audsettings *as, + const struct audio_capture_ops *ops, void *cb_opaque); =20 static void audio_mixeng_backend_del_capture( @@ -1710,8 +1710,8 @@ static const VMStateDescription vmstate_audio =3D { =20 static CaptureVoiceOut *audio_mixeng_backend_add_capture( AudioBackend *be, - struct audsettings *as, - struct audio_capture_ops *ops, + const struct audsettings *as, + const struct audio_capture_ops *ops, void *cb_opaque) { AudioMixengBackend *s =3D AUDIO_MIXENG_BACKEND(be); --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243724; cv=none; d=zohomail.com; s=zohoarc; b=G8ut3gyA5JnsGd6ruPMY8bsiVbzYwFwEv2MxFTASRl1mLII7020QM4Gtsh5TRoZwmNdajaKYlsMOsvE46d6sk4t2mUd0+ka8+FKw2aUy7e9xRAJfc8E/Ebsf3PaGkkIAj2QZWnW08A8yRldMmcu73JUQkLDC31nqTivpzPhDrDw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243724; h=Content-Type: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=eKkFMj950lDAUV4S1UFcLP4VDur4HUuRrCzi2Gmkt2k=; b=G6Lc7z+ONBvrqRcwSZUjljWG7dUo2HSziYN0FuHIZI2DqIhItvuKsLetReE6FUhxpZpa/zYtwKDrAsSLisPN01SARugFba2Ym9EplOlT0C3i60fOtUy9zIRsqqpwo4kWX5Wq5yhvWa7YrSTYoY+8dntIADnlQCbA6m3KLFl7NqU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243724355462.66253341281526; Mon, 16 Feb 2026 04:08:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfa-0008Ms-H1; Mon, 16 Feb 2026 06:21:38 -0500 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 1vrwcc-0006ry-PT for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcY-0008Fi-Gt for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:34 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-649-q2zDzTkyPTu0ssSat28GlQ-1; Mon, 16 Feb 2026 06:18:27 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9A1901955D8F; Mon, 16 Feb 2026 11:18:25 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 305A91955F43; Mon, 16 Feb 2026 11:18:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eKkFMj950lDAUV4S1UFcLP4VDur4HUuRrCzi2Gmkt2k=; b=Wg1Vdv1ECU/bV5PA+lUaMU86r9BjJczzfLGN/naVOqY2xv6M9UiNCMOeAlRly1dCsjvfgb 4prE1skTiau21qrA2kvsrWfePZklLlfGvTmaIFoqOps0DLqYdrePRsdYEUm+o+vB7UMt+L mTn8BhOOQnrQf0McdUZTdKLAQUGVndQ= X-MC-Unique: q2zDzTkyPTu0ssSat28GlQ-1 X-Mimecast-MFC-AGG-ID: q2zDzTkyPTu0ssSat28GlQ_1771240705 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:48 +0100 Subject: [PATCH 59/85] audio/alsa: replace custom logging with error_report and trace events MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-59-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=19789; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=CAWta9RWTinKoQTsIDLzifGCwuI25Ws2ra0+hdwsKPc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRy8HcvjIeoq6uibfYD0ekYfoi0Ybhg9tA2 oEup69+mFaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5UVbD/4k/XXp2RKQ+afpzp4JgmJ2HFnUGnM8yK2jeOabris8YGgenopoYRf4uwxC8r2x9IlpgoH /uHY6bnLOfPHHlYU2mY9uYzTIHvCWnS4TAAW9Me10fXwSR9ZxOYZIyMEnPcpaPXqGAvA2M5O9iN n224o2omAlaT320LbypUw3oRXgZFpkyW5YY55QyVHo7IA2SoeeD1R9b6IHM2jNTL0yhSCJqNzq0 nsmzjnUYNKF3PQ+m0XhpDywwZdt/qZ681lDLd2BbNT2IOFLls6z7DwxbPyeH5N9N7A3WGGGd4sB r5b58BUdDnvtwRaMX381bFeSvIcsttD/+nF9ISko2Cu6zkFV2PaVg+3HWprnbVlQTx3Z5f5eutk NN5637ID9GY2zJkx6Pos85qgsu/nIzTqZian4Nbh6hAEgJ8w5gAtJ76hzKyTErFaAFr2iqdExvn C9/ohb8PJC1snAzAImcA8jhtLWlByRQlxUe2QyFhLaoHDtgdyBlAGx63uIx+2TYi5jz4h9zNw/x ONcHxsjOAzPt65bmEId9Jr/A6Y91IaK+JGX28L6MEvCrY7zkumjgyh2aGlYNt8+cRibixfhXaUe oO5p8ygV1GXsHCdAiQAispXakUuR4p3WnmEPZTxLvzkJtRihbOeNYJR8t6Mte/bEiAvUmOucLdS 94voFGi2qnm6+NQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243726994154100 The ALSA audio backend uses its own logging infrastructure (AUD_log, AUD_vlog, dolog, ldebug) and a custom alsa_dump_info() debug helper. This approach is inconsistent with the rest of QEMU and makes the output harder to filter and configure. Replace the custom logging with standard QEMU error reporting: - Use error_report() / error_printf() for errors - Use warn_report() for non-fatal warnings (invalid formats, rejected parameters, unexpected states) - Convert ldebug() calls and alsa_dump_info() to trace events Remove DEBUG_ALSA and AUDIO_CAP macros which are no longer needed. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/alsaaudio.c | 169 +++++++++++++++++++++----------------------------= ---- audio/trace-events | 5 ++ 2 files changed, 72 insertions(+), 102 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 8f226b42612..889240ad0c7 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -26,17 +26,15 @@ #include #include "qemu/main-loop.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include "qemu/audio.h" #include "qom/object.h" #include "trace.h" =20 #pragma GCC diagnostic ignored "-Waddress" =20 -#define AUDIO_CAP "alsa" #include "audio_int.h" =20 -#define DEBUG_ALSA 0 - #define TYPE_AUDIO_ALSA "audio-alsa" OBJECT_DECLARE_SIMPLE_TYPE(AudioALSA, AUDIO_ALSA) =20 @@ -81,33 +79,29 @@ struct alsa_params_obt { snd_pcm_uframes_t samples; }; =20 -static void G_GNUC_PRINTF (2, 3) alsa_logerr (int err, const char *fmt, ..= .) +static void G_GNUC_PRINTF(2, 3) alsa_logerr(int err, const char *fmt, ...) { va_list ap; =20 - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", snd_strerror (err)); + error_printf("alsa: "); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); + error_printf(" Reason: %s", snd_strerror(err)); + error_printf("\n"); } =20 -static void G_GNUC_PRINTF (3, 4) alsa_logerr2 ( - int err, - const char *typ, - const char *fmt, - ... - ) +static void G_GNUC_PRINTF(3, 4) alsa_logerr2(int err, const char *typ, + const char *fmt, ...) { va_list ap; =20 - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", snd_strerror (err)); + error_printf("alsa: Could not initialize %s:", typ); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); + error_printf(" Reason: %s", snd_strerror(err)); + error_printf("\n"); } =20 static void alsa_fini_poll (struct pollhlp *hlp) @@ -130,7 +124,7 @@ static void alsa_anal_close1 (snd_pcm_t **handlep) { int err =3D snd_pcm_close (*handlep); if (err) { - alsa_logerr (err, "Failed to close PCM handle %p\n", *handlep); + alsa_logerr(err, "Failed to close PCM handle %p", *handlep); } *handlep =3D NULL; } @@ -145,7 +139,7 @@ static int alsa_recover (snd_pcm_t *handle) { int err =3D snd_pcm_prepare (handle); if (err < 0) { - alsa_logerr (err, "Failed to prepare handle %p\n", handle); + alsa_logerr(err, "Failed to prepare handle %p", handle); return -1; } return 0; @@ -155,7 +149,7 @@ static int alsa_resume (snd_pcm_t *handle) { int err =3D snd_pcm_resume (handle); if (err < 0) { - alsa_logerr (err, "Failed to resume handle %p\n", handle); + alsa_logerr(err, "Failed to resume handle %p", handle); return -1; } return 0; @@ -170,7 +164,7 @@ static void alsa_poll_handler (void *opaque) =20 count =3D poll (hlp->pfds, hlp->count, 0); if (count < 0) { - dolog ("alsa_poll_handler: poll %s\n", strerror (errno)); + warn_report("alsa_poll_handler: poll %s", strerror(errno)); return; } =20 @@ -183,7 +177,7 @@ static void alsa_poll_handler (void *opaque) err =3D snd_pcm_poll_descriptors_revents (hlp->handle, hlp->pfds, hlp->count, &revents); if (err < 0) { - alsa_logerr (err, "snd_pcm_poll_descriptors_revents"); + alsa_logerr(err, "snd_pcm_poll_descriptors_revents"); return; } =20 @@ -215,7 +209,7 @@ static void alsa_poll_handler (void *opaque) break; =20 default: - dolog ("Unexpected state %d\n", state); + warn_report("alsa: Unexpected state %d", state); } } =20 @@ -226,8 +220,8 @@ static int alsa_poll_helper (snd_pcm_t *handle, struct = pollhlp *hlp, int mask) =20 count =3D snd_pcm_poll_descriptors_count (handle); if (count <=3D 0) { - dolog ("Could not initialize poll mode\n" - "Invalid number of poll descriptors %d\n", count); + warn_report("alsa: Could not initialize poll mode: " + "Invalid number of poll descriptors %d", count); return -1; } =20 @@ -235,8 +229,7 @@ static int alsa_poll_helper (snd_pcm_t *handle, struct = pollhlp *hlp, int mask) =20 err =3D snd_pcm_poll_descriptors (handle, pfds, count); if (err < 0) { - alsa_logerr (err, "Could not initialize poll mode\n" - "Could not obtain poll descriptors\n"); + alsa_logerr(err, "Could not initialize poll mode: Could not obtain= poll descriptors"); g_free (pfds); return -1; } @@ -298,10 +291,7 @@ static snd_pcm_format_t aud_to_alsafmt(AudioFormat fmt= , bool big_endian) return big_endian ? SND_PCM_FORMAT_FLOAT_BE : SND_PCM_FORMAT_FLOAT= _LE; =20 default: - dolog ("Internal logic error: Bad audio format %d\n", fmt); -#ifdef DEBUG_AUDIO - abort (); -#endif + warn_report("alsa: Internal logic error: Bad audio format %d", fmt= ); return SND_PCM_FORMAT_U8; } } @@ -371,29 +361,13 @@ static int alsa_to_audfmt (snd_pcm_format_t alsafmt, = AudioFormat *fmt, break; =20 default: - dolog ("Unrecognized audio format %d\n", alsafmt); + warn_report("alsa: Unrecognized audio format %d", alsafmt); return -1; } =20 return 0; } =20 -static void alsa_dump_info (struct alsa_params_req *req, - struct alsa_params_obt *obt, - snd_pcm_format_t obtfmt, - AudiodevAlsaPerDirectionOptions *apdo) -{ - dolog("parameter | requested value | obtained value\n"); - dolog("format | %10d | %10d\n", req->fmt, obtfmt); - dolog("channels | %10d | %10d\n", - req->nchannels, obt->nchannels); - dolog("frequency | %10d | %10d\n", req->freq, obt->freq); - dolog("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n"); - dolog("requested: buffer len %" PRId32 " period len %" PRId32 "\n", - apdo->buffer_length, apdo->period_length); - dolog("obtained: samples %ld\n", obt->samples); -} - static void alsa_set_threshold (snd_pcm_t *handle, snd_pcm_uframes_t thres= hold) { int err; @@ -403,23 +377,22 @@ static void alsa_set_threshold (snd_pcm_t *handle, sn= d_pcm_uframes_t threshold) =20 err =3D snd_pcm_sw_params_current (handle, sw_params); if (err < 0) { - dolog ("Could not fully initialize DAC\n"); - alsa_logerr (err, "Failed to get current software parameters\n"); + error_report("alsa: Could not fully initialize DAC"); + alsa_logerr(err, "Failed to get current software parameters"); return; } =20 err =3D snd_pcm_sw_params_set_start_threshold (handle, sw_params, thre= shold); if (err < 0) { - dolog ("Could not fully initialize DAC\n"); - alsa_logerr (err, "Failed to set software threshold to %ld\n", - threshold); + error_report("alsa: Could not fully initialize DAC"); + alsa_logerr(err, "Failed to set software threshold to %ld", thresh= old); return; } =20 err =3D snd_pcm_sw_params (handle, sw_params); if (err < 0) { - dolog ("Could not fully initialize DAC\n"); - alsa_logerr (err, "Failed to set software parameters\n"); + error_report("alsa: Could not fully initialize DAC"); + alsa_logerr(err, "Failed to set software parameters"); return; } } @@ -451,13 +424,13 @@ static int alsa_open(bool in, struct alsa_params_req = *req, SND_PCM_NONBLOCK ); if (err < 0) { - alsa_logerr2 (err, typ, "Failed to open `%s':\n", pcm_name); + alsa_logerr2(err, typ, "Failed to open `%s'", pcm_name); return -1; } =20 err =3D snd_pcm_hw_params_any (handle, hw_params); if (err < 0) { - alsa_logerr2 (err, typ, "Failed to initialize hardware parameters\= n"); + alsa_logerr2(err, typ, "Failed to initialize hardware parameters"); goto err; } =20 @@ -467,18 +440,18 @@ static int alsa_open(bool in, struct alsa_params_req = *req, SND_PCM_ACCESS_RW_INTERLEAVED ); if (err < 0) { - alsa_logerr2 (err, typ, "Failed to set access type\n"); + alsa_logerr2(err, typ, "Failed to set access type"); goto err; } =20 err =3D snd_pcm_hw_params_set_format (handle, hw_params, req->fmt); if (err < 0) { - alsa_logerr2 (err, typ, "Failed to set format %d\n", req->fmt); + alsa_logerr2(err, typ, "Failed to set format %d", req->fmt); } =20 err =3D snd_pcm_hw_params_set_rate_near (handle, hw_params, &freq, 0); if (err < 0) { - alsa_logerr2 (err, typ, "Failed to set frequency %d\n", req->freq); + alsa_logerr2(err, typ, "Failed to set frequency %d", req->freq); goto err; } =20 @@ -488,8 +461,7 @@ static int alsa_open(bool in, struct alsa_params_req *r= eq, &nchannels ); if (err < 0) { - alsa_logerr2 (err, typ, "Failed to set number of channels %d\n", - req->nchannels); + alsa_logerr2(err, typ, "Failed to set number of channels %d", req-= >nchannels); goto err; } =20 @@ -501,14 +473,14 @@ static int alsa_open(bool in, struct alsa_params_req = *req, handle, hw_params, &btime, &dir); =20 if (err < 0) { - alsa_logerr2(err, typ, "Failed to set buffer time to %" PRId32= "\n", + alsa_logerr2(err, typ, "Failed to set buffer time to %" PRId32, apdo->buffer_length); goto err; } =20 if (apdo->has_buffer_length && btime !=3D apdo->buffer_length) { - dolog("Requested buffer time %" PRId32 - " was rejected, using %u\n", apdo->buffer_length, btime); + warn_report("alsa: Requested buffer time %" PRId32 " was rejec= ted, using %u", + apdo->buffer_length, btime); } } =20 @@ -520,43 +492,43 @@ static int alsa_open(bool in, struct alsa_params_req = *req, &dir); =20 if (err < 0) { - alsa_logerr2(err, typ, "Failed to set period time to %" PRId32= "\n", + alsa_logerr2(err, typ, "Failed to set period time to %" PRId32, apdo->period_length); goto err; } =20 if (apdo->has_period_length && ptime !=3D apdo->period_length) { - dolog("Requested period time %" PRId32 " was rejected, using %= d\n", - apdo->period_length, ptime); + warn_report("alsa: Requested period time %" PRId32 " was rejec= ted, using %d", + apdo->period_length, ptime); } } =20 err =3D snd_pcm_hw_params (handle, hw_params); if (err < 0) { - alsa_logerr2 (err, typ, "Failed to apply audio parameters\n"); + alsa_logerr2(err, typ, "Failed to apply audio parameters"); goto err; } =20 err =3D snd_pcm_hw_params_get_buffer_size (hw_params, &obt_buffer_size= ); if (err < 0) { - alsa_logerr2 (err, typ, "Failed to get buffer size\n"); + alsa_logerr2(err, typ, "Failed to get buffer size"); goto err; } =20 err =3D snd_pcm_hw_params_get_format (hw_params, &obtfmt); if (err < 0) { - alsa_logerr2 (err, typ, "Failed to get format\n"); + alsa_logerr2(err, typ, "Failed to get format"); goto err; } =20 if (alsa_to_audfmt (obtfmt, &obt->fmt, &obt->endianness)) { - dolog ("Invalid format was returned %d\n", obtfmt); + error_report("alsa: Invalid format was returned %d", obtfmt); goto err; } =20 err =3D snd_pcm_prepare (handle); if (err < 0) { - alsa_logerr2 (err, typ, "Could not prepare handle %p\n", handle); + alsa_logerr2(err, typ, "Could not prepare handle %p", handle); goto err; } =20 @@ -574,11 +546,9 @@ static int alsa_open(bool in, struct alsa_params_req *= req, =20 *handlep =3D handle; =20 - if (DEBUG_ALSA || obtfmt !=3D req->fmt || - obt->nchannels !=3D req->nchannels || obt->freq !=3D req->freq) { - dolog ("Audio parameters for %s\n", typ); - alsa_dump_info(req, obt, obtfmt, apdo); - } + trace_alsa_info_params(req->fmt, obtfmt, req->nchannels, obt->nchannel= s, + req->freq, obt->freq); + trace_alsa_info_samples(apdo->buffer_length, apdo->period_length, obt-= >samples); =20 return 0; =20 @@ -601,8 +571,7 @@ static size_t alsa_buffer_get_free(HWVoiceOut *hw) } } if (avail < 0) { - alsa_logerr(avail, - "Could not obtain number of available frames\n"); + alsa_logerr(avail, "Could not obtain number of available frame= s"); avail =3D 0; } } @@ -643,8 +612,7 @@ static size_t alsa_write(HWVoiceOut *hw, void *buf, siz= e_t len) =20 case -EPIPE: if (alsa_recover(alsa->handle)) { - alsa_logerr(written, "Failed to write %zu frames\n", - len_frames); + alsa_logerr(written, "Failed to write %zu frames", len= _frames); return pos; } trace_alsa_xrun_out(); @@ -656,8 +624,7 @@ static size_t alsa_write(HWVoiceOut *hw, void *buf, siz= e_t len) * recovery */ if (alsa_resume(alsa->handle)) { - alsa_logerr(written, "Failed to write %zu frames\n", - len_frames); + alsa_logerr(written, "Failed to write %zu frames", len= _frames); return pos; } trace_alsa_resume_out(); @@ -667,8 +634,7 @@ static size_t alsa_write(HWVoiceOut *hw, void *buf, siz= e_t len) return pos; =20 default: - alsa_logerr(written, "Failed to write %zu frames from %p\n= ", - len, src); + alsa_logerr(written, "Failed to write %zu frames from %p",= len_frames, src); return pos; } } @@ -687,7 +653,7 @@ static void alsa_fini_out (HWVoiceOut *hw) { ALSAVoiceOut *alsa =3D (ALSAVoiceOut *) hw; =20 - ldebug ("alsa_fini\n"); + trace_alsa_fini_out(); alsa_anal_close (&alsa->handle, &alsa->pollhlp); } =20 @@ -732,19 +698,19 @@ static int alsa_voice_ctl (snd_pcm_t *handle, const c= har *typ, int ctl) if (ctl =3D=3D VOICE_CTL_PAUSE) { err =3D snd_pcm_drop (handle); if (err < 0) { - alsa_logerr (err, "Could not stop %s\n", typ); + alsa_logerr(err, "Could not stop %s", typ); return -1; } } else { err =3D snd_pcm_prepare (handle); if (err < 0) { - alsa_logerr (err, "Could not prepare handle for %s\n", typ); + alsa_logerr(err, "Could not prepare handle for %s", typ); return -1; } if (ctl =3D=3D VOICE_CTL_START) { err =3D snd_pcm_start(handle); if (err < 0) { - alsa_logerr (err, "Could not start handle for %s\n", typ); + alsa_logerr(err, "Could not start handle for %s", typ); return -1; } } @@ -758,17 +724,17 @@ static void alsa_enable_out(HWVoiceOut *hw, bool enab= le) ALSAVoiceOut *alsa =3D (ALSAVoiceOut *) hw; AudiodevAlsaPerDirectionOptions *apdo =3D hw->s->dev->u.alsa.out; =20 + trace_alsa_enable_out(enable); + if (enable) { bool poll_mode =3D apdo->try_poll; =20 - ldebug("enabling voice\n"); if (poll_mode && alsa_poll_out(hw)) { poll_mode =3D 0; } hw->poll_mode =3D poll_mode; alsa_voice_ctl(alsa->handle, "playback", VOICE_CTL_PREPARE); } else { - ldebug("disabling voice\n"); if (hw->poll_mode) { hw->poll_mode =3D 0; alsa_fini_poll(&alsa->pollhlp); @@ -834,7 +800,7 @@ static size_t alsa_read(HWVoiceIn *hw, void *buf, size_= t len) =20 case -EPIPE: if (alsa_recover(alsa->handle)) { - alsa_logerr(nread, "Failed to read %zu frames\n", len); + alsa_logerr(nread, "Failed to read %zu frames", len); return pos; } trace_alsa_xrun_in(); @@ -844,8 +810,7 @@ static size_t alsa_read(HWVoiceIn *hw, void *buf, size_= t len) return pos; =20 default: - alsa_logerr(nread, "Failed to read %zu frames to %p\n", - len, dst); + alsa_logerr(nread, "Failed to read %zu frames to %p", len,= dst); return pos; } } @@ -862,10 +827,11 @@ static void alsa_enable_in(HWVoiceIn *hw, bool enable) ALSAVoiceIn *alsa =3D (ALSAVoiceIn *) hw; AudiodevAlsaPerDirectionOptions *apdo =3D hw->s->dev->u.alsa.in; =20 + trace_alsa_enable_in(enable); + if (enable) { bool poll_mode =3D apdo->try_poll; =20 - ldebug("enabling voice\n"); if (poll_mode && alsa_poll_in(hw)) { poll_mode =3D 0; } @@ -873,7 +839,6 @@ static void alsa_enable_in(HWVoiceIn *hw, bool enable) =20 alsa_voice_ctl(alsa->handle, "capture", VOICE_CTL_START); } else { - ldebug ("disabling voice\n"); if (hw->poll_mode) { hw->poll_mode =3D 0; alsa_fini_poll(&alsa->pollhlp); diff --git a/audio/trace-events b/audio/trace-events index f7f639d9605..737e3e60694 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -9,6 +9,11 @@ alsa_read_zero(long len) "Failed to read %ld frames (read = zero)" alsa_xrun_out(void) "Recovering from playback xrun" alsa_xrun_in(void) "Recovering from capture xrun" alsa_resume_out(void) "Resuming suspended output stream" +alsa_info_params(int req_fmt, int obt_fmt, int req_channels, int obt_chann= els, int req_freq, int obt_freq) "format %d->%d, channels %d->%d, frequency= %d->%d" +alsa_info_samples(int buffer_length, int period_length, long samples) "req= uested: buffer len %d, period len %d; obtained: %ld samples" +alsa_fini_out(void) "" +alsa_enable_out(bool enable) "enable=3D%d" +alsa_enable_in(bool enable) "enable=3D%d" =20 # ossaudio.c oss_version(int version) "OSS version =3D 0x%x" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244292; cv=none; d=zohomail.com; s=zohoarc; b=MFWQZA4Q0ARm5yMHwHhgJ4t+w4S3Q8p4yGvlNLegjJ55UNhrMvgNlv2ZVizA33lCtR8Vp6bPN0n+t1HGIogoyW6CSEhi6yJv6+g5t8M9hp9lHr02wJdFX30zQD7jOQsC0wrk9ffRH5OjSPW4fctjKKcONI21JeV/P22AQ/jR8ds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244292; h=Content-Type: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=imf3hzI7LKBfMTfzAqdoQfPRWfEP/D7PMD9pqFFwoX4=; b=CC+yfWYQFhmNemhp7sKmmxUArI5yOGdb9c3KXRqhfhdX0cc6xXIYmGG/hZXE5ssAUAV08yHPpF0lYg0/F3zBUPuaVw6Mu5hDzSFC4tOaFTP0NiWHPCwnNqvrHYhD6f0gMkgD6LV0zY07R+MgKRHnIWq5MX8Gh4YgeEfpaz32eRo= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244292335328.57849035702566; Mon, 16 Feb 2026 04:18:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfO-0006aR-C8; Mon, 16 Feb 2026 06:21:26 -0500 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 1vrwce-0006t4-Lt for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcc-0008Gb-Ha for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:36 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-647-kUpd9RqsO-iJeRoGm3Ma0w-1; Mon, 16 Feb 2026 06:18:30 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 83AB01955D8C; Mon, 16 Feb 2026 11:18:28 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7AB5618003F5; Mon, 16 Feb 2026 11:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=imf3hzI7LKBfMTfzAqdoQfPRWfEP/D7PMD9pqFFwoX4=; b=Z055ss6NJck6oBXnWE5f2b2h3EwPEuz6JQO9wslJ8aSsecY41RXOGJKrNlUTfybefXxoGe GKN8qyHixfnuRHrbeAeHx8UqNnLNkb0F5l/wUCR1yBakTFXGve40vTyQMpyFzkyHYpg6Xr qlCG7NGHnUhdfHd07ibrYvzZhddtkYE= X-MC-Unique: kUpd9RqsO-iJeRoGm3Ma0w-1 X-Mimecast-MFC-AGG-ID: kUpd9RqsO-iJeRoGm3Ma0w_1771240708 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:49 +0100 Subject: [PATCH 60/85] audio/coreaudio: replace custom logging with error_report MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-60-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=13433; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=m+PfI40oEtHkORC+s06hkAac6Itn0SlxZ9kz6+PeIgI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxR8X/TvnCVl+mCda3Iro5ShzHHVVEFfxXl3 WgWLRikONKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5d0VEACVPK67nF1fF8Nsi2ki/pm5LW/1WcGQ1Fun8hGoVWmFf7OlLXWBwMC1dvAjQi5V/oNd/vu /tSI8hcG4RAEPC6CPZy1hAqGcsCvSsduDGqPYUAnjmgLGPqxB3ywNjwS4koXKoAt8u05++Q7wwT oZi+633AX9bpJ5q4sn2pVNDZVry1yzeOTjbLeVoN+QuZId3oceNbgLEyIkyW/53jmAT81yGpUEQ 2t1hAvIVAp34GpwQfgCinHkC2ADe+Geta6GCbpTavfOjH6BOsQiyukct22hVU7kdrflaiON/Zab dCsG4DUCS7NowOVB8MIhni3TZbCw6b4zm72TVgE2biCiu/1K/5yFxUKTcDcAQyJZGykYQFYG2Wo 89ENOBDT9Wd0wgDzC2aPbdrjxj9RijbIN8FLV9mTzoITmyS2Q8zTgy5vovBTfhYKkR5zJvIn9ws 9ViKXIUJ7ONhlxyd5B3iSyzqTv5MWVu/YjVqmPFrOws4AIAZjMfXTx28H5WOjnCccQyqhQUfCId sTPNEzWevUWli3TynbdhxaxflIr4q/H70isdCqkQGAqn8cECAdr8wc9W4mFzPmlQDfVtL3VU3fU KOfRA8KLM+gjFQ6ZpP3pAfa+z3XMOzV56ix3jtEFTdpeufyIM3xfp4wQK6eELXNfBYAjC/dh4Rr 7lgAccHkUpm9+Kg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771244293818154100 The CoreAudio backend uses its own logging infrastructure (AUD_log, AUD_vlog, dolog) and the AUDIO_CAP macro. This approach is inconsistent with the rest of QEMU and makes the output harder to filter and configure. Replace the custom logging with standard QEMU error reporting: - Use error_report() / error_printf() for errors - Use warn_report() for non-fatal warnings (buffer frame size adjustments) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/coreaudio.m | 124 ++++++++++++++++++++++++++------------------------= ---- 1 file changed, 60 insertions(+), 64 deletions(-) diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 561c08f47c1..0c0e8583c89 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -28,10 +28,9 @@ =20 #include "qemu/main-loop.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include "qemu/audio.h" #include "qom/object.h" - -#define AUDIO_CAP "coreaudio" #include "audio_int.h" =20 #define TYPE_AUDIO_COREAUDIO "audio-coreaudio" @@ -157,7 +156,7 @@ static OSStatus coreaudio_get_isrunning(AudioDeviceID i= d, UInt32 *result) result); } =20 -static void coreaudio_logstatus (OSStatus status) +static void coreaudio_logstatus(OSStatus status) { const char *str =3D "BUG"; =20 @@ -207,70 +206,64 @@ static void coreaudio_logstatus (OSStatus status) break; =20 default: - AUD_log (AUDIO_CAP, "Reason: status code %" PRId32 "\n", (int32_t)= status); + error_printf(" Reason: status code %" PRId32, (int32_t)status); return; } =20 - AUD_log (AUDIO_CAP, "Reason: %s\n", str); + error_printf(" Reason: %s", str); } =20 -static void G_GNUC_PRINTF (2, 3) coreaudio_logerr ( - OSStatus status, - const char *fmt, - ... - ) +static void G_GNUC_PRINTF(2, 3) coreaudio_logerr(OSStatus status, + const char *fmt, ...) { va_list ap; =20 - va_start (ap, fmt); - AUD_log (AUDIO_CAP, fmt, ap); - va_end (ap); - - coreaudio_logstatus (status); + error_printf("coreaudio: "); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); + coreaudio_logstatus(status); + error_printf("\n"); } =20 -static void G_GNUC_PRINTF (3, 4) coreaudio_logerr2 ( - OSStatus status, - const char *typ, - const char *fmt, - ... - ) +static void G_GNUC_PRINTF(3, 4) coreaudio_logerr2(OSStatus status, + const char *typ, + const char *fmt, ...) { va_list ap; =20 - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - coreaudio_logstatus (status); + error_printf("coreaudio: Could not initialize %s: ", typ); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); + coreaudio_logstatus(status); + error_printf("\n"); } =20 #define coreaudio_playback_logerr(status, ...) \ coreaudio_logerr2(status, "playback", __VA_ARGS__) =20 -static int coreaudio_buf_lock (coreaudioVoiceOut *core, const char *fn_nam= e) +static int coreaudio_buf_lock(coreaudioVoiceOut *core, const char *fn_name) { int err; =20 - err =3D pthread_mutex_lock (&core->buf_mutex); + err =3D pthread_mutex_lock(&core->buf_mutex); if (err) { - dolog ("Could not lock voice for %s\nReason: %s\n", - fn_name, strerror (err)); + error_report("coreaudio: Could not lock voice for %s: %s", + fn_name, strerror(err)); return -1; } return 0; } =20 -static int coreaudio_buf_unlock (coreaudioVoiceOut *core, const char *fn_n= ame) +static int coreaudio_buf_unlock(coreaudioVoiceOut *core, const char *fn_na= me) { int err; =20 - err =3D pthread_mutex_unlock (&core->buf_mutex); + err =3D pthread_mutex_unlock(&core->buf_mutex); if (err) { - dolog ("Could not unlock voice for %s\nReason: %s\n", - fn_name, strerror (err)); + error_report("coreaudio: Could not unlock voice for %s: %s", + fn_name, strerror(err)); return -1; } return 0; @@ -378,12 +371,13 @@ static OSStatus init_out_device(coreaudioVoiceOut *co= re) =20 status =3D coreaudio_get_voice(&core->outputDeviceID); if (status !=3D kAudioHardwareNoError) { - coreaudio_playback_logerr (status, - "Could not get default output Device\n"= ); + coreaudio_playback_logerr(status, + "Could not get default output device"); return status; } if (core->outputDeviceID =3D=3D kAudioDeviceUnknown) { - dolog ("Could not initialize playback - Unknown Audiodevice\n"); + error_report("coreaudio: Could not initialize playback: " + "Unknown audio device"); return status; } =20 @@ -394,17 +388,19 @@ static OSStatus init_out_device(coreaudioVoiceOut *co= re) return 0; } if (status !=3D kAudioHardwareNoError) { - coreaudio_playback_logerr (status, - "Could not get device buffer frame ran= ge\n"); + coreaudio_playback_logerr(status, + "Could not get device buffer frame range= "); return status; } =20 if (frameRange.mMinimum > core->frameSizeSetting) { core->audioDevicePropertyBufferFrameSize =3D (UInt32) frameRange.m= Minimum; - dolog ("warning: Upsizing Buffer Frames to %f\n", frameRange.mMini= mum); + warn_report("coreaudio: Upsizing buffer frames to %f", + frameRange.mMinimum); } else if (frameRange.mMaximum < core->frameSizeSetting) { core->audioDevicePropertyBufferFrameSize =3D (UInt32) frameRange.m= Maximum; - dolog ("warning: Downsizing Buffer Frames to %f\n", frameRange.mMa= ximum); + warn_report("coreaudio: Downsizing buffer frames to %f", + frameRange.mMaximum); } else { core->audioDevicePropertyBufferFrameSize =3D core->frameSizeSettin= g; } @@ -416,9 +412,9 @@ static OSStatus init_out_device(coreaudioVoiceOut *core) return 0; } if (status !=3D kAudioHardwareNoError) { - coreaudio_playback_logerr (status, - "Could not set device buffer frame siz= e %" PRIu32 "\n", - (uint32_t)core->audioDevicePropertyBuf= ferFrameSize); + coreaudio_playback_logerr(status, + "Could not set device buffer frame size = %" PRIu32, + (uint32_t)core->audioDevicePropertyBuffe= rFrameSize); return status; } =20 @@ -429,8 +425,8 @@ static OSStatus init_out_device(coreaudioVoiceOut *core) return 0; } if (status !=3D kAudioHardwareNoError) { - coreaudio_playback_logerr (status, - "Could not get device buffer frame siz= e\n"); + coreaudio_playback_logerr(status, + "Could not get device buffer frame size"= ); return status; } core->hw.samples =3D core->bufferCount * core->audioDevicePropertyBuff= erFrameSize; @@ -442,9 +438,9 @@ static OSStatus init_out_device(coreaudioVoiceOut *core) return 0; } if (status !=3D kAudioHardwareNoError) { - coreaudio_playback_logerr (status, - "Could not set samplerate %lf\n", - streamBasicDescription.mSampleRate); + coreaudio_playback_logerr(status, + "Could not set samplerate %lf", + streamBasicDescription.mSampleRate); core->outputDeviceID =3D kAudioDeviceUnknown; return status; } @@ -468,7 +464,7 @@ static OSStatus init_out_device(coreaudioVoiceOut *core) return 0; } if (status !=3D kAudioHardwareNoError || core->ioprocid =3D=3D NULL) { - coreaudio_playback_logerr (status, "Could not set IOProc\n"); + coreaudio_playback_logerr(status, "Could not set IOProc"); core->outputDeviceID =3D kAudioDeviceUnknown; return status; } @@ -486,13 +482,13 @@ static void fini_out_device(coreaudioVoiceOut *core) if (status !=3D kAudioHardwareBadObjectError) { if (status !=3D kAudioHardwareNoError) { coreaudio_logerr(status, - "Could not determine whether Device is playin= g\n"); + "Could not determine whether device is playin= g"); } =20 if (isrunning) { status =3D AudioDeviceStop(core->outputDeviceID, core->ioproci= d); if (status !=3D kAudioHardwareBadDeviceError && status !=3D kA= udioHardwareNoError) { - coreaudio_logerr(status, "Could not stop playback\n"); + coreaudio_logerr(status, "Could not stop playback"); } } } @@ -501,7 +497,7 @@ static void fini_out_device(coreaudioVoiceOut *core) status =3D AudioDeviceDestroyIOProcID(core->outputDeviceID, core->ioprocid); if (status !=3D kAudioHardwareBadDeviceError && status !=3D kAudioHard= wareNoError) { - coreaudio_logerr(status, "Could not remove IOProc\n"); + coreaudio_logerr(status, "Could not remove IOProc"); } core->outputDeviceID =3D kAudioDeviceUnknown; } @@ -515,7 +511,7 @@ static void update_device_playback_state(coreaudioVoice= Out *core) if (status !=3D kAudioHardwareNoError) { if (status !=3D kAudioHardwareBadObjectError) { coreaudio_logerr(status, - "Could not determine whether Device is playin= g\n"); + "Could not determine whether device is playin= g"); } =20 return; @@ -526,7 +522,7 @@ static void update_device_playback_state(coreaudioVoice= Out *core) if (!isrunning) { status =3D AudioDeviceStart(core->outputDeviceID, core->ioproc= id); if (status !=3D kAudioHardwareBadDeviceError && status !=3D kA= udioHardwareNoError) { - coreaudio_logerr (status, "Could not resume playback\n"); + coreaudio_logerr(status, "Could not resume playback"); } } } else { @@ -535,7 +531,7 @@ static void update_device_playback_state(coreaudioVoice= Out *core) status =3D AudioDeviceStop(core->outputDeviceID, core->ioprocid); if (status !=3D kAudioHardwareBadDeviceError && status !=3D kA= udioHardwareNoError) { - coreaudio_logerr(status, "Could not pause playback\n"); + coreaudio_logerr(status, "Could not pause playback"); } } } @@ -576,7 +572,7 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct au= dsettings *as) /* create mutex */ err =3D pthread_mutex_init(&core->buf_mutex, NULL); if (err) { - dolog("Could not create mutex\nReason: %s\n", strerror (err)); + error_report("coreaudio: Could not create mutex: %s", strerror(err= )); return -1; } =20 @@ -594,8 +590,8 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct au= dsettings *as) &voice_addr, handle_voice_chan= ge, core); if (status !=3D kAudioHardwareNoError) { - coreaudio_playback_logerr (status, - "Could not listen to voice property cha= nge\n"); + coreaudio_playback_logerr(status, + "Could not listen to voice property chan= ge"); return -1; } =20 @@ -606,7 +602,7 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct au= dsettings *as) core); if (status !=3D kAudioHardwareNoError) { coreaudio_playback_logerr(status, - "Could not remove voice property cha= nge listener\n"); + "Could not remove voice property cha= nge listener"); } =20 return -1; @@ -626,7 +622,7 @@ static void coreaudio_fini_out (HWVoiceOut *hw) handle_voice_change, core); if (status !=3D kAudioHardwareNoError) { - coreaudio_logerr(status, "Could not remove voice property change l= istener\n"); + coreaudio_logerr(status, "Could not remove voice property change l= istener"); } =20 fini_out_device(core); @@ -634,7 +630,7 @@ static void coreaudio_fini_out (HWVoiceOut *hw) /* destroy mutex */ err =3D pthread_mutex_destroy(&core->buf_mutex); if (err) { - dolog("Could not destroy mutex\nReason: %s\n", strerror (err)); + error_report("coreaudio: Could not destroy mutex: %s", strerror(er= r)); } } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243251; cv=none; d=zohomail.com; s=zohoarc; b=e+7OD5Z/uVDVzi5bdOtQei6PRccF50KAwKbw0O6RrM3CSzgy9BmsyBckbga9rRo7a5P9CM4bqqmpBSLue2aN90OOx8RC30yol4BuErw2+jk7slWBjT7oaHC+qRDhiOGRZDFwLjwiyrILhfyDu41DruXhR5tbfW3wfLw7hmSRqeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243251; h=Content-Type: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=Xu6IN44Xl26WG365YIWkj0v11QMMjFBKKSOTEgL/OKo=; b=Nr6wGqeWP3SuS9DktQBDR3AOzPa/O/28fBw0NWNfXD3yy6ugH7OY5pvDw35/QQlIjKBED6r2xfB46bznvxR28z/bCEpJnqF5ST+Wu9OZ6d+3bJPb2xfriKGLIDgMWGW1KRHA1nrrxAo7PbDTbMwh1meTngLWNX/E5I+OzrM6p7s= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243251281185.9761296058481; Mon, 16 Feb 2026 04:00:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfT-0007Ik-8c; Mon, 16 Feb 2026 06:21:31 -0500 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 1vrwch-0006yi-Hz for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcf-0008HF-4K for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:38 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237-umqun_7oP1a-9wJU7Kk8ew-1; Mon, 16 Feb 2026 06:18:33 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 01B6D195FDD4; Mon, 16 Feb 2026 11:18:31 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0945230001B9; Mon, 16 Feb 2026 11:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xu6IN44Xl26WG365YIWkj0v11QMMjFBKKSOTEgL/OKo=; b=FqBjWRwrteoN+E5Z0hjQJLl0D+gnkrXp0AJcMqtSI63X+jDDNqs8aEUoUiJhpwi2zI8Pi/ GTXZ6uamZ0nfyC9u+RIt2EprLZWI2k8ogdMKThxKniHB8XwUM2g9+2NQD34v0c3SG3i3nd Y8NLpe2/dioVb8pYYLVN08344BruRHE= X-MC-Unique: umqun_7oP1a-9wJU7Kk8ew-1 X-Mimecast-MFC-AGG-ID: umqun_7oP1a-9wJU7Kk8ew_1771240711 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:50 +0100 Subject: [PATCH 61/85] audio/dbus: remove unused AUDIO_CAP macro MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-61-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=697; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=HSzXlEvn+9Pqf0QhfGnLSVpr6ES9PhgZ8mYtZ/b8vd8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxR6Oltzeluo61WTkvlTJwqAxD62sHuLolMK niVYaK69eSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5XeSD/9xOSekTswCUq3U/LjjLpbZPRbn82dmWjciigJyIRvhlLO+0hZsWCkr70PqxtDsZfjLOB4 59YN9qyCVt7Eg//MJjtCBKWor5tXVuRgsCIIIhoKw368vhNKEGARM3CS6WirkMxkXi5KKNVswFB FB0jYId4jrTLwUFAtT56PQimwarhdHl9hlc5J0vlUAEbwAcMLJfIL/uGTj7BMbACxyKDdPUPP7T Imb3G3dybLp8FNJVIFYc866IZoAS51lkKHHppIvpCKanP8Ujg/5aKmDmV4BwVmbpj0fttZKHp/I GU7t914/BmqCjzKR2R9VWkO6p9NO/aXde2gsbLLlmSKzuHs0cW2Hs/zBwA82yo8LW5zLTMSVX8x Z4ImSE31FutttSdLEBhZ2POAP8kzau/K4/epu1MIEFAUiMaZHEX8HQ9rHihkK0kosG6z7Ww0CiT 3zQ/7DOKoPjZy2fVyVWmWDtw5eC1BkxC4kDStfR6VWJDrocYe7u8x2RYVB9p/QoHDcBQ90drKYN BTTQp2gv5asZ4i6hhq6/ULe0c+3WY0pRoXTqE7N7FvuHnMLjvKrIWQyuhPyfjcH7vK4VStFYZrV HB6y08pmt2FPv69/jQ+9yGK/ZN4xpThR9M3lc+cFiKFZepfL0ea1EqQO0az4RjORvmpzd6wq7Gn Kj9A1YDsz6PGh9Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243264780158500 The DBus audio backend already uses error_report() for error logging. Remove the unused AUDIO_CAP macro which was left over from the old logging infrastructure. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/dbusaudio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index d8e548bf469..5f65c043c16 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -36,7 +36,6 @@ #include "ui/dbus-display.h" #include "ui/dbus-display1.h" =20 -#define AUDIO_CAP "dbus" #include "qemu/audio.h" #include "audio_int.h" #include "trace.h" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242397; cv=none; d=zohomail.com; s=zohoarc; b=aRKVixJUFi/fFHaMmPScANF3FBsTYtEC1OqG5qqNvBndN8aowMoiF2pLmnwCmWZSr3e2zI50DxonUK1o86H/FULfMgT6HCQz1GYRFxLKwvecI7WI2i/IszltkxSO572yrFbTVt/uFQiPGP221yBFVimcBHCcMqhxRYoP8A3AJT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242397; h=Content-Type: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=hxleiIuMmSQxAplkZkRImBt1hhK43Xtyj3HdkAU9nk4=; b=Nu7jBUmSFIY8GaiHXRoZmxcgMt0tzHKIf1F8M3WKDcNklC6xz7nSuPIEs+6yQihZkQXB0xBPdSt72wOVgFyq2Ssf5bdOyRr9tvBCScH4tv21o0+SHcFL/kvWIo7/RDE2ksykic4bjJ/hD5VBT9Y5vn8pc2j3+tzlpCGgMSmpC3I= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242397060667.1523744023099; Mon, 16 Feb 2026 03:46:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfc-000090-Pj; Mon, 16 Feb 2026 06:21:40 -0500 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 1vrwcm-00075e-Hj for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwci-0008Hn-Jo for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:42 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-449-Ov7S36wAPRCG5fbdAF4h1w-1; Mon, 16 Feb 2026 06:18:35 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B05DA1954B34; Mon, 16 Feb 2026 11:18:33 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EAD4819560AD; Mon, 16 Feb 2026 11:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hxleiIuMmSQxAplkZkRImBt1hhK43Xtyj3HdkAU9nk4=; b=Wx5mx7LoyIkXItaQHACsYHil6ZuX4qszfYnUrLxxCsqNZ3+x5UpraFBwKZ8FO6OFetUOlj fCZ6QFF9xRDycqI/MpP9UK8BrBQH07LD3XzWxk12ljn0oStnciA+1jTnBLNd/1hG0fXPvO 5n91xhrxarYhIaVWAbqElaNmCJBSfnU= X-MC-Unique: Ov7S36wAPRCG5fbdAF4h1w-1 X-Mimecast-MFC-AGG-ID: Ov7S36wAPRCG5fbdAF4h1w_1771240713 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:51 +0100 Subject: [PATCH 62/85] audio/dsound: replace custom logging with error_report & trace MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-62-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=21303; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=5rlLKZYChnAU7rxWYkldvo1LS6BroTN0lrE9LwrT7vU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxReoWbj5FukBIihc8PV7DcL64s7eWJWS6OX 9/KJbTEsPuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5XmFD/9DPJEWxNt8e7oRJggBnpreYniCdEMzO0m2ScEPVXDg6QZHRa688RxBGJ/utR2W+sWYJeZ hJ/1cWNHbIjIYV4TO+lon4QAe2I5BOi6oVViaEcTAuZ7YYKFGevNn9psEWUNlFNFIBqWPNQfsvs 1T6u33yji5I/o0lYRwb4bktc7WtLgVdYInRA+wrDtjjST2EOzkDFmM2FdZ7udk7E1SLxjHij6dK Cq7SLfbp/87MSHeFmzhBUokV2nkd7opCiGT137B8q2bC4XyScHHLl2wBL5Zq5gHPLb5LKNPwYbE yS8OIY0dFrYi1Io9Umx+kf1H8Ux87uhj3ixSSm+yOSuiqaGF0QnKmR9MnjPp4m58tR3DooTOsnh aH5hRk3WAGnctN3kPexhS6KrQxg+N+3pcMkNRUjQiJAksAiJONTAnW9WJww8j2qbfb8zGjJe5mP ST2fWrufRC0/zaUtOBwD/No5E09F7ao1IAfQVtfGCHiiDBuWhvgab86iqxKVLfZsv/hzIQmi9ui 6dFnt3VjC743PZTvviOlMZLd8IggWp0Ado26IMDc2WJrNnx5gdLo1qHFKwbrSXM0Qq7jG6Sg5ud OL6z0y1LNCaLntBpt9lulox9RJ6Yd7NZIu6PH2/CqmCbY8/Kbni+pQm99XFwPWT8P+a2FWoOJfP /OvF6ssn+9d6htA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771242400409154100 The DirectSound audio backend uses its own logging infrastructure (AUD_log, AUD_vlog, dolog) and the AUDIO_CAP macro. This approach is inconsistent with the rest of QEMU and makes the output harder to filter and configure. Replace the custom logging with standard QEMU error reporting. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/dsound_template.h | 72 ++++++++++++-------------- audio/audio_win_int.c | 31 ++++++----- audio/dsoundaudio.c | 134 +++++++++++++++++++-------------------------= ---- audio/trace-events | 5 ++ 4 files changed, 108 insertions(+), 134 deletions(-) diff --git a/audio/dsound_template.h b/audio/dsound_template.h index 022a7307c99..af4019bcb34 100644 --- a/audio/dsound_template.h +++ b/audio/dsound_template.h @@ -53,9 +53,9 @@ static int glue (dsound_unlock_, TYPE) ( { HRESULT hr; =20 - hr =3D glue (IFACE, _Unlock) (buf, p1, blen1, p2, blen2); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not unlock " NAME "\n"); + hr =3D glue(IFACE, _Unlock)(buf, p1, blen1, p2, blen2); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not unlock " NAME); return -1; } =20 @@ -85,35 +85,35 @@ static int glue (dsound_lock_, TYPE) ( #endif hr =3D glue(IFACE, _Lock)(buf, pos, len, p1p, blen1p, p2p, blen2p, fla= g); =20 - if (FAILED (hr)) { + if (FAILED(hr)) { #ifndef DSBTYPE_IN if (hr =3D=3D DSERR_BUFFERLOST) { - if (glue (dsound_restore_, TYPE) (buf, s)) { - dsound_logerr (hr, "Could not lock " NAME "\n"); + if (glue(dsound_restore_, TYPE)(buf, s)) { + dsound_logerr(hr, "Could not lock " NAME); } goto fail; } #endif - dsound_logerr (hr, "Could not lock " NAME "\n"); + dsound_logerr(hr, "Could not lock " NAME); goto fail; } =20 if ((p1p && *p1p && (*blen1p % info->bytes_per_frame)) || (p2p && *p2p && (*blen2p % info->bytes_per_frame))) { - dolog("DirectSound returned misaligned buffer %ld %ld\n", - *blen1p, *blen2p); + error_report("dsound: returned misaligned buffer %ld %ld", + *blen1p, *blen2p); glue(dsound_unlock_, TYPE)(buf, *p1p, p2p ? *p2p : NULL, *blen1p, blen2p ? *blen2p : 0); goto fail; } =20 if (p1p && !*p1p && *blen1p) { - dolog("warning: !p1 && blen1=3D%ld\n", *blen1p); + warn_report("dsound: !p1 && blen1=3D%ld", *blen1p); *blen1p =3D 0; } =20 if (p2p && !*p2p && *blen2p) { - dolog("warning: !p2 && blen2=3D%ld\n", *blen2p); + warn_report("dsound: !p2 && blen2=3D%ld", *blen2p); *blen2p =3D 0; } =20 @@ -143,14 +143,14 @@ static void dsound_fini_out (HWVoiceOut *hw) #endif =20 if (ds->FIELD) { - hr =3D glue (IFACE, _Stop) (ds->FIELD); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not stop " NAME "\n"); + hr =3D glue(IFACE, _Stop)(ds->FIELD); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not stop " NAME); } =20 - hr =3D glue (IFACE, _Release) (ds->FIELD); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release " NAME "\n"); + hr =3D glue(IFACE, _Release)(ds->FIELD); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not release " NAME); } ds->FIELD =3D NULL; } @@ -182,7 +182,8 @@ static int dsound_init_out(HWVoiceOut *hw, struct audse= ttings *as) #endif =20 if (!s->FIELD2) { - dolog ("Attempt to initialize voice without " NAME2 " object\n"); + error_report("dsound: Attempt to initialize voice without " + NAME2 " object"); return -1; } =20 @@ -212,28 +213,28 @@ static int dsound_init_out(HWVoiceOut *hw, struct aud= settings *as) ); #endif =20 - if (FAILED (hr)) { - dsound_logerr2 (hr, typ, "Could not create " NAME "\n"); + if (FAILED(hr)) { + dsound_logerr2(hr, typ, "Could not create " NAME); return -1; } =20 - hr =3D glue (IFACE, _GetFormat) (ds->FIELD, &wfx, sizeof (wfx), NULL); - if (FAILED (hr)) { - dsound_logerr2 (hr, typ, "Could not get " NAME " format\n"); + hr =3D glue(IFACE, _GetFormat)(ds->FIELD, &wfx, sizeof(wfx), NULL); + if (FAILED(hr)) { + dsound_logerr2(hr, typ, "Could not get " NAME " format"); goto fail0; } =20 -#ifdef DEBUG_DSOUND - dolog (NAME "\n"); - print_wave_format (&wfx); -#endif + trace_dsound_wave_format( + wfx.wFormatTag, wfx.nChannels, + wfx.nSamplesPerSec, wfx.nAvgBytesPerSec, + wfx.nBlockAlign, wfx.wBitsPerSample, wfx.cbSize); =20 memset (&bc, 0, sizeof (bc)); bc.dwSize =3D sizeof (bc); =20 - hr =3D glue (IFACE, _GetCaps) (ds->FIELD, &bc); - if (FAILED (hr)) { - dsound_logerr2 (hr, typ, "Could not get " NAME " format\n"); + hr =3D glue(IFACE, _GetCaps)(ds->FIELD, &bc); + if (FAILED(hr)) { + dsound_logerr2(hr, typ, "Could not get " NAME " caps"); goto fail0; } =20 @@ -247,18 +248,13 @@ static int dsound_init_out(HWVoiceOut *hw, struct aud= settings *as) audio_pcm_init_info (&hw->info, &obt_as); =20 if (bc.dwBufferBytes % hw->info.bytes_per_frame) { - dolog ( - "GetCaps returned misaligned buffer size %ld, alignment %d\n", - bc.dwBufferBytes, hw->info.bytes_per_frame - ); + warn_report("dsound: GetCaps returned misaligned buffer size %ld, " + "alignment %d", bc.dwBufferBytes, hw->info.bytes_per_f= rame); } hw->size_emul =3D bc.dwBufferBytes; hw->samples =3D bc.dwBufferBytes / hw->info.bytes_per_frame; =20 -#ifdef DEBUG_DSOUND - dolog ("caps %ld, desc %ld\n", - bc.dwBufferBytes, bd.dwBufferBytes); -#endif + trace_dsound_buffer_bytes(bc.dwBufferBytes, bd.dwBufferBytes); return 0; =20 fail0: diff --git a/audio/audio_win_int.c b/audio/audio_win_int.c index 44a8ff24a6f..ecd599c87de 100644 --- a/audio/audio_win_int.c +++ b/audio/audio_win_int.c @@ -2,12 +2,12 @@ =20 #include "qemu/osdep.h" =20 -#define AUDIO_CAP "win-int" #include #include #include =20 #include "qemu/audio.h" +#include "qemu/error-report.h" #include "audio_int.h" #include "audio_win_int.h" =20 @@ -53,7 +53,7 @@ int waveformat_from_audio_settings (WAVEFORMATEX *wfx, break; =20 default: - dolog("Internal logic error: Bad audio format %d\n", as->fmt); + error_report("dsound: Internal logic error: Bad audio format %d", = as->fmt); return -1; } =20 @@ -64,7 +64,7 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx, struct audsettings *as) { if (!wfx->nSamplesPerSec) { - dolog ("Invalid wave format, frequency is zero\n"); + error_report("dsound: Invalid wave format, frequency is zero"); return -1; } as->freq =3D wfx->nSamplesPerSec; @@ -79,10 +79,9 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx, break; =20 default: - dolog ( - "Invalid wave format, number of channels is not 1 or 2, but %d= \n", - wfx->nChannels - ); + error_report("dsound: Invalid wave format, " + "number of channels is not 1 or 2, but %d", + wfx->nChannels); return -1; } =20 @@ -101,9 +100,9 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx, break; =20 default: - dolog("Invalid PCM wave format, bits per sample is not " - "8, 16 or 32, but %d\n", - wfx->wBitsPerSample); + error_report("dsound: Invalid PCM wave format, bits per sample= is not " + "8, 16 or 32, but %d", + wfx->wBitsPerSample); return -1; } } else if (wfx->wFormatTag =3D=3D WAVE_FORMAT_IEEE_FLOAT) { @@ -113,15 +112,15 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx, break; =20 default: - dolog("Invalid IEEE_FLOAT wave format, bits per sample is not " - "32, but %d\n", - wfx->wBitsPerSample); + error_report("dsound: Invalid IEEE_FLOAT wave format, " + "bits per sample is not 32, but %d", + wfx->wBitsPerSample); return -1; } } else { - dolog("Invalid wave format, tag is not PCM and not IEEE_FLOAT, " - "but %d\n", - wfx->wFormatTag); + error_report("dsound: Invalid wave format, " + "tag is not PCM and not IEEE_FLOAT, but %d", + wfx->wFormatTag); return -1; } =20 diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 2c592c56663..704bc3da73b 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -28,8 +28,7 @@ =20 #include "qemu/osdep.h" #include "qemu/audio.h" - -#define AUDIO_CAP "dsound" +#include "qemu/error-report.h" #include "audio_int.h" #include "qemu/module.h" #include "qapi/error.h" @@ -40,6 +39,7 @@ #include #include =20 +#include "trace.h" #include "audio_win_int.h" =20 #define TYPE_AUDIO_DSOUND "audio-dsound" @@ -55,9 +55,6 @@ struct AudioDsound { struct audsettings settings; }; =20 - -/* #define DEBUG_DSOUND */ - typedef struct { HWVoiceOut hw; LPDIRECTSOUNDBUFFER dsound_buffer; @@ -214,56 +211,37 @@ static void dsound_log_hresult(HRESULT hr) const char *str =3D dserror(hr); =20 if (str) { - AUD_log (AUDIO_CAP, "Reason: %s\n", str); + error_printf(" Reason: %s", str); } else { - AUD_log (AUDIO_CAP, "Reason: Unknown (HRESULT: 0x%lx)\n", hr); + error_printf(" Reason: Unknown (HRESULT: 0x%lx)", hr); } } =20 -static void G_GNUC_PRINTF (2, 3) dsound_logerr ( - HRESULT hr, - const char *fmt, - ... - ) +static void G_GNUC_PRINTF(2, 3) dsound_logerr(HRESULT hr, const char *fmt,= ...) { va_list ap; =20 - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - dsound_log_hresult (hr); + error_printf("dsound: "); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); + dsound_log_hresult(hr); + error_printf("\n"); } =20 -static void G_GNUC_PRINTF (3, 4) dsound_logerr2 ( - HRESULT hr, - const char *typ, - const char *fmt, - ... - ) +static void G_GNUC_PRINTF(3, 4) dsound_logerr2(HRESULT hr, const char *typ, + const char *fmt, ...) { va_list ap; =20 - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - dsound_log_hresult (hr); + error_printf("dsound: Could not initialize %s: ", typ); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); + dsound_log_hresult(hr); + error_printf("\n"); } =20 -#ifdef DEBUG_DSOUND -static void print_wave_format (WAVEFORMATEX *wfx) -{ - dolog ("tag =3D %d\n", wfx->wFormatTag); - dolog ("nChannels =3D %d\n", wfx->nChannels); - dolog ("nSamplesPerSec =3D %ld\n", wfx->nSamplesPerSec); - dolog ("nAvgBytesPerSec =3D %ld\n", wfx->nAvgBytesPerSec); - dolog ("nBlockAlign =3D %d\n", wfx->nBlockAlign); - dolog ("wBitsPerSample =3D %d\n", wfx->wBitsPerSample); - dolog ("cbSize =3D %d\n", wfx->cbSize); -} -#endif =20 static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb, AudioDsound *s) { @@ -272,7 +250,7 @@ static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb,= AudioDsound *s) hr =3D IDirectSoundBuffer_Restore (dsb); =20 if (hr !=3D DS_OK) { - dsound_logerr (hr, "Could not restore playback buffer\n"); + dsound_logerr(hr, "Could not restore playback buffer"); return -1; } return 0; @@ -290,7 +268,7 @@ static int dsound_get_status_out (LPDIRECTSOUNDBUFFER d= sb, DWORD *statusp, =20 hr =3D IDirectSoundBuffer_GetStatus (dsb, statusp); if (FAILED (hr)) { - dsound_logerr (hr, "Could not get playback buffer status\n"); + dsound_logerr(hr, "Could not get playback buffer status"); return -1; } =20 @@ -309,7 +287,7 @@ static int dsound_get_status_in (LPDIRECTSOUNDCAPTUREBU= FFER dscb, =20 hr =3D IDirectSoundCaptureBuffer_GetStatus (dscb, statusp); if (FAILED (hr)) { - dsound_logerr (hr, "Could not get capture buffer status\n"); + dsound_logerr(hr, "Could not get capture buffer status"); return -1; } =20 @@ -340,11 +318,7 @@ static void dsound_clear_sample (HWVoiceOut *hw, LPDIR= ECTSOUNDBUFFER dsb, len1 =3D blen1 / hw->info.bytes_per_frame; len2 =3D blen2 / hw->info.bytes_per_frame; =20 -#ifdef DEBUG_DSOUND - dolog ("clear %p,%ld,%ld %p,%ld,%ld\n", - p1, blen1, len1, - p2, blen2, len2); -#endif + trace_dsound_clear_sample(p1, blen1, len1, p2, blen2, len2); =20 if (p1 && len1) { audio_pcm_info_clear_buf (&hw->info, p1, len1); @@ -366,40 +340,40 @@ static void dsound_enable_out(HWVoiceOut *hw, bool en= able) LPDIRECTSOUNDBUFFER dsb =3D ds->dsound_buffer; =20 if (!dsb) { - dolog ("Attempt to control voice without a buffer\n"); + error_report("dsound: Attempt to control voice without a buffer"); return; } =20 if (enable) { - if (dsound_get_status_out (dsb, &status, s)) { + if (dsound_get_status_out(dsb, &status, s)) { return; } =20 if (status & DSBSTATUS_PLAYING) { - dolog ("warning: Voice is already playing\n"); + warn_report("dsound: Voice is already playing"); return; } =20 - dsound_clear_sample (hw, dsb, s); + dsound_clear_sample(hw, dsb, s); =20 - hr =3D IDirectSoundBuffer_Play (dsb, 0, 0, DSBPLAY_LOOPING); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not start playing buffer\n"); + hr =3D IDirectSoundBuffer_Play(dsb, 0, 0, DSBPLAY_LOOPING); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not start playing buffer"); return; } } else { - if (dsound_get_status_out (dsb, &status, s)) { + if (dsound_get_status_out(dsb, &status, s)) { return; } =20 if (status & DSBSTATUS_PLAYING) { - hr =3D IDirectSoundBuffer_Stop (dsb); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not stop playing buffer\n"); + hr =3D IDirectSoundBuffer_Stop(dsb); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not stop playing buffer"); return; } } else { - dolog ("warning: Voice is not playing\n"); + warn_report("dsound: Voice is not playing"); } } } @@ -414,7 +388,7 @@ static size_t dsound_buffer_get_free(HWVoiceOut *hw) hr =3D IDirectSoundBuffer_GetCurrentPosition( dsb, &ppos, ds->first_time ? &wpos : NULL); if (FAILED(hr)) { - dsound_logerr(hr, "Could not get playback buffer position\n"); + dsound_logerr(hr, "Could not get playback buffer position"); return 0; } =20 @@ -441,7 +415,7 @@ static void *dsound_get_buffer_out(HWVoiceOut *hw, size= _t *size) err =3D dsound_lock_out(dsb, &hw->info, hw->pos_emul, req_size, &ret, = NULL, &act_size, NULL, false, AUDIO_DSOUND(hw->s)); if (err) { - dolog("Failed to lock buffer\n"); + error_report("dsound: Failed to lock buffer"); *size =3D 0; return NULL; } @@ -457,7 +431,7 @@ static size_t dsound_put_buffer_out(HWVoiceOut *hw, voi= d *buf, size_t len) int err =3D dsound_unlock_out(dsb, buf, NULL, len, 0); =20 if (err) { - dolog("Failed to unlock buffer!!\n"); + error_report("dsound: Failed to unlock buffer"); return 0; } hw->pos_emul =3D (hw->pos_emul + len) % hw->size_emul; @@ -473,40 +447,40 @@ static void dsound_enable_in(HWVoiceIn *hw, bool enab= le) LPDIRECTSOUNDCAPTUREBUFFER dscb =3D ds->dsound_capture_buffer; =20 if (!dscb) { - dolog ("Attempt to control capture voice without a buffer\n"); + error_report("dsound: Attempt to control capture voice without a b= uffer"); return; } =20 if (enable) { - if (dsound_get_status_in (dscb, &status)) { + if (dsound_get_status_in(dscb, &status)) { return; } =20 if (status & DSCBSTATUS_CAPTURING) { - dolog ("warning: Voice is already capturing\n"); + warn_report("dsound: Voice is already capturing"); return; } =20 /* clear ?? */ =20 - hr =3D IDirectSoundCaptureBuffer_Start (dscb, DSCBSTART_LOOPING); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not start capturing\n"); + hr =3D IDirectSoundCaptureBuffer_Start(dscb, DSCBSTART_LOOPING); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not start capturing"); return; } } else { - if (dsound_get_status_in (dscb, &status)) { + if (dsound_get_status_in(dscb, &status)) { return; } =20 if (status & DSCBSTATUS_CAPTURING) { - hr =3D IDirectSoundCaptureBuffer_Stop (dscb); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not stop capturing\n"); + hr =3D IDirectSoundCaptureBuffer_Stop(dscb); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not stop capturing"); return; } } else { - dolog ("warning: Voice is not capturing\n"); + warn_report("dsound: Voice is not capturing"); } } } @@ -523,7 +497,7 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t= *size) =20 hr =3D IDirectSoundCaptureBuffer_GetCurrentPosition(dscb, NULL, &rpos); if (FAILED(hr)) { - dsound_logerr(hr, "Could not get capture buffer position\n"); + dsound_logerr(hr, "Could not get capture buffer position"); *size =3D 0; return NULL; } @@ -544,7 +518,7 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t= *size) err =3D dsound_lock_in(dscb, &hw->info, hw->pos_emul, req_size, &ret, = NULL, &act_size, NULL, false, AUDIO_DSOUND(hw->s)); if (err) { - dolog("Failed to lock buffer\n"); + error_report("dsound: Failed to lock buffer"); *size =3D 0; return NULL; } @@ -560,7 +534,7 @@ static void dsound_put_buffer_in(HWVoiceIn *hw, void *b= uf, size_t len) int err =3D dsound_unlock_in(dscb, buf, NULL, len, 0); =20 if (err) { - dolog("Failed to unlock buffer!!\n"); + error_report("dsound: Failed to unlock buffer"); return; } hw->pos_emul =3D (hw->pos_emul + len) % hw->size_emul; @@ -577,7 +551,7 @@ static void audio_dsound_finalize(Object *obj) =20 hr =3D IDirectSound_Release (s->dsound); if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSound\n"); + dsound_logerr(hr, "Could not release DirectSound"); } s->dsound =3D NULL; =20 @@ -587,7 +561,7 @@ static void audio_dsound_finalize(Object *obj) =20 hr =3D IDirectSoundCapture_Release (s->dsound_capture); if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSoundCapture\n"); + dsound_logerr(hr, "Could not release DirectSoundCapture"); } s->dsound_capture =3D NULL; } diff --git a/audio/trace-events b/audio/trace-events index 737e3e60694..b2f29666700 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -23,6 +23,11 @@ dbus_audio_register(const char *s, const char *dir) "sen= der =3D %s, dir =3D %s" dbus_audio_put_buffer_out(size_t pos, size_t size) "buf_pos =3D %zu, buf_s= ize =3D %zu" dbus_audio_read(size_t len) "len =3D %zu" =20 +# dsoundaudio.c +dsound_clear_sample(void *p1, uint32_t blen1, uint32_t len1, void *p2, uin= t32_t blen2, uint32_t len2) "p1=3D%p, blen1=3D%u, len1=3D%u, p2=3D%p, blen2= =3D%u, len2=3D%u" +dsound_wave_format(uint16_t wFormatTag, uint16_t nChannels, uint32_t nSamp= lesPerSec, uint32_t nAvgBytesPerSec, uint16_t nBlockAlign, uint16_t wBitsPe= rSample, uint16_t cbSize) "wFormatTag=3D%u, nChannels=3D%u, nSamplesPerSec= =3D%u, nAvgBytesPerSec=3D%u, nBlockAlign=3D%u, wBitsPerSample=3D%u, cbSize= =3D%u" +dsound_buffer_bytes(uint32_t caps_bytes, uint32_t desc_bytes) "caps_bytes= =3D%u, desc_bytes=3D%u" + # pwaudio.c pw_state_changed(int nodeid, const char *s) "node id: %d stream state: %s" pw_read(int32_t avail, uint32_t index, size_t len) "avail=3D%d index=3D%u = len=3D%zu" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242181; cv=none; d=zohomail.com; s=zohoarc; b=JX//v3ozdTufdnvcUxisHtvFyRASNkc+mNbs6oiH21CvnO7T/VBHxDLREuIoD+gGg1AtNrtbwGms2dHbVgSTydjF161UF3TuCpFSLhPNhNeu9+ILkcQvxZkSKBvrLbrKlGiFPQIEqhA/NQHA5qCNBrVsl0H1e9ovrVctWrbrNBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242181; h=Content-Type: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=3OeZeYhTauS7VhsUmiT8lNq2q4uk8o3wKup878n2xcg=; b=Yz1XjndE83vmprNBQ6MNZ1nTmUARlI7kkFd0adxFagNGjbvya1Ja0Hs/z0iWMlWmfT4omWpWeodVpwHgrf8A1hYEl14tbq2s+u01czYJO/5qmZNwk3dxd8K9w4SzSeErx7qdDkz4SNfMAxcb3JWDlednGxJN/GeW3gMuplq7Lyk= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242181176248.1687116583961; Mon, 16 Feb 2026 03:43:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfU-0007SM-7O; Mon, 16 Feb 2026 06:21:32 -0500 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 1vrwcm-00075b-Gx for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwck-0008Hs-5X for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:43 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-PmmclhK9MPSHztIgP2OG1w-1; Mon, 16 Feb 2026 06:18:38 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 623F21955D42; Mon, 16 Feb 2026 11:18:36 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5A7A130001A5; Mon, 16 Feb 2026 11:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3OeZeYhTauS7VhsUmiT8lNq2q4uk8o3wKup878n2xcg=; b=beahFPMwQM38f1SoyNOCT7c3yWYTatlShPsWEXVm37Wu0fzV0P0zkOOEVrB/Y7W+HNLZIU cS8099rHCEyRAqFwwEU0m9d8b0+sAWY8ax6pTRRgI/uAA6VmPknLBXYicxAz9WfCLYd/47 h8PimbdXyrkKyZJpY7oECrHwLc5a5TY= X-MC-Unique: PmmclhK9MPSHztIgP2OG1w-1 X-Mimecast-MFC-AGG-ID: PmmclhK9MPSHztIgP2OG1w_1771240716 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:52 +0100 Subject: [PATCH 63/85] audio/jack: replace custom logging with report & trace MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-63-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=4967; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=tnMUAuR9ZZnzXMT3/4hZtykb2+KAGrajZYT1JRkA5GQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRdKQiHLFBtMKklXyT0ri2mogrf0CRJLN2W MtWyA9Y4MuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5V2HD/43Ec0BC88USxdOBEGpbxPp/j+PvXsJBpkzTzKxTT01rEjMcaT33FYv/9NRx/W1U0V9UNI H0FIA4Z8fIUAjBUk7WV13p1wnQhRuVzYW+lB2iQpni6FpLTyU8p23DWC0+5fsfIBU0srgEDib5N CWSK0iGPTjbiFYoO2VkNAxt5qaElmU1iECoutYY+KNs36H1/78T5ZqNROW220BRGbBV+VF2aNmd tejOz6ssTlRuKl9L5kHFTtTETkCnEIcD6NzsiHCIllCsPQ4sU3Ov2oFlDBxi9j9AJR1h46wy/Sb VEsxddNnITSLiikrdeFYwWZSmB8sqbWrWSvzKjr2fNNhJrV3tYuU1wK77ASkxASJOHFhba9bXiN S8QA0Xqnc6rqYqE+93SVgiXHGV0FdtIwqU506kFadYnEOnlaKs6pr80kcDhxZS9Mk/ZIrhUrG8s hAyWl8a1shMsMBZpxeRAoCM5N22V220gxtN56KIOcGyHOMsU/oaxYO3tl6BEb+u8N5XQsga94L1 bvZX4EzCjjRXR0pdG5B/cvqiWgFCJGwxbYn2YaE+m4XJCDWdpXWvJmK7NYNdP24j/NZGg6MsHEQ JDEKo9lniDw/gnnye9Trki/q94XhhNofhJ7z8UPGxi6+Ys6Jnt7SugrXguxxZGDNpU9g/Ede4p5 M/sLAwbQG8oQtBg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242182662154100 Replace the custom audio logging infrastructure with standard QEMU error reporting and tracing. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/jackaudio.c | 29 +++++++++++++---------------- audio/trace-events | 9 +++++++++ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/audio/jackaudio.c b/audio/jackaudio.c index e415e94e6e6..a2f725a3232 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -26,11 +26,11 @@ #include "qemu/module.h" #include "qemu/atomic.h" #include "qemu/main-loop.h" +#include "qemu/error-report.h" #include "qemu/audio.h" #include "qom/object.h" - -#define AUDIO_CAP "jack" #include "audio_int.h" +#include "trace.h" =20 #include #include @@ -343,7 +343,7 @@ static void qjack_client_recover(QJackClient *c) =20 /* if enabled then attempt to recover */ if (c->enabled) { - dolog("attempting to reconnect to server\n"); + trace_jack_client_recover(); qjack_client_init(c); } } @@ -399,10 +399,10 @@ static void qjack_client_connect_ports(QJackClient *c) } =20 if (c->out) { - dolog("connect %s -> %s\n", p, ports[i]); + trace_jack_connect(p, ports[i]); jack_connect(c->client, p, ports[i]); } else { - dolog("connect %s -> %s\n", ports[i], p); + trace_jack_connect(ports[i], p); jack_connect(c->client, ports[i], p); } } @@ -441,9 +441,9 @@ static int qjack_client_init(QJackClient *c) c->opt->server_name); =20 if (c->client =3D=3D NULL) { - dolog("jack_client_open failed: status =3D 0x%2.0x\n", status); + error_report("jack: jack_client_open failed: status =3D 0x%2.0x", = status); if (status & JackServerFailed) { - dolog("unable to connect to JACK server\n"); + error_report("jack: unable to connect to JACK server"); } return -1; } @@ -451,12 +451,11 @@ static int qjack_client_init(QJackClient *c) c->freq =3D jack_get_sample_rate(c->client); =20 if (status & JackServerStarted) { - dolog("JACK server started\n"); + trace_jack_server_started(); } =20 if (status & JackNameNotUnique) { - dolog("JACK unique name assigned %s\n", - jack_get_client_name(c->client)); + trace_jack_unique_name(jack_get_client_name(c->client)); } =20 /* Allocate working buffer for process callback */ @@ -536,8 +535,7 @@ static int qjack_init_out(HWVoiceOut *hw, struct audset= tings *as) }; audio_pcm_init_info(&hw->info, &os); =20 - dolog("JACK output configured for %dHz (%d samples)\n", - jo->c.freq, jo->c.buffersize); + trace_jack_out_init(jo->c.freq, jo->c.buffersize); =20 return 0; } @@ -572,8 +570,7 @@ static int qjack_init_in(HWVoiceIn *hw, struct audsetti= ngs *as) }; audio_pcm_init_info(&hw->info, &is); =20 - dolog("JACK input configured for %dHz (%d samples)\n", - ji->c.freq, ji->c.buffersize); + trace_jack_in_init(ji->c.freq, ji->c.buffersize); =20 return 0; } @@ -654,12 +651,12 @@ static int qjack_thread_creator(jack_native_thread_t = *thread, =20 static void qjack_error(const char *msg) { - dolog("E: %s\n", msg); + error_report("jack: %s", msg); } =20 static void qjack_info(const char *msg) { - dolog("I: %s\n", msg); + trace_jack_info(msg); } =20 static void audio_jack_class_init(ObjectClass *klass, const void *data) diff --git a/audio/trace-events b/audio/trace-events index b2f29666700..79744456cec 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -28,6 +28,15 @@ dsound_clear_sample(void *p1, uint32_t blen1, uint32_t l= en1, void *p2, uint32_t dsound_wave_format(uint16_t wFormatTag, uint16_t nChannels, uint32_t nSamp= lesPerSec, uint32_t nAvgBytesPerSec, uint16_t nBlockAlign, uint16_t wBitsPe= rSample, uint16_t cbSize) "wFormatTag=3D%u, nChannels=3D%u, nSamplesPerSec= =3D%u, nAvgBytesPerSec=3D%u, nBlockAlign=3D%u, wBitsPerSample=3D%u, cbSize= =3D%u" dsound_buffer_bytes(uint32_t caps_bytes, uint32_t desc_bytes) "caps_bytes= =3D%u, desc_bytes=3D%u" =20 +# jackaudio.c +jack_client_recover(void) "attempting to reconnect to server" +jack_connect(const char *src, const char *dst) "connect %s -> %s" +jack_server_started(void) "server started" +jack_unique_name(const char *name) "unique name assigned %s" +jack_out_init(uint32_t freq, int buffersize) "output configured for %uHz (= %d samples)" +jack_in_init(uint32_t freq, int buffersize) "input configured for %uHz (%d= samples)" +jack_info(const char *msg) "%s" + # pwaudio.c pw_state_changed(int nodeid, const char *s) "node id: %d stream state: %s" pw_read(int32_t avail, uint32_t index, size_t len) "avail=3D%d index=3D%u = len=3D%zu" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243363; cv=none; d=zohomail.com; s=zohoarc; b=PV4muDwOm3IRASowh1t7vXdP6z8DoCebuKQ+J5aLIzrqbn7ghfST7je648neIZy2bf5cfnmUExjXjVhMA2+8MZaX8CIxxaPexgmOuzNHI0Xrk+cCNaTmwb4KCbi+78spm65NlutUPb2hYzIuAuizq2LxEWD8pIDtN/O32Bbg/Ak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243363; h=Content-Type: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=ESVl7hrPW6399tVk+EQUGmjKjUQ+e3r5I81ZjO955hM=; b=ChcwnFa1+/P/ppzPADE5X4y3e0IKDKZSFUdAbXh+6asAz3l1PfZP7bDL3M5yLNwVGqtcbSI13QjtnEowyFbVvNvR1QMEnNq3N6YQR+s+QhvXirlE7v+iMW9L2IvmFZPFeIB+PTelbdWy/ox/5onDQC2si+g3o5NFdEJo7i45Mwo= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243363239825.8593840505305; Mon, 16 Feb 2026 04:02:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfe-0000Ia-Dv; Mon, 16 Feb 2026 06:21:42 -0500 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 1vrwcp-0007AM-Ia for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcn-0008IF-Ql for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:47 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-rlQ0flM9PCaOP741xb7FmQ-1; Mon, 16 Feb 2026 06:18:40 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EF0C71956094; Mon, 16 Feb 2026 11:18:38 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 533741955F43; Mon, 16 Feb 2026 11:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ESVl7hrPW6399tVk+EQUGmjKjUQ+e3r5I81ZjO955hM=; b=WxitHbsmSjMM2b+49J3z7E4jeHExDlNL9YtJJgZqO1QJFooysCcqjYh1XCarugsXkxUVIG tjIrYTwCkTJI80UeEYIBiv7ZUXzALFiF5+K4BhJZ1+4mYR5FCFOzoWDyqi8104FcKpR50q aAMhDYU7pAtiIbZ7NgHTXYLvO0zQ6lY= X-MC-Unique: rlQ0flM9PCaOP741xb7FmQ-1 X-Mimecast-MFC-AGG-ID: rlQ0flM9PCaOP741xb7FmQ_1771240719 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:53 +0100 Subject: [PATCH 64/85] audio/noaudio: remove unused AUDIO_CAP macro MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-64-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=508; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=JtGKRFxHxWAyAWIxjSqifHUPbgYk6YcOPZOxE1yLVOI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRVNsCBTWWg1tNNteGSBiz0njwgCY6FRIH3 nMd4+9LO9CJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5QxZEACzT4G4yQQQQRGAk7dVAbUYTLYD8UPVGICeTbv6NcHVunbOtcVdjjeOTrktoBGCXXro3L/ s7pjtgyI2h9+nxdLlYqSgg58ggPdq1Eb0kF974IiaO+pqd+tZwr2btWOcPZLl9fa8rSpJjP2y3H 5itX379LrSMcqd4J+OSzKwi76OYwzQaSYUnIJptdJKhp8WaWIVaeHcbTSGtFh/nK3y8glVAXj1+ DRXaC62konBMk04aSuqcl7rOqykM0utLqBZNlwZdiCqfAvlKHln06SRKGgu3vIbSfZf3tX4MYah 5F8B8Z1il+3ssIEnVdW+uAXi4oOBDTG60LeATSdoO+7jQ1mPVf0qCUIac2rknTiKtMjf+I91jR4 d8Nl+hwVKrnLyZV6LtP4C+Ou19Jf32P/SJfjpMZ1HCwGKsNSZKFqWOCbK/9TRl88c0U3YZtdLRT 0861nTq3twPkZaOsOlupjLpbnvmoB+pBq0BJFzUggW6jFNr90AjWQD+84XqhkBVWKvqOVRHCV9F mbbudDujqvRBkWg725+ANpP3AKbOnz29l1pC0vQ0+RTnWj0fpOzkC7CTfGxIasdXbSjaKSNhYbd qeUJE4YOT/A+fpMkB47QNgbu16fw+ieBBd7PkVZzS4lnV1+KXob6hcdNMZgsbdUHgwMqiaiaQR/ cGGYVk6ZPANZvCw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243365060158500 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/noaudio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/audio/noaudio.c b/audio/noaudio.c index e056813181a..70316c572ec 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -27,7 +27,6 @@ #include "qemu/audio.h" #include "qom/object.h" =20 -#define AUDIO_CAP "noaudio" #include "audio_int.h" =20 #define TYPE_AUDIO_NONE "audio-none" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243529; cv=none; d=zohomail.com; s=zohoarc; b=nohWefIFPfqwhKds2BFt8SIsQfXOruNH7StCee7gE895tqH6/whQOrFBILP24ndELjE4WNAFSrCyzokglf9ASDEvaWVR9fiFUzqKsPZsqfYzVOaG69L7X5Al3YG338mH8E4Uhu6c4ac4z8UA/2CUbaUBfp97HGWjMahx84tg2+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243529; h=Content-Type: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=hLSoXVhoQIeUoHnSqf7NdVnGnnPXay6u7AUxyZ65rWQ=; b=dPjGQ04GlkfUubam48EyK8ka92hZQcU+5aqSHqpMxXRC+Szhjg6CFy7A+XoYKYV6FNegC0EwPuAfEMYUGQUMoxxe0tmeOXTVdQn9PgPUrj3lG40ecZFP5+uFpJyk2bqW/ZF2yN2zNKwqlXcDEcrP2uOB2Ii7gADL86fbKqD8JNM= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243529844216.72771300997567; Mon, 16 Feb 2026 04:05:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfk-0000z7-Gd; Mon, 16 Feb 2026 06:21:48 -0500 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 1vrwcr-0007IG-WF for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcp-0008ML-F1 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:49 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-599-u2Bp3mhwM0ybXtk98bioWg-1; Mon, 16 Feb 2026 06:18:43 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 58E4E18004BB; Mon, 16 Feb 2026 11:18:41 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AA5971800464; Mon, 16 Feb 2026 11:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hLSoXVhoQIeUoHnSqf7NdVnGnnPXay6u7AUxyZ65rWQ=; b=NLbMazNnxJgLHPOGy6Fe6CWYG/MeH3ZEndh9AXeUxc9cB/ToaoWQwsJ6ouySd9kfx5QhmI 3Sc6RV7VLbEQBjVrr+X031j7bAXbzjULdjwQnYV8xqxJIETOmoaZNLARGiLT3hoVa8b4eU Isbz0qJGu61rL7RmGcqMhS1+jkkE/ZU= X-MC-Unique: u2Bp3mhwM0ybXtk98bioWg-1 X-Mimecast-MFC-AGG-ID: u2Bp3mhwM0ybXtk98bioWg_1771240721 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:54 +0100 Subject: [PATCH 65/85] audio/oss: replace custom logging with report & trace MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-65-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=16589; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=lywGw39/K7tbYnTEejhPkXeJI8LPyKiBTCBxJgYT1QE=; b=kA0DAAoB2ujhCXWWnOUByyZiAGmS/FGgfCj2YjnLyA349Yy2aVqG26hNPn8fFkoBofZH157sz okCMwQAAQoAHRYhBIepvZM/h8YG0nb2Ldro4Ql1lpzlBQJpkvxRAAoJENro4Ql1lpzlt5gP/AxQ tV8FrcIA7ePhB3T8atS+KwV57ns5GnHlwvAH5rDBqRziozFSsnknJZz0pIcHXxcLiBc/f7Iv2JD a1aNpweI3DIha8ez0g8WNd/in6t9hxEaFMl4gnmxgr/n29dtYluRRwVISYLrQKqAK1uISTUiINq q9yptjMhUkbp5rWJ9HJtzFnKshz3BAPks4Fd/cJfvHvd6oo/jENTc9GFH/YHMhwMhX8S2y/nkb/ NyeqscBOMee9tarX/i58azdCiGYqYgCApl1ItJnd7o8G7Z/dGf6+nM2XqaGWbH1rHm8YhrWYqHg n0JEMaTLORUbcUSEhVwkhZhn2xUGzLD6CREcOw2dxZwhWU3No5ANwmBx9z0BAlvKVgbQOxS7MRL y/DvfyCPPy+Ssc6yoSe5tIT0VDCa+NCGBNkOeq8Plx1/dv1JZ7aLpBc1C28S/XRib4Q3l1zsNc1 4O7L3IRpx1KcVZqwzT65R2vzJW4XLdIq+DE+7d2GBrQ56D7eb4yZVoPyWDndiPZUh2XjtDHMoWi 0AM8Lio4ObSYR2E7n9+X7PsG4mVuI0VkxIVX93/qLMj7PKrPjO9J6Vx0i7j5USauZlmCOcCLUo8 GgWm2UOTvBvtMeRL+6FRtSSzvdMzUUyUOiCqZxDfBzgTw+am9jxKtkg+aXKkiMfGBHpGba8wTZA DaRYw X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243532288158500 Replace the custom audio logging infrastructure with standard QEMU error reporting and tracing. Note the patch drops DEBUG_MISMATCH condition, and now always trace actual audio parameters. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/ossaudio.c | 176 +++++++++++++++++++++++--------------------------= ---- audio/trace-events | 5 ++ 2 files changed, 81 insertions(+), 100 deletions(-) diff --git a/audio/ossaudio.c b/audio/ossaudio.c index d12c65dd0d7..81f49f9a7e7 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -31,11 +31,10 @@ #include "qemu/host-utils.h" #include "qapi/error.h" #include "qemu/audio.h" +#include "qemu/error-report.h" #include "qom/object.h" -#include "trace.h" - -#define AUDIO_CAP "oss" #include "audio_int.h" +#include "trace.h" =20 #define TYPE_AUDIO_OSS "audio-oss" OBJECT_DECLARE_SIMPLE_TYPE(AudioOss, AUDIO_OSS) @@ -76,43 +75,40 @@ struct oss_params { int fragsize; }; =20 -static void G_GNUC_PRINTF (2, 3) oss_logerr (int err, const char *fmt, ...) +static void G_GNUC_PRINTF(2, 3) oss_logerr(int err, const char *fmt, ...) { va_list ap; =20 - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); + error_printf("oss: "); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); =20 - AUD_log (AUDIO_CAP, "Reason: %s\n", strerror (err)); + error_printf(" Reason: %s\n", strerror(err)); } =20 -static void G_GNUC_PRINTF (3, 4) oss_logerr2 ( - int err, - const char *typ, - const char *fmt, - ... - ) +static void G_GNUC_PRINTF(3, 4) oss_logerr2(int err, const char *typ, + const char *fmt, ...) { va_list ap; =20 - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); + error_printf("oss: Could not initialize %s: ", typ); =20 - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); =20 - AUD_log (AUDIO_CAP, "Reason: %s\n", strerror (err)); + error_printf(" Reason: %s\n", strerror(err)); } =20 -static void oss_anal_close (int *fdp) +static void oss_anal_close(int *fdp) { int err; =20 - qemu_set_fd_handler (*fdp, NULL, NULL, NULL); - err =3D close (*fdp); + qemu_set_fd_handler(*fdp, NULL, NULL, NULL); + err =3D close(*fdp); if (err) { - oss_logerr (errno, "Failed to close file(fd=3D%d)\n", *fdp); + oss_logerr(errno, "Failed to close file(fd=3D%d)", *fdp); } *fdp =3D -1; } @@ -159,10 +155,7 @@ static int aud_to_ossfmt(AudioFormat fmt, bool big_end= ian) return big_endian ? AFMT_U16_BE : AFMT_U16_LE; =20 default: - dolog ("Internal logic error: Bad audio format %d\n", fmt); -#ifdef DEBUG_AUDIO - abort (); -#endif + error_report("oss: Internal logic error: Bad audio format %d", fmt= ); return AFMT_U8; } } @@ -201,27 +194,13 @@ static int oss_to_audfmt (int ossfmt, AudioFormat *fm= t, int *endianness) break; =20 default: - dolog ("Unrecognized audio format %d\n", ossfmt); + error_report("oss: Unrecognized audio format %d", ossfmt); return -1; } =20 return 0; } =20 -#if defined DEBUG_MISMATCHES || defined DEBUG -static void oss_dump_info (struct oss_params *req, struct oss_params *obt) -{ - dolog ("parameter | requested value | obtained value\n"); - dolog ("format | %10d | %10d\n", req->fmt, obt->fmt); - dolog ("channels | %10d | %10d\n", - req->nchannels, obt->nchannels); - dolog ("frequency | %10d | %10d\n", req->freq, obt->freq); - dolog ("nfrags | %10d | %10d\n", req->nfrags, obt->nfrags); - dolog ("fragsize | %10d | %10d\n", - req->fragsize, obt->fragsize); -} -#endif - #ifdef USE_DSP_POLICY static int oss_get_version (int fd, int *version, const char *typ) { @@ -240,7 +219,7 @@ static int oss_get_version (int fd, int *version, const= char *typ) return 0; } #endif - oss_logerr2 (errno, typ, "Failed to get OSS version\n"); + oss_logerr2(errno, typ, "Failed to get OSS version"); return -1; } return 0; @@ -269,7 +248,7 @@ static int oss_open(int in, struct oss_params *req, aud= settings *as, =20 fd =3D open (dspname, oflags | O_NONBLOCK); if (-1 =3D=3D fd) { - oss_logerr2 (errno, typ, "Failed to open `%s'\n", dspname); + oss_logerr2(errno, typ, "Failed to open '%s'", dspname); return -1; } =20 @@ -281,23 +260,23 @@ static int oss_open(int in, struct oss_params *req, a= udsettings *as, qapi_AudiodevOssPerDirectionOptions_base(opdo), as, 23220); =20 if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &fmt)) { - oss_logerr2 (errno, typ, "Failed to set sample size %d\n", req->fm= t); + oss_logerr2(errno, typ, "Failed to set sample size %d", req->fmt); goto err; } =20 if (ioctl (fd, SNDCTL_DSP_CHANNELS, &nchannels)) { - oss_logerr2 (errno, typ, "Failed to set number of channels %d\n", - req->nchannels); + oss_logerr2(errno, typ, "Failed to set number of channels %d", + req->nchannels); goto err; } =20 if (ioctl (fd, SNDCTL_DSP_SPEED, &freq)) { - oss_logerr2 (errno, typ, "Failed to set frequency %d\n", req->freq= ); + oss_logerr2(errno, typ, "Failed to set frequency %d", req->freq); goto err; } =20 if (ioctl (fd, SNDCTL_DSP_NONBLOCK, NULL)) { - oss_logerr2 (errno, typ, "Failed to set non-blocking mode\n"); + oss_logerr2(errno, typ, "Failed to set non-blocking mode"); goto err; } =20 @@ -311,9 +290,9 @@ static int oss_open(int in, struct oss_params *req, aud= settings *as, if (version >=3D 0x040000) { int policy2 =3D policy; if (ioctl(fd, SNDCTL_DSP_POLICY, &policy2)) { - oss_logerr2 (errno, typ, - "Failed to set timing policy to %d\n", - policy); + oss_logerr2(errno, typ, + "Failed to set timing policy to %d", + policy); goto err; } setfragment =3D 0; @@ -325,20 +304,20 @@ static int oss_open(int in, struct oss_params *req, a= udsettings *as, if (setfragment) { int mmmmssss =3D (req->nfrags << 16) | ctz32 (req->fragsize); if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) { - oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)= \n", - req->nfrags, req->fragsize); + oss_logerr2(errno, typ, "Failed to set buffer length (%d, %d)", + req->nfrags, req->fragsize); goto err; } } =20 if (ioctl (fd, in ? SNDCTL_DSP_GETISPACE : SNDCTL_DSP_GETOSPACE, &abin= fo)) { - oss_logerr2 (errno, typ, "Failed to get buffer length\n"); + oss_logerr2(errno, typ, "Failed to get buffer length"); goto err; } =20 if (!abinfo.fragstotal || !abinfo.fragsize) { - AUD_log (AUDIO_CAP, "Returned bogus buffer information(%d, %d) for= %s\n", - abinfo.fragstotal, abinfo.fragsize, typ); + error_report("oss: Returned bogus buffer information(%d, %d) for %= s", + abinfo.fragstotal, abinfo.fragsize, typ); goto err; } =20 @@ -349,20 +328,13 @@ static int oss_open(int in, struct oss_params *req, a= udsettings *as, obt->fragsize =3D abinfo.fragsize; *pfd =3D fd; =20 -#ifdef DEBUG_MISMATCHES - if ((req->fmt !=3D obt->fmt) || - (req->nchannels !=3D obt->nchannels) || - (req->freq !=3D obt->freq) || - (req->fragsize !=3D obt->fragsize) || - (req->nfrags !=3D obt->nfrags)) { - dolog ("Audio parameters mismatch\n"); - oss_dump_info (req, obt); - } -#endif + trace_oss_out_params( + req->fmt, obt->fmt, + req->nchannels, obt->nchannels, + req->freq, obt->freq, + req->nfrags, obt->nfrags, + req->fragsize, obt->fragsize); =20 -#ifdef DEBUG - oss_dump_info (req, obt); -#endif return 0; =20 err: @@ -378,7 +350,7 @@ static size_t oss_get_available_bytes(OSSVoiceOut *oss) =20 err =3D ioctl(oss->fd, SNDCTL_DSP_GETOPTR, &cntinfo); if (err < 0) { - oss_logerr(errno, "SNDCTL_DSP_GETOPTR failed\n"); + oss_logerr(errno, "SNDCTL_DSP_GETOPTR failed"); return 0; } =20 @@ -459,8 +431,7 @@ static size_t oss_write(HWVoiceOut *hw, void *buf, size= _t len) bytes_written =3D write(oss->fd, pcm, len); if (bytes_written < 0) { if (errno !=3D EAGAIN) { - oss_logerr(errno, "failed to write %zu bytes\n", - len); + oss_logerr(errno, "failed to write %zu bytes", len); } return pos; } @@ -474,18 +445,18 @@ static size_t oss_write(HWVoiceOut *hw, void *buf, si= ze_t len) return pos; } =20 -static void oss_fini_out (HWVoiceOut *hw) +static void oss_fini_out(HWVoiceOut *hw) { int err; - OSSVoiceOut *oss =3D (OSSVoiceOut *) hw; + OSSVoiceOut *oss =3D (OSSVoiceOut *)hw; =20 - ldebug ("oss_fini\n"); - oss_anal_close (&oss->fd); + trace_oss_fini_out(); + oss_anal_close(&oss->fd); =20 if (oss->mmapped && hw->buf_emul) { err =3D munmap(hw->buf_emul, hw->size_emul); if (err) { - oss_logerr(errno, "Failed to unmap buffer %p, size %zu\n", + oss_logerr(errno, "Failed to unmap buffer %p, size %zu", hw->buf_emul, hw->size_emul); } hw->buf_emul =3D NULL; @@ -526,8 +497,8 @@ static int oss_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) oss->fragsize =3D obt.fragsize; =20 if (obt.nfrags * obt.fragsize % hw->info.bytes_per_frame) { - dolog ("warning: Misaligned DAC buffer, size %d, alignment %d\n", - obt.nfrags * obt.fragsize, hw->info.bytes_per_frame); + warn_report("oss: Misaligned DAC buffer, size %d, alignment %d", + obt.nfrags * obt.fragsize, hw->info.bytes_per_frame); } =20 hw->samples =3D (obt.nfrags * obt.fragsize) / hw->info.bytes_per_frame; @@ -544,20 +515,16 @@ static int oss_init_out(HWVoiceOut *hw, struct audset= tings *as) 0 ); if (hw->buf_emul =3D=3D MAP_FAILED) { - oss_logerr(errno, "Failed to map %zu bytes of DAC\n", - hw->size_emul); + oss_logerr(errno, "Failed to map %zu bytes of DAC", hw->size_e= mul); hw->buf_emul =3D NULL; } else { int trig =3D 0; if (ioctl (fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { - oss_logerr (errno, "SNDCTL_DSP_SETTRIGGER 0 failed\n"); + oss_logerr(errno, "SNDCTL_DSP_SETTRIGGER 0 failed"); } else { trig =3D PCM_ENABLE_OUTPUT; - if (ioctl (fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { - oss_logerr ( - errno, - "SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n" - ); + if (ioctl(fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { + oss_logerr(errno, "SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OU= TPUT failed"); } else { oss->mmapped =3D 1; } @@ -566,7 +533,7 @@ static int oss_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) if (!oss->mmapped) { err =3D munmap(hw->buf_emul, hw->size_emul); if (err) { - oss_logerr(errno, "Failed to unmap buffer %p size %zu\= n", + oss_logerr(errno, "Failed to unmap buffer %p size %zu", hw->buf_emul, hw->size_emul); } hw->buf_emul =3D NULL; @@ -582,13 +549,14 @@ static int oss_init_out(HWVoiceOut *hw, struct audset= tings *as) static void oss_enable_out(HWVoiceOut *hw, bool enable) { int trig; - OSSVoiceOut *oss =3D (OSSVoiceOut *) hw; + OSSVoiceOut *oss =3D (OSSVoiceOut *)hw; AudiodevOssPerDirectionOptions *opdo =3D oss->dev->u.oss.out; =20 + trace_oss_enable_out(enable); + if (enable) { hw->poll_mode =3D opdo->try_poll; =20 - ldebug("enabling voice\n"); if (hw->poll_mode) { oss_poll_out(hw); } @@ -601,12 +569,12 @@ static void oss_enable_out(HWVoiceOut *hw, bool enabl= e) trig =3D PCM_ENABLE_OUTPUT; if (ioctl(oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { oss_logerr(errno, - "SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n"); + "SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed"); return; } } else { if (hw->poll_mode) { - qemu_set_fd_handler (oss->fd, NULL, NULL, NULL); + qemu_set_fd_handler(oss->fd, NULL, NULL, NULL); hw->poll_mode =3D 0; } =20 @@ -614,10 +582,9 @@ static void oss_enable_out(HWVoiceOut *hw, bool enable) return; } =20 - ldebug ("disabling voice\n"); trig =3D 0; - if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { - oss_logerr (errno, "SNDCTL_DSP_SETTRIGGER 0 failed\n"); + if (ioctl(oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { + oss_logerr(errno, "SNDCTL_DSP_SETTRIGGER 0 failed"); return; } } @@ -654,9 +621,16 @@ static int oss_init_in(HWVoiceIn *hw, struct audsettin= gs *as) oss->nfrags =3D obt.nfrags; oss->fragsize =3D obt.fragsize; =20 + trace_oss_in_params( + req.fmt, obt.fmt, + req.nchannels, obt.nchannels, + req.freq, obt.freq, + req.nfrags, obt.nfrags, + req.fragsize, obt.fragsize); + if (obt.nfrags * obt.fragsize % hw->info.bytes_per_frame) { - dolog ("warning: Misaligned ADC buffer, size %d, alignment %d\n", - obt.nfrags * obt.fragsize, hw->info.bytes_per_frame); + warn_report("oss: Misaligned ADC buffer, size %d, alignment %d", + obt.nfrags * obt.fragsize, hw->info.bytes_per_frame); } =20 hw->samples =3D (obt.nfrags * obt.fragsize) / hw->info.bytes_per_frame; @@ -690,7 +664,7 @@ static size_t oss_read(HWVoiceIn *hw, void *buf, size_t= len) case EAGAIN: break; default: - oss_logerr(errno, "Failed to read %zu bytes of audio (to %= p)\n", + oss_logerr(errno, "Failed to read %zu bytes of audio (to %= p)", len, dst); break; } @@ -706,9 +680,11 @@ static size_t oss_read(HWVoiceIn *hw, void *buf, size_= t len) =20 static void oss_enable_in(HWVoiceIn *hw, bool enable) { - OSSVoiceIn *oss =3D (OSSVoiceIn *) hw; + OSSVoiceIn *oss =3D (OSSVoiceIn *)hw; AudiodevOssPerDirectionOptions *opdo =3D oss->dev->u.oss.out; =20 + trace_oss_enable_in(enable); + if (enable) { hw->poll_mode =3D opdo->try_poll; =20 diff --git a/audio/trace-events b/audio/trace-events index 79744456cec..f33be2dd8e3 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -17,6 +17,11 @@ alsa_enable_in(bool enable) "enable=3D%d" =20 # ossaudio.c oss_version(int version) "OSS version =3D 0x%x" +oss_out_params(int req_fmt, int obt_fmt, int req_channels, int obt_channel= s, int req_freq, int obt_freq, int req_nfrags, int obt_nfrags, int req_frag= size, int obt_fragsize) "fmt=3D%d->%d, channels %d->%d, freq=3D%d->%d, nfra= gs=3D%d->%d, fragsize=3D%d->%d" +oss_in_params(int req_fmt, int obt_fmt, int req_channels, int obt_channels= , int req_freq, int obt_freq, int req_nfrags, int obt_nfrags, int req_frags= ize, int obt_fragsize) "fmt=3D%d->%d, channels %d->%d, freq=3D%d->%d, nfrag= s=3D%d->%d, fragsize=3D%d->%d" +oss_fini_out(void) "" +oss_enable_out(bool enable) "enable=3D%d" +oss_enable_in(bool enable) "enable=3D%d" =20 # dbusaudio.c dbus_audio_register(const char *s, const char *dir) "sender =3D %s, dir = =3D %s" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771245975; cv=none; d=zohomail.com; s=zohoarc; b=KiyxecZVUYOrCx2cAFW2OIWtzxPevVA7jojJaM1bf7/T/16WEHG/Kac8htQ/CQQ/mBONzNUJGqIaiTOLH+VP2bLW97TLb0mMHzLDllKTpCF6AVjM5a2oq2jSlvykYllyxKLOew2fPUGt51uEzMxedig7/8CTP2AZsEU8M4vQr5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771245975; h=Content-Type: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=XVi8lBbZ0x6d3H1xMhZZ9DSsdXtKNj+ngko1jxe7z6A=; b=URQLW7GymwAqMVdCHfYgwa8GGUsiYoxqaxog3m5R+GMt9bxAbyl8+UQO2kVUi1fQq051jB2Q+nACcEgEIJ7Nj1IyQuQ4Wk/dJT0IAtdsyaYl/iiNR7HJH1kEuDUwCxZwVG2TDrfDxs4U6vCi91u6eW1QNjDcOhlAGijlb/wPWS4= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771245974994732.5469266791313; Mon, 16 Feb 2026 04:46:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfl-00013m-AY; Mon, 16 Feb 2026 06:21:49 -0500 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 1vrwcu-0007LB-66 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcr-0008OL-Gf for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:51 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-684-zJtL5P6jP1Csz4OKR2yq9Q-1; Mon, 16 Feb 2026 06:18:45 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F396918005B7; Mon, 16 Feb 2026 11:18:43 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3E21530001B9; Mon, 16 Feb 2026 11:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XVi8lBbZ0x6d3H1xMhZZ9DSsdXtKNj+ngko1jxe7z6A=; b=QzA3BNd1PQwOqe8LicCQnAz+j4PquGT/BRLddV4LWYmqhzy3srDe/nZxf9MVTIn66zBcD3 vFxaHh9SyyneLh1DnkDovBnYrwWrz7Q9SFHkSutGenO4M0QIV1IalS0NCt6lkIkKkugBWC sEyv/SjVZJXmkzUUmwy2l2dm/f6ncLA= X-MC-Unique: zJtL5P6jP1Csz4OKR2yq9Q-1 X-Mimecast-MFC-AGG-ID: zJtL5P6jP1Csz4OKR2yq9Q_1771240724 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:55 +0100 Subject: [PATCH 66/85] audio/pa: replace custom logging with report & trace MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-66-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=12351; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=JVY/WEAWBXacb1I5A+f54VMSEuURH3uia0ld/lulY3A=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRy2drI2ApEGZky9utC6vxFX2Qq7hWFM0w1 gQGbw0SCvSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5UDQD/48AuiOLZKP52JlrfEGLAKncJplORzeyFMSjsEljNCsEY7pGmUB2Bcxuv/54n0wFjdJK0J eWKKFtEyMKMUJGdcMKAzrpL1mCayluCXO6n58vJxFMN+VWhR6yz33Gtn9gKdDQ6rdcuzdIrpsrW lTUkjSRw74/Jx3bIIRwzSzv/fm69unL482SUJp0xuK1ug51cy7rJV9SynQsYo1m1WmlzdqzgxYB zCwRAzYkSyuNVk7QJZf9RstGDJK3DO/Q0IfKUD727aFukJgvfqkhSVfgk+cRL37wrvt5DC9My1f K6dBQrs9KdtW3R8OFxOD8WrDk7LuiRVWen552brdjOkixBiRwQM3vccTirhm6LoLtW0qwoKHlHA SiN2QjGnUkfgbEXJgdJrPCIY+bzWeY6UYxsxpVd772gevm1SnDNrG/gqJfPqMNDKQUHv+UsipXm 09a/6iWWrY8aKmo/iq+mjuiwt4T7M8+PD7gscF9Cwr0lOh2ph09fxhmGABXn9+WjIL2iPSl2Deq Duh7hrc8lutuORf/wc3E306CEJcUxNJkyVBV8wMs03x34fTjH1aH257eAup//OJNh7mTjlFqIar ZxxJPLxs+VAP2VzZu2NedpZYmuP57JHHP4kG5Boxo+epjdfqJkKecMhTvOMM1vwbgfPdRtS5mze RYpJOv2Ynod6oNQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771246000377158500 Replace the custom audio logging infrastructure with standard QEMU error reporting and tracing. qpa_conn_init() is called during audio_pa_realize() and already reports an error through Error *. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/paaudio.c | 77 ++++++++++++++++++++++++++++-------------------------= ---- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index b7826402e12..1501b26386a 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -3,14 +3,13 @@ #include "qemu/osdep.h" #include "qemu/module.h" #include "qemu/audio.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qom/object.h" +#include "audio_int.h" =20 #include =20 -#define AUDIO_CAP "pulseaudio" -#include "audio_int.h" - #define TYPE_AUDIO_PA "audio-pa" OBJECT_DECLARE_SIMPLE_TYPE(AudioPa, AUDIO_PA) =20 @@ -51,15 +50,16 @@ typedef struct { =20 static void qpa_conn_fini(PAConnection *c); =20 -static void G_GNUC_PRINTF (2, 3) qpa_logerr (int err, const char *fmt, ...) +static void G_GNUC_PRINTF(2, 3) qpa_logerr(int err, const char *fmt, ...) { va_list ap; =20 - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); + error_printf("pulseaudio: "); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); =20 - AUD_log (AUDIO_CAP, "Reason: %s\n", pa_strerror (err)); + error_printf(" Reason: %s\n", pa_strerror(err)); } =20 #ifndef PA_CONTEXT_IS_GOOD @@ -113,12 +113,12 @@ static void *qpa_get_buffer_in(HWVoiceIn *hw, size_t = *size) pa_threaded_mainloop_lock(c->mainloop); =20 CHECK_DEAD_GOTO(c, p->stream, unlock_and_fail, - "pa_threaded_mainloop_lock failed\n"); + "pa_threaded_mainloop_lock failed"); =20 if (!p->read_length) { r =3D pa_stream_peek(p->stream, &p->read_data, &p->read_length); CHECK_SUCCESS_GOTO(c, r =3D=3D 0, unlock_and_fail, - "pa_stream_peek failed\n"); + "pa_stream_peek failed"); } =20 *size =3D MIN(p->read_length, *size); @@ -141,7 +141,7 @@ static void qpa_put_buffer_in(HWVoiceIn *hw, void *buf,= size_t size) pa_threaded_mainloop_lock(c->mainloop); =20 CHECK_DEAD_GOTO(c, p->stream, unlock, - "pa_threaded_mainloop_lock failed\n"); + "pa_threaded_mainloop_lock failed"); =20 assert(buf =3D=3D p->read_data && size <=3D p->read_length); =20 @@ -150,7 +150,7 @@ static void qpa_put_buffer_in(HWVoiceIn *hw, void *buf,= size_t size) =20 if (size && !p->read_length) { r =3D pa_stream_drop(p->stream); - CHECK_SUCCESS_GOTO(c, r =3D=3D 0, unlock, "pa_stream_drop failed\n= "); + CHECK_SUCCESS_GOTO(c, r =3D=3D 0, unlock, "pa_stream_drop failed"); } =20 unlock: @@ -166,7 +166,7 @@ static size_t qpa_read(HWVoiceIn *hw, void *data, size_= t length) pa_threaded_mainloop_lock(c->mainloop); =20 CHECK_DEAD_GOTO(c, p->stream, unlock_and_fail, - "pa_threaded_mainloop_lock failed\n"); + "pa_threaded_mainloop_lock failed"); if (pa_stream_get_state(p->stream) !=3D PA_STREAM_READY) { /* wait for stream to become ready */ goto unlock; @@ -179,7 +179,7 @@ static size_t qpa_read(HWVoiceIn *hw, void *data, size_= t length) if (!p->read_length) { r =3D pa_stream_peek(p->stream, &p->read_data, &p->read_length= ); CHECK_SUCCESS_GOTO(c, r =3D=3D 0, unlock_and_fail, - "pa_stream_peek failed\n"); + "pa_stream_peek failed"); if (!p->read_length) { /* buffer is empty */ break; @@ -196,7 +196,7 @@ static size_t qpa_read(HWVoiceIn *hw, void *data, size_= t length) if (!p->read_length) { r =3D pa_stream_drop(p->stream); CHECK_SUCCESS_GOTO(c, r =3D=3D 0, unlock_and_fail, - "pa_stream_drop failed\n"); + "pa_stream_drop failed"); } } =20 @@ -218,7 +218,7 @@ static size_t qpa_buffer_get_free(HWVoiceOut *hw) pa_threaded_mainloop_lock(c->mainloop); =20 CHECK_DEAD_GOTO(c, p->stream, unlock_and_fail, - "pa_threaded_mainloop_lock failed\n"); + "pa_threaded_mainloop_lock failed"); if (pa_stream_get_state(p->stream) !=3D PA_STREAM_READY) { /* wait for stream to become ready */ l =3D 0; @@ -227,7 +227,7 @@ static size_t qpa_buffer_get_free(HWVoiceOut *hw) =20 l =3D pa_stream_writable_size(p->stream); CHECK_SUCCESS_GOTO(c, l !=3D (size_t) -1, unlock_and_fail, - "pa_stream_writable_size failed\n"); + "pa_stream_writable_size failed"); =20 unlock: pa_threaded_mainloop_unlock(c->mainloop); @@ -248,12 +248,12 @@ static void *qpa_get_buffer_out(HWVoiceOut *hw, size_= t *size) pa_threaded_mainloop_lock(c->mainloop); =20 CHECK_DEAD_GOTO(c, p->stream, unlock_and_fail, - "pa_threaded_mainloop_lock failed\n"); + "pa_threaded_mainloop_lock failed"); =20 *size =3D -1; r =3D pa_stream_begin_write(p->stream, &ret, size); CHECK_SUCCESS_GOTO(c, r >=3D 0, unlock_and_fail, - "pa_stream_begin_write failed\n"); + "pa_stream_begin_write failed"); =20 pa_threaded_mainloop_unlock(c->mainloop); return ret; @@ -273,10 +273,10 @@ static size_t qpa_put_buffer_out(HWVoiceOut *hw, void= *data, size_t length) pa_threaded_mainloop_lock(c->mainloop); =20 CHECK_DEAD_GOTO(c, p->stream, unlock_and_fail, - "pa_threaded_mainloop_lock failed\n"); + "pa_threaded_mainloop_lock failed"); =20 r =3D pa_stream_write(p->stream, data, length, NULL, 0LL, PA_SEEK_RELA= TIVE); - CHECK_SUCCESS_GOTO(c, r >=3D 0, unlock_and_fail, "pa_stream_write fail= ed\n"); + CHECK_SUCCESS_GOTO(c, r >=3D 0, unlock_and_fail, "pa_stream_write fail= ed"); =20 pa_threaded_mainloop_unlock(c->mainloop); return length; @@ -296,7 +296,7 @@ static size_t qpa_write(HWVoiceOut *hw, void *data, siz= e_t length) pa_threaded_mainloop_lock(c->mainloop); =20 CHECK_DEAD_GOTO(c, p->stream, unlock_and_fail, - "pa_threaded_mainloop_lock failed\n"); + "pa_threaded_mainloop_lock failed"); if (pa_stream_get_state(p->stream) !=3D PA_STREAM_READY) { /* wait for stream to become ready */ l =3D 0; @@ -306,14 +306,14 @@ static size_t qpa_write(HWVoiceOut *hw, void *data, s= ize_t length) l =3D pa_stream_writable_size(p->stream); =20 CHECK_SUCCESS_GOTO(c, l !=3D (size_t) -1, unlock_and_fail, - "pa_stream_writable_size failed\n"); + "pa_stream_writable_size failed"); =20 if (l > length) { l =3D length; } =20 r =3D pa_stream_write(p->stream, data, l, NULL, 0LL, PA_SEEK_RELATIVE); - CHECK_SUCCESS_GOTO(c, r >=3D 0, unlock_and_fail, "pa_stream_write fail= ed\n"); + CHECK_SUCCESS_GOTO(c, r >=3D 0, unlock_and_fail, "pa_stream_write fail= ed"); =20 unlock: pa_threaded_mainloop_unlock(c->mainloop); @@ -345,7 +345,7 @@ static pa_sample_format_t audfmt_to_pa(AudioFormat afmt= , bool big_endian) format =3D big_endian ? PA_SAMPLE_FLOAT32BE : PA_SAMPLE_FLOAT32LE; break; default: - dolog ("Internal logic error: Bad audio format %d\n", afmt); + error_report("pulseaudio: Internal logic error: Bad audio format %= d", afmt); format =3D PA_SAMPLE_U8; break; } @@ -376,12 +376,12 @@ static AudioFormat pa_to_audfmt (pa_sample_format_t f= mt, int *endianness) *endianness =3D 0; return AUDIO_FORMAT_F32; default: - dolog ("Internal logic error: Bad pa_sample_format %d\n", fmt); + error_report("pulseaudio: Internal logic error: Bad pa_sample_form= at %d", fmt); return AUDIO_FORMAT_U8; } } =20 -static void context_state_cb (pa_context *c, void *userdata) +static void context_state_cb(pa_context *c, void *userdata) { PAConnection *conn =3D userdata; =20 @@ -473,7 +473,7 @@ static pa_stream *qpa_simple_new ( break; =20 default: - dolog("Internal error: unsupported channel count %d\n", ss->channe= ls); + error_report("pulseaudio: unsupported channel count %d", ss->chann= els); goto fail; } =20 @@ -553,7 +553,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) &error ); if (!pa->stream) { - qpa_logerr (error, "pa_simple_new for playback failed\n"); + qpa_logerr(error, "pa_simple_new for playback failed"); goto fail1; } =20 @@ -604,7 +604,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsetting= s *as) &error ); if (!pa->stream) { - qpa_logerr (error, "pa_simple_new for capture failed\n"); + qpa_logerr(error, "pa_simple_new for capture failed"); goto fail1; } =20 @@ -633,7 +633,7 @@ static void qpa_simple_disconnect(PAConnection *c, pa_s= tream *stream) =20 err =3D pa_stream_disconnect(stream); if (err !=3D 0) { - dolog("Failed to disconnect! err=3D%d\n", err); + error_report("pulseaudio: Failed to disconnect! err=3D%d", err); } pa_stream_unref(stream); } @@ -664,7 +664,7 @@ static void qpa_fini_in (HWVoiceIn *hw) int r =3D pa_stream_drop(pa->stream); if (r) { qpa_logerr(pa_context_errno(c->context), - "pa_stream_drop failed\n"); + "pa_stream_drop failed"); } pa->read_length =3D 0; } @@ -698,7 +698,7 @@ static void qpa_volume_out(HWVoiceOut *hw, Volume *vol) &v, NULL, NULL); if (!op) { qpa_logerr(pa_context_errno(c->context), - "set_sink_input_volume() failed\n"); + "set_sink_input_volume() failed"); } else { pa_operation_unref(op); } @@ -708,7 +708,7 @@ static void qpa_volume_out(HWVoiceOut *hw, Volume *vol) vol->mute, NULL, NULL); if (!op) { qpa_logerr(pa_context_errno(c->context), - "set_sink_input_mute() failed\n"); + "set_sink_input_mute() failed"); } else { pa_operation_unref(op); } @@ -740,7 +740,7 @@ static void qpa_volume_in(HWVoiceIn *hw, Volume *vol) &v, NULL, NULL); if (!op) { qpa_logerr(pa_context_errno(c->context), - "set_source_output_volume() failed\n"); + "set_source_output_volume() failed"); } else { pa_operation_unref(op); } @@ -750,7 +750,7 @@ static void qpa_volume_in(HWVoiceIn *hw, Volume *vol) vol->mute, NULL, NULL); if (!op) { qpa_logerr(pa_context_errno(c->context), - "set_source_output_mute() failed\n"); + "set_source_output_mute() failed"); } else { pa_operation_unref(op); } @@ -788,7 +788,7 @@ static void *qpa_conn_init(const char *server) =20 if (pa_context_connect(c->context, server, 0, NULL) < 0) { qpa_logerr(pa_context_errno(c->context), - "pa_context_connect() failed\n"); + "pa_context_connect() failed"); goto fail; } =20 @@ -809,7 +809,7 @@ static void *qpa_conn_init(const char *server) =20 if (!PA_CONTEXT_IS_GOOD(state)) { qpa_logerr(pa_context_errno(c->context), - "Wrong context state\n"); + "Wrong context state"); goto unlock_and_fail; } =20 @@ -823,7 +823,6 @@ static void *qpa_conn_init(const char *server) unlock_and_fail: pa_threaded_mainloop_unlock(c->mainloop); fail: - AUD_log (AUDIO_CAP, "Failed to initialize PA context"); qpa_conn_fini(c); return NULL; } --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244701; cv=none; d=zohomail.com; s=zohoarc; b=TgPmRI7hCZx5z8hI2fEzFZukm+VPv/AnBWxCuPCEy5ygijD2wynOgtF9OHJsjfnIgHacJsuWDD005kb+cWYHF/iyw+Ic2GxFOR3htn4fgQ5MjwPbWYvIorKOT0VY/llp+8KLhfO2pN54fZTmxUk0BS6p5sRSaNRHcjB0MIS43Lk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244701; h=Content-Type: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=f2dXnZAb4GQ3OqunerrTarsSyOPnsFPU054yEOgQ/M0=; b=eRFFOqwIFiReAUvHvdJcyvFMSvNUx76LEc3LTkXxMP6Wef9218DmNMHb1TT6OL72SswNYBJDgqqfosSrE37t27wF/b/iS/uBLn4+5fN12U7XEyI5U1EHDT4kpc8/vGorRXmKHYF/58Df+ElK9EiTg1nVTSHaiMdkAd5M9c8Psv8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244701885597.2830525575439; Mon, 16 Feb 2026 04:25:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfP-0006jY-F4; Mon, 16 Feb 2026 06:21:27 -0500 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 1vrwcx-0007NK-KC for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcv-0008P2-5V for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:55 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-600-Mwrem7XYPm-sZi5F77Bv5g-1; Mon, 16 Feb 2026 06:18:48 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 575A81955D8D; Mon, 16 Feb 2026 11:18:46 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AE32130001A5; Mon, 16 Feb 2026 11:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f2dXnZAb4GQ3OqunerrTarsSyOPnsFPU054yEOgQ/M0=; b=L9Gup3PM5j6v3YBZ3UYi8F54OY6MuOfbxRsCsJ9ACL8U0NqYJbPSyzW9eXwsrKOxvdVLu5 uGlmdORel91I7HbKXx1iDvm004kHwjyuMjAR+qpIK6+Mo3QLdZlDEock4Km9ABramvCcHj 8zyLQ64uoMAacyhlw4mc45aUCm9CNOM= X-MC-Unique: Mwrem7XYPm-sZi5F77Bv5g-1 X-Mimecast-MFC-AGG-ID: Mwrem7XYPm-sZi5F77Bv5g_1771240726 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:56 +0100 Subject: [PATCH 67/85] audio/pw: replace custom logging with error_report MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-67-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland , Thomas Huth X-Developer-Signature: v=1; a=openpgp-sha256; l=2025; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=9XNiYrTBg8/TjuL3Pf/yXDW/8WV5yurqmx3CbFtxjhs=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRSfLO9lhGAIAH3YGIPwWElH4Mul7Hib5HK 35X9PJePGqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5UVtD/4hBQEGov6kG25Fo3wIZ4XoC+OUUtYUBYbExsdpwvRV9u6PriUD/wbSI6t7vtwZqh3YmsG ffVaMEHgjnq4xCRx3Ku5ohAAk7ng4PW9udOkEKoIBd4jFoHZvqTAGLuctUlrrsY/1AoOZHHFl4W xe8qhEZIMXLNoDYWA9cQ5LQnmTqsBmhTNgjr+3Iio43g/OyiJiyPxT64QFT0Dnw+O7Lo8m5cuwn k028BB6BAPqn06TbU0thagkhsN1BNrlD2gKpAXcVM0N2H1PJK5bUfFkkBpwxdl5dKiBHh6bu5PH mbvYSGIQQJ8LoUiGRyhet/kN80enWRypYLN6RiWW/+H5Zf+3hL2vjSccJh/CURs2sR/xfhEWKHw mq/WEJe8UKWT4Y0geGK4PKw4er7vqzWCKrSUrj+5bXCq0S6UYQobLXdRcI/izvP9QGop0EHtCsn TOEAdvFD7EjSEOq8oVCVFrjok4TIJh6DPFsMEav2WLicZk6TJXaH5Gbidmbj9F5lVStvHEThWqY uyPmgS8yzwBo87/sxKjIoA+vIMSt31OZ24sjeoNViXWJQjLKZNnUrlhlw4StayW9BhD2TujDGnc QM3RbTmANEUCzMqYBNOe6/0fan+x80MRf+V3BDaWgvbWEja41PmeMFkzK1PteYBjJZ1Ebtfm7oL dDYhn8YKVNLFGTA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244703863154100 Replace the custom audio logging infrastructure (dolog macro) with standard QEMU error reporting (error_report). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Thomas Huth Reviewed-by: Akihiko Odaki --- audio/pwaudio.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/audio/pwaudio.c b/audio/pwaudio.c index 7a009a94f3a..6a80e5a333e 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -20,14 +20,13 @@ #include =20 #include + +#include "audio_int.h" #include "trace.h" =20 -#define AUDIO_CAP "pipewire" #define RINGBUFFER_SIZE (1u << 22) #define RINGBUFFER_MASK (RINGBUFFER_SIZE - 1) =20 -#include "audio_int.h" - #define TYPE_AUDIO_PW "audio-pipewire" OBJECT_DECLARE_SIMPLE_TYPE(AudioPw, AUDIO_PW) =20 @@ -358,7 +357,7 @@ audfmt_to_pw(AudioFormat fmt, bool big_endian) format =3D big_endian ? SPA_AUDIO_FORMAT_F32_BE : SPA_AUDIO_FORMAT= _F32_LE; break; default: - dolog("Internal logic error: Bad audio format %d\n", fmt); + error_report("pipewire: internal logic error: bad audio format %d"= , fmt); format =3D SPA_AUDIO_FORMAT_U8; break; } @@ -418,7 +417,7 @@ pw_to_audfmt(enum spa_audio_format fmt, int *endianness, return AUDIO_FORMAT_F32; default: *sample_size =3D 1; - dolog("Internal logic error: Bad spa_audio_format %d\n", fmt); + error_report("pipewire: internal logic error: bad spa_audio_format= %d", fmt); return AUDIO_FORMAT_U8; } } @@ -518,7 +517,7 @@ qpw_set_position(uint32_t channels, uint32_t position[S= PA_AUDIO_MAX_CHANNELS]) position[0] =3D SPA_AUDIO_CHANNEL_MONO; break; default: - dolog("Internal error: unsupported channel count %d\n", channels); + error_report("pipewire: unsupported channel count %d", channels); } } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243431; cv=none; d=zohomail.com; s=zohoarc; b=SaiqXGQOLfjQjdxgYOzvCNdzy17POLaws/6WBJ6A+77cosoMb0jyisWKW4K+vJoQ1Qv4EdmBj9JSwVmEgJJbN/ZpIGCgvsJqfZ8wjJ0c2Ye8ov9U1hwP+VvSnNO+nSo4m7kMQ16+MoN3YrLdtBXix4Ug1kHbcfvAx6f7H3GaeVc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243431; h=Content-Type: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=VFkfaoxr/ut97cWdnq1cYjjnuVQk6XLSkYyC2tDUZnU=; b=YLqbw+GUBXVywoq6afGQDFOTrb8hm44G1Z6f7Ac5pvaSvcuTkiiSVqD6zQgr13EvS+NmJXnS0cuvpQXqvL6V6U8W4r3aksFNEQFmi7rkbODhD+1iBdBJXIOMIdAVQfNm1wmyml2sWlvJP+Zb0lsqkUREEdNDEV+sz0uKaxkbJ4g= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243431121995.2376601015201; Mon, 16 Feb 2026 04:03:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfe-0000Gy-79; Mon, 16 Feb 2026 06:21:42 -0500 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 1vrwcz-0007OJ-9n for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwcx-0008PL-HP for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:57 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-34-R09qfEgPMLCnKkap6eOMzQ-1; Mon, 16 Feb 2026 06:18:51 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6F4281800259; Mon, 16 Feb 2026 11:18:49 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5BEA618003F5; Mon, 16 Feb 2026 11:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VFkfaoxr/ut97cWdnq1cYjjnuVQk6XLSkYyC2tDUZnU=; b=VIM2LYGjete46DWD0VlizwdSBHMQOXQyS4oDxMVfJXw/76yN2lNJ7r7sC6TsLP/RCGqLfb afpC0zDITQoZyQEY+uVrlLIq8bpwFZGG/xexsZ3vfoZzYsj2g0xgRXputKErqumEBC8RTd j+js0dA3kXHoyGYSQziPwxISMP/hVhY= X-MC-Unique: R09qfEgPMLCnKkap6eOMzQ-1 X-Mimecast-MFC-AGG-ID: R09qfEgPMLCnKkap6eOMzQ_1771240729 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:57 +0100 Subject: [PATCH 68/85] audio/sdl: replace custom logging with error_report MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-68-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland , Thomas Huth X-Developer-Signature: v=1; a=openpgp-sha256; l=4310; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Gn3WILxoPJAdsQuhXzBqAuStlGu4nqLwJFp2NZ4IZow=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRETj/q3txCvED93aDLMvSuZ8Ocd/u4aov9 GG9p9nZp3+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5eqUD/97hpvOdcFFIZH/83/e20nye1/j7tZQsFEEejX/jrJ8WNJ7GYy02PJp0miTn2LJ1hI1W6P x9di2RYPVlurujFPSsOKQgAQ6+ExFhXP+Q2uVZfg2CTb/bfOuTIAb182dzNuibzcrT+7JiLbwmo /W+r8ZsVBf5FVtM6aSV6ceXn35mhMRVRbn/DlsY70UMBmjC4sLgT4R2ETni5ZTJyq7oujoz7kuc djhBVnTiFpbz/KYDR5JJKqM6bf7XH2zByQRr+qmRMngRUjyG5SBQJFqmqwCH/dao2DDFiMtjy8B +16380/SysbKAyTR8WUr+zj5LTeE9jRmtCzcMSWSykbobvf0114iKJrYFKV0vPb2gUZ/pYlCjvh hIXWX3K5tMQhGFw/vDyK64T3JI5RNgPEPYKhNHVEV4VDVVEYOTvBALcCbDK+4KtSUark9Fep+YU yKn2w1pzHios0T5b0h3LRBl/FtzlppHXeHo38X8mZVQ38U24i8xjQdRH9D4jvg9BpNMJ+wkQTR4 Rx6tSPG8PjH+Lw+OmijFvbz2qhJgaX2zE9ngbmCthaEHdXgfWBA4CY+lwd+ecgmc3kDs5FSuTHW 82vxX1CD4wgFjznXWWV625L+dAvXGR5vrcfRFcD2btn1UsJkp4Lhojrvm0koatBtnCo/sUZ4zsM wobr+H3DV3J8afg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243433639158500 Replace the custom audio logging infrastructure (dolog macro and AUD_log/AUD_vlog) with standard QEMU error reporting (error_report, error_printf, error_vprintf). Note that we also dropped the abort() call in DEBUG_AUDIO, as it is not usually compiled with, doesn't help much, and can easily be added back when doing development as needed. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Thomas Huth Reviewed-by: Akihiko Odaki --- audio/sdlaudio.c | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index d974d7eac46..5f332678209 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -26,6 +26,7 @@ #include #include #include "qemu/module.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu/audio.h" #include "qom/object.h" @@ -38,7 +39,6 @@ #endif #endif =20 -#define AUDIO_CAP "sdl" #include "audio_int.h" =20 #define TYPE_AUDIO_SDL "audio-sdl" @@ -67,17 +67,6 @@ typedef struct SDLVoiceIn { SDL_AudioDeviceID devid; } SDLVoiceIn; =20 -static void G_GNUC_PRINTF (1, 2) sdl_logerr (const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", SDL_GetError ()); -} - static int aud_to_sdlfmt (AudioFormat fmt) { switch (fmt) { @@ -102,10 +91,7 @@ static int aud_to_sdlfmt (AudioFormat fmt) return AUDIO_F32LSB; =20 default: - dolog ("Internal logic error: Bad audio format %d\n", fmt); -#ifdef DEBUG_AUDIO - abort (); -#endif + error_report("sdl: internal logic error: bad audio format %d", fmt= ); return AUDIO_U8; } } @@ -164,7 +150,7 @@ static int sdl_to_audfmt(int sdlfmt, AudioFormat *fmt, = int *endianness) break; =20 default: - dolog ("Unrecognized SDL audio format %d\n", sdlfmt); + error_report("sdl: unrecognized audio format %d", sdlfmt); return -1; } =20 @@ -182,27 +168,27 @@ static SDL_AudioDeviceID sdl_open(SDL_AudioSpec *req,= SDL_AudioSpec *obt, /* Make sure potential threads created by SDL don't hog signals. */ err =3D sigfillset (&new); if (err) { - dolog ("sdl_open: sigfillset failed: %s\n", strerror (errno)); + error_report("sdl: sigfillset failed: %s", strerror (errno)); return 0; } err =3D pthread_sigmask (SIG_BLOCK, &new, &old); if (err) { - dolog ("sdl_open: pthread_sigmask failed: %s\n", strerror (err)); + error_report("sdl: pthread_sigmask failed: %s", strerror (err)); return 0; } #endif =20 devid =3D SDL_OpenAudioDevice(NULL, rec, req, obt, 0); if (!devid) { - sdl_logerr("SDL_OpenAudioDevice for %s failed\n", - rec ? "recording" : "playback"); + error_report("SDL_OpenAudioDevice for %s failed: %s", + rec ? "recording" : "playback", SDL_GetError()); } =20 #ifndef _WIN32 err =3D pthread_sigmask (SIG_SETMASK, &old, NULL); if (err) { - dolog ("sdl_open: pthread_sigmask (restore) failed: %s\n", - strerror (errno)); + error_report("sdl: pthread_sigmask (restore) failed: %s", + strerror (errno)); /* We have failed to restore original signal mask, all bets are of= f, so exit the process */ exit (EXIT_FAILURE); @@ -233,8 +219,6 @@ static void sdl_callback_out(void *opaque, Uint8 *buf, = int len) =20 if (!sdl->exit) { =20 - /* dolog("callback_out: len=3D%d avail=3D%zu\n", len, hw->pending_= emul); */ - while (hw->pending_emul && len) { size_t write_len, start; =20 @@ -283,8 +267,6 @@ static void sdl_callback_in(void *opaque, Uint8 *buf, i= nt len) return; } =20 - /* dolog("callback_in: len=3D%d pending=3D%zu\n", len, hw->pending_emu= l); */ - while (hw->pending_emul < hw->size_emul && len) { size_t read_len =3D MIN(len, MIN(hw->size_emul - hw->pos_emul, hw->size_emul - hw->pending_emul)); --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242588; cv=none; d=zohomail.com; s=zohoarc; b=gsOQMDHdsDfnZkjshxuPjtLb1hvq/mn/Mn5u7IAJSvq6/p5H85FgVTbeEdVxXpnA9mDyV7VnIetBE1vLYqI8LGLzq6M6cYcMPmb0J1hXa5U1wtbt+vYKmC64fs9eCq6PBiLMgiTpW4hd3XVtxexu6d+O2w5stMSYlr+4eE6WCvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242588; h=Content-Type: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=zZPwP50pYxUr6MP+yYvCFJCeqAndqgUmshxGKnX4ZHc=; b=gcRZMPAKd0Wy/K7Wq9h+bL11fQ+iwlj0ahyzcrZvBEwUZaTxlq+hZF+SoSGgOMD3EHi4ZR/3M5/3dHY/ozIpuEuED+iO4233/4erurdvYXAIuVT0YKOmgLBwflWqcuiS5zOTFa++gomq4E1poe6JKGqaG93B0faO0EzRyP77Yc8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242588479741.401456001256; Mon, 16 Feb 2026 03:49:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfV-0007aW-7J; Mon, 16 Feb 2026 06:21:33 -0500 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 1vrwd3-0007Sp-UF for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwd1-0008Pv-62 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:01 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-228-8W2w716eMz2pe1Ymxx73KA-1; Mon, 16 Feb 2026 06:18:54 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DD35C1956089; Mon, 16 Feb 2026 11:18:51 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 546601800464; Mon, 16 Feb 2026 11:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zZPwP50pYxUr6MP+yYvCFJCeqAndqgUmshxGKnX4ZHc=; b=bY3/3rUoUuvd6WdNtEbpT3v9Z8APV4CV782cX9cOIuLcjkb5OkP2zcRUmU1L6alq7GnLxV MGjMFqr5XoRLRqgqJA8/7I16hXkvWArvzsZ2R9EWjvOHsL+kcbkeGpIQtfIkH8oQ2ZOPP/ Z+ThBY1Wq7J60/Ss3UhEm4SDN/Bwe64= X-MC-Unique: 8W2w716eMz2pe1Ymxx73KA-1 X-Mimecast-MFC-AGG-ID: 8W2w716eMz2pe1Ymxx73KA_1771240732 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:58 +0100 Subject: [PATCH 69/85] audio/sndio: replace custom logging with error_report MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-69-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Thomas Huth , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3292; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=8yW9wJ3mIfAWUvsc6PEfigNiDWoTGEQkRlzr3mI/fbs=; b=kA0DAAoB2ujhCXWWnOUByyZiAGmS/FGj/RWAwCaalX3Sad3mihLN/7gHO9AimlvuTKXg6QHZW IkCMwQAAQoAHRYhBIepvZM/h8YG0nb2Ldro4Ql1lpzlBQJpkvxRAAoJENro4Ql1lpzlf+AP/0Hf 9dfWzN4T09rWtuvAlg1E/wN4VBXt0eI3AatGe5dpxfHfpDTW8Gf1zggK5Qx7mNMyI2KMJUJJwDM UTXQ5P7Y1Ic6ZXnEpfdCb/DIJl1Pf4YrGcItguC5V5aOoi6PpjZEwfDnotJRPyJkJDNYJEnYpdR zfkd7dVkVSrWfN3NU91ql4qSJgp/0p1qvHeUeLCtzdqux6NUiyT8QQqLfHnuRlf+hKXDP3qeLoS H/jylL1pNwpj86uuWs/d6zo2+SzI/X+ZV+tk7rzB1h5g7xiBYY//U7iKMsOf5JD/R/URdsKG74C kUavivCFGwenRs38C5IdjZA14Ux520EYvlipOUd3D77am1d5fmsZk7VWCfwMZF0b121LJ/ubwSw dovC0BR2Xzu1tigP7BYQQDg38dCLxtuhXICuOFeraMJrFRI0jRJiB/DJdgMEEI1D4lT8EiXu9Vo raL2REVIggU7YvUbB3aDVdFObTivxJhssArngKrEvUeKRPiBT2ZcJoAxgNyCJktyqir1hwkMECW QViUnBOFVaoQM+dhnK9XO9bIKTGS1NyXSbK9dNJsoolFyJxjLuRDat5U9DawIKfxrEfMuLsJV9A tEQq8fWxNIhZBtdRnSOPAiSxCgExnHzhM+ZtloJ6Ya8IELrwEcQrij7HcUyjD5CqQg9DXM41f3b U0XhE X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771242604197158500 Replace the custom audio logging infrastructure (dolog macro) with standard QEMU error reporting (error_report). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Thomas Huth Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/sndioaudio.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 21f43836fd1..766eceeeefe 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -18,12 +18,12 @@ #include #include #include "qemu/main-loop.h" +#include "qemu/error-report.h" #include "qemu/audio.h" -#include "trace.h" #include "qom/object.h" =20 -#define AUDIO_CAP "sndio" #include "audio_int.h" +#include "trace.h" =20 #define TYPE_AUDIO_SNDIO "audio-sndio" OBJECT_DECLARE_SIMPLE_TYPE(AudioSndio, AUDIO_SNDIO) @@ -348,7 +348,7 @@ static int sndio_init(SndioVoice *self, /* open the device in non-blocking mode */ self->hdl =3D sio_open(dev_name, mode, 1); if (self->hdl =3D=3D NULL) { - dolog("failed to open device\n"); + error_report("sndio: failed to open device"); return -1; } =20 @@ -382,7 +382,7 @@ static int sndio_init(SndioVoice *self, req.sig =3D 0; break; default: - dolog("unknown audio sample format\n"); + error_report("sndio: unknown audio sample format"); return -1; } =20 @@ -401,12 +401,12 @@ static int sndio_init(SndioVoice *self, req.appbufsz =3D req.rate * latency / 1000000; =20 if (!sio_setpar(self->hdl, &req)) { - dolog("failed set audio params\n"); + error_report("sndio: failed to set audio params"); goto fail; } =20 if (!sio_getpar(self->hdl, &self->par)) { - dolog("failed get audio params\n"); + error_report("sndio: failed to get audio params"); goto fail; } =20 @@ -419,7 +419,7 @@ static int sndio_init(SndioVoice *self, if (self->par.bits !=3D req.bits || self->par.bps !=3D req.bits / 8 || self->par.sig !=3D req.sig || (req.bits > 8 && self->par.le !=3D r= eq.le) || self->par.rate !=3D as->freq || nch !=3D as->nchannels) { - dolog("unsupported audio params\n"); + error_report("sndio: unsupported audio params"); goto fail; } =20 @@ -431,7 +431,7 @@ static int sndio_init(SndioVoice *self, =20 self->buf =3D g_malloc(self->buf_size); if (self->buf =3D=3D NULL) { - dolog("failed to allocate audio buffer\n"); + error_report("sndio: failed to allocate audio buffer"); goto fail; } =20 @@ -439,13 +439,13 @@ static int sndio_init(SndioVoice *self, =20 self->pfds =3D g_malloc_n(nfds, sizeof(struct pollfd)); if (self->pfds =3D=3D NULL) { - dolog("failed to allocate pollfd structures\n"); + error_report("sndio: failed to allocate pollfd structures"); goto fail; } =20 self->pindexes =3D g_malloc_n(nfds, sizeof(struct pollindex)); if (self->pindexes =3D=3D NULL) { - dolog("failed to allocate pollindex structures\n"); + error_report("sndio: failed to allocate pollindex structures"); goto fail; } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244787; cv=none; d=zohomail.com; s=zohoarc; b=eYMwfSIj8Y0q6GOHdwemZB4St/+e8qpCKIz8HfiqRT0NSUqhworzreR7JpVZexbROb7devWABsbOvztk28Lc1KYDkiGlKOjmkM/hTw2Mc1ahxjB8NbUN09jXHLOrfryQQUGC4KYLmB9D2UfXfqoMGn/SqDsR5ASj8C1cqKAGMXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244787; h=Content-Type: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=KAKt4CvCFG4mzYabTt4mTrA6Ft2BKrJ6zjij58RhywI=; b=gxpmyS8bS9bD05a5vnlvLIHAHjtSaSVJ0uwmrCE2FbkCM38L6FzVMAAYDOxXXmJg5zwgrakLXqkzw4NnI8aOfulsFSbgFfQ+WCEotZExy26udi+IAZUvYgnuN9RMN0m5JAj+yuWtjB7O2e+V2VNVXEPoaZTcFej1z4eMt+SbW/s= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244786657238.08088147798378; Mon, 16 Feb 2026 04:26:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfP-0006iP-6Z; Mon, 16 Feb 2026 06:21:27 -0500 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 1vrwd4-0007T9-Pc for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwd3-0008QH-6H for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:02 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-711-AQUHFmnfNzyCJtRKh0ofKg-1; Mon, 16 Feb 2026 06:18:57 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 47DE51956060; Mon, 16 Feb 2026 11:18:55 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 01CD51955F22; Mon, 16 Feb 2026 11:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KAKt4CvCFG4mzYabTt4mTrA6Ft2BKrJ6zjij58RhywI=; b=WbaZA+hZvZYNQCRebrRamKW6qmueZupDti499s0u3u1ja+6Xqoop8jbVcQocHZUsB/LwCS PdVs7L71WAOjGJ21xs2S5rCpIlMzUauPqpdsq7aK+tabvOYmNJ8Gx7ZB2wjOAd0AXp1Wll UZUcHXBRMnhv0Whgme7bGng/89KJb6s= X-MC-Unique: AQUHFmnfNzyCJtRKh0ofKg-1 X-Mimecast-MFC-AGG-ID: AQUHFmnfNzyCJtRKh0ofKg_1771240735 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:59 +0100 Subject: [PATCH 70/85] audio/spice: remove unused AUDIO_CAP macro MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-70-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Thomas Huth , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=598; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=MqZZlsSA5odZdvc1Tj/JSrGEReLFTmuCGtE0H89M0aU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRq4+gwTPcAd8pPhRDmKamOxBfo6hpEYoxU th3CL7Fh7yJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5ReJD/oDDMnZtfu+31bPvGH23DEWjsilPkIZqvDFleSu1VWYCqFLa2EesvLSR4rTt7xDDitfaU7 WV98YXuj+ZssBOXHXBKDtpFCSTSPMHwjFHqa1vmCeAxOPd/x5Ju0U2ZQddJxsdRWv2Lrjq5yL3X n+o3ddftwnrnxp3VaIJcqlFVVe3bVvqckIlubggbsnfq/EBOQ6ibGk4KDx5zJmw7LtjVeiJfIoy XPfOkx8kvvATM7KMBEfvf5inrxjx+txca2YQmnaNzHWXPmqL0wzj9pHELL2yKGpf6YGtg2H4WHc b+3oK/EfKC11tQANh0JKngnTFCEV/COfXS0CXgdrgGRSF7mv8xO9PuqyqHzH9ahntyWTHMLZuur Eitpb6fmcKCYGM06dMFHZDCe8ROCM6godaS/Fpnbf40EH9EQrZEcenDc2Ol2IHMWQSYIsttbc1y JntkUsTcqTfkvYqb7HnndX0Dql6ErjCSlboMA6EWr/X41NbFhG4/WL0k6gGotsVCcx/l7RLu20q gz2o7l+5aszzEKMa76YKUliQgUQyW3Fd0wkweJBgtxzsOCDFgy8Icl3LseE8nDAD2STK+hUOyG/ I7JHo0u1164yCzQx3XZMukynLckdTdM/qxqIlFtK3ifkTUwmBdhxqEb9zWU1xOlFkaEdTPP240+ 17eWOOQHjc147EQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771244791207154100 The AUDIO_CAP macro is no longer used. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Thomas Huth Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/spiceaudio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 0d188e974df..81b897e13e0 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -26,7 +26,6 @@ #include "ui/qemu-spice.h" #include "qom/object.h" =20 -#define AUDIO_CAP "spice" #include "qemu/audio.h" #include "audio_int.h" =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243296; cv=none; d=zohomail.com; s=zohoarc; b=bc4mNalrERsN2HNVYEjZTzRs01KQGigTcruOrX50Hw/OAIvbZjb0FGpSfdntZA3V09cSJZ+dgAy5updoCDntvD9NNk0ZgvMrFcRqRL1hJO54L++EUarII6Zkp2r/HpfUGkNmC87e8PTk5jhcEITj88PiyNjLu6L8l2S4zN9uE70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243296; h=Content-Type: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=kcz5monBArNaXcY5PhEuW+EZzvnBJyzEr+NifJaMiTA=; b=I5jZ4SnozbMqooD7EKDMrbDFDfRVPjZGk07Ja2rlTrmT2gEkNpGzX6hRD/4fg5x96MNawzTWw3f6VNeLHCVqV4fzK6YaOpmC9RRPOleqA4ItuRb9+dV5roSlWOVteyk4DxYLpdCcDtao2C+/Wj+q3Wi5EbBnHE2QQeElbC/Fwd8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243296902123.70499344756547; Mon, 16 Feb 2026 04:01:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfW-0007pL-TK; Mon, 16 Feb 2026 06:21:34 -0500 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 1vrwd9-0007Ur-5X for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwd7-0008R6-C7 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:06 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-wLzjMd9WOeuCX78ZAzILDg-1; Mon, 16 Feb 2026 06:19:00 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 24BAA1956089; Mon, 16 Feb 2026 11:18:58 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 29E7F30001A5; Mon, 16 Feb 2026 11:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kcz5monBArNaXcY5PhEuW+EZzvnBJyzEr+NifJaMiTA=; b=I18eE5P0dTOHtgCARk8IHgIsw47vmnhku5Kc7JnFqud7AGjkew1MtEecUmKuIJ6FLVKDdm SmX7lp6T/9HApPpPt2M9dlyDoBLL5vt5aiTsKBUW40kjnUIw9fk74kCDXkeZb0U3s2jTDZ EhQR0StrH3QFK1ugCzd/Qa4xSt7vsqc= X-MC-Unique: wLzjMd9WOeuCX78ZAzILDg-1 X-Mimecast-MFC-AGG-ID: wLzjMd9WOeuCX78ZAzILDg_1771240738 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:00 +0100 Subject: [PATCH 71/85] audio/wav: replace custom logging with error_report MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-71-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Thomas Huth , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3883; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=uy45aaxsrjikhNcoNvvFIYlxO1WkTxvpW/LgSnOpQeQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRdF6doIYfytosh7z/TOgj7Eu7I/l0FEgOC OWyEbY3E0iJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5W1pD/4soLavWDJkIjW9wjtTAn9bFFjzpkpQvg+h/UkCj+CwRYP9f0ABzpzzvK4HJTji5IErsBq Cv+dYZem2stuwHwUe1EFktQY8EbQ/QK/kqB0rk7Owvn8RceUCp86sgYCIYS2Htyf/7Zdw+tfgiL jpPmGk2jU8RcFOUPqBEGBR+T0Xp1y82JAwP8pHSpNfeJyWs5QjYnNHR0uzXyJ4wfLQPHHFRl1hl TmP5fPtgFXJrl+nsbESW4cIKKnOGC7Omib/SitjBwGrfEIKJNzgzRxABSKZmq20CkMEvqjpjT8I V58YqecwLayd6LAup7KagI7NI2T45yKEk/J/64awhwg5xYIlVLnzmrmeCQ65apIWgcgne+5d8Du S9TWQ2fpZ54PegbRkddf07FcgEPSFvYp+GVyAgbbZHz41wzTZeuWGFgcg0XY6V2Cl4u/hzNK/67 eNRlZvguytwYAt+R4ciluJ4qJT94ROktWWoZi1m83NX5LmC7N2ruQo2/aUb1ehNSjDUEZ04/99J xhzrd24T8aqQ2ZF+Pr7FCZ74U/mjh6/aQ7Y5VWRDYUfhlDilx66zZ4AdjkA8OtUzYMFFdUzGfqA 4Z87I8w5yrRi2uaw5ppeHGnKf3Lct4ysBmHMNDy+jT0TJ3+jzWtkn66yK666d8YvftCQBZDpmmv cKGDqaKhgfK1rGg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243298671158500 Replace the custom audio logging infrastructure (dolog macro) with standard QEMU error reporting (error_report). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Thomas Huth Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/wavaudio.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/audio/wavaudio.c b/audio/wavaudio.c index ade8fd1d8c3..eed1e501af0 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -24,10 +24,10 @@ =20 #include "qemu/osdep.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include "qemu/audio.h" #include "qom/object.h" =20 -#define AUDIO_CAP "wav" #include "audio_int.h" =20 #define TYPE_AUDIO_WAV "audio-wav" @@ -51,8 +51,8 @@ static size_t wav_write_out(HWVoiceOut *hw, void *buf, si= ze_t len) assert(bytes % hw->info.bytes_per_frame =3D=3D 0); =20 if (bytes && fwrite(buf, bytes, 1, wav->f) !=3D 1) { - dolog("wav_write_out: fwrite of %" PRId64 " bytes failed\nReason: = %s\n", - bytes, strerror(errno)); + error_report("wav: fwrite of %" PRId64 " bytes failed: %s", + bytes, strerror(errno)); } =20 wav->total_samples +=3D bytes / hw->info.bytes_per_frame; @@ -98,11 +98,11 @@ static int wav_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) =20 case AUDIO_FORMAT_S32: case AUDIO_FORMAT_U32: - dolog ("WAVE files can not handle 32bit formats\n"); + error_report("wav: WAVE files cannot handle 32-bit formats"); return -1; =20 case AUDIO_FORMAT_F32: - dolog("WAVE files can not handle float formats\n"); + error_report("wav: WAVE files cannot handle float formats"); return -1; =20 default: @@ -122,14 +122,13 @@ static int wav_init_out(HWVoiceOut *hw, struct audset= tings *as) =20 wav->f =3D fopen(wav_path, "wb"); if (!wav->f) { - dolog ("Failed to open wave file `%s'\nReason: %s\n", - wav_path, strerror(errno)); + error_report("wav: failed to open wave file '%s': %s", + wav_path, strerror(errno)); return -1; } =20 if (fwrite (hdr, sizeof (hdr), 1, wav->f) !=3D 1) { - dolog ("wav_init_out: failed to write header\nReason: %s\n", - strerror(errno)); + error_report("wav: failed to write header: %s", strerror(errno)); return -1; } =20 @@ -153,30 +152,25 @@ static void wav_fini_out (HWVoiceOut *hw) le_store (dlen, datalen, 4); =20 if (fseek (wav->f, 4, SEEK_SET)) { - dolog ("wav_fini_out: fseek to rlen failed\nReason: %s\n", - strerror(errno)); + error_report("wav: fseek to rlen failed: %s", strerror(errno)); goto doclose; } if (fwrite (rlen, 4, 1, wav->f) !=3D 1) { - dolog ("wav_fini_out: failed to write rlen\nReason: %s\n", - strerror (errno)); + error_report("wav: failed to write rlen: %s", strerror(errno)); goto doclose; } if (fseek (wav->f, 32, SEEK_CUR)) { - dolog ("wav_fini_out: fseek to dlen failed\nReason: %s\n", - strerror (errno)); + error_report("wav: fseek to dlen failed: %s", strerror(errno)); goto doclose; } if (fwrite (dlen, 4, 1, wav->f) !=3D 1) { - dolog ("wav_fini_out: failed to write dlen\nReaons: %s\n", - strerror (errno)); + error_report("wav: failed to write dlen: %s", strerror(errno)); goto doclose; } =20 doclose: if (fclose (wav->f)) { - dolog ("wav_fini_out: fclose %p failed\nReason: %s\n", - wav->f, strerror (errno)); + error_report("wav: fclose failed: %s", strerror(errno)); } wav->f =3D NULL; } --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243573; cv=none; d=zohomail.com; s=zohoarc; b=lhCBKz7eekHiRunGn+h3WC7D4lJ3BmkyrD+4yp+YryEf06wWMGMaPkTbDR9pbFSEPpYwmdLutR2lbEbr9LPbw/+oRDSn0bWJiJECBbZAAlaDENAMwWTz+NHbOfuqHLs/tAYLNc0ur8hewzf0gJ/pp5YBphESZBj18Y/c1iTyBTM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243573; h=Content-Type: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=69TpAbLc835uRq+7bqGvGaCCGAehwUooI9PZV8h2xkQ=; b=RA6AmxJytklOiMlMi+lVfIniBV2T7HvAJNzzFGKf3Sz6zxNAoaB09ExHc2KCg56M+dLN+vZ2iKXxI1mRC7X3OTuK2bajmFhxu9CvchuY4jb5At9ckUJVRX4JGNg75ErUx6yWSCG1Sp2lrTji6t3fqmCEBSKtN8NX5m+wmyKJf5Q= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243573857784.7864832992034; Mon, 16 Feb 2026 04:06:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfg-0000VJ-H9; Mon, 16 Feb 2026 06:21:44 -0500 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 1vrwdB-0007Y4-Uw for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwd9-0008RN-7S for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:09 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-12-iL9B9r0ONgGtNee3MF5IxA-1; Mon, 16 Feb 2026 06:19:03 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5860C1800613; Mon, 16 Feb 2026 11:19:01 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E746719560A2; Mon, 16 Feb 2026 11:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=69TpAbLc835uRq+7bqGvGaCCGAehwUooI9PZV8h2xkQ=; b=O1MlrzIAAHsASqNtzy14RNseaSwOaicWvtaLgWTY3IspLCejUL0Ah58XY3LZXM7ODXgqeo V2pZZrktPYjO9OGKPLvnM742wczSSVyKYJ93ebln54j8wVuBSPotqEzRrsDE5YertermZ3 qmP29WiWu1vDjoqyndnEqESZbBjTQoY= X-MC-Unique: iL9B9r0ONgGtNee3MF5IxA-1 X-Mimecast-MFC-AGG-ID: iL9B9r0ONgGtNee3MF5IxA_1771240741 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:01 +0100 Subject: [PATCH 72/85] audio/mixeng: replace redundant pcm_info fields with AudioFormat MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-72-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=14827; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=6RvKes4eeAZsnFIGHb2No0aVPDEgHxjZ5PZuEzoitnE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRIdt9pEaFKX1LeDM3omLSV9e2u5tzZsVB1 4mVsA571qOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5VDID/9xRrLsopHx1gJXXggw5OnMkQNTCEvUa0/IEMNo2ohrXBnZgn9lzWrwC8cjxaPVPrRYhPS SQU43wTIXCfuq1Fvu+wMUwnDCTXfxkwvS+ooqniRlXDZBFCuv1E9957y1n7N18Zg3FIDm4YkCTf +Lyj0yFrLfGCrv6UHv/0lelAxAITl4I2e2XmZYtP1AzEmk6JTNscx/xCaQGM+u7dDC/HTyCzshT Hf5hunwj17bMeEUgqvmI3ZjYzRVrBUmZKHqolkqVpuOFcAjkgSAMbeUoTL68I6CZVr5xpKlZPy6 BafwwW3pWqpU/HmByGk7aHqC87owTbNfsaA1RozLSK/DTIMHlqi+wvRYPkmhK61SL6snm4l/zSg 8n/EMkFW3sUUK07Zy3rr3APbgthDxgfLejvVfG33FSAPxjZWMKLtLnmgN/2XC4aHupMkwhH8kgN qt+A6+Cpq+YIO9ZOsxFMArB1P80cxZWaJWYEzCNibegbzaDFupqNv6KzTAjW51bewZ/B0BSoGFS cIwSJUlaGDIM+Y+WRi7w+laOldovlh0F0kfq3Ci3dccVyShCc8pdE2r07hmHPvQaHrGvtC1Ynbe YQH2skUVP+yTOx7krxd7B9DKE67t+t2MNkRqcuPFbhcBpr94TksQ3w9nHxH4BMzhOYDpfeIY83g ncV3/or0QAR6Mtw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243576701154100 The audio_pcm_info structure stored three fields (bits, is_signed, is_float) that were always derived from the AudioFormat enum. This redundancy meant the same information was represented twice, with no type-level guarantee that they stayed in sync. Replace these fields with a single AudioFormat field, and add helper functions to extract the derived properties when needed: - audio_format_bits() - audio_format_is_signed() - audio_format_is_float() This improves type safety by making AudioFormat the single source of truth, eliminating the possibility of inconsistent state between the format enum and its derived boolean/integer representations. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki Reviewed-by: Mark Cave-Ayland --- audio/audio_int.h | 4 +- audio/audio_template.h | 12 +-- include/qemu/audio.h | 49 +++++++++++ audio/audio-mixeng-be.c | 218 ++++++++++++++------------------------------= ---- audio/dbusaudio.c | 12 +-- audio/coreaudio.m | 2 +- 6 files changed, 126 insertions(+), 171 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 5334c4baad2..dd5f2220d75 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -45,9 +45,7 @@ struct audio_callback { }; =20 struct audio_pcm_info { - int bits; - bool is_signed; - bool is_float; + AudioFormat af; int freq; int nchannels; int bytes_per_frame; diff --git a/audio/audio_template.h b/audio/audio_template.h index 08d60422589..3da91a4782c 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -173,7 +173,7 @@ static int glue (audio_pcm_sw_init_, TYPE) ( sw->empty =3D true; #endif =20 - if (sw->info.is_float) { + if (audio_format_is_float(hw->info.af)) { #ifdef DAC sw->conv =3D mixeng_conv_float[sw->info.nchannels =3D=3D 2] [sw->info.swap_endianness]; @@ -188,9 +188,9 @@ static int glue (audio_pcm_sw_init_, TYPE) ( sw->clip =3D mixeng_clip #endif [sw->info.nchannels =3D=3D 2] - [sw->info.is_signed] + [audio_format_is_signed(hw->info.af)] [sw->info.swap_endianness] - [audio_bits_to_index(sw->info.bits)]; + [audio_format_to_index(hw->info.af)]; } =20 sw->name =3D g_strdup (name); @@ -300,7 +300,7 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixen= gBackend *s, goto err1; } =20 - if (hw->info.is_float) { + if (audio_format_is_float(hw->info.af)) { #ifdef DAC hw->clip =3D mixeng_clip_float[hw->info.nchannels =3D=3D 2] [hw->info.swap_endianness]; @@ -315,9 +315,9 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixen= gBackend *s, hw->conv =3D mixeng_conv #endif [hw->info.nchannels =3D=3D 2] - [hw->info.is_signed] + [audio_format_is_signed(hw->info.af)] [hw->info.swap_endianness] - [audio_bits_to_index(hw->info.bits)]; + [audio_format_to_index(hw->info.af)]; } =20 glue(audio_pcm_hw_alloc_resources_, TYPE)(hw); diff --git a/include/qemu/audio.h b/include/qemu/audio.h index b6b6ee9b560..9e4566d60aa 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -185,6 +185,55 @@ bool audio_be_set_dbus_server(AudioBackend *be, =20 const char *audio_application_name(void); =20 +static inline int audio_format_bits(AudioFormat fmt) +{ + switch (fmt) { + case AUDIO_FORMAT_S8: + case AUDIO_FORMAT_U8: + return 8; + + case AUDIO_FORMAT_S16: + case AUDIO_FORMAT_U16: + return 16; + + case AUDIO_FORMAT_F32: + case AUDIO_FORMAT_S32: + case AUDIO_FORMAT_U32: + return 32; + + case AUDIO_FORMAT__MAX: + break; + } + + g_assert_not_reached(); +} + +static inline bool audio_format_is_float(AudioFormat fmt) +{ + return fmt =3D=3D AUDIO_FORMAT_F32; +} + +static inline bool audio_format_is_signed(AudioFormat fmt) +{ + switch (fmt) { + case AUDIO_FORMAT_S8: + case AUDIO_FORMAT_S16: + case AUDIO_FORMAT_S32: + case AUDIO_FORMAT_F32: + return true; + + case AUDIO_FORMAT_U8: + case AUDIO_FORMAT_U16: + case AUDIO_FORMAT_U32: + return false; + + case AUDIO_FORMAT__MAX: + break; + } + + g_assert_not_reached(); +} + #define DEFINE_AUDIO_PROPERTIES(_s, _f) \ DEFINE_PROP_AUDIODEV("audiodev", _s, _f) =20 diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index d02cfe3c509..931d5b206f2 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -62,23 +62,28 @@ int audio_bug (const char *funcname, int cond) return cond; } =20 -static inline int audio_bits_to_index (int bits) +/* + * Convert audio format to mixeng_clip index. Used by audio_pcm_sw_init_ a= nd + * audio_mixeng_backend_add_capture() + */ +static int audio_format_to_index(AudioFormat af) { - switch (bits) { - case 8: + switch (af) { + case AUDIO_FORMAT_U8: + case AUDIO_FORMAT_S8: return 0; - - case 16: + case AUDIO_FORMAT_U16: + case AUDIO_FORMAT_S16: return 1; - - case 32: + case AUDIO_FORMAT_U32: + case AUDIO_FORMAT_S32: return 2; - - default: - audio_bug ("bits_to_index", 1); - AUD_log (NULL, "invalid bits %d\n", bits); - return 0; + case AUDIO_FORMAT_F32: + case AUDIO_FORMAT__MAX: + break; } + + g_assert_not_reached(); } =20 void AUD_vlog (const char *cap, const char *fmt, va_list ap) @@ -172,141 +177,68 @@ static int audio_validate_settings (const struct aud= settings *as) =20 static int audio_pcm_info_eq (struct audio_pcm_info *info, const struct au= dsettings *as) { - int bits =3D 8; - bool is_signed =3D false, is_float =3D false; - - switch (as->fmt) { - case AUDIO_FORMAT_S8: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U8: - break; - - case AUDIO_FORMAT_S16: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U16: - bits =3D 16; - break; - - case AUDIO_FORMAT_F32: - is_float =3D true; - /* fall through */ - case AUDIO_FORMAT_S32: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U32: - bits =3D 32; - break; - - default: - abort(); - } - return info->freq =3D=3D as->freq + return info->af =3D=3D as->fmt + && info->freq =3D=3D as->freq && info->nchannels =3D=3D as->nchannels - && info->is_signed =3D=3D is_signed - && info->is_float =3D=3D is_float - && info->bits =3D=3D bits && info->swap_endianness =3D=3D (as->endianness !=3D HOST_BIG_ENDI= AN); } =20 void audio_pcm_init_info (struct audio_pcm_info *info, const struct audset= tings *as) { - int bits =3D 8, mul; - bool is_signed =3D false, is_float =3D false; - - switch (as->fmt) { - case AUDIO_FORMAT_S8: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U8: - mul =3D 1; - break; - - case AUDIO_FORMAT_S16: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U16: - bits =3D 16; - mul =3D 2; - break; - - case AUDIO_FORMAT_F32: - is_float =3D true; - /* fall through */ - case AUDIO_FORMAT_S32: - is_signed =3D true; - /* fall through */ - case AUDIO_FORMAT_U32: - bits =3D 32; - mul =3D 4; - break; - - default: - abort(); - } - + info->af =3D as->fmt; info->freq =3D as->freq; - info->bits =3D bits; - info->is_signed =3D is_signed; - info->is_float =3D is_float; info->nchannels =3D as->nchannels; - info->bytes_per_frame =3D as->nchannels * mul; + info->bytes_per_frame =3D as->nchannels * audio_format_bits(as->fmt) /= 8; info->bytes_per_second =3D info->freq * info->bytes_per_frame; info->swap_endianness =3D (as->endianness !=3D HOST_BIG_ENDIAN); } =20 -void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int= len) +void audio_pcm_info_clear_buf(struct audio_pcm_info *info, void *buf, int = len) { if (!len) { return; } =20 - if (info->is_signed || info->is_float) { - memset(buf, 0x00, len * info->bytes_per_frame); - } else { - switch (info->bits) { - case 8: - memset(buf, 0x80, len * info->bytes_per_frame); - break; - - case 16: - { - int i; - uint16_t *p =3D buf; - short s =3D INT16_MAX; - - if (info->swap_endianness) { - s =3D bswap16 (s); - } - - for (i =3D 0; i < len * info->nchannels; i++) { - p[i] =3D s; - } - } - break; + switch (info->af) { + case AUDIO_FORMAT_U8: + memset(buf, 0x80, len * info->bytes_per_frame); + break; + case AUDIO_FORMAT_U16: { + int i; + uint16_t *p =3D buf; + short s =3D INT16_MAX; =20 - case 32: - { - int i; - uint32_t *p =3D buf; - int32_t s =3D INT32_MAX; + if (info->swap_endianness) { + s =3D bswap16(s); + } =20 - if (info->swap_endianness) { - s =3D bswap32 (s); - } + for (i =3D 0; i < len * info->nchannels; i++) { + p[i] =3D s; + } + break; + } + case AUDIO_FORMAT_U32: { + int i; + uint32_t *p =3D buf; + int32_t s =3D INT32_MAX; =20 - for (i =3D 0; i < len * info->nchannels; i++) { - p[i] =3D s; - } - } - break; + if (info->swap_endianness) { + s =3D bswap32(s); + } =20 - default: - AUD_log (NULL, "audio_pcm_info_clear_buf: invalid bits %d\n", - info->bits); - break; + for (i =3D 0; i < len * info->nchannels; i++) { + p[i] =3D s; } + break; + } + case AUDIO_FORMAT_S8: + case AUDIO_FORMAT_S16: + case AUDIO_FORMAT_S32: + case AUDIO_FORMAT_F32: + memset(buf, 0x00, len * info->bytes_per_frame); + break; + case AUDIO_FORMAT__MAX: + g_assert_not_reached(); } } =20 @@ -719,8 +651,8 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *= buf, size_t buf_len) #ifdef DEBUG_AUDIO static void audio_pcm_print_info (const char *cap, struct audio_pcm_info *= info) { - dolog("%s: bits %d, sign %d, float %d, freq %d, nchan %d\n", - cap, info->bits, info->is_signed, info->is_float, info->freq, + dolog("%s: %s, freq %d, nchan %d\n", + cap, AudioFormat_str(info->af), info->freq, info->nchannels); } #endif @@ -1759,15 +1691,15 @@ static CaptureVoiceOut *audio_mixeng_backend_add_ca= pture( =20 cap->buf =3D g_malloc0_n(hw->mix_buf.size, hw->info.bytes_per_fram= e); =20 - if (hw->info.is_float) { + if (audio_format_is_float(hw->info.af)) { hw->clip =3D mixeng_clip_float[hw->info.nchannels =3D=3D 2] [hw->info.swap_endianness]; } else { hw->clip =3D mixeng_clip [hw->info.nchannels =3D=3D 2] - [hw->info.is_signed] + [audio_format_is_signed(hw->info.af)] [hw->info.swap_endianness] - [audio_bits_to_index(hw->info.bits)]; + [audio_format_to_index(hw->info.af)]; } =20 QLIST_INSERT_HEAD (&s->cap_head, cap, entries); @@ -1869,29 +1801,6 @@ audsettings audiodev_to_audsettings(AudiodevPerDirec= tionOptions *pdo) }; } =20 -int audioformat_bytes_per_sample(AudioFormat fmt) -{ - switch (fmt) { - case AUDIO_FORMAT_U8: - case AUDIO_FORMAT_S8: - return 1; - - case AUDIO_FORMAT_U16: - case AUDIO_FORMAT_S16: - return 2; - - case AUDIO_FORMAT_U32: - case AUDIO_FORMAT_S32: - case AUDIO_FORMAT_F32: - return 4; - - case AUDIO_FORMAT__MAX: - ; - } - abort(); -} - - /* frames =3D freq * usec / 1e6 */ int audio_buffer_frames(AudiodevPerDirectionOptions *pdo, audsettings *as, int def_usecs) @@ -1914,8 +1823,7 @@ int audio_buffer_samples(AudiodevPerDirectionOptions = *pdo, int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo, audsettings *as, int def_usecs) { - return audio_buffer_samples(pdo, as, def_usecs) * - audioformat_bytes_per_sample(as->fmt); + return audio_buffer_samples(pdo, as, def_usecs) * audio_format_bits(as= ->fmt) / 8; } =20 void audio_rate_start(RateCtl *rate) diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 5f65c043c16..b212b3d6022 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -147,9 +147,9 @@ dbus_init_out_listener(QemuDBusDisplay1AudioOutListener= *listener, qemu_dbus_display1_audio_out_listener_call_init( listener, (uintptr_t)hw, - hw->info.bits, - hw->info.is_signed, - hw->info.is_float, + audio_format_bits(hw->info.af), + audio_format_is_signed(hw->info.af), + audio_format_is_float(hw->info.af), hw->info.freq, hw->info.nchannels, hw->info.bytes_per_frame, @@ -273,9 +273,9 @@ dbus_init_in_listener(QemuDBusDisplay1AudioInListener *= listener, HWVoiceIn *hw) qemu_dbus_display1_audio_in_listener_call_init( listener, (uintptr_t)hw, - hw->info.bits, - hw->info.is_signed, - hw->info.is_float, + audio_format_bits(hw->info.af), + audio_format_is_signed(hw->info.af), + audio_format_is_float(hw->info.af), hw->info.freq, hw->info.nchannels, hw->info.bytes_per_frame, diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 0c0e8583c89..1f4b3d9d467 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -359,7 +359,7 @@ static OSStatus init_out_device(coreaudioVoiceOut *core) AudioValueRange frameRange; =20 AudioStreamBasicDescription streamBasicDescription =3D { - .mBitsPerChannel =3D core->hw.info.bits, + .mBitsPerChannel =3D audio_format_bits(core->hw.info.af), .mBytesPerFrame =3D core->hw.info.bytes_per_frame, .mBytesPerPacket =3D core->hw.info.bytes_per_frame, .mChannelsPerFrame =3D core->hw.info.nchannels, --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244663; cv=none; d=zohomail.com; s=zohoarc; b=d8kWZ1iHi9Z+/PISNYabPUdyEa5h4c9HT4UMAnogJ61rW92d/gJLy5NETbrqdJt9D78aShVtduQj9+VBU36v/NOxX9RmHzQz9/uXPAi290A/y9g/o98/cHPM/omoOKt1iNIkH43/J6pgScT40QbDZvmcTfoa1Fx6xGYPVBkmCo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244663; h=Content-Type: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=jntLF8LgSwELUiTDp0fDgXaQYj3kXStV51lpxXjNGtE=; b=XKy6JqerP3q148OOScpWtev6IllvoXjzYDYFieaDWBh/6weErOUo6ZUvTdXs0ns42M4Tw5FVBEpsuVZC7PuFyv14q4gTgsw9kZExPJLUUTpb2YqtUlHkNtfrZCsxVzbBmow0K9fLxtRqhwwaJ3r6R6GQnnOjDF3msTM4xIAZTjs= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244663461915.2182714499967; Mon, 16 Feb 2026 04:24:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfh-0000a9-6A; Mon, 16 Feb 2026 06:21:45 -0500 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 1vrwdG-0007jL-C2 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdD-0008SB-4R for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:14 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-341-FnCv0qhAMbqPYgWbIvTNAw-1; Mon, 16 Feb 2026 06:19:06 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 078471956060; Mon, 16 Feb 2026 11:19:04 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4F9D919560AD; Mon, 16 Feb 2026 11:19:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jntLF8LgSwELUiTDp0fDgXaQYj3kXStV51lpxXjNGtE=; b=L6sPCos8v282CrsoyjeMO5l/uSSKKTPjXtA5Ix3Ccbje05EcmaprnVsgEG87MfZmqtBofk AGOdVJF9Pz7eFIJaPM8d337SZp85BSQlIL2lxelDt4JlvXV4cS3HXXUpHyjzM2CImYYCpv vs1eLow+lxm6EbEipJPRT6LCVBFxRAo= X-MC-Unique: FnCv0qhAMbqPYgWbIvTNAw-1 X-Mimecast-MFC-AGG-ID: FnCv0qhAMbqPYgWbIvTNAw_1771240744 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:02 +0100 Subject: [PATCH 73/85] audio: replace int endianness with bool big_endian in audsettings MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-73-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Thomas Huth , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=29670; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=eda24egNwmutPTFgtvu5N2Y467+Bchz6V0rlBRhfQmU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxRxOp/Os2G5es71qM5vaek21/WveE1JjUgk pTtW8AeE/+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac 5eJaEACh6y3rwtNX1/L2zrdmmA7/dSdA0+ianT4FujGUPOt54aWWH2FmgbrSM5CuKcMQez62CVA DkIZFjXmOSpD0u95pXAVCHKBBcjprJ3gXqzLZEqdn1s2qrc4zjAKQ5hbRlM2F2Akewm7e+WVJ6j GgJaGWppVDFFZOb0fvQDNGv0Euc/fFD2EUqymzyOan6PXjaoQxTMrLMgOzfeCZydWeeC0H/7M3g xoXvFqB3nti58sDRHnAdIv82BTBgJO5C/Bsj3Ym0KjbnY67YCwhaLPC0I3WaqSf3BwTSSQyvO6F My3os6WAGyNegWC/nfg+dIgU6Rw6qHFptMRF9zjFzD0rSpu+5EpAM4/87To8ohjx3pjBVdD+4Dw ol5PXP1XGlx69t7aUnf8h7R+jYXEf552bh1E/q+X49MFjvv1KqN3KEhWT15ft3ZzlfEQzOTvG+c 6n0SMNv0lnrLUnRBjZr2lFKb9eUWsVIZCFwAOrQM/EndYfJ8dUuNMsklhJzEsy+d3MgXC50sUIM VwJUBhzayQFsT70+nWWYVbDf8tCep40NzsJKer5Cu/ej0A440yJ6bzovw6kJ03HsUhw29XNBgbc yO0RStYYKFUHCRZ1c9z6yMsQVD8Xi4fXlC2n4ZEJXXrKUPd5X034BxGi/+fvQOzjzy561dp5sQy wg3T33ZouM2WZuA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244664125158500 The endianness field used an int to represent a boolean concept, with 0 meaning little-endian and 1 meaning big-endian. This required runtime validation to reject invalid values and made the code less readable. Replace with a bool big_endian field that is self-documenting and type-safe. The compiler now enforces valid values, eliminating the need for the validation check in audio_validate_settings(). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Thomas Huth Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/dsound_template.h | 2 +- include/qemu/audio.h | 2 +- audio/alsaaudio.c | 8 ++++---- audio/audio-mixeng-be.c | 21 ++++----------------- audio/jackaudio.c | 4 ++-- audio/ossaudio.c | 22 +++++++++++----------- audio/paaudio.c | 22 +++++++++++----------- audio/pwaudio.c | 30 +++++++++++++++--------------- audio/sdlaudio.c | 26 +++++++++++++------------- audio/sndioaudio.c | 2 +- audio/spiceaudio.c | 4 ++-- audio/wavaudio.c | 2 +- audio/wavcapture.c | 2 +- hw/audio/ac97.c | 2 +- hw/audio/adlib.c | 2 +- hw/audio/asc.c | 2 +- hw/audio/cs4231a.c | 6 +++--- hw/audio/es1370.c | 2 +- hw/audio/gus.c | 2 +- hw/audio/lm4549.c | 6 +++--- hw/audio/sb16.c | 8 ++++---- hw/audio/via-ac97.c | 2 +- hw/audio/virtio-snd.c | 2 +- hw/audio/wm8750.c | 4 ++-- hw/display/xlnx_dp.c | 2 +- hw/usb/dev-audio.c | 2 +- tests/audio/test-audio.c | 2 +- ui/vnc.c | 2 +- 28 files changed, 90 insertions(+), 103 deletions(-) diff --git a/audio/dsound_template.h b/audio/dsound_template.h index af4019bcb34..f9761120875 100644 --- a/audio/dsound_template.h +++ b/audio/dsound_template.h @@ -244,7 +244,7 @@ static int dsound_init_out(HWVoiceOut *hw, struct audse= ttings *as) } =20 ds->first_time =3D true; - obt_as.endianness =3D 0; + obt_as.big_endian =3D false; audio_pcm_init_info (&hw->info, &obt_as); =20 if (bc.dwBufferBytes % hw->info.bytes_per_frame) { diff --git a/include/qemu/audio.h b/include/qemu/audio.h index 9e4566d60aa..cff8a334f36 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -38,7 +38,7 @@ typedef struct audsettings { int freq; int nchannels; AudioFormat fmt; - int endianness; + bool big_endian; } audsettings; =20 typedef struct SWVoiceOut SWVoiceOut; diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 889240ad0c7..e2290ea814a 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -666,7 +666,7 @@ static int alsa_init_out(HWVoiceOut *hw, struct audsett= ings *as) struct audsettings obt_as; Audiodev *dev =3D hw->s->dev; =20 - req.fmt =3D aud_to_alsafmt (as->fmt, as->endianness); + req.fmt =3D aud_to_alsafmt (as->fmt, as->big_endian); req.freq =3D as->freq; req.nchannels =3D as->nchannels; =20 @@ -677,7 +677,7 @@ static int alsa_init_out(HWVoiceOut *hw, struct audsett= ings *as) obt_as.freq =3D obt.freq; obt_as.nchannels =3D obt.nchannels; obt_as.fmt =3D obt.fmt; - obt_as.endianness =3D obt.endianness; + obt_as.big_endian =3D obt.endianness; =20 audio_pcm_init_info (&hw->info, &obt_as); hw->samples =3D obt.samples; @@ -752,7 +752,7 @@ static int alsa_init_in(HWVoiceIn *hw, struct audsettin= gs *as) struct audsettings obt_as; Audiodev *dev =3D hw->s->dev; =20 - req.fmt =3D aud_to_alsafmt (as->fmt, as->endianness); + req.fmt =3D aud_to_alsafmt (as->fmt, as->big_endian); req.freq =3D as->freq; req.nchannels =3D as->nchannels; =20 @@ -763,7 +763,7 @@ static int alsa_init_in(HWVoiceIn *hw, struct audsettin= gs *as) obt_as.freq =3D obt.freq; obt_as.nchannels =3D obt.nchannels; obt_as.fmt =3D obt.fmt; - obt_as.endianness =3D obt.endianness; + obt_as.big_endian =3D obt.endianness; =20 audio_pcm_init_info (&hw->info, &obt_as); hw->samples =3D obt.samples; diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 931d5b206f2..d05202aabae 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -135,19 +135,7 @@ static void audio_print_settings (const struct audsett= ings *as) break; } =20 - AUD_log (NULL, " endianness=3D"); - switch (as->endianness) { - case 0: - AUD_log (NULL, "little"); - break; - case 1: - AUD_log (NULL, "big"); - break; - default: - AUD_log (NULL, "invalid"); - break; - } - AUD_log (NULL, "\n"); + AUD_log (NULL, " endianness=3D%s\n", as->big_endian ? "big" : "little"= ); } =20 static int audio_validate_settings (const struct audsettings *as) @@ -155,7 +143,6 @@ static int audio_validate_settings (const struct audset= tings *as) int invalid; =20 invalid =3D as->nchannels < 1; - invalid |=3D as->endianness !=3D 0 && as->endianness !=3D 1; =20 switch (as->fmt) { case AUDIO_FORMAT_S8: @@ -180,7 +167,7 @@ static int audio_pcm_info_eq (struct audio_pcm_info *in= fo, const struct audsetti return info->af =3D=3D as->fmt && info->freq =3D=3D as->freq && info->nchannels =3D=3D as->nchannels - && info->swap_endianness =3D=3D (as->endianness !=3D HOST_BIG_ENDI= AN); + && info->swap_endianness =3D=3D (as->big_endian !=3D HOST_BIG_ENDI= AN); } =20 void audio_pcm_init_info (struct audio_pcm_info *info, const struct audset= tings *as) @@ -190,7 +177,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, = const struct audsettings info->nchannels =3D as->nchannels; info->bytes_per_frame =3D as->nchannels * audio_format_bits(as->fmt) /= 8; info->bytes_per_second =3D info->freq * info->bytes_per_frame; - info->swap_endianness =3D (as->endianness !=3D HOST_BIG_ENDIAN); + info->swap_endianness =3D (as->big_endian !=3D HOST_BIG_ENDIAN); } =20 void audio_pcm_info_clear_buf(struct audio_pcm_info *info, void *buf, int = len) @@ -1797,7 +1784,7 @@ audsettings audiodev_to_audsettings(AudiodevPerDirect= ionOptions *pdo) .freq =3D pdo->frequency, .nchannels =3D pdo->channels, .fmt =3D pdo->format, - .endianness =3D HOST_BIG_ENDIAN, + .big_endian =3D HOST_BIG_ENDIAN, }; } =20 diff --git a/audio/jackaudio.c b/audio/jackaudio.c index a2f725a3232..d9ae8edc0e0 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -531,7 +531,7 @@ static int qjack_init_out(HWVoiceOut *hw, struct audset= tings *as) .freq =3D jo->c.freq, .nchannels =3D jo->c.nchannels, .fmt =3D AUDIO_FORMAT_F32, - .endianness =3D 0 + .big_endian =3D false }; audio_pcm_init_info(&hw->info, &os); =20 @@ -566,7 +566,7 @@ static int qjack_init_in(HWVoiceIn *hw, struct audsetti= ngs *as) .freq =3D ji->c.freq, .nchannels =3D ji->c.nchannels, .fmt =3D AUDIO_FORMAT_F32, - .endianness =3D 0 + .big_endian =3D false }; audio_pcm_init_info(&hw->info, &is); =20 diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 81f49f9a7e7..157979e84b4 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -160,36 +160,36 @@ static int aud_to_ossfmt(AudioFormat fmt, bool big_en= dian) } } =20 -static int oss_to_audfmt (int ossfmt, AudioFormat *fmt, int *endianness) +static int oss_to_audfmt (int ossfmt, AudioFormat *fmt, bool *big_endian) { switch (ossfmt) { case AFMT_S8: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_S8; break; =20 case AFMT_U8: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_U8; break; =20 case AFMT_S16_LE: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_S16; break; =20 case AFMT_U16_LE: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_U16; break; =20 case AFMT_S16_BE: - *endianness =3D 1; + *big_endian =3D true; *fmt =3D AUDIO_FORMAT_S16; break; =20 case AFMT_U16_BE: - *endianness =3D 1; + *big_endian =3D true; *fmt =3D AUDIO_FORMAT_U16; break; =20 @@ -475,7 +475,7 @@ static int oss_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) =20 oss->fd =3D -1; =20 - req.fmt =3D aud_to_ossfmt (as->fmt, as->endianness); + req.fmt =3D aud_to_ossfmt (as->fmt, as->big_endian); req.freq =3D as->freq; req.nchannels =3D as->nchannels; =20 @@ -483,7 +483,7 @@ static int oss_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) return -1; } =20 - err =3D oss_to_audfmt(obt.fmt, &obt_as.fmt, &obt_as.endianness); + err =3D oss_to_audfmt(obt.fmt, &obt_as.fmt, &obt_as.big_endian); if (err) { oss_anal_close (&fd); return -1; @@ -601,14 +601,14 @@ static int oss_init_in(HWVoiceIn *hw, struct audsetti= ngs *as) =20 oss->fd =3D -1; =20 - req.fmt =3D aud_to_ossfmt (as->fmt, as->endianness); + req.fmt =3D aud_to_ossfmt (as->fmt, as->big_endian); req.freq =3D as->freq; req.nchannels =3D as->nchannels; if (oss_open(1, &req, as, &obt, &fd, dev)) { return -1; } =20 - err =3D oss_to_audfmt(obt.fmt, &obt_as.fmt, &obt_as.endianness); + err =3D oss_to_audfmt(obt.fmt, &obt_as.fmt, &obt_as.big_endian); if (err) { oss_anal_close (&fd); return -1; diff --git a/audio/paaudio.c b/audio/paaudio.c index 1501b26386a..c9957105543 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -352,28 +352,28 @@ static pa_sample_format_t audfmt_to_pa(AudioFormat af= mt, bool big_endian) return format; } =20 -static AudioFormat pa_to_audfmt (pa_sample_format_t fmt, int *endianness) +static AudioFormat pa_to_audfmt (pa_sample_format_t fmt, bool *big_endian) { switch (fmt) { case PA_SAMPLE_U8: return AUDIO_FORMAT_U8; case PA_SAMPLE_S16BE: - *endianness =3D 1; + *big_endian =3D true; return AUDIO_FORMAT_S16; case PA_SAMPLE_S16LE: - *endianness =3D 0; + *big_endian =3D false; return AUDIO_FORMAT_S16; case PA_SAMPLE_S32BE: - *endianness =3D 1; + *big_endian =3D true; return AUDIO_FORMAT_S32; case PA_SAMPLE_S32LE: - *endianness =3D 0; + *big_endian =3D false; return AUDIO_FORMAT_S32; case PA_SAMPLE_FLOAT32BE: - *endianness =3D 1; + *big_endian =3D true; return AUDIO_FORMAT_F32; case PA_SAMPLE_FLOAT32LE: - *endianness =3D 0; + *big_endian =3D false; return AUDIO_FORMAT_F32; default: error_report("pulseaudio: Internal logic error: Bad pa_sample_form= at %d", fmt); @@ -531,7 +531,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) PAConnection *c =3D apa->conn; =20 pa->g =3D apa; - ss.format =3D audfmt_to_pa (as->fmt, as->endianness); + ss.format =3D audfmt_to_pa (as->fmt, as->big_endian); ss.channels =3D as->nchannels; ss.rate =3D as->freq; =20 @@ -541,7 +541,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) ba.maxlength =3D -1; ba.prebuf =3D -1; =20 - obt_as.fmt =3D pa_to_audfmt (ss.format, &obt_as.endianness); + obt_as.fmt =3D pa_to_audfmt (ss.format, &obt_as.big_endian); =20 pa->stream =3D qpa_simple_new ( c, @@ -582,7 +582,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsetting= s *as) PAConnection *c =3D apa->conn; =20 pa->g =3D apa; - ss.format =3D audfmt_to_pa (as->fmt, as->endianness); + ss.format =3D audfmt_to_pa (as->fmt, as->big_endian); ss.channels =3D as->nchannels; ss.rate =3D as->freq; =20 @@ -592,7 +592,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsetting= s *as) ba.minreq =3D -1; ba.prebuf =3D -1; =20 - obt_as.fmt =3D pa_to_audfmt (ss.format, &obt_as.endianness); + obt_as.fmt =3D pa_to_audfmt (ss.format, &obt_as.big_endian); =20 pa->stream =3D qpa_simple_new ( c, diff --git a/audio/pwaudio.c b/audio/pwaudio.c index 6a80e5a333e..b70bf0c1353 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -365,7 +365,7 @@ audfmt_to_pw(AudioFormat fmt, bool big_endian) } =20 static AudioFormat -pw_to_audfmt(enum spa_audio_format fmt, int *endianness, +pw_to_audfmt(enum spa_audio_format fmt, bool *big_endian, uint32_t *sample_size) { switch (fmt) { @@ -377,43 +377,43 @@ pw_to_audfmt(enum spa_audio_format fmt, int *endianne= ss, return AUDIO_FORMAT_U8; case SPA_AUDIO_FORMAT_S16_BE: *sample_size =3D 2; - *endianness =3D 1; + *big_endian =3D true; return AUDIO_FORMAT_S16; case SPA_AUDIO_FORMAT_S16_LE: *sample_size =3D 2; - *endianness =3D 0; + *big_endian =3D false; return AUDIO_FORMAT_S16; case SPA_AUDIO_FORMAT_U16_BE: *sample_size =3D 2; - *endianness =3D 1; + *big_endian =3D true; return AUDIO_FORMAT_U16; case SPA_AUDIO_FORMAT_U16_LE: *sample_size =3D 2; - *endianness =3D 0; + *big_endian =3D false; return AUDIO_FORMAT_U16; case SPA_AUDIO_FORMAT_S32_BE: *sample_size =3D 4; - *endianness =3D 1; + *big_endian =3D true; return AUDIO_FORMAT_S32; case SPA_AUDIO_FORMAT_S32_LE: *sample_size =3D 4; - *endianness =3D 0; + *big_endian =3D false; return AUDIO_FORMAT_S32; case SPA_AUDIO_FORMAT_U32_BE: *sample_size =3D 4; - *endianness =3D 1; + *big_endian =3D true; return AUDIO_FORMAT_U32; case SPA_AUDIO_FORMAT_U32_LE: *sample_size =3D 4; - *endianness =3D 0; + *big_endian =3D false; return AUDIO_FORMAT_U32; case SPA_AUDIO_FORMAT_F32_BE: *sample_size =3D 4; - *endianness =3D 1; + *big_endian =3D true; return AUDIO_FORMAT_F32; case SPA_AUDIO_FORMAT_F32_LE: *sample_size =3D 4; - *endianness =3D 0; + *big_endian =3D false; return AUDIO_FORMAT_F32; default: *sample_size =3D 1; @@ -534,13 +534,13 @@ qpw_init_out(HWVoiceOut *hw, struct audsettings *as) =20 pw_thread_loop_lock(c->thread_loop); =20 - v->info.format =3D audfmt_to_pw(as->fmt, as->endianness); + v->info.format =3D audfmt_to_pw(as->fmt, as->big_endian); v->info.channels =3D as->nchannels; qpw_set_position(as->nchannels, v->info.position); v->info.rate =3D as->freq; =20 obt_as.fmt =3D - pw_to_audfmt(v->info.format, &obt_as.endianness, &v->frame_size); + pw_to_audfmt(v->info.format, &obt_as.big_endian, &v->frame_size); v->frame_size *=3D as->nchannels; =20 v->req =3D (uint64_t)AUDIO_MIXENG_BACKEND(c)->dev->timer_period * v->i= nfo.rate @@ -581,13 +581,13 @@ qpw_init_in(HWVoiceIn *hw, struct audsettings *as) =20 pw_thread_loop_lock(c->thread_loop); =20 - v->info.format =3D audfmt_to_pw(as->fmt, as->endianness); + v->info.format =3D audfmt_to_pw(as->fmt, as->big_endian); v->info.channels =3D as->nchannels; qpw_set_position(as->nchannels, v->info.position); v->info.rate =3D as->freq; =20 obt_as.fmt =3D - pw_to_audfmt(v->info.format, &obt_as.endianness, &v->frame_size); + pw_to_audfmt(v->info.format, &obt_as.big_endian, &v->frame_size); v->frame_size *=3D as->nchannels; =20 /* call the function that creates a new stream for recording */ diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 5f332678209..936a3ed076d 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -96,56 +96,56 @@ static int aud_to_sdlfmt (AudioFormat fmt) } } =20 -static int sdl_to_audfmt(int sdlfmt, AudioFormat *fmt, int *endianness) +static int sdl_to_audfmt(int sdlfmt, AudioFormat *fmt, bool *big_endian) { switch (sdlfmt) { case AUDIO_S8: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_S8; break; =20 case AUDIO_U8: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_U8; break; =20 case AUDIO_S16LSB: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_S16; break; =20 case AUDIO_U16LSB: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_U16; break; =20 case AUDIO_S16MSB: - *endianness =3D 1; + *big_endian =3D true; *fmt =3D AUDIO_FORMAT_S16; break; =20 case AUDIO_U16MSB: - *endianness =3D 1; + *big_endian =3D true; *fmt =3D AUDIO_FORMAT_U16; break; =20 case AUDIO_S32LSB: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_S32; break; =20 case AUDIO_S32MSB: - *endianness =3D 1; + *big_endian =3D true; *fmt =3D AUDIO_FORMAT_S32; break; =20 case AUDIO_F32LSB: - *endianness =3D 0; + *big_endian =3D false; *fmt =3D AUDIO_FORMAT_F32; break; =20 case AUDIO_F32MSB: - *endianness =3D 1; + *big_endian =3D true; *fmt =3D AUDIO_FORMAT_F32; break; =20 @@ -350,7 +350,7 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) return -1; } =20 - err =3D sdl_to_audfmt(obt.format, &obt_as.fmt, &obt_as.endianness); + err =3D sdl_to_audfmt(obt.format, &obt_as.fmt, &obt_as.big_endian); if (err) { sdl_close_out(sdl); return -1; @@ -406,7 +406,7 @@ static int sdl_init_in(HWVoiceIn *hw, audsettings *as) return -1; } =20 - err =3D sdl_to_audfmt(obt.format, &obt_as.fmt, &obt_as.endianness); + err =3D sdl_to_audfmt(obt.format, &obt_as.fmt, &obt_as.big_endian); if (err) { sdl_close_in(sdl); return -1; diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 766eceeeefe..761f23f8273 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -387,7 +387,7 @@ static int sndio_init(SndioVoice *self, } =20 if (req.bits > 8) { - req.le =3D as->endianness ? 0 : 1; + req.le =3D !as->big_endian; } =20 req.rate =3D as->freq; diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 81b897e13e0..f903ef77e72 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -106,7 +106,7 @@ static int line_out_init(HWVoiceOut *hw, struct audsett= ings *as) #endif settings.nchannels =3D SPICE_INTERFACE_PLAYBACK_CHAN; settings.fmt =3D AUDIO_FORMAT_S16; - settings.endianness =3D HOST_BIG_ENDIAN; + settings.big_endian =3D HOST_BIG_ENDIAN; =20 audio_pcm_init_info (&hw->info, &settings); hw->samples =3D LINE_OUT_SAMPLES; @@ -222,7 +222,7 @@ static int line_in_init(HWVoiceIn *hw, struct audsettin= gs *as) #endif settings.nchannels =3D SPICE_INTERFACE_RECORD_CHAN; settings.fmt =3D AUDIO_FORMAT_S16; - settings.endianness =3D HOST_BIG_ENDIAN; + settings.big_endian =3D HOST_BIG_ENDIAN; =20 audio_pcm_init_info (&hw->info, &settings); hw->samples =3D LINE_IN_SAMPLES; diff --git a/audio/wavaudio.c b/audio/wavaudio.c index eed1e501af0..55d12d6cdfd 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -111,7 +111,7 @@ static int wav_init_out(HWVoiceOut *hw, struct audsetti= ngs *as) =20 hdr[34] =3D bits16 ? 0x10 : 0x08; =20 - wav_as.endianness =3D 0; + wav_as.big_endian =3D false; audio_pcm_init_info (&hw->info, &wav_as); =20 hw->samples =3D 1024; diff --git a/audio/wavcapture.c b/audio/wavcapture.c index 69aa91e35f6..2dac9461710 100644 --- a/audio/wavcapture.c +++ b/audio/wavcapture.c @@ -137,7 +137,7 @@ int wav_start_capture(AudioBackend *state, CaptureState= *s, const char *path, as.freq =3D freq; as.nchannels =3D 1 << stereo; as.fmt =3D bits16 ? AUDIO_FORMAT_S16 : AUDIO_FORMAT_U8; - as.endianness =3D 0; + as.big_endian =3D false; =20 ops.notify =3D wav_notify; ops.capture =3D wav_capture; diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 5d442b7e067..fd74c249949 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -313,7 +313,7 @@ static void open_voice(AC97LinkState *s, int index, int= freq) as.freq =3D freq; as.nchannels =3D 2; as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D 0; + as.big_endian =3D false; =20 if (freq > 0) { s->invalid_freq[index] =3D 0; diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index ce17e21d5fd..52ee5cb6256 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -254,7 +254,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) as.freq =3D s->freq; as.nchannels =3D SHIFT; as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D HOST_BIG_ENDIAN; + as.big_endian =3D HOST_BIG_ENDIAN; =20 s->voice =3D audio_be_open_out( s->audio_be, diff --git a/hw/audio/asc.c b/hw/audio/asc.c index 35c7b5750d6..ea59bdde7b8 100644 --- a/hw/audio/asc.c +++ b/hw/audio/asc.c @@ -648,7 +648,7 @@ static void asc_realize(DeviceState *dev, Error **errp) as.freq =3D ASC_FREQ; as.nchannels =3D 2; as.fmt =3D AUDIO_FORMAT_U8; - as.endianness =3D HOST_BIG_ENDIAN; + as.big_endian =3D HOST_BIG_ENDIAN; =20 s->voice =3D audio_be_open_out(s->audio_be, s->voice, "asc.out", s, as= c_out_cb, &as); diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index e6cae9c988e..c589670e855 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -289,7 +289,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) } =20 as.nchannels =3D (val & (1 << 4)) ? 2 : 1; - as.endianness =3D 0; + as.big_endian =3D false; s->tab =3D NULL; =20 switch ((val >> 5) & ((s->dregs[MODE_And_ID] & MODE2) ? 7 : 3)) { @@ -305,12 +305,12 @@ static void cs_reset_voices (CSState *s, uint32_t val) s->tab =3D ALawDecompressTable; x_law: as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D HOST_BIG_ENDIAN; + as.big_endian =3D HOST_BIG_ENDIAN; s->shift =3D as.nchannels =3D=3D 2; break; =20 case 6: - as.endianness =3D 1; + as.big_endian =3D true; /* fall through */ case 2: as.fmt =3D AUDIO_FORMAT_S16; diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index e1658393c6a..ca7ad16df49 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -407,7 +407,7 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) as.freq =3D new_freq; as.nchannels =3D 1 << (new_fmt & 1); as.fmt =3D (new_fmt & 2) ? AUDIO_FORMAT_S16 : AUDIO_FORMAT= _U8; - as.endianness =3D 0; + as.big_endian =3D false; =20 if (i =3D=3D ADC_CHANNEL) { s->adc_voice =3D diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 5c2a34c09d2..196c4f72205 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -256,7 +256,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) as.freq =3D s->freq; as.nchannels =3D 2; as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D HOST_BIG_ENDIAN; + as.big_endian =3D HOST_BIG_ENDIAN; =20 s->voice =3D audio_be_open_out( s->audio_be, diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index 14e15a844ba..a891e975106 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -202,7 +202,7 @@ void lm4549_write(lm4549_state *s, as.freq =3D value; as.nchannels =3D 2; as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D 0; + as.big_endian =3D false; =20 s->voice =3D audio_be_open_out( s->audio_be, @@ -272,7 +272,7 @@ static int lm4549_post_load(void *opaque, int version_i= d) as.freq =3D freq; as.nchannels =3D 2; as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D 0; + as.big_endian =3D false; =20 s->voice =3D audio_be_open_out( s->audio_be, @@ -312,7 +312,7 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_= req_cb, void* opaque, as.freq =3D 48000; as.nchannels =3D 2; as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D 0; + as.big_endian =3D false; =20 s->voice =3D audio_be_open_out( s->audio_be, diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index c8fc7df8b44..1b5e452a29b 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -213,7 +213,7 @@ static void continue_dma8 (SB16State *s) as.freq =3D s->freq; as.nchannels =3D 1 << s->fmt_stereo; as.fmt =3D s->fmt; - as.endianness =3D 0; + as.big_endian =3D false; =20 s->voice =3D audio_be_open_out( s->audio_be, @@ -376,7 +376,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t= d0, int dma_len) as.freq =3D s->freq; as.nchannels =3D 1 << s->fmt_stereo; as.fmt =3D s->fmt; - as.endianness =3D 0; + as.big_endian =3D false; =20 s->voice =3D audio_be_open_out( s->audio_be, @@ -877,7 +877,7 @@ static void legacy_reset (SB16State *s) as.freq =3D s->freq; as.nchannels =3D 1; as.fmt =3D AUDIO_FORMAT_U8; - as.endianness =3D 0; + as.big_endian =3D false; =20 s->voice =3D audio_be_open_out( s->audio_be, @@ -1300,7 +1300,7 @@ static int sb16_post_load (void *opaque, int version_= id) as.freq =3D s->freq; as.nchannels =3D 1 << s->fmt_stereo; as.fmt =3D s->fmt; - as.endianness =3D 0; + as.big_endian =3D false; =20 s->voice =3D audio_be_open_out( s->audio_be, diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c index 84d137b41a3..9d61283542a 100644 --- a/hw/audio/via-ac97.c +++ b/hw/audio/via-ac97.c @@ -237,7 +237,7 @@ static void open_voice_out(ViaAC97State *s) .freq =3D CODEC_REG(s, AC97_PCM_Front_DAC_Rate), .nchannels =3D s->aur.type & BIT(4) ? 2 : 1, .fmt =3D s->aur.type & BIT(5) ? AUDIO_FORMAT_S16 : AUDIO_FORMAT_S8, - .endianness =3D 0, + .big_endian =3D false, }; s->vo =3D audio_be_open_out(s->audio_be, s->vo, "via-ac97.out", s, out= _cb, &as); } diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c index 89e24c0a8e0..8b949146468 100644 --- a/hw/audio/virtio-snd.c +++ b/hw/audio/virtio-snd.c @@ -378,7 +378,7 @@ static void virtio_snd_get_qemu_audsettings(audsettings= *as, as->nchannels =3D MIN(AUDIO_MAX_CHANNELS, params->channels); as->fmt =3D virtio_snd_get_qemu_format(params->format); as->freq =3D virtio_snd_get_qemu_freq(params->rate); - as->endianness =3D 0; /* Conforming to VIRTIO 1.0: always little endia= n. */ + as->big_endian =3D false; /* Conforming to VIRTIO 1.0: always little e= ndian. */ } =20 /* diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index 2a286515b14..e2507b0269a 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -202,7 +202,7 @@ static void wm8750_set_format(WM8750State *s) return; =20 /* Setup input */ - in_fmt.endianness =3D 0; + in_fmt.big_endian =3D false; in_fmt.nchannels =3D 2; in_fmt.freq =3D s->adc_hz; in_fmt.fmt =3D AUDIO_FORMAT_S16; @@ -215,7 +215,7 @@ static void wm8750_set_format(WM8750State *s) CODEC ".input3", s, wm8750_audio_in_cb, &in_fmt); =20 /* Setup output */ - out_fmt.endianness =3D 0; + out_fmt.big_endian =3D false; out_fmt.nchannels =3D 2; out_fmt.freq =3D s->dac_hz; out_fmt.fmt =3D AUDIO_FORMAT_S16; diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index 9aa4709b411..7d037b46a35 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1393,7 +1393,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error *= *errp) as.freq =3D 44100; as.nchannels =3D 2; as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D 0; + as.big_endian =3D false; =20 s->amixer_output_stream =3D audio_be_open_out(s->audio_be, s->amixer_output_stream, diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 7b758718c12..e18e0a1dfd6 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -975,7 +975,7 @@ static void usb_audio_reinit(USBDevice *dev, unsigned c= hannels) s->out.as.freq =3D USBAUDIO_SAMPLE_RATE; s->out.as.nchannels =3D s->out.channels; s->out.as.fmt =3D AUDIO_FORMAT_S16; - s->out.as.endianness =3D 0; + s->out.as.big_endian =3D false; streambuf_init(&s->out.buf, s->buffer, s->out.channels); =20 s->out.voice =3D audio_be_open_out(s->audio_be, s->out.voice, TYPE_USB= _AUDIO, diff --git a/tests/audio/test-audio.c b/tests/audio/test-audio.c index 90d96ae0575..b87a12eb55b 100644 --- a/tests/audio/test-audio.c +++ b/tests/audio/test-audio.c @@ -57,7 +57,7 @@ static const struct audsettings default_test_settings =3D= { .freq =3D SAMPLE_RATE, .nchannels =3D CHANNELS, .fmt =3D AUDIO_FORMAT_S16, - .endianness =3D 0, + .big_endian =3D false, }; =20 static void dummy_audio_callback(void *opaque, int avail) diff --git a/ui/vnc.c b/ui/vnc.c index d56fe2c180e..daf5b01d342 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3372,7 +3372,7 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSoc= ket *sioc, vs->as.freq =3D 44100; vs->as.nchannels =3D 2; vs->as.fmt =3D AUDIO_FORMAT_S16; - vs->as.endianness =3D 0; + vs->as.big_endian =3D false; =20 qemu_mutex_init(&vs->output_mutex); vs->bh =3D qemu_bh_new(vnc_jobs_bh, vs); --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243855; cv=none; d=zohomail.com; s=zohoarc; b=TRWpjhN/WA1zcFtrAzZZTlu3lyzcMxY9fTFZp+O/IvCLpxnu3Ney87zZM9k7CAMKKAejdZJPiEUPlSElc7rXPvZzga9RQQvlxUqU9xkzL6KkryR9MPu+USyYwhy1VpTmYuBUZoPBgwA73N3cufVown20sdf5aHw+wKGN8013/uk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243855; h=Content-Type: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=jh01TnR1WKr53dWUDRQLe2CRWCIsdVlOiG3qS34GaeQ=; b=cdoyVOPyvOshUETNhOoCclWLBFg5m2OOU6J2SpqI1nvF09Obnp0IfN/vSFFkPE5pCboZl6wGPFcPDdd+eQYQpg4jLPyagcTlBSPNU32EqlALTs4GHnUbX68czgbf8ayTTKBYbLYSBQ2nQsCMpc5jKd64Ggid3cflVRCGqzW5x9k= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177124385554118.23019343756448; Mon, 16 Feb 2026 04:10:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfZ-0008F0-HV; Mon, 16 Feb 2026 06:21:37 -0500 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 1vrwdG-0007kz-RP for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdF-0008SJ-2V for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:14 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-t-1jchMZMYSArAE2aATl6g-1; Mon, 16 Feb 2026 06:19:09 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 07E8C1800342; Mon, 16 Feb 2026 11:19:07 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D83CC18004AD; Mon, 16 Feb 2026 11:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jh01TnR1WKr53dWUDRQLe2CRWCIsdVlOiG3qS34GaeQ=; b=Qr8v+z9+5DPTyaREJwtAcA3sEYWk9i6iZL0fWPlOjnBHIyiunWs4U5bVIz5YjR/oBY7khI QP99EGyVj65r97oBJBaXIKz3DcMFPJ7qCVZsoS7AFdxjLPRfLUwCw4DEZY48VldlnX+9U4 zVksCSu0TMtgaMiZGJoY6rP8xGFGwz0= X-MC-Unique: t-1jchMZMYSArAE2aATl6g-1 X-Mimecast-MFC-AGG-ID: t-1jchMZMYSArAE2aATl6g_1771240747 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:03 +0100 Subject: [PATCH 74/85] audio: replace ldebug with trace events MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-74-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2585; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=LJcSuW2BtX9Mst8LxXKghg7ubBSgT/CUaX2Tj3sx1Wg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSPE7di7Rch31YMastXMAVy+GZfzsJE4IK6 Fvi8O83bZqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5T+GEACpbLJzGOjg525NzPv4kC8pvkMsd0iF3XyMVgKJam1cBlQj3If6dK7B8zrxLr6BFknjArQ ySqgc1cXCqWLFgXK4BMJcHo5CaL8u/DHoi1lJFSbZPa+NoBEPGUB8wyGBt9XHsYytZenl7wUXFh vM6h/Zf+lGgdEykhcOCMTMx27HyCWYOehMkaHxvBBxG0PbsVIr3z7BbJllfUWG75bPZijIBe8VK yikCQXRwIhP3WfGV3DgTl31aWi2WuZ3J86HhKeT+7pAIwP6vO3yvZ/zmr7VqH3qzJJOv+rRzWb2 NqMtIlJ5Q+nhaelSKGv8fHPak1ZQfPvEGbUeMcNLA25auYn6u+eDKs5PxsFJhlcQ6ukmGUFuj+T emyrxm6uBHi9u313nbGOiOjH5NcCfJJu8tbkEjUHi3b0C6s8wED1MJFeO7pAP1aQl7Q0j2kFXv0 1pk8oozJhDROqsGgwEgnV6S1xEXoEBaA1OgjEjWW3CjoGg0ThJUX+Sv2SeEDMYBdrmfPjAVcxdu GpFi+SNC05FTnDNB7BafVusVJoozRXEcFi/k5wmYawxlmmh7bpOl0uG6u7yGQHShan845xSZrtt 1C8it1U+Jmz/hkiO6SFY45YeG6vVaXDP3W3sMmwQiAUHmyaubvCB1G1lE5WK1MnLbevRjvAriTt ksLlNbUW3axPwlQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243858935154100 Replace the ldebug macro calls with proper trace events: - audio_get_avail: traces available samples in capture stream - audio_open_out/audio_open_in: traces stream open parameters This provides structured tracing that can be enabled at runtime without requiring debug builds. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_template.h | 7 +++++-- audio/audio-mixeng-be.c | 6 +----- audio/trace-events | 7 +++++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index 3da91a4782c..c47a2f202f0 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -507,8 +507,11 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(s); pdo =3D glue(audio_get_pdo_, TYPE)(s->dev); =20 - ldebug ("open %s, freq %d, nchannels %d, fmt %d\n", - name, as->freq, as->nchannels, as->fmt); +#ifdef DAC + trace_audio_open_out(name, as->freq, as->nchannels, as->fmt); +#else + trace_audio_open_in(name, as->freq, as->nchannels, as->fmt); +#endif =20 if (audio_bug(__func__, audio_validate_settings(as))) { audio_print_settings (as); diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index d05202aabae..84e4d136de3 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -881,11 +881,7 @@ static size_t audio_get_avail(SWVoiceIn *sw) return 0; } =20 - ldebug ( - "%s: get_avail live %zu frontend frames %u\n", - SW_NAME (sw), - live, st_rate_frames_out(sw->rate, live) - ); + trace_audio_get_avail(SW_NAME(sw), live, st_rate_frames_out(sw->rate, = live)); =20 return live; } diff --git a/audio/trace-events b/audio/trace-events index f33be2dd8e3..4749c54fc04 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -58,3 +58,10 @@ audio_be_set_active_out(void *sw, bool on) "sw=3D%p, on= =3D%d" audio_timer_start(int interval) "interval %d ms" audio_timer_stop(void) "" audio_timer_delayed(int interval) "interval %d ms" + +# audio-mixeng-be.c +audio_get_avail(const char *name, size_t live, uint32_t frontend_frames) "= %s: get_avail live %zu frontend frames %u" + +# audio_template.h +audio_open_out(const char *name, int freq, int nchannels, int fmt) "open %= s, freq %d, nchannels %d, fmt %d" +audio_open_in(const char *name, int freq, int nchannels, int fmt) "open %s= , freq %d, nchannels %d, fmt %d" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243847; cv=none; d=zohomail.com; s=zohoarc; b=LvDXPdldRiLjZjcjhj1tPXkLvwmNhjGoE1bei/DSLpCcF9RxNXwBU5KDAyAhE6LO+Mdb/WXqSXkaR9oCp0lN76psVE04mZIBhyeKZUAE709hvGCPKtUJXAymSWYjwkrtjXY7ZKOZbMLIWkG/QK5BAe4DQBDaPJKVmdgfRVs2gwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243847; h=Content-Type: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=N7c59NEfg4hmqcbZ3MZ180N2UP3aJ4ktCpkln/Wb2qE=; b=l2gGiOr/K7FGf3/gCUJXyWafDIz8coEqViBFn4IY26gg42zkDHzPo2aMquqNk1WNz8IBvKaukvloi6UKhip/kmPFiqHFiCNQLdRnvY4KCtvjJUf98fGbnDqUd1UNhyLj+oxHZyqDl76uU7tH062koRCMNKxwPWgpLt67foNnwY4= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243847017671.8251739965331; Mon, 16 Feb 2026 04:10:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfa-0008Mu-ID; Mon, 16 Feb 2026 06:21:38 -0500 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 1vrwdL-0007yI-4e for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdJ-0008TO-2x for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:18 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-199-4BQWyRFXM5OZuEZ7gBJIeg-1; Mon, 16 Feb 2026 06:19:11 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9C51D18002C1; Mon, 16 Feb 2026 11:19:09 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0BD8A1955F43; Mon, 16 Feb 2026 11:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N7c59NEfg4hmqcbZ3MZ180N2UP3aJ4ktCpkln/Wb2qE=; b=JqOcgD0JtQkNLMFqZ40t0jkzI+1vxDCkRnqErCEwp/D8kdoa3bm+CVZnHWwdq0WJaMx0Sr hZGj+UlYaPAP5CvxPka8Q3saMEzAass3eT5BTIAix57fvOPX1mz31A0XNIJDnuNGQjoIFs kZsuLuiWb/KZxd/fxksFvzm9+3YSqpY= X-MC-Unique: 4BQWyRFXM5OZuEZ7gBJIeg-1 X-Mimecast-MFC-AGG-ID: 4BQWyRFXM5OZuEZ7gBJIeg_1771240749 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:04 +0100 Subject: [PATCH 75/85] audio: rework DEBUG_POLL MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-75-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3820; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=VuHJE/OMoLF5FV66Xec/LvzCGIsN/NmdER0U65ZSEv0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSC3oidMw+TYQw+bed/aGyUDri9z1ES2mfP mNcR+kss6KJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5c4uD/sEd++T8QohRaQ95Za6IPQRCm1KE+xDf5nA1SOKwPzmuQDDiQrozdPuMv5Vcy1FSDc0oPq hMyYijL0C49wC06yiwaPAjtwios2ncI6XYim21cjvauUwO/wfvXwu0MB94+nmkjhMYrXkIJq+MI xs7veXvlVf+ThVbDHMxp9LjWFNxRnlYrbYzfKcgOLSYqNusDtMnHmJRdlm6C+A/Er/LPMCAl0Vr +GSVoh5Gz81ZwuZo0hyXkkF6l8BZIvU6ECtv8YpOIQLgrnxRX9sKNRzHG5sRhu+QcjEmUbNy7H/ ppfOeH/VQd4wnJhY9VVvvsdOi8tFnW0tcmc0ONrzKxnO4nMaKbQB1QoD6JdlPe8TOTDncUdQonJ MxBn0lCJMKJ9CIBR0dj49JKuelJUP6gLrphdeiyq68CSuXhXcylMFXmwwwpv43NS2RbpKzPRgPf Ak/YJest1iyVRLsB1w2ixFHwRXqRWIrfz1h04eRahIvgr3feZJPKOhFMIcXUoEBMysWPkXT3vGY We+JscZXwHlOTYrJh9JOxhR+OmoHYO27+PI0xWwCIedoP3ZCe5SmKubNKk1XoxUpSV6Ag7v/QvJ vlAgGhrJnAB6N2j85w8oN3e+SbsyenoPP+47zACsMUTS6W6ZyiQAiWvgRSPBJcSkYuRFFvmXAYI XLrX7JpFBi9H96w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243848785154100 Use more correct GTimer, specific for each backend, with a trace event. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 1 + include/qemu/timer.h | 1 + audio/audio-mixeng-be.c | 25 +++++++++---------------- audio/trace-events | 1 + 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index dd5f2220d75..e0ed6af67ed 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -224,6 +224,7 @@ struct AudioMixengBackend { Audiodev *dev; =20 QEMUTimer *ts; + GTimer *run_timer; QLIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in; QLIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out; QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head; diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 7c18da16525..b931181f53d 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -6,6 +6,7 @@ #include "qemu/host-utils.h" =20 #define NANOSECONDS_PER_SECOND 1000000000LL +#define MICROSECONDS_PER_SECOND 1000000LL =20 /* timers */ =20 diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 84e4d136de3..2aeb05ba37e 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -24,13 +24,13 @@ #include "system/replay.h" #include "system/runstate.h" #include "trace.h" +#include "trace/control.h" =20 #define AUDIO_CAP "audio" #include "audio_int.h" =20 /* #define DEBUG_OUT */ /* #define DEBUG_CAPTURE */ -/* #define DEBUG_POLL */ =20 #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" =20 @@ -1269,22 +1269,12 @@ void audio_run(AudioMixengBackend *s, const char *m= sg) audio_run_in(s); audio_run_capture(s); =20 -#ifdef DEBUG_POLL - { - static double prevtime; - double currtime; - struct timeval tv; - - if (gettimeofday (&tv, NULL)) { - perror ("audio_run: gettimeofday"); - return; - } - - currtime =3D tv.tv_sec + tv.tv_usec * 1e-6; - dolog ("Elapsed since last %s: %f\n", msg, currtime - prevtime); - prevtime =3D currtime; + if (trace_event_get_state(TRACE_AUDIO_RUN_POLL)) { + /* Convert seconds to microseconds for trace event */ + int64_t elapsed_us =3D g_timer_elapsed(s->run_timer, NULL) * MICRO= SECONDS_PER_SECOND; + trace_audio_run_poll(msg, elapsed_us); + g_timer_start(s->run_timer); } -#endif } =20 void audio_generic_run_buffer_in(HWVoiceIn *hw) @@ -1545,6 +1535,7 @@ static void audio_mixeng_backend_init(Object *obj) QLIST_INIT(&s->hw_head_in); QLIST_INIT(&s->cap_head); s->ts =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); + s->run_timer =3D g_timer_new(); =20 s->vmse =3D qemu_add_vm_change_state_handler(audio_vm_change_state_han= dler, s); assert(s->vmse !=3D NULL); @@ -1596,6 +1587,8 @@ static void audio_mixeng_backend_finalize(Object *obj) s->ts =3D NULL; } =20 + g_clear_pointer(&s->run_timer, g_timer_destroy); + if (s->vmse) { qemu_del_vm_change_state_handler(s->vmse); s->vmse =3D NULL; diff --git a/audio/trace-events b/audio/trace-events index 4749c54fc04..d66a712e871 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -61,6 +61,7 @@ audio_timer_delayed(int interval) "interval %d ms" =20 # audio-mixeng-be.c audio_get_avail(const char *name, size_t live, uint32_t frontend_frames) "= %s: get_avail live %zu frontend frames %u" +audio_run_poll(const char *msg, int64_t elapsed_us) "Elapsed since last %s= : %" PRId64 " us" =20 # audio_template.h audio_open_out(const char *name, int freq, int nchannels, int fmt) "open %= s, freq %d, nchannels %d, fmt %d" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242205; cv=none; d=zohomail.com; s=zohoarc; b=mOrgzFyYK4uq3B4uzp4P0ceCcFGI2RBtlYhADk2E7E2NMcQs8Ec+Zucbvav3cpFJnwRhTlX0fteXW7iV0uZ+gGZGXbucoHeBbe3cvd1s9s9B8TwNELYdjqnKmmP4IMLEF/pNcOb/6yWmzMFLBld1XdK7ejrWxjuQtRSsUnkbJuc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242205; h=Content-Type: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=vPnMn5GvDJ7OVIuZ6lCYOvbjpyhZ011xLX1+qzHSAZE=; b=eOG1O7ARSUBNcTDPy0iehWp5SaDjpSZxJfMtDopeleqGewS+DczFcw/Y6R0WF+oW/W9f3YQiAKZf2wGGUdnOAzVyTTNbY8tP8Jsqxxia5s4re5wIFfywlqJNzox9XnI7mo7aKvUVKFFdpiCWuq4Kb/8lbb8SpgxQSPIs1/eg6Sw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242205541204.60141380544985; Mon, 16 Feb 2026 03:43:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfU-0007SH-8i; Mon, 16 Feb 2026 06:21:32 -0500 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 1vrwdL-00080I-Hd for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdJ-0008TW-TO for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:19 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-648-eQmQSJsUOAOApDI_wTsxNg-1; Mon, 16 Feb 2026 06:19:14 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0DA3B1955D89; Mon, 16 Feb 2026 11:19:12 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5AE441800465; Mon, 16 Feb 2026 11:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vPnMn5GvDJ7OVIuZ6lCYOvbjpyhZ011xLX1+qzHSAZE=; b=blVUIEUZSk2uHJwlFP086PBT+nvs8YI6TH4B6f6wcrCcOWRBnSQZrhhV/Ulf5Mn/S2g3WJ IZTta872fN8lordDmBMb0nYGvNIx1vy8rJxO0YC0pKs3QvBbbj3V6xDGYSjpvUfKPSFKIo R8wlBRI1A29TbzmiOtyp7Qx2wkMrVGg= X-MC-Unique: eQmQSJsUOAOApDI_wTsxNg-1 X-Mimecast-MFC-AGG-ID: eQmQSJsUOAOApDI_wTsxNg_1771240752 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:05 +0100 Subject: [PATCH 76/85] audio: replace DEBUG_CAPTURE with traces MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-76-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3272; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=UIeZrRXkt2pxBSVmhpp0ZuhXisqo8XrlL/ZfBoMA7Kc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSqeKbpRQDATwUVaUtAewI8YCn+CHkcAFwq uCcGV09uEWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5TUYEACCbS0H+9dz94pjnMmO2xlvs4V12fgz0J7fur4MSTA/XPA1q1YsGH0mWiV1cnmPGeVtLRR +WhDf/9jAI+OO8FxHvWArz8gP3j/74DMPgZCZ4yXtek1thU7aG+9k/rJe6DObjk+IDGGtYmKYWU KbQ415cyNdY4Bxnf89wAwlXpG0TmFWp2+LdxhC6DHlTbQIgX2z89IfStYp/PLT0JDAJ9pYVsvpx dnD7mVOCGCaKBwuqzf10w6YBZey7ZxABiRYGH04jFyhoYI5BrvnAoHyYao88r3ioOw1LC61OBb7 LaSWv0I1dvWYt7lGfEOnLOHdCYNlD7OjAMGWwHTOa9JF2GE7hfs/JA8s4mGtScgZzqKnMVdYw7V oDKaaVo3Q71kcRUEF0LUSUuWyUvhxCj+4Ur7V63ZMztHKOW6uiXnBWwRKueoxuDwFCa610B985t eSCqa4ZUpz/3gRjHzHgMRZDUX+qUgjmK6OrrBsgkT7Y/s4GDz57XFm3TD6SK+qNIx/XsAnaBKvU 49hoHtw0vFVhZmeFGDHw1SwGhFIfqgw6WJVOppAfm4nOMJv1XO9YCG6ESFQG8nRlufbhltH9+AT XOKZbFx73GPx4VsmnCOHyHdEuWYY7/RxbjU8w0TLmvzrlfNZZ7WNEAnL4H9ndPe/nVgCtedhJWF HNJGsBKFUSRvi5Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242208048158500 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio-mixeng-be.c | 20 +++++++------------- audio/trace-events | 3 +++ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 2aeb05ba37e..1963f3e5c79 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -30,7 +30,6 @@ #include "audio_int.h" =20 /* #define DEBUG_OUT */ -/* #define DEBUG_CAPTURE */ =20 #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" =20 @@ -249,9 +248,8 @@ static void audio_notify_capture (CaptureVoiceOut *cap,= audcnotification_e cmd) { struct capture_callback *cb; =20 -#ifdef DEBUG_CAPTURE - dolog ("notification %d sent\n", cmd); -#endif + trace_audio_notify_capture(cmd); + for (cb =3D cap->cb_head.lh_first; cb; cb =3D cb->entries.le_next) { cb->ops.notify (cb->opaque, cmd); } @@ -333,12 +331,10 @@ static int audio_attach_capture (HWVoiceOut *hw) sw->rate =3D st_rate_start (sw->info.freq, hw_cap->info.freq); QLIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); QLIST_INSERT_HEAD (&hw->cap_head, sc, entries); -#ifdef DEBUG_CAPTURE - sw->name =3D g_strdup_printf ("for %p %d,%d,%d", - hw, sw->info.freq, sw->info.bits, - sw->info.nchannels); - dolog ("Added %s active =3D %d\n", sw->name, sw->active); -#endif + sw->name =3D g_strdup_printf("for %p %d,%s,%d", + hw, sw->info.freq, AudioFormat_str(sw->= info.af), + sw->info.nchannels); + trace_audio_capture_attach(sw->name, sw->active); if (sw->active) { audio_capture_maybe_changed (cap, 1); } @@ -1707,10 +1703,8 @@ static void audio_mixeng_backend_del_capture( =20 while (sw) { SWVoiceCap *sc =3D (SWVoiceCap *) sw; -#ifdef DEBUG_CAPTURE - dolog ("freeing %s\n", sw->name); -#endif =20 + trace_audio_capture_free_sw(sw->name); sw1 =3D sw->entries.le_next; if (sw->rate) { st_rate_stop (sw->rate); diff --git a/audio/trace-events b/audio/trace-events index d66a712e871..3f8ebf9c6cb 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -58,10 +58,13 @@ audio_be_set_active_out(void *sw, bool on) "sw=3D%p, on= =3D%d" audio_timer_start(int interval) "interval %d ms" audio_timer_stop(void) "" audio_timer_delayed(int interval) "interval %d ms" +audio_notify_capture(int cmd) "notification %d sent" +audio_capture_attach(const char *name, bool active) "capture %s active=3D%= d" =20 # audio-mixeng-be.c audio_get_avail(const char *name, size_t live, uint32_t frontend_frames) "= %s: get_avail live %zu frontend frames %u" audio_run_poll(const char *msg, int64_t elapsed_us) "Elapsed since last %s= : %" PRId64 " us" +audio_capture_free_sw(const char *name) "freeing %s" =20 # audio_template.h audio_open_out(const char *name, int freq, int nchannels, int fmt) "open %= s, freq %d, nchannels %d, fmt %d" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244653; cv=none; d=zohomail.com; s=zohoarc; b=Row2PrB3dBMyOKZnf9Jm4+8pn1xXJ9/JWL0zWqMC7FBMNBDfY21awSICg0zJYXbjfxlW2xoUmL8vw93Ah0nv9M7dcSYiNzuQ0h5U9GRZgUEdu6cpqA2c2dd8fmCAuXL8szc3f+rak2MZJYgI1Lur2YUmw1a9GLkyNvggE9WmXiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244653; h=Content-Type: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=BB6jQvGRqbXD7hENVx2pNstNIc4pFnH7f/Xe+/sKYwo=; b=MBqXTEIrsF1R5oCkqSS+p986B2LUYNctTX2qVHz/qHrvzi2ZEmF3avpp1oBGf6ug+DId97keBiFs4gCeL10D/g1DRw2eJvWJus46KmpkVm8NOXwW2DCnf6GGvieK2RopIhDKzLuzKA3CqmjT66TRlUUzl2H2JGoTnL5X8SA78iU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244653225942.1974918147043; Mon, 16 Feb 2026 04:24:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfh-0000fr-S8; Mon, 16 Feb 2026 06:21:45 -0500 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 1vrwdQ-0008Kj-3t for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdO-0008UU-J5 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:23 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-533-vPQv5zfANgG7zZ6iODK0HQ-1; Mon, 16 Feb 2026 06:19:17 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 911A2180047F; Mon, 16 Feb 2026 11:19:15 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EE2E61800464; Mon, 16 Feb 2026 11:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240761; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BB6jQvGRqbXD7hENVx2pNstNIc4pFnH7f/Xe+/sKYwo=; b=KDk73N0wRcuB5rHKrW+C2Im2WGKmYztpEaRaHhYvnDlEBdqo/kZYw/Zz4v/9WO7zs8QFT8 7hVJSzsCfm26zw3vYRoXngMCaDJWg6N23a+oqM0vpq7eXYHpXvLc8dyHQut6uK8v+sTwW2 rPIKdkCFN95o461EV66oqGNQWYDgG3U= X-MC-Unique: vPQv5zfANgG7zZ6iODK0HQ-1 X-Mimecast-MFC-AGG-ID: vPQv5zfANgG7zZ6iODK0HQ_1771240755 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:06 +0100 Subject: [PATCH 77/85] audio: replace DEBUG_OUT with traces MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-77-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3777; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=b1klW4axY6twkEGfrheCi2WZdrVTpoIdzbMvZtSetFQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSD1tB2iPbiDer/gUC7JJQHK122dd/DQiHS gGvw/JMRp2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5Qi4D/4kXQIy8DYZMN/lWGjcNjP2yxGx6bYOyUBlC6LUHkP6lmCwgKBMMJxvfkK52LPURJ76oAl doYlcUY3INlg0+gqnyafels7Du27ZnzlqbykSep+qMKAd5IT0A4vZzoyKogG8MWTmn+F0UUqlql RivjAWeT8DjNwFbNjUb+XU1Qr3KV092DKgjabnrW/B759kiskAA/e/HEz4B2i8/6i1+7tsBmaCX i7p2Dvu02Zin6B2O7pGq2TapCXQBdoaMV6NkqTTd4XpoUjlu6dAbgVw5u2KvkfT2xauUSl0y6TW HaTvsOB0ZCwc71ObqHWNYH+R8IBwyFenQf28NGrT/uhT5WACKHBywrYRLZH80iEvgKpw6JKMnuS EHilMeHUsB0Dh17FWNb3L1d2ddku3pCwB5a3D34EfnuG958UeKs4qNKgCXV2XdXrQexnqru8/oC fcRKLJ1cbNfeC8nqOefyAp1lbW38vQaaSveXukk6Z+ZIZMgQmWlI+MvbQbUxSiQLEikQVwOqDlR Nn6F+ehNer0rhvkCfIfwPwI7owWnHUpbx8pwYaMu19TInF3w75m0LJJHWz2OONGj4DO02aoFame gxl6N3oCnKaFHRIkIs2nlyeyMorEzPgmmtCi2AnaPemuNUzMJWNR9H23Fv5NKvu8ksrnlJmOuwn z189WHXkqsIdQ/g== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771244653901158500 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio-mixeng-be.c | 32 ++++++++------------------------ audio/trace-events | 5 +++++ 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 1963f3e5c79..3dd9d17dd25 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -29,8 +29,6 @@ #define AUDIO_CAP "audio" #include "audio_int.h" =20 -/* #define DEBUG_OUT */ - #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" =20 const struct mixeng_volume nominal_volume =3D { @@ -568,9 +566,7 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *= buf, size_t buf_len) } =20 if (live =3D=3D hw->mix_buf.size) { -#ifdef DEBUG_OUT - dolog ("%s is full %zu\n", sw->name, live); -#endif + trace_audio_out_full(sw->name, live); return 0; } =20 @@ -618,15 +614,8 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void = *buf, size_t buf_len) sw->resample_buf.pos =3D 0; } =20 -#ifdef DEBUG_OUT - dolog ( - "%s: write size %zu written %zu total mixed %zu\n", - SW_NAME(sw), - buf_len / sw->info.bytes_per_frame, - total_in, - sw->total_hw_samples_mixed - ); -#endif + trace_audio_sw_write(SW_NAME(sw), buf_len / sw->info.bytes_per_frame, + total_in, sw->total_hw_samples_mixed); =20 return total_in * sw->info.bytes_per_frame; } @@ -900,10 +889,8 @@ static size_t audio_get_free(SWVoiceOut *sw) =20 dead =3D sw->hw->mix_buf.size - live; =20 -#ifdef DEBUG_OUT - dolog("%s: get_free live %zu dead %zu frontend frames %u\n", - SW_NAME(sw), live, dead, st_rate_frames_in(sw->rate, dead)); -#endif + trace_audio_get_free(SW_NAME(sw), live, dead, + st_rate_frames_in(sw->rate, dead)); =20 return dead; } @@ -1058,9 +1045,8 @@ static void audio_run_out(AudioMixengBackend *s) =20 if (hw->pending_disable && !nb_live) { SWVoiceCap *sc; -#ifdef DEBUG_OUT - dolog ("Disabling voice\n"); -#endif + + trace_audio_out_disable(); hw->enabled =3D false; hw->pending_disable =3D false; if (k->enable_out) { @@ -1089,9 +1075,7 @@ static void audio_run_out(AudioMixengBackend *s) hw->mix_buf.pos =3D 0; } =20 -#ifdef DEBUG_OUT - dolog("played=3D%zu\n", played); -#endif + trace_audio_out_played(played); =20 if (played) { audio_capture_mix_and_clear (hw, prev_rpos, played); diff --git a/audio/trace-events b/audio/trace-events index 3f8ebf9c6cb..7a73d6eb84f 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -65,6 +65,11 @@ audio_capture_attach(const char *name, bool active) "cap= ture %s active=3D%d" audio_get_avail(const char *name, size_t live, uint32_t frontend_frames) "= %s: get_avail live %zu frontend frames %u" audio_run_poll(const char *msg, int64_t elapsed_us) "Elapsed since last %s= : %" PRId64 " us" audio_capture_free_sw(const char *name) "freeing %s" +audio_out_full(const char *name, size_t live) "%s is full %zu" +audio_sw_write(const char *name, size_t size, size_t written, size_t total= _mixed) "%s: write size %zu written %zu total mixed %zu" +audio_get_free(const char *name, size_t live, size_t dead, uint32_t fronte= nd_frames) "%s: get_free live %zu dead %zu frontend frames %u" +audio_out_disable(void) "Disabling voice" +audio_out_played(size_t played) "played=3D%zu" =20 # audio_template.h audio_open_out(const char *name, int freq, int nchannels, int fmt) "open %= s, freq %d, nchannels %d, fmt %d" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242389; cv=none; d=zohomail.com; s=zohoarc; b=kpVBptsKWz7H9KhBKEJIwpG/KIeDFmqVilgzv1W6bpjPXoRCBVhBEFp+FGwu7uSkrVIym5TuwPEHtP02lnwlYkWhkEnGeTJqs8ypAJPxFDV+fuFpd61PIQmoZg4yNVIJP5CMUAOEsKPFassbRN89FpNijW98xqwdGafBkG2VV1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242389; h=Content-Type: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=j/L1qp3ldn5ldXcfT6BhehGpgMBZTb6wUy0XgMwt8eQ=; b=JuvTH3qIFRTzEIHcJqC2je0kYt8VakJ3Dx3yWf/AOXRHAU/1WUnspZNvezYMRCKlL7jt0O3FNrHSd+kv1Y60qUt7mqacC03s/rs8yWEMSds8fBDXr8n0VyGQb5OPlJubwHaU6cV80iRd3vLU5aJoqFolGWlM0p9AFBUgf1tpzwQ= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242389774625.3353788605147; Mon, 16 Feb 2026 03:46:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfj-0000ts-S0; Mon, 16 Feb 2026 06:21:48 -0500 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 1vrwdT-0008Uh-Gq for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdQ-0008Un-Il for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:27 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-ij9K_VF3OMeyv3ibV2-OZA-1; Mon, 16 Feb 2026 06:19:20 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C7B711956050; Mon, 16 Feb 2026 11:19:18 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A059519560A2; Mon, 16 Feb 2026 11:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j/L1qp3ldn5ldXcfT6BhehGpgMBZTb6wUy0XgMwt8eQ=; b=VgMVArvTB8xJTwvc7rh/ZGwk+mjQkxXXJEmHYZ0l4BESvvZF/EDwV3ydppf66QdA8EG3kI 3VKdbOm3V2J0pW7pwb1PhBKbuneXtVDtXqgNHhzBAIikfS4mqsI9fPnK3CWs9RetprJd/H ahMlnWaStCoqI5Pa5Q0oQ1PoEljuxSs= X-MC-Unique: ij9K_VF3OMeyv3ibV2-OZA-1 X-Mimecast-MFC-AGG-ID: ij9K_VF3OMeyv3ibV2-OZA_1771240758 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:07 +0100 Subject: [PATCH 78/85] audio: replace DEBUG_AUDIO with trace MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-78-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2400; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=xQHNvgrEZK26gRRFzeS01/f7AY6vbpJbR/MSqj2WBVI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSjsTCtVBufqbWe12dQHHQP4s2y6y0BeiKl 6xSWk4QUzeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5UxLEACRC7wS8hTEs8W4MzLQqSnqwSWssu9QpJ6ji7QfaHvm3NCgQQ3Bzq0KH8ql/P1Iev0CNFi MOt9Ma3s4FOsX3tHDzeTlqQICKX5EZIESDFeQ9/sJdkjoQ4rcqHGcsDZF+7vVKWlP4LM2A21Fel JfVLs6lThdyoV8fJdsliaJptYgtQ+3t9y0MrYgFrp/YJviL8tM0Q2pnlglbVyo4HS3h4JpH8L3i P7jE4vpsZq/tSL2ubW76BBxqlDVerx6CNQZVR99G/tG8L0Zs3cscckS3hgwQbOYqltchzhMQaW/ 2mI7X+YfoIYG4WnyZnwY4dIdvTn1SfyN7xWoMd8bNJASQODHa+R/+X79rdUpHCaPBI9DiAyMyHE HfuNnNv5X90Y0oeTSCx2HFsP2xAqSiGKjiRwgwHUEBNYVkdlJAW+JhSEXOspYSxQ2C07PZbuQTz P0w5OD5N6TyUxPGr2a4KAMF2TtOYIq6/97MvyirRuhysY8BVHr8U7UeDt2RFszuBLWc47uaLG0H 6pK7EIWpIqZ8HiBqlwCsOxRmoSyIM9RvpVljHvE7RQexh1luM4Db1oI3pt/Kwn+6pj4w2DoGIho I8v5aGf2zwGbIiV+zUqPeiKfarIYX3ZvScTDSkJyIAmQOMG8nkDK9/0TciQNdPeZgD7PGBDkLCO 0FLSjghCKLeYq2Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242392701154100 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_template.h | 10 +++++----- audio/audio-mixeng-be.c | 9 --------- audio/trace-events | 1 + 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index c47a2f202f0..e884c8e9b1a 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -556,11 +556,11 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( sw->callback.fn =3D callback_fn; sw->callback.opaque =3D callback_opaque; =20 -#ifdef DEBUG_AUDIO - dolog ("%s\n", name); - audio_pcm_print_info ("hw", &sw->hw->info); - audio_pcm_print_info ("sw", &sw->info); -#endif + trace_audio_voice_pair(G_STRINGIFY(TYPE), name, + AudioFormat_str(sw->hw->info.af), + sw->hw->info.freq, sw->hw->info.nchannels, + AudioFormat_str(sw->info.af), + sw->info.freq, sw->info.nchannels); =20 return sw; =20 diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 3dd9d17dd25..7eabb1c2505 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -620,15 +620,6 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void = *buf, size_t buf_len) return total_in * sw->info.bytes_per_frame; } =20 -#ifdef DEBUG_AUDIO -static void audio_pcm_print_info (const char *cap, struct audio_pcm_info *= info) -{ - dolog("%s: %s, freq %d, nchan %d\n", - cap, AudioFormat_str(info->af), info->freq, - info->nchannels); -} -#endif - #define DAC #include "audio_template.h" #undef DAC diff --git a/audio/trace-events b/audio/trace-events index 7a73d6eb84f..ed04792d508 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -74,3 +74,4 @@ audio_out_played(size_t played) "played=3D%zu" # audio_template.h audio_open_out(const char *name, int freq, int nchannels, int fmt) "open %= s, freq %d, nchannels %d, fmt %d" audio_open_in(const char *name, int freq, int nchannels, int fmt) "open %s= , freq %d, nchannels %d, fmt %d" +audio_voice_pair(const char *type, const char *name, const char *hw_fmt, i= nt hw_freq, int hw_nchannels, const char *sw_fmt, int sw_freq, int sw_nchan= nels) "%s: name=3D%s hw=3D%s/%d/%d sw=3D%s/%d/%d" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771245254; cv=none; d=zohomail.com; s=zohoarc; b=Stvmza7sBViPQVSQ1v9wACcBJeCbdPgZH/8fozelpeHJiJda1WN4K7ilvfllWpl6lYJF4fQPdnSE0Mg7hOfZA+pC4yqNKdXkI1GVUwEInc3sLGTnTD/dYR8ujbX6XAtLr3b+vv4rADCLqdubU9ZxkBpzL8h2yEacesPSr1fJsrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771245254; h=Content-Type: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=Vhkcofagmtouh19qmptVO0BhTBa1KkRCfho8pOX3WJ4=; b=OCpNzhzxggppR6hYwJm7MzEgjJMTfjw9uoZjni7cSGGqPAZgpHa7+rbWebITLqtFWVi9hBQlfvAGYRa7mjyW9q0NXuf8Rjl1QZ6pLWDUoLAGUo6zGd4nuYQpTTatIKqztUnnVjU//37QZjaiWjfVN9+bkt5GPy1T1Tel1AAtMrM= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771245254040210.2861534279093; Mon, 16 Feb 2026 04:34:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfn-0001I8-5Q; Mon, 16 Feb 2026 06:21:51 -0500 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 1vrwdU-00006Q-Pf for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdT-0008VG-6A for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:28 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-360-f5jl3WirOrOxa-w2KaN19w-1; Mon, 16 Feb 2026 06:19:23 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 46E961955BF7; Mon, 16 Feb 2026 11:19:21 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9A97E19560AD; Mon, 16 Feb 2026 11:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vhkcofagmtouh19qmptVO0BhTBa1KkRCfho8pOX3WJ4=; b=QyoBhVHePr77v46FvJSw7fL7YMwGSpTUUjmG7lBql1Zy/xznK9nBpji/Gv4JvwlwujCZ7B o2bSVKzr5c0ZwainE+Fq8bsplpPF7QW/DCU9V2xnQG6vFFY2IbaBwsA+aDfWIpj51Oc4jo ZZ11bvnboMClQNM4kncfhoJo200UiPI= X-MC-Unique: f5jl3WirOrOxa-w2KaN19w-1 X-Mimecast-MFC-AGG-ID: f5jl3WirOrOxa-w2KaN19w_1771240761 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:08 +0100 Subject: [PATCH 79/85] tests/audio: add an invalid settings test MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-79-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=1591; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Ep6XYOJTTnvtH9h/pjwifpDZkwuSLv1dTtbA4CUxjQ4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSlVux5GX2MP4GqvIafm6hOtzHkoU0PgFqO z4IngKs0h6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5bYKEACK0tFObpv+eWOkSGmhRF2Ge+H+Pf/Jcu5cjGTFfMcaFmQWKvG2wxfiaREgdPzfPy9MEKA S5i9JfdtK7KWQLBW5jsAGs7jf+rezMkVGxT+Q/Am84CQVW/470vIbfGlYknE4GK4SnbnQKTeKm8 W5IfkIZIL277f1zcXyiKUb7TZfY0FbNAGPAnkDyPuzinGx7HxHknMWqhOCfURnXBbXPL0JY2yeI 40ZJrVuPvYmUUNHLQgaTJjmDQpEq1JZ9ql7TnQgz0q45ywwDhetO6gJipBV4kkRPCBu4h0yDFW+ VxXyYNwxLDw/hA9PNKVgw48NSPLKwYzvsDOYuorgC6163QfRPs/wElLV8P9YqQUOqDwtzXkw1jK B731yz2BexvM6VJbpoSTG7wzECGY+fcEoc9F9GzoKK9V9dQZoIz711JMRYUU2bo1hz7rKHDz+fe zjFc5hmlvwPC3JP2kK0BCRhKh1l0NUZfFbKZQBGsVwYXWlxokbyFAMVC2WThTNMSIMgRJIbFYPB gGxx+q9RxCMgZh3VhnqHSG79yjXtM/6Uk6pBldGYg9SoAnGeQWCqZIFtYAbo5+S+Y7HoDURsf9z mJdjrUTgMZ/ntwQiUMwgvgdZLMN2Yb0thsZ13Lw8MdkadrZLJZNZQDr3CxIoJ8sMSHk9eonDcwA yeuHpTFqWHd0WfA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771245256694158500 As we are going to change the related code next. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- tests/audio/test-audio.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/audio/test-audio.c b/tests/audio/test-audio.c index b87a12eb55b..af8cf03d10e 100644 --- a/tests/audio/test-audio.c +++ b/tests/audio/test-audio.c @@ -534,6 +534,26 @@ static void test_audio_multiple_voices(void) audio_be_close_out(be, out1); } =20 +static const struct audsettings invalid_test_settings =3D { + .nchannels =3D 0, + .freq =3D SAMPLE_RATE, + .fmt =3D AUDIO_FORMAT_S16, + .big_endian =3D false, +}; + +static void test_audio_invalid_settings(void) +{ + AudioBackend *be =3D get_test_audio_backend(); + void *voice; + + voice =3D audio_be_open_out(be, NULL, "invalid", NULL, + dummy_audio_callback, &invalid_test_settings= ); + g_assert_null(voice); + voice =3D audio_be_open_in(be, NULL, "invalid", NULL, + dummy_audio_callback, &invalid_test_settings); + g_assert_null(voice); +} + int main(int argc, char **argv) { GOptionContext *context; @@ -589,6 +609,7 @@ int main(int argc, char **argv) =20 g_test_add_func("/audio/null-handling", test_audio_null_handling); g_test_add_func("/audio/multiple-voices", test_audio_multiple_voices); + g_test_add_func("/audio/invalid-settings", test_audio_invalid_settings= ); =20 ret =3D g_test_run(); =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242162; cv=none; d=zohomail.com; s=zohoarc; b=iehx3SQeDrLHMlqyHzyybIE8A4w71ToaUZJJ3lbL6I49N9h0onewrLz4Bq2WuAZtrLuq5GXbgNmAS5Lg/4+eOsEHFGmRgqoMsuimBkJ5DE/5rqlzvGq0DZkgec7GNxI0Ez/B3na//pj1SkVkE0SA8dJ+aJVbxTPc4D10ul5mEQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242162; h=Content-Type: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=m0EmStvnfux6SRdwIes6737BLoqxJP2yVeKJO8MbGz4=; b=PKuUFF8BxyVON/k34F43cVuhGtKBg9/LYIDgtmr/WFK5P6UFBRklMiltXNDW8W8zrQUC4e7gZiLJeexhduNZzXr8Ez0WVOUryo1wN+fci5iVH1//9QychpMZZYStwhH5woa3dm8PeOT2TMzhb7CFEf4QfuqO1ZA9D63Jd6nk/Hw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771242162126858.0161100719016; Mon, 16 Feb 2026 03:42:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfU-0007XQ-Ow; Mon, 16 Feb 2026 06:21:32 -0500 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 1vrwdY-0000co-Jb for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdW-0008WR-Vf for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:32 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-157-qBn4hfwiOxy1PhneU5GLmw-1; Mon, 16 Feb 2026 06:19:26 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 416311800352; Mon, 16 Feb 2026 11:19:24 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 490CC30001A5; Mon, 16 Feb 2026 11:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m0EmStvnfux6SRdwIes6737BLoqxJP2yVeKJO8MbGz4=; b=Ia6TSTDxJzKU3qSdV5mt3XQGVq4pP41EgXQgxYj3+seoeyQHiS8JtC9bhkwPgKQiFuDokq 0Yg/qR0L47BVD2Ux67w2vehwVcBJJ+Z06BJnxXbfHZlRidP6qJGMBTfy8wV+w+cY4oGGQO J8MgST20xixhko2QKcqlAna9qaME9xY= X-MC-Unique: qBn4hfwiOxy1PhneU5GLmw-1 X-Mimecast-MFC-AGG-ID: qBn4hfwiOxy1PhneU5GLmw_1771240764 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:09 +0100 Subject: [PATCH 80/85] audio: rework invalid audsettings error MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-80-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3338; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=DOJovR/J2k1KAla05HmsB7pR9pRP9RvnTgMZQuarhDc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSnXO32iYEl8o8zZV2F9Oh/JWAlwWg37ikc r7xIdTzuR6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5aVEEACh9XvMthEFPQywxqOzatqETNSiy+JPT0Xu3afRti/u4CYaGO1uPl/mL39QskvYmUU79pW UAbDvbOzfLl3X4ABUSXsI6Txh1W4V1GoeY7CZrEW7X/hG7MuF6wgaIZUwlMa6ycLtpwqrfszJo7 sWW92UWAd+XbYASkT2nMVj7rRNcsk3MKoAJ1F5LveFmJ1Cj/kEjspvjS05sMOGVQJTja2LPt7dU vcxTrol5D/Hes2WClKpxZrm4MqHHGlrC1n+9JnFjaV7Y/+99/k50jnp1L1QuLf6KEKd+gABOJB6 NW6o6mE83UskEDBuSfc5U2SOR0YLi+QKBGbPdC5lhfgULyEClCqD263BkVdvvwOvYPgbZ/Bd4kG S4dfBvZWaEVGKadD+CflRzdbxWi/oZC9b/QpsLeCXuTiCPoybRpki0BfZts55DchoScL0JAxYpJ hE7wcsudaVF6mi+AMbHtiuAFRrlA7/v6fE2FYOObiBjIaQT4DSPAfNwP6es4njGz6iDmM1VOLwH r6lDXyGNQ9D/W2a3zmDoJ5w6UDTfs4tWEa0+uSZ3kxRws9JeBxCWUk6mexV3AO+Jeor5HZcloOZ 8TiODYoCUOLdcBPlY+DM7h1tWmnZGnHdn1kVXtZnVUfotxpjLYPVT1BB3b5/x/kImG7yNHESnud ppkdaJCERvAbbnA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242164322154100 Currently, when given invalid settings, QEMU will print to stderr: A bug was just triggered in audio_mixeng_backend_open_out Save all your work and restart without audio I am sorry Context: audio: frequency=3D44100 nchannels=3D0 fmt=3DS16 endianness=3Dlittle Now it will use error_report() and simply report: audio: Invalid audio settings: frequency=3D44100 nchannels=3D0 fmt=3Ds16 en= dian=3Dlittle Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_template.h | 5 +++-- audio/audio-mixeng-be.c | 41 +++++++---------------------------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index e884c8e9b1a..5711f4a26e1 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -513,8 +513,9 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( trace_audio_open_in(name, as->freq, as->nchannels, as->fmt); #endif =20 - if (audio_bug(__func__, audio_validate_settings(as))) { - audio_print_settings (as); + if (audio_validate_settings(as)) { + g_autofree char *str =3D audsettings_to_string(as); + error_report("audio: Invalid audio settings: %s", str); goto fail; } =20 diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 7eabb1c2505..bb8c0b56f78 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -101,38 +101,11 @@ void AUD_log (const char *cap, const char *fmt, ...) va_end (ap); } =20 -static void audio_print_settings (const struct audsettings *as) +static char *audsettings_to_string(const struct audsettings *as) { - dolog ("frequency=3D%d nchannels=3D%d fmt=3D", as->freq, as->nchannels= ); - - switch (as->fmt) { - case AUDIO_FORMAT_S8: - AUD_log (NULL, "S8"); - break; - case AUDIO_FORMAT_U8: - AUD_log (NULL, "U8"); - break; - case AUDIO_FORMAT_S16: - AUD_log (NULL, "S16"); - break; - case AUDIO_FORMAT_U16: - AUD_log (NULL, "U16"); - break; - case AUDIO_FORMAT_S32: - AUD_log (NULL, "S32"); - break; - case AUDIO_FORMAT_U32: - AUD_log (NULL, "U32"); - break; - case AUDIO_FORMAT_F32: - AUD_log (NULL, "F32"); - break; - default: - AUD_log (NULL, "invalid(%d)", as->fmt); - break; - } - - AUD_log (NULL, " endianness=3D%s\n", as->big_endian ? "big" : "little"= ); + return g_strdup_printf("frequency=3D%d nchannels=3D%d fmt=3D%s endian= =3D%s", + as->freq, as->nchannels, AudioFormat_str(as->fm= t), + as->big_endian ? "big" : "little"); } =20 static int audio_validate_settings (const struct audsettings *as) @@ -1607,9 +1580,9 @@ static CaptureVoiceOut *audio_mixeng_backend_add_capt= ure( return NULL; } =20 - if (audio_validate_settings (as)) { - dolog ("Invalid settings were passed when trying to add capture\n"= ); - audio_print_settings (as); + if (audio_validate_settings(as)) { + g_autofree char *str =3D audsettings_to_string(as); + error_report("audio: Invalid audio settings when trying to add cap= ture: %s", str); return NULL; } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243414; cv=none; d=zohomail.com; s=zohoarc; b=Ds7l9WhbYKvud/tOVXsa/TIwdQBWm4ZtAo3pWh6HvzqNZK0hG0YNEzq4UyrGu376sduxWWSay8MwFNw++tbzSvELWbqsINQsOuWMbp10tJtdx5kGREJF8Q+dzSdLMAZhA9HtPdb3h8bCkLqKhEvsSDAOn167gzySWI+ErU4EIZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243414; h=Content-Type: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=Ewz4+F8wLEtvaEcONlL4Y8tX4BoVoh7SgRY5ARaYuAk=; b=Y6ESCjQW8IYwarmVRwM3D7BbVITjQYEa3jwo5JF5jQP2DhpAtRNkZWo00P1+9+ta9d4Ci699zsvCFUTypy6evy2HV1RMxjzW6ebh71dSkAg86IMXklHyatF3vvLm89FhZ93RGhHB6C5BqmhJzdvdG/8R1R4MGwZJyGz2HEQbtnU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243414951899.5521552576761; Mon, 16 Feb 2026 04:03:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfm-0001Fn-OM; Mon, 16 Feb 2026 06:21:50 -0500 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 1vrwdc-0000za-5a for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdZ-00006K-T1 for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:35 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-688-NFnMI7v4M2qG1oNPCa19nQ-1; Mon, 16 Feb 2026 06:19:29 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4065519560A7; Mon, 16 Feb 2026 11:19:27 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E991C1800668; Mon, 16 Feb 2026 11:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240772; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ewz4+F8wLEtvaEcONlL4Y8tX4BoVoh7SgRY5ARaYuAk=; b=WEgjcK5Hsbw1wuJum+vlaXNcPNmHm5XIkh9ZwRrtOweREICuhTICnlJto37Vk8MVtcRTpZ Kf8oOuMIGe+ADCWQGz9Gp37rUwu578AQphW2DuhMl5LP+4HuVhvmda/AqqKmYR/OQiS27m Tn2UHaXBVS/9Eop5o4FFFtL8IOq2Q1c= X-MC-Unique: NFnMI7v4M2qG1oNPCa19nQ-1 X-Mimecast-MFC-AGG-ID: NFnMI7v4M2qG1oNPCa19nQ_1771240767 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:10 +0100 Subject: [PATCH 81/85] audio: rework audio_bug() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-81-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=11037; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/3V2T6+AVOssg4wHpZHYi8m0iDkSaDhsu7P35DaXrLk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSkgYNzhg230arsEiJ36msyQOTDWB/1rWp2 jCud6Nb6SqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5ZARD/4ng5KqzsGHx2AdN1Bn1SUQy3SQMGz031sYQKws8JP6i5rivPPufw0sjMHaUuws8zjBmJJ 4be9tI1HZqcH8MZrS7w2qaBbGsRPo9B2aYeIAC5BYRGbpmXwkyi1Ns/YylOSIvLoWQry2aHWYPE ftbl1RLU+fDVskVEGhrxk8sSKwRZRI0rNGvoXYKkXBNJp1zTDFuQSSGy66Gm2/JhCxJqx4krECa kfDyY7Xy0zvkjOEvH7huW6VCQHqwG9V1dph0RUvIbbd5tNZtcDp+gBUIVOIPydmGQJWez/eCV7H qvlROvh7Tr7WAASbPzNm0BWsrOT7QA0pVDRJUUwiJfJ2enwhRvh6XLfBMtdL6K+0AlGO+Ne+T82 8arzr/T+7IOHZmHuy5tY0ZHp1gS/dmM4SeGdaAEKYgWf7EjtEU6Xc1HT4APbzkSl/pq7Huz1t7n zMtt3E4Xvn+fRpcxnzIUDV+k6jkmNELA4aJsVsPp6P+FMBB/b4KAqZphssV9mZD+JqaqzaGPbqO Ghas7HORNNilgMzzK583KgqNxod9QXmjQfg/iKHTZj8mA7k4BCjlDUt4QFLWvM4Dxq/kw6b3ju2 SxXEzYoyOh6/j6ihKbqPDAKTCs/mWHYjKKL7PMeVSlX9B5Ndu9l3fzEwqpqE+/+DxphMjH4ZV08 7yOZ06a2ngjYkoA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771243416738154100 audio_bug() is a bit unconventional, it is meant to be used as a condition expression, passing the actual condition as second argument (and __func__ as first argument). If the condition is true, it uses AUD_log() to print to stderr, and has some dubious recommendations printed only once. This change: - clears the control flow, and make the condition directly visible in the 'if' statement. - uses standard QEMU error_report() - audio_bug() now captures __func__ - remove the "Save all your work and restart..." once hint Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 2 -- audio/audio_template.h | 38 +++++++++++++-------------- audio/audio-mixeng-be.c | 69 +++++++++++++++++++--------------------------= ---- 3 files changed, 46 insertions(+), 63 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index e0ed6af67ed..20ec7883aab 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -244,8 +244,6 @@ extern const char *audio_prio_list[]; void audio_pcm_init_info (struct audio_pcm_info *info, const struct audset= tings *as); void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int= len); =20 -int audio_bug (const char *funcname, int cond); - void audio_run(AudioMixengBackend *s, const char *msg); =20 typedef struct RateCtl { diff --git a/audio/audio_template.h b/audio/audio_template.h index 5711f4a26e1..9dde36738bc 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -64,15 +64,15 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioMixe= ngBackend *s, min_voices); } =20 - if (audio_bug(__func__, !voice_size && max_voices)) { - dolog("drv=3D`%s' voice_size=3D0 max_voices=3D%d\n", - k->name, max_voices); + if (!voice_size && max_voices) { + audio_bug("drv=3D`%s' voice_size=3D0 max_voices=3D%d", + k->name, max_voices); glue(s->nb_hw_voices_, TYPE) =3D 0; } =20 - if (audio_bug(__func__, voice_size && !max_voices)) { - dolog("drv=3D`%s' voice_size=3D%zu max_voices=3D0\n", - k->name, voice_size); + if (voice_size && !max_voices) { + audio_bug("drv=3D`%s' voice_size=3D%zu max_voices=3D0", + k->name, voice_size); } } =20 @@ -88,8 +88,8 @@ static void glue(audio_pcm_hw_alloc_resources_, TYPE)(HW = *hw) { if (glue(audio_get_pdo_, TYPE)(hw->s->dev)->mixing_engine) { size_t samples =3D hw->samples; - if (audio_bug(__func__, samples =3D=3D 0)) { - dolog("Attempted to allocate empty buffer\n"); + if (samples =3D=3D 0) { + audio_bug("Attempted to allocate empty buffer"); } =20 HWBUF.buffer =3D g_new0(st_sample, samples); @@ -275,8 +275,8 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixen= gBackend *s, return NULL; } =20 - if (audio_bug(__func__, !glue(k->init_, TYPE))) { - dolog("No host audio driver or missing init_%s\n", NAME); + if (!glue(k->init_, TYPE)) { + audio_bug("No host audio driver or missing init_%s", NAME); return NULL; } =20 @@ -295,8 +295,8 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioMixen= gBackend *s, goto err0; } =20 - if (audio_bug(__func__, hw->samples <=3D 0)) { - dolog("hw->samples=3D%zd\n", hw->samples); + if (hw->samples <=3D 0) { + audio_bug("hw->samples=3D%zd", hw->samples); goto err1; } =20 @@ -477,8 +477,8 @@ static void glue (audio_close_, TYPE) (SW *sw) static void glue(audio_mixeng_backend_close_, TYPE)(AudioBackend *be, SW *= sw) { if (sw) { - if (audio_bug(__func__, !be)) { - dolog("backend=3D%p\n", be); + if (!be) { + audio_bug("backend=3D%p", be); return; } =20 @@ -498,9 +498,9 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( AudioMixengBackendClass *k; AudiodevPerDirectionOptions *pdo; =20 - if (audio_bug(__func__, !be || !name || !callback_fn || !as)) { - dolog("backend=3D%p name=3D%p callback_fn=3D%p as=3D%p\n", - be, name, callback_fn, as); + if (!be || !name || !callback_fn || !as) { + audio_bug("backend=3D%p name=3D%p callback_fn=3D%p as=3D%p", + be, name, callback_fn, as); goto fail; } =20 @@ -519,8 +519,8 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( goto fail; } =20 - if (audio_bug(__func__, !glue(k->init_, TYPE))) { - dolog("Can not open `%s' (no host audio driver)\n", name); + if (!glue(k->init_, TYPE)) { + error_report("audio: Can not open `%s' (no host audio driver)", na= me); goto fail; } =20 diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index bb8c0b56f78..45bcfb74338 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -31,6 +31,8 @@ =20 #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" =20 +#define audio_bug(fmt, ...) error_report("%s: " fmt, __func__, ##__VA_ARGS= __) + const struct mixeng_volume nominal_volume =3D { .mute =3D 0, #ifdef FLOAT_MIXENG @@ -42,23 +44,6 @@ const struct mixeng_volume nominal_volume =3D { #endif }; =20 -int audio_bug (const char *funcname, int cond) -{ - if (cond) { - static int shown; - - AUD_log (NULL, "A bug was just triggered in %s\n", funcname); - if (!shown) { - shown =3D 1; - AUD_log (NULL, "Save all your work and restart without audio\n= "); - AUD_log (NULL, "I am sorry\n"); - } - AUD_log (NULL, "Context:\n"); - } - - return cond; -} - /* * Convert audio format to mixeng_clip index. Used by audio_pcm_sw_init_ a= nd * audio_mixeng_backend_add_capture() @@ -332,8 +317,8 @@ static size_t audio_pcm_hw_find_min_in (HWVoiceIn *hw) static size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw) { size_t live =3D hw->total_samples_captured - audio_pcm_hw_find_min_in = (hw); - if (audio_bug(__func__, live > hw->conv_buf.size)) { - dolog("live=3D%zu hw->conv_buf.size=3D%zu\n", live, hw->conv_buf.s= ize); + if (live > hw->conv_buf.size) { + audio_bug("live=3D%zu hw->conv_buf.size=3D%zu", live, hw->conv_buf= .size); return 0; } return live; @@ -402,8 +387,8 @@ static size_t audio_pcm_sw_read(SWVoiceIn *sw, void *bu= f, size_t buf_len) if (!live) { return 0; } - if (audio_bug(__func__, live > hw->conv_buf.size)) { - dolog("live_in=3D%zu hw->conv_buf.size=3D%zu\n", live, hw->conv_bu= f.size); + if (live > hw->conv_buf.size) { + audio_bug("live=3D%zu hw->conv_buf.size=3D%zu", live, hw->conv_buf= .size); return 0; } =20 @@ -454,8 +439,8 @@ static size_t audio_pcm_hw_get_live_out (HWVoiceOut *hw= , int *nb_live) if (nb_live1) { size_t live =3D smin; =20 - if (audio_bug(__func__, live > hw->mix_buf.size)) { - dolog("live=3D%zu hw->mix_buf.size=3D%zu\n", live, hw->mix_buf= .size); + if (live > hw->mix_buf.size) { + audio_bug("live=3D%zu hw->mix_buf.size=3D%zu", live, hw->mix_b= uf.size); return 0; } return live; @@ -533,8 +518,8 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *= buf, size_t buf_len) size_t frames_in_max, frames_out_max, total_in, total_out; =20 live =3D sw->total_hw_samples_mixed; - if (audio_bug(__func__, live > hw->mix_buf.size)) { - dolog("live=3D%zu hw->mix_buf.size=3D%zu\n", live, hw->mix_buf.siz= e); + if (live > hw->mix_buf.size) { + audio_bug("live=3D%zu hw->mix_buf.size=3D%zu", live, hw->mix_buf.s= ize); return 0; } =20 @@ -824,9 +809,9 @@ static size_t audio_get_avail(SWVoiceIn *sw) } =20 live =3D sw->hw->total_samples_captured - sw->total_hw_samples_acquire= d; - if (audio_bug(__func__, live > sw->hw->conv_buf.size)) { - dolog("live=3D%zu sw->hw->conv_buf.size=3D%zu\n", live, - sw->hw->conv_buf.size); + if (live > sw->hw->conv_buf.size) { + audio_bug("live=3D%zu sw->hw->conv_buf.size=3D%zu", live, + sw->hw->conv_buf.size); return 0; } =20 @@ -845,9 +830,9 @@ static size_t audio_get_free(SWVoiceOut *sw) =20 live =3D sw->total_hw_samples_mixed; =20 - if (audio_bug(__func__, live > sw->hw->mix_buf.size)) { - dolog("live=3D%zu sw->hw->mix_buf.size=3D%zu\n", live, - sw->hw->mix_buf.size); + if (live > sw->hw->mix_buf.size) { + audio_bug("live=3D%zu sw->hw->mix_buf.size=3D%zu", live, + sw->hw->mix_buf.size); return 0; } =20 @@ -1002,8 +987,8 @@ static void audio_run_out(AudioMixengBackend *s) live =3D 0; } =20 - if (audio_bug(__func__, live > hw->mix_buf.size)) { - dolog("live=3D%zu hw->mix_buf.size=3D%zu\n", live, hw->mix_buf= .size); + if (live > hw->mix_buf.size) { + audio_bug("live=3D%zu hw->mix_buf.size=3D%zu", live, hw->mix_b= uf.size); continue; } =20 @@ -1033,9 +1018,9 @@ static void audio_run_out(AudioMixengBackend *s) prev_rpos =3D hw->mix_buf.pos; played =3D audio_pcm_hw_run_out(hw, live); replay_audio_out(&played); - if (audio_bug(__func__, hw->mix_buf.pos >=3D hw->mix_buf.size)) { - dolog("hw->mix_buf.pos=3D%zu hw->mix_buf.size=3D%zu played=3D%= zu\n", - hw->mix_buf.pos, hw->mix_buf.size, played); + if (hw->mix_buf.pos >=3D hw->mix_buf.size) { + audio_bug("hw->mix_buf.pos=3D%zu hw->mix_buf.size=3D%zu played= =3D%zu", + hw->mix_buf.pos, hw->mix_buf.size, played); hw->mix_buf.pos =3D 0; } =20 @@ -1050,9 +1035,9 @@ static void audio_run_out(AudioMixengBackend *s) continue; } =20 - if (audio_bug(__func__, played > sw->total_hw_samples_mixed)) { - dolog("played=3D%zu sw->total_hw_samples_mixed=3D%zu\n", - played, sw->total_hw_samples_mixed); + if (played > sw->total_hw_samples_mixed) { + audio_bug("played=3D%zu sw->total_hw_samples_mixed=3D%zu", + played, sw->total_hw_samples_mixed); played =3D sw->total_hw_samples_mixed; } =20 @@ -1195,9 +1180,9 @@ static void audio_run_capture(AudioMixengBackend *s) continue; } =20 - if (audio_bug(__func__, captured > sw->total_hw_samples_mixed)= ) { - dolog("captured=3D%zu sw->total_hw_samples_mixed=3D%zu\n", - captured, sw->total_hw_samples_mixed); + if (captured > sw->total_hw_samples_mixed) { + audio_bug("captured=3D%zu sw->total_hw_samples_mixed=3D%zu= ", + captured, sw->total_hw_samples_mixed); captured =3D sw->total_hw_samples_mixed; } =20 --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771242554; cv=none; d=zohomail.com; s=zohoarc; b=Xba7tFWSBgui1wh3tC6jYuOyIFUzn+eaquMQMYWnhYmqrMIw2vB3XfTQOxNU0hayrNHVklrAV5RqianUKHxmfJq3bXL2kiJ7fsaNAof4DFA/HMZpqGCjfbYAUXRXLC9aSj6PGS+3ia+koPBEB7rrvhWE0/akMyNyjJ7n1MH0Zy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771242554; h=Content-Type: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=FAUf6ISAZflTDjhXPD3ercX88fY0ngZoOrqUS7o23nE=; b=daQfUySyW3laJAlK4RGj0yneMC0CktuX9SmE8XcK0Wavuc4eWvsPcvMXQW7giMFkXKYOlKvDnApsj2hyB/bG82SJtsHHcO69tf+ATO3hdzxzMSNiWuzO7DT3uyAAlZ4Qmq3Xq86QlU50EXCr4xB6Y6yHi2vezs0Xkt+U6Cgt5c8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17712425542617.3208699180804615; Mon, 16 Feb 2026 03:49:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfV-0007c0-Gr; Mon, 16 Feb 2026 06:21:33 -0500 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 1vrwdd-00014w-QN for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdc-00008p-1J for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:37 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-eZ5vn84fMCuPDEEuy7Dqdw-1; Mon, 16 Feb 2026 06:19:32 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 13585180061C; Mon, 16 Feb 2026 11:19:30 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 366AE18003F5; Mon, 16 Feb 2026 11:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240775; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FAUf6ISAZflTDjhXPD3ercX88fY0ngZoOrqUS7o23nE=; b=BiNGh4GsUVsrI5ErVCxb8+jKAeQqGg3HFPbaZJuHHNkqgnY0WFJGZ0MMJvo5Fjq34mxh3w dw4kcueH2vJPqJEBNz+mOHHU+3d7eayh1MjIRI842JEjtCt+KApmllSUybD0RtmTxPOtyX fhb5yDyj+1HoVP95Aqk5Ve+L+2vMiSY= X-MC-Unique: eZ5vn84fMCuPDEEuy7Dqdw-1 X-Mimecast-MFC-AGG-ID: eZ5vn84fMCuPDEEuy7Dqdw_1771240770 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:11 +0100 Subject: [PATCH 82/85] audio: replace remaining dolog() and AUD_log MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-82-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=5295; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=mOUp9eC9vpEhRWm1F10PNR55828CsJNREo9Q5TCNNvM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxS8OVVpkPOKm5cUtP04sCqyOLFsyNqaNIl+ zQ23O2L4S2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5Tn9EACsUwLAH8MeYZjy+V08nmhf4+TbU/JZDkFGl+cx5bR8Lz114WS2shcfs0dbnzJVobZNqqw BLjBA/96RW2g3aPpaGlfYwKnJsZtK2dUhV8OSPzmyRN8t65kjIqdZic3epkDw12BdgSnVlkmPxl WYMJKRFfk6suDuXwGdvrCuvNKQOfmg6Z6Xl114MSZKSVbfR7Yoac7yrR09nW8+GPFhKqzSk3p61 vpyAiAy+ClkBHyM97svUVRfNYXjSo4Ma7GH/TZzjGFaCqW5iADljBc7/9QWX+DPLad/6Hk2CRzA cWdxVZoDXXJYc6Z5DMTLiDyQCGgufr452FPMlI+SpplDo3u1082HdxghrBbmbqpd69tXJaFG7Pi TUYRX5dLEkAKEShuPBXu2QtbLV45sIKjwkDSERI+srdBFXNETo1W43TVkPlLVDNn2P0roHZ1gT5 p6Pdvlog/oH8okWj/Gtieze1O9P5KgFvFCb1TzbrAeOTge9ekBx/YBnl4z/SMrrqQwYgVZrEJqi kst01pGscF9tnPcmgfT+6tdFtdI9tkvKS5Wgnx9H0Dgy+zP1+PtGKk4BaB0XHrE5Ij+7lLmtjhp cRpvpQGCJvMr9IWWFGAfC1KzXvlE1hlkkJRDxA4TcmiSstDMBcmjbzTpf0nF2/OL0aGL6bPRr7M vOVYUq6gDhnHJtQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771242556188154100 Use warn_report/error_report and trace instead. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_template.h | 19 ++++++++----------- audio/audio-mixeng-be.c | 14 ++++++-------- audio/trace-events | 1 + 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index 9dde36738bc..760aaf5f31f 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -47,21 +47,19 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioMixe= ngBackend *s, if (glue(s->nb_hw_voices_, TYPE) > max_voices) { if (!max_voices) { #ifdef DAC - dolog("Driver `%s' does not support " NAME "\n", k->name); + warn_report("audio: Driver '%s' does not support " NAME, k->na= me); #endif } else { - dolog("Driver `%s' does not support %d " NAME " voices, max %d= \n", - k->name, - glue(s->nb_hw_voices_, TYPE), - max_voices); + warn_report("audio: Driver '%s' does not support %d " NAME " v= oices, max %d", + k->name, glue(s->nb_hw_voices_, TYPE), max_voices); } glue(s->nb_hw_voices_, TYPE) =3D max_voices; } =20 if (glue(s->nb_hw_voices_, TYPE) < min_voices) { - dolog("Bogus number of " NAME " voices %d, setting to %d\n", - glue(s->nb_hw_voices_, TYPE), - min_voices); + warn_report("audio: Bogus number of " NAME " voices %d, setting to= %d", + glue(s->nb_hw_voices_, TYPE), + min_voices); } =20 if (!voice_size && max_voices) { @@ -443,7 +441,7 @@ static SW *glue(audio_pcm_create_voice_pair_, TYPE)( =20 hw =3D glue(audio_pcm_hw_add_, TYPE)(s, &hw_as); if (!hw) { - dolog("Could not create a backend for voice `%s'\n", sw_name); + error_report("audio: Could not create a backend for voice '%s'", s= w_name); goto err1; } =20 @@ -537,8 +535,7 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( HW *hw =3D sw->hw; =20 if (!hw) { - dolog("Internal logic error: voice `%s' has no backend\n", - SW_NAME(sw)); + audio_bug("Internal logic error: voice '%s' has no backend", S= W_NAME(sw)); goto fail; } =20 diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 45bcfb74338..87e5a2fc3af 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -654,7 +654,7 @@ static size_t audio_mixeng_backend_write(AudioBackend *= be, SWVoiceOut *sw, hw =3D sw->hw; =20 if (!hw->enabled) { - dolog("Writing to disabled voice %s\n", SW_NAME(sw)); + warn_report("audio: Writing to disabled voice %s", SW_NAME(sw)); return 0; } =20 @@ -677,7 +677,7 @@ static size_t audio_mixeng_backend_read(AudioBackend *b= e, hw =3D sw->hw; =20 if (!hw->enabled) { - dolog("Reading from disabled voice %s\n", SW_NAME(sw)); + warn_report("audio: Reading from disabled voice %s", SW_NAME(sw)); return 0; } =20 @@ -874,9 +874,8 @@ static void audio_capture_mix_and_clear(HWVoiceOut *hw,= size_t rpos, sw->empty =3D sw->total_hw_samples_mixed =3D=3D 0; =20 if (to_read - frames_in) { - dolog("Could not mix %zu frames into a capture " - "buffer, mixed %zu\n", - to_read, frames_in); + audio_bug("Could not mix %zu frames into a capture " + "buffer, mixed %zu", to_read, frames_in); break; } n -=3D to_read; @@ -1561,7 +1560,7 @@ static CaptureVoiceOut *audio_mixeng_backend_add_capt= ure( } =20 if (!audio_get_pdo_out(s->dev)->mixing_engine) { - dolog("Can't capture with mixeng disabled\n"); + error_report("audio: Can't capture with mixeng disabled"); return NULL; } =20 @@ -1754,8 +1753,7 @@ size_t audio_rate_peek_bytes(RateCtl *rate, struct au= dio_pcm_info *info) void audio_rate_add_bytes(RateCtl *rate, size_t bytes_used) { if (rate->peeked_frames < 0 || rate->peeked_frames > 65536) { - AUD_log(NULL, "Resetting rate control (%" PRId64 " frames)\n", - rate->peeked_frames); + trace_audio_rate_reset(rate->peeked_frames); audio_rate_start(rate); } =20 diff --git a/audio/trace-events b/audio/trace-events index ed04792d508..222e73c7e88 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -70,6 +70,7 @@ audio_sw_write(const char *name, size_t size, size_t writ= ten, size_t total_mixed audio_get_free(const char *name, size_t live, size_t dead, uint32_t fronte= nd_frames) "%s: get_free live %zu dead %zu frontend frames %u" audio_out_disable(void) "Disabling voice" audio_out_played(size_t played) "played=3D%zu" +audio_rate_reset(int64_t frames) "Resetting rate control (%" PRId64 " fram= es)" =20 # audio_template.h audio_open_out(const char *name, int freq, int nchannels, int fmt) "open %= s, freq %d, nchannels %d, fmt %d" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243454; cv=none; d=zohomail.com; s=zohoarc; b=lbLnmGzYlQYxi11O6vRZDHA4C2t3xxzQLHkVrd4SHpjIMGBlry0CBmglbiU/RgkMtfIHSOg7En1WTWo5tIM3wDicI57XfxRWk4mdLXZLkDGTPamhDTGYMNdMQUymLUS4jPcHiOLALMZlG206qRrpTK5dRmKCGKDSSJdpBLPTfr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243454; h=Content-Type: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=LUP+G2rwSZjjp818AEO2MqOgi20Zq+c3evxaj7rofVg=; b=TVp6Yz/CqOnilFoizTUMANzbXG3dmLth0V0qwFQQSOyN8i46rpEWyB/n4N0q98E/hY4j/ff2MLG1MO/ZGxbafjqO0d/Q6LKVnHb5b/AjlSjw8cIYZB4n4y1Bv9yozye/790KfVGo8DbWyUhSGnx9Hw+tunQCwDoRD07Jf3akU+8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243454887590.1408009569144; Mon, 16 Feb 2026 04:04:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwff-0000OI-3t; Mon, 16 Feb 2026 06:21:43 -0500 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 1vrwdi-0001Gz-KJ for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdf-00009q-ML for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:42 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-154-6rvFx-VzM8q23-UhVuhAUw-1; Mon, 16 Feb 2026 06:19:34 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 809BC1800464; Mon, 16 Feb 2026 11:19:32 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D778B30001A5; Mon, 16 Feb 2026 11:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LUP+G2rwSZjjp818AEO2MqOgi20Zq+c3evxaj7rofVg=; b=eL+WhRiMqBiEaR2GR3YxbOppvpdPo35kaGAMzjb460Z0g3DEY3QLlZODOX4HyB9UbvGxis r7qXnE2I+Gq/v9Jp1DzRv4G5GgKfVekc5AwzHuJAyKq3EWvzutZnZ1Jcy6IC10x3YVabg+ /8rsP5uT8d94HuIvGnRP5tyLIHO3G+Y= X-MC-Unique: 6rvFx-VzM8q23-UhVuhAUw-1 X-Mimecast-MFC-AGG-ID: 6rvFx-VzM8q23-UhVuhAUw_1771240772 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:12 +0100 Subject: [PATCH 83/85] audio: remove AUD_log/ldebug MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-83-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=3404; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=wYEC+0RY6JzYLHGKwBVCYQt+/nE3Fr4RFck/o8ke+9Q=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSB39sG13RfjzVUOgEPjEPtzl6qSSehB8VC Yyu8pBZpF6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5cbxD/4gZMNLnfHBdGVo9QnEl60b3/UEw8dEanVeoITFTFDpqf2ci8JC75kPIInmGCi2Dobtz+f lsL5xSoxpyhZg+t0ojuc8T6UBcw5ZOzv57fwBCQDQvFaULlIzddwmRqR6CVOM+8HPrmlHS9nQIS UDheF1iCBoxwlaihAId4pxM1GIgTSHV6X1hwOApo7MSDqg/xNp2MqZnRcScPYKPbesk9mB9lSvs 70mUUX3WFbndWXCJocQv1NEox7jfJsGhKVa/lUt5/M17GWDuNTCB6kNNbBmmBH/ocL532gItmWg LS5UJLDGrxkBuKRjZFQRDsKFG/ierneuNnN2mxDX49jfSJhucbXt4PCR9yVuzjiu1Pu0RYlzqtx Dt9fMlajxTVa9BJEgnbNVj0sMw7q8+YtkvzY8x9epI/fQkS/8kDN5pHNGztauT5CccgA8AAuwHv 55LDXAtsofD6CghlgmOazwg/NvvU8BRA+kHpLHkSKvq0dwW7CSgfeX3bakCpWER49EcTYA4z6QF Fx2UUaRQLpKoWoCbJMLtbktdAFZwtqMgZFWh3TQNjgM7duLj5gDnFs/aJmtAHsLr7lqCZ8Jweyn Hv4ewuPxOX4oe8OzzO58dKge1Ht/oKntsoYqGdfHttiWD4JYX0zGSAY/qas6pvPEdoqyq8Dev0l MIlxQLE98zjuV8Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243455603158500 audio/ is now converted to use QEMU standard trace & error reporting. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 14 -------------- audio/audio_template.h | 2 +- audio/audio-mixeng-be.c | 19 ------------------- audio/mixeng.c | 1 - 4 files changed, 1 insertion(+), 35 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 20ec7883aab..3fc4b516878 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -33,12 +33,6 @@ #include "qemu/audio-capture.h" #include "mixeng.h" =20 -void G_GNUC_PRINTF(2, 0) -AUD_vlog(const char *cap, const char *fmt, va_list ap); - -void G_GNUC_PRINTF(2, 3) -AUD_log(const char *cap, const char *fmt, ...); - struct audio_callback { void *opaque; audio_callback_fn fn; @@ -276,14 +270,6 @@ static inline size_t audio_ring_posb(size_t pos, size_= t dist, size_t len) return pos >=3D dist ? pos - dist : len - dist + pos; } =20 -#define dolog(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__) - -#ifdef DEBUG -#define ldebug(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__) -#else -#define ldebug(fmt, ...) (void)0 -#endif - AudiodevPerDirectionOptions *audio_get_pdo_in(Audiodev *dev); AudiodevPerDirectionOptions *audio_get_pdo_out(Audiodev *dev); =20 diff --git a/audio/audio_template.h b/audio/audio_template.h index 760aaf5f31f..85a128e2f47 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -128,7 +128,7 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) (= SW *sw) /* f_fe_min =3D ceil(1 [frames] * f_be [Hz] / size_be [frames]) */ f_fe_min =3D (f_be + HWBUF.size - 1) / HWBUF.size; qemu_log_mask(LOG_UNIMP, - AUDIO_CAP ": The guest selected a " NAME " sample ra= te" + "audio: The guest selected a " NAME " sample rate" " of %d Hz for %s. Only sample rates >=3D %" PRIu64 = " Hz" " are supported.\n", sw->info.freq, sw->name, f_fe_min); diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 87e5a2fc3af..a6d5812fc65 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -26,7 +26,6 @@ #include "trace.h" #include "trace/control.h" =20 -#define AUDIO_CAP "audio" #include "audio_int.h" =20 #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" @@ -68,24 +67,6 @@ static int audio_format_to_index(AudioFormat af) g_assert_not_reached(); } =20 -void AUD_vlog (const char *cap, const char *fmt, va_list ap) -{ - if (cap) { - fprintf(stderr, "%s: ", cap); - } - - vfprintf(stderr, fmt, ap); -} - -void AUD_log (const char *cap, const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (cap, fmt, ap); - va_end (ap); -} - static char *audsettings_to_string(const struct audsettings *as) { return g_strdup_printf("frequency=3D%d nchannels=3D%d fmt=3D%s endian= =3D%s", diff --git a/audio/mixeng.c b/audio/mixeng.c index e63c76e021d..a209737a913 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -26,7 +26,6 @@ #include "qemu/bswap.h" #include "qemu/audio.h" =20 -#define AUDIO_CAP "mixeng" #include "audio_int.h" #ifdef FLOAT_MIXENG #include "qemu/error-report.h" --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771243559; cv=none; d=zohomail.com; s=zohoarc; b=mAPkVPP+u23kT8dXUGedpJMDH/pwLS1RWYGuot6if7s3x3ptpcBLPu2qBZNexFgmfHeesx/XaKrdZa9xihsXYq7h8xeVbYidnFcwY0JLeYxhlTpSeRM1rkIVjRdb7l0pViRGuLSe/kDePA/NUTv1Yxn1Ij+BHm0fnU34f6R7hVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771243559; h=Content-Type: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=eRimCvSJ4O0vwol/1wYyZmOmc8eByk/Bn62j9horiPY=; b=gA3upmYHlZfr0wFgYlxXtQP1R4WEjrC2o/CCqy4XvoYxUz3XAPUVvXBiu3vFMhV3O6LCY0us7VTwYu7sp54rFTdbl5SdSmMvwTzhBeAm0++wL64nVlpQ3uRalWtVFVVulUKBsoRh7kaab/HWB/6d0SM+gPvLr85iJ/jqKR30S3Y= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771243559549747.1292637174703; Mon, 16 Feb 2026 04:05:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfg-0000Xo-Mk; Mon, 16 Feb 2026 06:21:44 -0500 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 1vrwdr-0001N6-3B for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdi-0000Ab-PX for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:45 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-503-HOPyokzDOG6BOBcfyw_o7g-1; Mon, 16 Feb 2026 06:19:37 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 96EE218002E2; Mon, 16 Feb 2026 11:19:35 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8838F18003F5; Mon, 16 Feb 2026 11:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eRimCvSJ4O0vwol/1wYyZmOmc8eByk/Bn62j9horiPY=; b=g2bP3/TuhEAtQSQn3F7wRGIzCpiPJV4hCAdGKqAvYLRGasMvCihdjzXASJzLxj22X6t158 5NecoiPj5ibzSH5etreAJ5/eQaLIuhX9gpWKdJzqgViQkN0JNzrk3T4PeS6cx5nCJUdQQW iK3FCyFwzCbqekLONqfIBFSvwO3s5V8= X-MC-Unique: HOPyokzDOG6BOBcfyw_o7g-1 X-Mimecast-MFC-AGG-ID: HOPyokzDOG6BOBcfyw_o7g_1771240775 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:13 +0100 Subject: [PATCH 84/85] audio: remove AudioMixengBackendClass.name MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-84-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=9354; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=aJ0UgZuLfo+fSXqaSmFV5ghUB/RvdNXc2xmcEzCyWR4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSmrL6831tovaI0C4UzymsjGfCpJhywg7Sp mncd5V9WtqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5cwnD/9l/Nk8TvkQtlYd/ISG5JrG7B1byV+/fOjSqhIR8fUzW2tdBw34LoLQ/5pYJQXmef0uGvo tlcvEZFPoVZHFcEn0gTpT9E/iod/f0rcQU31Ll1QGs0T2lbosZqejrK/8jYfJPQLk305nMInNwv n9awDqsYAYSS0dwKXkcSLtpWUjHavxZ6LKWR5v2EVBzwc4PojBmiQYqSSUSmntrXUP8ec9kulyO BwlcOpIm+0QNZMsmHE3KmKvLezKDbBo/wS3n1cvYTJzWo/WjOfTHbvQZrsauxIk1KOS3HJRVM2l cCMMbt872Nr7wAltJtIBFSwiGGjyyeRv8oE3R1Zjo+CbreKKDnL3kbTS5N+rB5xPUMecFMZb84Z vf8Pnnoof3L3WBI6vXYTxhfg0eXPjKZSt1uzyvUNNU2IUTHGnswmWYy/9spw9BCQ5vV5uN/xHja 3j+o7ljDvIwRxfDFkma1yLxY1DeGdYxAsnR7+rTwtYw01cYoxejhV3NfJzDRd6gms8EL5KjWckb y1M3/Zs1LRjMKXF5iEvZ2+y7IFZ/xWUp29rV+im0IVKB/MJRsWmI82Cc6lTIpFtai4QtGijR/r+ rnL8xRgXl7sZXUZGSBzyyHEIc3R8JdHEGnnTCsrZ0ks/sinMlK0GazvX8qbHAgmf1e8kxfSIzJ7 uzclJgiGqnXI5UA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1771243560102158500 Simply use the class name instead. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Mark Cave-Ayland Reviewed-by: Akihiko Odaki --- audio/audio_int.h | 1 - audio/audio_template.h | 15 ++++++++------- audio/alsaaudio.c | 1 - audio/dbusaudio.c | 1 - audio/dsoundaudio.c | 1 - audio/jackaudio.c | 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/spiceaudio.c | 1 - audio/wavaudio.c | 1 - audio/coreaudio.m | 1 - 15 files changed, 8 insertions(+), 21 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 3fc4b516878..06f79ade6b0 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -173,7 +173,6 @@ struct SWVoiceCap { struct AudioMixengBackendClass { AudioBackendClass parent_class; =20 - const char *name; int max_voices_out; int max_voices_in; size_t voice_size_out; diff --git a/audio/audio_template.h b/audio/audio_template.h index 85a128e2f47..228369cf9a1 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -40,6 +40,7 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioMixeng= Backend *s, AudioMixengBackendClass *k, int min_voices) { + const char *be_name =3D object_class_get_name(OBJECT_CLASS(k)); int max_voices =3D glue(k->max_voices_, TYPE); size_t voice_size =3D glue(k->voice_size_, TYPE); =20 @@ -47,11 +48,11 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioMixe= ngBackend *s, if (glue(s->nb_hw_voices_, TYPE) > max_voices) { if (!max_voices) { #ifdef DAC - warn_report("audio: Driver '%s' does not support " NAME, k->na= me); + warn_report("audio: '%s' backend does not support " NAME, be_n= ame); #endif } else { - warn_report("audio: Driver '%s' does not support %d " NAME " v= oices, max %d", - k->name, glue(s->nb_hw_voices_, TYPE), max_voices); + warn_report("audio: '%s' backend does not support %d " NAME " = voices, max %d", + be_name, glue(s->nb_hw_voices_, TYPE), max_voices); } glue(s->nb_hw_voices_, TYPE) =3D max_voices; } @@ -63,14 +64,14 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioMixe= ngBackend *s, } =20 if (!voice_size && max_voices) { - audio_bug("drv=3D`%s' voice_size=3D0 max_voices=3D%d", - k->name, max_voices); + audio_bug("backend=3D`%s' voice_size=3D0 max_voices=3D%d", + be_name, max_voices); glue(s->nb_hw_voices_, TYPE) =3D 0; } =20 if (voice_size && !max_voices) { - audio_bug("drv=3D`%s' voice_size=3D%zu max_voices=3D0", - k->name, voice_size); + audio_bug("backend=3D`%s' voice_size=3D%zu max_voices=3D0", + be_name, voice_size); } } =20 diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index e2290ea814a..dc99ccb44fa 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -895,7 +895,6 @@ static void audio_alsa_class_init(ObjectClass *klass, c= onst void *data) audio_alsa_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_paren= t(klass)); =20 b->realize =3D audio_alsa_realize; - k->name =3D "alsa"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(ALSAVoiceOut); diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index b212b3d6022..e9bdf6adb5b 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -699,7 +699,6 @@ static void audio_dbus_class_init(ObjectClass *klass, c= onst void *data) =20 b->realize =3D audio_dbus_realize; b->set_dbus_server =3D dbus_audio_set_server; - k->name =3D "dbus"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(DBusVoiceOut); diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 704bc3da73b..338ee49c2fe 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -649,7 +649,6 @@ static void audio_dsound_class_init(ObjectClass *klass,= const void *data) audio_dsound_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_par= ent(klass)); =20 b->realize =3D audio_dsound_realize; - k->name =3D "dsound"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D 1; k->voice_size_out =3D sizeof(DSoundVoiceOut); diff --git a/audio/jackaudio.c b/audio/jackaudio.c index d9ae8edc0e0..f49fd82c45c 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -663,7 +663,6 @@ static void audio_jack_class_init(ObjectClass *klass, c= onst void *data) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 - k->name =3D "jack"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(QJackOut); diff --git a/audio/noaudio.c b/audio/noaudio.c index 70316c572ec..ea6a78c7055 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -113,7 +113,6 @@ static void audio_none_class_init(ObjectClass *klass, c= onst void *data) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 - k->name =3D "none"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(NoVoiceOut); diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 157979e84b4..63c6e0a291f 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -739,7 +739,6 @@ static void audio_oss_class_init(ObjectClass *klass, co= nst void *data) audio_oss_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent= (klass)); =20 b->realize =3D audio_oss_realize; - k->name =3D "oss"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(OSSVoiceOut); diff --git a/audio/paaudio.c b/audio/paaudio.c index c9957105543..23e8767a46b 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -920,7 +920,6 @@ static void audio_pa_class_init(ObjectClass *klass, con= st void *data) audio_pa_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent(= klass)); =20 b->realize =3D audio_pa_realize; - k->name =3D "pa"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(PAVoiceOut); diff --git a/audio/pwaudio.c b/audio/pwaudio.c index b70bf0c1353..a59c22e60b8 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -829,7 +829,6 @@ static void audio_pw_class_init(ObjectClass *klass, con= st void *data) audio_pw_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent(= klass)); =20 b->realize =3D audio_pw_realize; - k->name =3D "pipewire"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(PWVoiceOut); diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 936a3ed076d..bd6a46e2af1 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -458,7 +458,6 @@ static void audio_sdl_class_init(ObjectClass *klass, co= nst void *data) audio_sdl_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_parent= (klass)); =20 b->realize =3D audio_sdl_realize; - k->name =3D "sdl"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(SDLVoiceOut); diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 761f23f8273..2e05ef7ea74 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -531,7 +531,6 @@ static void audio_sndio_class_init(ObjectClass *klass, = const void *data) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 - k->name =3D "sndio"; k->max_voices_out =3D INT_MAX; k->max_voices_in =3D INT_MAX; k->voice_size_out =3D sizeof(SndioVoice); diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index f903ef77e72..70a0b60dd83 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -303,7 +303,6 @@ static void audio_spice_class_init(ObjectClass *klass, = const void *data) audio_spice_parent_class =3D AUDIO_BACKEND_CLASS(object_class_get_pare= nt(klass)); =20 b->realize =3D spice_audio_realize; - k->name =3D "spice"; k->max_voices_out =3D 1; k->max_voices_in =3D 1; k->voice_size_out =3D sizeof(SpiceVoiceOut); diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 55d12d6cdfd..d247dd3ffe6 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -188,7 +188,6 @@ static void audio_wav_class_init(ObjectClass *klass, co= nst void *data) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 - k->name =3D "wav"; k->max_voices_out =3D 1; k->max_voices_in =3D 0; k->voice_size_out =3D sizeof(WAVVoiceOut); diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 1f4b3d9d467..a28fa77d73f 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -646,7 +646,6 @@ static void audio_coreaudio_class_init(ObjectClass *kla= ss, const void *data) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_CLASS(klass); =20 - k->name =3D "coreaudio"; k->max_voices_out =3D 1; k->max_voices_in =3D 0; k->voice_size_out =3D sizeof(coreaudioVoiceOut); --=20 2.53.0 From nobody Sun Apr 12 05:51:31 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1771244570; cv=none; d=zohomail.com; s=zohoarc; b=Esetp7oBbS9NlWoj5XaKiF2BeIedV1LHoyAsfScd1OCQt9weCdxV4VznwXPMs8fdylqHoRQnDciiIEPJ58qOk+Ieo23acFY4ncQm2hrq0YBWNkqgtMSyhTwHE136Ylk2FCtC86z5+ChktuVQcasT8pBFqnyJmJyHuewsdbEg6bA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771244570; h=Content-Type: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=Q2Crx2KgUAwnEy87HWgsOaaYoitWHO1zrWYwI/ei/8M=; b=Vy48n/mLt9nsifQZ0GhAEP1LP+hzUN6l/Oizq1uSO1BKA6KLUYmAn4d6iEb4YMMdAoxoYRUQxs+PAl9TUWgbcUGktDk7WZzDIkr7ryh7VBxHuOHDjK1i1Z/X/6KFYtzDXWxynvqEWvUuDXjNOXpqACwD3r06m5xA0R17lx6mBf4= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1771244570766977.8143977481199; Mon, 16 Feb 2026 04:22:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfh-0000cq-Ix; Mon, 16 Feb 2026 06:21:45 -0500 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 1vrwds-0001N8-TO for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vrwdp-0000BI-OU for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:19:52 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-wztx3Tz4MEavFk7S-CErQA-1; Mon, 16 Feb 2026 06:19:41 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 16E381955E85; Mon, 16 Feb 2026 11:19:39 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6575619560A2; Mon, 16 Feb 2026 11:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q2Crx2KgUAwnEy87HWgsOaaYoitWHO1zrWYwI/ei/8M=; b=OXOHJnjjJkouigVeVSMmB/KDcktr+UlqnJsSeRsosY6QBn8OqbMbEkE1/lGNR7joKoVAWu +RrVboPQIBE+Vj6pX42k86w4Y6OFrUo8QobwZaSDJ9XX0fdhj4A5+uXL4DwnpsIQsey33x G2xfRLyHlfx0lF3a0+bEfnda54rIoe0= X-MC-Unique: wztx3Tz4MEavFk7S-CErQA-1 X-Mimecast-MFC-AGG-ID: wztx3Tz4MEavFk7S-CErQA_1771240779 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:16:14 +0100 Subject: [PATCH 85/85] audio: fix leak of audio capture name MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260216-audio-v1-85-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1003; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=+/qbPnbuV5WIbcdJiURpXcBqN7bHW5OURadsQ5xtxzU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxSgPLkGa2xJzc0EI+p2+p70rKTHKwdzl9HW TN5LHqVN3eJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UgAKCRDa6OEJdZac 5YLJD/9t6KHsCgWVm7cqSlatVlLUB3q/e7xGytm+ZZPCXOSrSf5fY+hj415LUG8bsG8xV2cosX8 MEOTmRQnC6RHVCryAjG2n+ifi4PdniHgmO50U0/nKI/BW7tayodXxc7JlgmNXo9FPauSVgfAxcv KU32aKMDj7AjTNkaqbn8dXcbXnGkDH7U4OTmggvftG6mmj6rs0Kh9WqGKOpyVvZ/omFuL7Q8NRH B6oZUV8insD2WL9/F0ugHLIRr5uUsIHSuWBpLZ/kK/XP9EFFdeRcYzOP8UgBrLJU1DMH18LDrce ijdhV1tFRpHeSdu/XwZKUJYCNUc9iizK39RZcq4ykBXpRzLTsL8t826gxcIjbmcZpDaok1Hzyl4 nNHlft2DfNGV9/+WsmeLY9mXkhi7XYMf8+FiCuJ3EmKuUJ8lLaWgzonQfUXZOaQeq2YCm4fIu6x qP02bwcGLkqPo0swNGHQ8AYH97wtGpPk9PEqjdlULY8Izf0p2yq595t3DON0Z6os2qm5dG4KVjm Uh4Lz+SAy7EHHau1GRIadVhOu4cYW2AQq7j3SlfJg/hAYRvLIHtFLc2LH0rxZm5Zj9Bs6Ga1jBQ qalQdfPISV5jfYiMnJhi2gkmjMFn8GK/02PyexJvJKig4oLtdONRQKppztA6cD8DmiKs8hkdPhF QZnN6LPWQ89Qm3g== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1771244571792154100 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki --- audio/audio-mixeng-be.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index a6d5812fc65..37040450511 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -227,6 +227,7 @@ static void audio_detach_capture (HWVoiceOut *hw) CaptureVoiceOut *cap =3D sc->cap; int was_active =3D sw->active; =20 + g_clear_pointer(&sw->name, g_free); if (sw->rate) { st_rate_stop (sw->rate); sw->rate =3D NULL; @@ -1618,6 +1619,7 @@ static void audio_mixeng_backend_del_capture( SWVoiceCap *sc =3D (SWVoiceCap *) sw; =20 trace_audio_capture_free_sw(sw->name); + g_clear_pointer(&sw->name, g_free); sw1 =3D sw->entries.le_next; if (sw->rate) { st_rate_stop (sw->rate); --=20 2.53.0