From nobody Sun Nov 16 01:14:26 2025 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=1762164153; cv=none; d=zohomail.com; s=zohoarc; b=Ba8x6nUfNXloH0nQYoa1dRVKkVdwTbSJpHIB+sv80W7+58l3KAKwAZRbWpXev4J2u8+FJjYNY7SGuRmGGT/ZvhVdHm+yrY+L95MUPPQYtSmTtZIERTPQFyykURzd4gmOEPdkkrJ9rCl2SNLeLIVZmNasnlSUpJG8aIoSz2nXOWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762164153; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mJX024coPJgmrYZ3/DvCAyY8b0d9HmEy4sHo0h7sjVw=; b=CP6G/fTvBZ8PxTdpjiflwkdLEPO3VUG3lcfSex+A4xc/C7L0Ut1bCey4rhuZDSmyhJXdxI4PEuM1UtDnprVbLzsDAd4PDLjHFQm7N6BI3hMwN3+nlVDDv7FH1tyjqE2LK3MGobUHwbMtP3X4G1DleP7mOMj4sWd5q1LsLdUY03I= 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 1762164153624337.22508871416085; Mon, 3 Nov 2025 02:02:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vFrOF-0007KM-Tg; Mon, 03 Nov 2025 05:02: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 1vFrOC-0007FV-UQ for qemu-devel@nongnu.org; Mon, 03 Nov 2025 05:02:16 -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 1vFrO8-0000PG-K0 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 05:02:16 -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-617-0pIf2gmeMyyNZzrx67Twag-1; Mon, 03 Nov 2025 05:02:05 -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 2C02A1955F25 for ; Mon, 3 Nov 2025 10:02:04 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8C6DC1800579; Mon, 3 Nov 2025 10:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762164126; 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; bh=mJX024coPJgmrYZ3/DvCAyY8b0d9HmEy4sHo0h7sjVw=; b=idYlwZZltOe9rJfMun0ULU8DZmpiEfd4xmSGFfp4S6MPHXhQMl6b3BH+mIbDsJQ4bvAgDo DAlEWQ+ld8a9VQjLnoFvZAm2lfAqmjZ8KlokCUhHTl5igi3QjCHSKW2UTA0LnqZXLQ2uhu noDV1Fg/g9h7ntX8XYSNvREqVahkbT0= X-MC-Unique: 0pIf2gmeMyyNZzrx67Twag-1 X-Mimecast-MFC-AGG-ID: 0pIf2gmeMyyNZzrx67Twag_1762164124 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH] audio/dbus: make "dbus" the default backend when using -display dbus Date: Mon, 3 Nov 2025 14:01:58 +0400 Message-ID: <20251103100158.1148552-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1762164155406154100 From: Marc-Andr=C3=A9 Lureau 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 coming up cleanup series. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.c | 3 +++ audio/dbusaudio.c | 8 +++++++- ui/dbus.c | 17 +++++++++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 86e674410a..0f992a775c 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -57,6 +57,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 d729a810aa..1fe7c4ed64 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 d2dff33258..45fb3c1aa3 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,12 +219,20 @@ dbus_display_complete(UserCreatable *uc, Error **errp) return; } =20 + 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) { - 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)) { + 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->p2= p, errp)) { + return; + } + =20 consoles =3D g_array_new(FALSE, FALSE, sizeof(guint32)); for (idx =3D 0;; idx++) { @@ -475,6 +484,8 @@ early_dbus_init(DisplayOptions *opts) #endif } =20 + using_dbus_display =3D 1; + type_register_static(&dbus_vc_type_info); } =20 @@ -488,8 +499,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.51.1