In case no sound hardware is present the driver initializes
successfully and throws errors later on, i.e. effectively the
automatic probing doesn't work. So the driver should not be
used by default (until that is fixed). Drop the can_be_default
flag.
Explicitly picking the alsa driver (using QEMU_AUDIO_DRV=alsa
environment variable) will continue to work.
Buglink: https://bugs.launchpad.net/qemu/+bug/1816052
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
audio/alsaaudio.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 635be73bf4..1cc570e30b 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -1218,7 +1218,6 @@ static struct audio_driver alsa_audio_driver = {
.init = alsa_audio_init,
.fini = alsa_audio_fini,
.pcm_ops = &alsa_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof (ALSAVoiceOut),
--
2.9.3
On 19.02.19 11:15, Gerd Hoffmann wrote: > ardware is present the driver initializes > successfully and throws errors later on, i.e. effectively the > automatic probing doesn't work. So the driver should not be > used by default (until that is fixed). Drop the can_be_default > flag. > > Explicitly picking the alsa driver (using QEMU_AUDIO_DRV=alsa > environment variable) will continue to work. Just pointing out that with this patch, audio initialization still hinders me from starting guests on my Fedora 29 when running under root (I don't think this patch was also intended to fix that, just pointing out for me the problem still exists). ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused sdl: SDL_OpenAudio failed sdl: Reason: ALSA: Couldn't open audio device: Connection refused ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused sdl: SDL_OpenAudio failed sdl: Reason: ALSA: Couldn't open audio device: Connection refused audio: Failed to create voice `pcspk' qemu-system-x86_64: Initialization of device isa-pcspk failed: Initializing audio voice failed For whatever reason, on my Fedora29 root cannot access alsa devices. Maybe it is a Fedora 29 problem, maybe only my setup is messed up (e.g. because of an upgrade). The workaround for me is to not run QEMU as root. (I don't have time to look into the details) -- Thanks, David / dhildenb
On Tue, Feb 19, 2019 at 11:39:49AM +0100, David Hildenbrand wrote: > On 19.02.19 11:15, Gerd Hoffmann wrote: > > ardware is present the driver initializes > > successfully and throws errors later on, i.e. effectively the > > automatic probing doesn't work. So the driver should not be > > used by default (until that is fixed). Drop the can_be_default > > flag. > > > > Explicitly picking the alsa driver (using QEMU_AUDIO_DRV=alsa > > environment variable) will continue to work. > > Just pointing out that with this patch, audio initialization still > hinders me from starting guests on my Fedora 29 when running under root > (I don't think this patch was also intended to fix that, just pointing > out for me the problem still exists). > > > ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: > Connection refused > > sdl: SDL_OpenAudio failed > sdl: Reason: ALSA: Couldn't open audio device: Connection refused > ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: > Connection refused > > sdl: SDL_OpenAudio failed > sdl: Reason: ALSA: Couldn't open audio device: Connection refused > audio: Failed to create voice `pcspk' > qemu-system-x86_64: Initialization of device isa-pcspk failed: > Initializing audio voice failed > > > For whatever reason, on my Fedora29 root cannot access alsa devices. > Maybe it is a Fedora 29 problem, maybe only my setup is messed up (e.g. > because of an upgrade). The workaround for me is to not run QEMU as > root. (I don't have time to look into the details) Does your machine actually have any sound card in it ? ie does /dev/snd/ report any pcm* devices ? Based on your logs here, I suspect it has no sound card. The reason it will work as non-root, is that QEMU will activate the pulseaudio backend that works fine [1] even if no sound card is present. Regards, Daniel [1] by "fine" I mean it'll happily accept the audio stream from the app and send it to /dev/null :-) -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
On 19.02.19 12:17, Daniel P. Berrangé wrote: > On Tue, Feb 19, 2019 at 11:39:49AM +0100, David Hildenbrand wrote: >> On 19.02.19 11:15, Gerd Hoffmann wrote: >>> ardware is present the driver initializes >>> successfully and throws errors later on, i.e. effectively the >>> automatic probing doesn't work. So the driver should not be >>> used by default (until that is fixed). Drop the can_be_default >>> flag. >>> >>> Explicitly picking the alsa driver (using QEMU_AUDIO_DRV=alsa >>> environment variable) will continue to work. >> >> Just pointing out that with this patch, audio initialization still >> hinders me from starting guests on my Fedora 29 when running under root >> (I don't think this patch was also intended to fix that, just pointing >> out for me the problem still exists). >> >> >> ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: >> Connection refused >> >> sdl: SDL_OpenAudio failed >> sdl: Reason: ALSA: Couldn't open audio device: Connection refused >> ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: >> Connection refused >> >> sdl: SDL_OpenAudio failed >> sdl: Reason: ALSA: Couldn't open audio device: Connection refused >> audio: Failed to create voice `pcspk' >> qemu-system-x86_64: Initialization of device isa-pcspk failed: >> Initializing audio voice failed >> >> >> For whatever reason, on my Fedora29 root cannot access alsa devices. >> Maybe it is a Fedora 29 problem, maybe only my setup is messed up (e.g. >> because of an upgrade). The workaround for me is to not run QEMU as >> root. (I don't have time to look into the details) > > Does your machine actually have any sound card in it ? ie does > /dev/snd/ report any pcm* devices ? Well, I can listen to audio, so I assume yes ;) Let's check t460s: ~ $ ls -la /dev/snd/ insgesamt 0 drwxr-xr-x 4 root root 360 19. Feb 08:39 . drwxr-xr-x 22 root root 4400 19. Feb 08:40 .. drwxr-xr-x 2 root root 60 19. Feb 08:39 by-id drwxr-xr-x 2 root root 80 19. Feb 08:39 by-path crw-rw----+ 1 root audio 116, 3 19. Feb 08:39 controlC0 crw-rw----+ 1 root audio 116, 13 19. Feb 08:39 controlC1 crw-rw----+ 1 root audio 116, 11 19. Feb 08:39 hwC1D0 crw-rw----+ 1 root audio 116, 12 19. Feb 08:39 hwC1D2 crw-rw----+ 1 root audio 116, 2 19. Feb 08:40 pcmC0D0c crw-rw----+ 1 root audio 116, 5 19. Feb 08:40 pcmC1D0c crw-rw----+ 1 root audio 116, 4 19. Feb 11:40 pcmC1D0p crw-rw----+ 1 root audio 116, 10 19. Feb 08:40 pcmC1D10p crw-rw----+ 1 root audio 116, 6 19. Feb 08:40 pcmC1D3p crw-rw----+ 1 root audio 116, 7 19. Feb 08:40 pcmC1D7p crw-rw----+ 1 root audio 116, 8 19. Feb 08:40 pcmC1D8p crw-rw----+ 1 root audio 116, 9 19. Feb 08:40 pcmC1D9p > > Based on your logs here, I suspect it has no sound card. The reason > it will work as non-root, is that QEMU will activate the pulseaudio > backend that works fine [1] even if no sound card is present. The thing is, I can play audio as normal user, but not as root t460s: ~ $ LANG=C speaker-test -d default speaker-test 1.1.6 Playback device is default Stream parameters are 48000Hz, S16_LE, 1 channels Using 16 octaves of pink noise Rate set to 48000Hz (requested 48000Hz) Buffer size range from 192 to 2097152 Period size range from 64 to 699051 Using max buffer size 2097152 Periods = 4 was set period_size = 524288 was set buffer_size = 2097152 ALSA <-> PulseAudio PCM I/O Plugin t460s: ~ $ LANG=C sudo speaker-test -d default speaker-test 1.1.6 Playback device is default Stream parameters are 48000Hz, S16_LE, 1 channels Using 16 octaves of pink noise ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused Again, this might be an issue on my system. But as I never touched any of the configuration it either is broken on all Fedora 29 installations or only on mine due to system upgrades. I already tried downgrading pulse audio without luck. -- Thanks, David / dhildenb
On Tue, Feb 19, 2019 at 11:39:49AM +0100, David Hildenbrand wrote: > On 19.02.19 11:15, Gerd Hoffmann wrote: > > ardware is present the driver initializes > > successfully and throws errors later on, i.e. effectively the > > automatic probing doesn't work. So the driver should not be > > used by default (until that is fixed). Drop the can_be_default > > flag. > > > > Explicitly picking the alsa driver (using QEMU_AUDIO_DRV=alsa > > environment variable) will continue to work. > > Just pointing out that with this patch, audio initialization still > hinders me from starting guests on my Fedora 29 when running under root > (I don't think this patch was also intended to fix that, just pointing > out for me the problem still exists). > > > ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: > Connection refused > > sdl: SDL_OpenAudio failed > sdl: Reason: ALSA: Couldn't open audio device: Connection refused > ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: > Connection refused > > sdl: SDL_OpenAudio failed > sdl: Reason: ALSA: Couldn't open audio device: Connection refused > audio: Failed to create voice `pcspk' > qemu-system-x86_64: Initialization of device isa-pcspk failed: > Initializing audio voice failed So SDL has the same problem (possibly only when using alsa). Hmm. Dropping can_be_default here will too break sound on BSD ...
On Tue, Feb 19, 2019 at 01:12:58PM +0100, Gerd Hoffmann wrote: > On Tue, Feb 19, 2019 at 11:39:49AM +0100, David Hildenbrand wrote: > > On 19.02.19 11:15, Gerd Hoffmann wrote: > > > ardware is present the driver initializes > > > successfully and throws errors later on, i.e. effectively the > > > automatic probing doesn't work. So the driver should not be > > > used by default (until that is fixed). Drop the can_be_default > > > flag. > > > > > > Explicitly picking the alsa driver (using QEMU_AUDIO_DRV=alsa > > > environment variable) will continue to work. > > > > Just pointing out that with this patch, audio initialization still > > hinders me from starting guests on my Fedora 29 when running under root > > (I don't think this patch was also intended to fix that, just pointing > > out for me the problem still exists). > > > > > > ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: > > Connection refused > > > > sdl: SDL_OpenAudio failed > > sdl: Reason: ALSA: Couldn't open audio device: Connection refused > > ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: > > Connection refused > > > > sdl: SDL_OpenAudio failed > > sdl: Reason: ALSA: Couldn't open audio device: Connection refused > > audio: Failed to create voice `pcspk' > > qemu-system-x86_64: Initialization of device isa-pcspk failed: > > Initializing audio voice failed > > So SDL has the same problem (possibly only when using alsa). > > Hmm. Dropping can_be_default here will too break sound on BSD ... We could temporarily put the Linux default ordering back to have "oss" before sdl/alsa until the initialization code in sdl/alsa can be fixed to correctly detect working audio. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
> > So SDL has the same problem (possibly only when using alsa). > > > > Hmm. Dropping can_be_default here will too break sound on BSD ... > > We could temporarily put the Linux default ordering back to have "oss" > before sdl/alsa until the initialization code in sdl/alsa can be fixed to > correctly detect working audio. Reordering doesn't help, they would still probe successfully and fail later, only after oss probe failed ... pa is ok, when the daemon isn't running init() fails properly. cheers, Gerd
On Tue, Feb 19, 2019 at 11:15:10AM +0100, Gerd Hoffmann wrote: > In case no sound hardware is present the driver initializes > successfully and throws errors later on, i.e. effectively the > automatic probing doesn't work. So the driver should not be > used by default (until that is fixed). Drop the can_be_default > flag. > > Explicitly picking the alsa driver (using QEMU_AUDIO_DRV=alsa > environment variable) will continue to work. > > Buglink: https://bugs.launchpad.net/qemu/+bug/1816052 > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > audio/alsaaudio.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c > index 635be73bf4..1cc570e30b 100644 > --- a/audio/alsaaudio.c > +++ b/audio/alsaaudio.c > @@ -1218,7 +1218,6 @@ static struct audio_driver alsa_audio_driver = { > .init = alsa_audio_init, > .fini = alsa_audio_fini, > .pcm_ops = &alsa_pcm_ops, > - .can_be_default = 1, > .max_voices_out = INT_MAX, > .max_voices_in = INT_MAX, > .voice_size_out = sizeof (ALSAVoiceOut), This fixes the problem with alsa, but then we get exactly the same problem with sdl audio iniitalizing but then not working. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
© 2016 - 2024 Red Hat, Inc.