Hi

On Tue, Feb 3, 2026 at 7:42 PM Mark Cave-Ayland
<[email protected]> wrote:
>
> On 23/01/2026 07:49, [email protected] wrote:
>
> > From: Marc-André Lureau <[email protected]>
> >
> > 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é Lureau <[email protected]>
> > ---
> >   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 e5841d7f0e6..80e4ba83712 100644
> > --- a/audio/audio.c
> > +++ b/audio/audio.c
> > @@ -57,6 +57,9 @@
> >       that we generate the list.
> >   */
> >   const char *audio_prio_list[] = {
> > +#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
> >
> >   #include "ui/dbus.h"
> > +#include "ui/dbus-display.h"
> >   #include "ui/dbus-display1.h"
> >
> >   #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 = g_new0(DBusAudio, 1);
> > +    DBusAudio *da;
> >
> > +    if (!qemu_using_dbus_display(errp)) {
> > +        return NULL;
> > +    }
> > +
> > +    da = g_new0(DBusAudio, 1);
> >       da->dev = dev;
> >       da->out_listeners = 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 d2dff332585..e44e2ff9877 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"
> >
> > @@ -218,9 +219,20 @@ dbus_display_complete(UserCreatable *uc, Error **errp)
> >           return;
> >       }
> >
> > -    if (dd->audiodev && *dd->audiodev) {
> > -        AudioBackend *audio_be = audio_be_by_name(dd->audiodev, errp);
> > -        if (!audio_be || !audio_be_set_dbus_server(audio_be, dd->server, 
> > dd->p2p, errp)) {
> > +    {
> > +        AudioBackend *audio_be = audio_get_default_audio_be(NULL);
> > +
> > +        if (audio_be && !g_str_equal(audio_be->drv->name, "dbus")) {
> > +            audio_be = NULL;
> > +        }
> > +        if (dd->audiodev && *dd->audiodev) {
> > +            audio_be = 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
> >       }
> >
> > +    using_dbus_display = 1;
> > +
> >       type_register_static(&dbus_vc_type_info);
> >   }
> >
> > @@ -488,8 +502,6 @@ dbus_init(DisplayState *ds, DisplayOptions *opts)
> >           exit(1);
> >       }
> >
> > -    using_dbus_display = 1;
> > -
> >       object_new_with_props(TYPE_DBUS_DISPLAY,
> >                             object_get_objects_root(),
> >                             "dbus-display", &error_fatal,
>
> Looks reasonable to me: out of curiosity, what's the best client to use
> to test a combined dbus display/audio setup? Anyhow:
>
> Reviewed-by: Mark Cave-Ayland <[email protected]>

thanks

I only know of 2 desktop clients, libmks[1] and qemu-display/rdw[2].
But only qemu-display/rdw actually implements audio support.

[1] https://gitlab.gnome.org/GNOME/libmks
[2] https://gitlab.com/marcandre.lureau/qemu-display

-- 
Marc-André Lureau

Reply via email to