Bug 1683

Summary: Enable sound for qemux86
Product: [Build System, Metadata & Runtime] BSPs Reporter: Paul Eggleton <bluelightning>
Component: bsps-oe-coreAssignee: Robert Yang <liezhi.yang>
Status: RESOLVED FIXED QA Contact: Alexandru Georgescu <alexandru.c.georgescu>
Severity: enhancement    
Priority: Low CC: alexandru.c.georgescu, dvhart, holger.behrens, meta.mr.watcher, meta.watcher, poky.bs.watcher, poky.watcher, richard.purdie, sgw
Version: unspecified   
Target Milestone: Future   
Hardware: x86   
OS: Multiple   
See Also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=3528
https://bugzilla.yoctoproject.org/show_bug.cgi?id=1018
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Bug Depends on: 4827    
Bug Blocks: 1018    
Attachments:
Description Flags
Patch 1 to enable sound
none
Patch 2 to enable sound none

Description Paul Eggleton 2011-10-17 06:35:59 UTC
It would be useful if sound was enabled by default by the runqemu script. To enable sound manually I found I needed to do three things:

1) export QEMU_AUDIO_DRV=alsa (otherwise it defaults to oss, which is not available by default on my Ubuntu system)

2) Add qemuparams="-soundhw all" to runqemu command line (you can select drivers more specifically, but given there are only three supported drivers I don't think it matters)

3) modprobe snd-ens1370 within the running system - apparently we already install the appropriate kernel module, we just need to auto-load it.
Comment 1 Richard Purdie 2011-11-15 13:28:04 UTC
Created attachment 280 [details]
Patch 1 to enable sound
Comment 2 Richard Purdie 2011-11-15 13:28:31 UTC
Created attachment 281 [details]
Patch 2 to enable sound
Comment 3 Richard Purdie 2011-11-15 13:30:19 UTC
I tried this (patches attached). I ran into the complexity of my system running pulseaudio. To make this work we'd need to enable pulseaudio in qemu-native/nativesdk by building pulseaudio as a dependency for qemu.

We could really use a way to turn these features on/off in the qemu script.
Comment 4 Paul Eggleton 2011-11-15 14:23:08 UTC
Surely you don't *need* pulseaudio support in an application just to play sound with it installed? I was under the impression it provided a standard ALSA interface.
Comment 5 Richard Purdie 2011-11-15 15:26:30 UTC
Running qemu complained my alsa device was locked, presumably by pulseaudio which was active on the system. Qemu also has a pulseaudio specific backend...
Comment 6 Cristian Iorga 2014-03-20 15:19:15 UTC
Using pulseaudio as the audio backend for qemu works, however, it is my understanding that not all Linux distros rely on pulseaudio server for audio services. This would basically mean, at a minimal level, to detect at runtime (runqemu) which audio server is used (pa, alsa, oss) and set qccordingly qemu.
Another issue that needs to get solved is that sound from guest machines is muted while using qemu's pulseaudio backend. This also needs to get fixed.
Finally, a little bit of cleanup needs to be performed in qemu scripts (runqemu).
Comment 7 Stephen K Jolley 2014-07-31 15:26:23 UTC
*** Bug 5602 has been marked as a duplicate of this bug. ***
Comment 8 Robert Yang 2016-09-15 04:17:43 UTC
Now the audio support is controlled by bsp, it can set QB_AUDIO_DRV, QB_AUDIO_DRV and QB_AUDIO_OPT, see meta/classes/qemuboot.bbclass for more info.

Merged into master:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=b405712414de98cba3a645601419aceb32d52f02

And qemux86, qemux86-64's sound support had been done.