Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] No sound in most games in QEMU/KVM steam vm
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gamers & Players
View previous topic :: View next topic  
Author Message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Fri Aug 12, 2016 11:05 am    Post subject: [SOLVED] No sound in most games in QEMU/KVM steam vm Reply with quote

I have successfully set up a Linux Mint VM meant for gaming, using mostly the guide from Alex Williamson. Host is Gentoo. UEFI has been buggy for me, so the vm uses the old SeaBIOS. Graphics for host and guest are two nvidia cards. I do not plan to use their HDMI audio output and do not own HDMI speaker/monitor to test. The host has sound via the onboard intel C610/X99 audio controller. For guest sound, I have decided to use the host's pulseaudio, with

Guest's /etc/pulse/client.conf:
Code:
default-server = <ip of host>


...and proper configuration in the host. Sound works in the guest:
  • In Mint's settings sound test
  • In Firefox HTML5
  • In Steam store videos
  • with speaker-test
  • In Valve's Source Engine games


However, sound does not work in every other game I've tried so far: There is nothing to hear.

There are solutions circulating in the internet to remove/rename the directory "alsa-lib" and the library "libasound.so*" from the steam runtime directories. This didn't change anything in my case.

Running steam with STEAM_RUNTIME=0 exported has steam sitting for some seconds after a message about successful verification of the installation, and then terminating.

My first guess was that these games try to use ALSA directly, so I removed the pulseaudio "default-server" config entry and configured an ac97 sound card in virt-manager. Result: Nothing to hear in the guest at all. Speaker-test reports normal operation on the console, and I can see the spikes in pavumeter, but there is no sound from the speakers.

Now it gets weird: After I removed the passed through graphics card and host USB input devices, re-added QXL video and SPICE display and started the vm, sound works with the ac97 guest device. I have narrowed it down to the host nvidia graphics device (without the audio device): If the nvidia vga device is passed through, sound does not work although everything in the guest indicates it is working, even pavumeter.

The same setup, but with QXL/SPICE video output: Sound works.

So, there are two problems here: Some games apparently do not honor pulseaudio. Prefered solution, if this assumption is correct: Force them to use pulseaudio.
Second problem: Emulated sound cards stop producing hearable output as soon as the actual video card is passed through. Even if only the video device is passed through, not the audio device. Has anyone ever heard of this?

In guest's dmesg I found only the following sound related:
Code:
[    4.691428] snd_intel8x0 0000:00:09.0: enable KVM optimization
[    5.008602] snd_intel8x0 0000:00:09.0: intel8x0_measure_ac97_clock: measured 53306 usecs (3673 samples)
[    5.008603] snd_intel8x0 0000:00:09.0: measured clock 68904 rejected
[    5.372144] snd_intel8x0 0000:00:09.0: intel8x0_measure_ac97_clock: measured 55969 usecs (3677 samples)
[    5.372146] snd_intel8x0 0000:00:09.0: measured clock 65697 rejected
[    5.732127] snd_intel8x0 0000:00:09.0: intel8x0_measure_ac97_clock: measured 55911 usecs (3675 samples)
[    5.732129] snd_intel8x0 0000:00:09.0: measured clock 65729 rejected
[    5.732130] snd_intel8x0 0000:00:09.0: clocking to 48000


This looks the same (didn't compare the exact numbers) in the working QXL/SPICE configuration and in the not-working nvidia vga passthrough configuration.


Last edited by Apheus on Sat Aug 13, 2016 12:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Sat Aug 13, 2016 12:13 pm    Post subject: [SOLVED] No sound in most games in QEMU/KVM steam vm Reply with quote

Got it, at least problem number 2: It was purely host related. Libvirt does - by default - not allow host audio if there is no paravirtual display.

/etc/libvirt/qemu.conf
Code:
nographics_allow_host_audio = 1


Is supposed to allow host audio. It gets $QEMU_AUDIO_DRV=pa to the qemu process. For $QEMU_PA_SERVER=localhost, I still have to use a wrapper script.

Both methods can be combined: With default-server set in guest's /etc/pulse/client.conf, the desktop, browser and Valve games use the direct network connection to host pulseaudio like I intended in the first place. Other games use the emulated sound device. With the QEMU_AUDIO_DRV/QEMU_PA_SERVER setup, the sound ends up at the host via network anyway.

The ac97 device stutters, I have better results with ich9.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gamers & Players All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum