From nobody Mon Feb 9 22:19:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1640202365; cv=none; d=zohomail.com; s=zohoarc; b=jkSjl0v15s8nFf7JsGQwUgWi5ovWuX6/0x4ZiJPhs8mGROJAh4e+4lSa1G7xCyJb5ICVkpWOhBfc6AXqq3MmjfUH7CWVMC96b4zs6EXvmZ0DAXbCdSQEbfz1AZhJYzqfI/nZUGcBUhn+LUzC2ME3NYAhKibY6SIQu3Z2S6M1O78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640202365; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PVATe6e0DjKT6/ZXjuQSaaorRvCI3v3pvZIb7HjeQtw=; b=gas9OmzSO2MpSFmPniEJKIYcHcWaNG4Ees+Vq2p8yrVrVlAgLSL4i+3NSb+HCUlB/MD6qB/hLKnTDmPWPpXz2skf6qsjhmNb/NO5Fj2iX3J3huihOAjqgAN9OhLRKcRfuYpWPSaUu67L6kRqTNVDJrix8sqCCgV0GXdGAhzVhn8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1640202365740610.0676423507072; Wed, 22 Dec 2021 11:46:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-660-RKf73W-_OLek-xJo43fzuA-1; Wed, 22 Dec 2021 14:46:01 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9FF51023F4F; Wed, 22 Dec 2021 19:45:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7DDA7B6F0; Wed, 22 Dec 2021 19:45:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 799D51806D1D; Wed, 22 Dec 2021 19:45:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BMJjqLI019189 for ; Wed, 22 Dec 2021 14:45:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 25BF178AA1; Wed, 22 Dec 2021 19:45:52 +0000 (UTC) Received: from localhost (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE8D878AAC; Wed, 22 Dec 2021 19:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640202364; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=PVATe6e0DjKT6/ZXjuQSaaorRvCI3v3pvZIb7HjeQtw=; b=fU7LqX5wRLalPTm9lmm2WCCPtCuQDhaGfGDPMmqjEYcliFIY3Lwx7vI1CnneBqUhWBPG6i A8f0aYGUvsG6lh2v++Q/AoZ3yoVDHagJui9pxO0ZGMWpJZk0wXbRxvxcQtmhSw7v+4cu1j LWymn6WyCQxuduxctPY4vXqQfo+tWSo= X-MC-Unique: RKf73W-_OLek-xJo43fzuA-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH v3 10/16] qemu: add audio type 'dbus' Date: Wed, 22 Dec 2021 23:43:39 +0400 Message-Id: <20211222194345.766352-11-marcandre.lureau@redhat.com> In-Reply-To: <20211222194345.766352-1-marcandre.lureau@redhat.com> References: <20211222194345.766352-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1640202366308100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_command.c | 12 +++++-- src/qemu/qemu_validate.c | 30 ++++++++++++++++- .../qemuxml2argvdata/graphics-dbus-audio.args | 33 +++++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 4 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/graphics-dbus-audio.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2524abb1e971..8303a20bc8bd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8586,7 +8586,8 @@ qemuBuildGraphicsEGLHeadlessCommandLine(virQEMUDriver= Config *cfg G_GNUC_UNUSED, =20 =20 static int -qemuBuildGraphicsDBusCommandLine(virCommand *cmd, +qemuBuildGraphicsDBusCommandLine(virDomainDef *def, + virCommand *cmd, virDomainGraphicsDef *graphics) { g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; @@ -8608,6 +8609,13 @@ qemuBuildGraphicsDBusCommandLine(virCommand *cmd, graphics->data.dbus.rendernode); } =20 + if (graphics->data.dbus.audioId > 0) { + g_autofree char *audioid =3D qemuGetAudioIDString(def, graphics->d= ata.dbus.audioId); + if (!audioid) + return -1; + virBufferAsprintf(&opt, ",audiodev=3D%s", audioid); + } + virCommandAddArg(cmd, "-display"); virCommandAddArgBuffer(cmd, &opt); =20 @@ -8652,7 +8660,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfig *cfg, =20 break; case VIR_DOMAIN_GRAPHICS_TYPE_DBUS: - if (qemuBuildGraphicsDBusCommandLine(cmd, graphics) < 0) + if (qemuBuildGraphicsDBusCommandLine(def, cmd, graphics) < 0) return -1; =20 break; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 50253e9009b9..7ab121aed0dc 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4128,6 +4128,24 @@ qemuValidateDomainDeviceDefVNCGraphics(const virDoma= inGraphicsDef *graphics, } =20 =20 +static int +qemuValidateDomainDeviceDefDBusGraphics(const virDomainGraphicsDef *graphi= cs, + const virDomainDef *def) +{ + if (graphics->data.dbus.audioId > 0) { + virDomainAudioDef *audio =3D virDomainDefFindAudioByID(def, graphi= cs->data.dbus.audioId); + + if (audio && audio->type !=3D VIR_DOMAIN_AUDIO_TYPE_DBUS) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("The associated audio is not of 'dbus' kind."= )); + return -1; + } + } + + return 0; +} + + static int qemuValidateDomainDeviceDefGraphics(const virDomainGraphicsDef *graphics, const virDomainDef *def, @@ -4205,10 +4223,15 @@ qemuValidateDomainDeviceDefGraphics(const virDomain= GraphicsDef *graphics, =20 break; =20 + case VIR_DOMAIN_GRAPHICS_TYPE_DBUS: + if (qemuValidateDomainDeviceDefDBusGraphics(graphics, def) < 0) + return -1; + + break; + case VIR_DOMAIN_GRAPHICS_TYPE_SDL: case VIR_DOMAIN_GRAPHICS_TYPE_RDP: case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: - case VIR_DOMAIN_GRAPHICS_TYPE_DBUS: case VIR_DOMAIN_GRAPHICS_TYPE_LAST: break; } @@ -4456,6 +4479,11 @@ qemuValidateDomainDeviceDefAudio(virDomainAudioDef *= audio, break; =20 case VIR_DOMAIN_AUDIO_TYPE_DBUS: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DISPLAY_DBUS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("D-Bus audio is not supported with this QEMU"= )); + return -1; + } break; =20 case VIR_DOMAIN_AUDIO_TYPE_LAST: diff --git a/tests/qemuxml2argvdata/graphics-dbus-audio.args b/tests/qemuxm= l2argvdata/graphics-dbus-audio.args new file mode 100644 index 000000000000..ab23f6ac1cda --- /dev/null +++ b/tests/qemuxml2argvdata/graphics-dbus-audio.args @@ -0,0 +1,33 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-QEMU= Guest1/master-key.aes \ +-machine pc,usb=3Doff,dump-guest-core=3Doff \ +-accel tcg \ +-m 214 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-audiodev '{"id":"audio1","driver":"dbus","in":{"mixing-engine":false},"ou= t":{"mixing-engine":false}}' \ +-display dbus,p2p=3Don,audiodev=3Daudio1 \ +-device cirrus-vga,id=3Dvideo0,bus=3Dpci.0,addr=3D0x2 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 68f1ac9fdbb7..37fc7120b6ed 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1608,6 +1608,8 @@ mymain(void) QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_DISPLAY_DBUS); DO_TEST("graphics-dbus-p2p", QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_DISPLAY_DBUS); + DO_TEST("graphics-dbus-audio", + QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_DISPLAY_DBUS, QEMU_CAPS= _AUDIODEV); =20 DO_TEST_NOCAPS("input-usbmouse"); DO_TEST_NOCAPS("input-usbtablet"); --=20 2.34.1.8.g35151cf07204