qemu: Make QEMU audio backend configurable (!1859)
At the moment we assume that everyone running QEMU is either using ALSA, or has the ALSA PulseAudio plugin configured on the host system. (Since we run QEMU outside of the chroot at the moment, configuration files are read from the host system instead of the chroot...) Other distributions have much wider support for PulseAudio, so not everyone will actually have the ALSA PulseAudio plugin configured. In that case, it is better to use QEMU's PulseAudio backend since that does not require any configuration. It also lets us drop the alsa-lib fork, since that was only needed for loading the ALSA PulseAudio plugin. In general, it seems difficult to detect which audio backend the user wants to run (if any). Selecting the wrong one results in ugly warnings when running QEMU. So let's not assume any by default, and add a --audio option instead which accepts one of QEMU's audio backends (alsa, pa or sdl).
This commit is contained in:
parent
e04712a636
commit
66fdb74b5b
|
@ -147,6 +147,10 @@ def arguments_qemu(subparser):
|
||||||
help="QEMU's display parameter (default: sdl,gl=on)",
|
help="QEMU's display parameter (default: sdl,gl=on)",
|
||||||
default="sdl,gl=on", nargs="?")
|
default="sdl,gl=on", nargs="?")
|
||||||
|
|
||||||
|
ret.add_argument("--audio", dest="qemu_audio", choices=["alsa", "pa", "sdl"],
|
||||||
|
help="QEMU's audio backend (default: none)",
|
||||||
|
default=None, nargs="?")
|
||||||
|
|
||||||
ret.add_argument("--host-qemu", dest="host_qemu", action='store_true',
|
ret.add_argument("--host-qemu", dest="host_qemu", action='store_true',
|
||||||
help="Use the host system's qemu")
|
help="Use the host system's qemu")
|
||||||
|
|
||||||
|
|
|
@ -129,8 +129,7 @@ def command_qemu(args, arch, device, img_path, spice_enabled):
|
||||||
rootfs_native = args.work + "/chroot_native"
|
rootfs_native = args.work + "/chroot_native"
|
||||||
env = {"QEMU_MODULE_DIR": rootfs_native + "/usr/lib/qemu",
|
env = {"QEMU_MODULE_DIR": rootfs_native + "/usr/lib/qemu",
|
||||||
"GBM_DRIVERS_PATH": rootfs_native + "/usr/lib/xorg/modules/dri",
|
"GBM_DRIVERS_PATH": rootfs_native + "/usr/lib/xorg/modules/dri",
|
||||||
"LIBGL_DRIVERS_PATH": rootfs_native + "/usr/lib/xorg/modules/dri",
|
"LIBGL_DRIVERS_PATH": rootfs_native + "/usr/lib/xorg/modules/dri"}
|
||||||
"ALSA_PLUGIN_DIRS": rootfs_native + "/usr/lib/alsa-lib"}
|
|
||||||
|
|
||||||
if "gtk" in args.qemu_display:
|
if "gtk" in args.qemu_display:
|
||||||
gdk_cache = create_gdk_loader_cache(args)
|
gdk_cache = create_gdk_loader_cache(args)
|
||||||
|
@ -218,7 +217,8 @@ def command_qemu(args, arch, device, img_path, spice_enabled):
|
||||||
command += ["-display", args.qemu_display]
|
command += ["-display", args.qemu_display]
|
||||||
|
|
||||||
# Audio support
|
# Audio support
|
||||||
command += ["-audiodev", "id=alsa,driver=alsa"]
|
if args.qemu_audio:
|
||||||
|
command += ["-audiodev", args.qemu_audio + ",id=audio"]
|
||||||
command += ["-soundhw", "hda"]
|
command += ["-soundhw", "hda"]
|
||||||
|
|
||||||
return (command, env)
|
return (command, env)
|
||||||
|
@ -274,7 +274,7 @@ def install_depends(args, arch):
|
||||||
"mesa-gl", "mesa-egl", "mesa-dri-ati", "mesa-dri-freedreno",
|
"mesa-gl", "mesa-egl", "mesa-dri-ati", "mesa-dri-freedreno",
|
||||||
"mesa-dri-intel", "mesa-dri-nouveau", "mesa-dri-swrast",
|
"mesa-dri-intel", "mesa-dri-nouveau", "mesa-dri-swrast",
|
||||||
"mesa-dri-virtio", "mesa-dri-vmwgfx", "qemu-audio-alsa",
|
"mesa-dri-virtio", "mesa-dri-vmwgfx", "qemu-audio-alsa",
|
||||||
"qemu-audio-sdl", "alsa-plugins-pulse"]
|
"qemu-audio-pa", "qemu-audio-sdl"]
|
||||||
if args.spice_port:
|
if args.spice_port:
|
||||||
depends += ["virt-viewer", "font-noto"]
|
depends += ["virt-viewer", "font-noto"]
|
||||||
pmb.chroot.apk.install(args, depends)
|
pmb.chroot.apk.install(args, depends)
|
||||||
|
|
Loading…
Reference in New Issue